summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-10-21 14:51:13 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-10-21 14:51:13 +0200
commit5209a846a9157e649fcdcb561f7eaf19c8c0e465 (patch)
treeb0a7e52b5646c8eec182dbc391e7934b6804488c /source3
parent625359b2e266105022309df8985720108ecd6f67 (diff)
parent2ee8d29d22bcb1c350ab59d71b0aee548489bc9c (diff)
downloadsamba-5209a846a9157e649fcdcb561f7eaf19c8c0e465.tar.gz
samba-5209a846a9157e649fcdcb561f7eaf19c8c0e465.tar.bz2
samba-5209a846a9157e649fcdcb561f7eaf19c8c0e465.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba into regsrv
Conflicts: source4/lib/registry/ldb.c source4/rpc_server/winreg/rpc_winreg.c
Diffstat (limited to 'source3')
-rw-r--r--source3/Makefile.in303
-rw-r--r--source3/auth/auth.c4
-rw-r--r--source3/auth/auth_domain.c65
-rw-r--r--source3/auth/auth_netlogond.c321
-rw-r--r--source3/auth/auth_sam.c2
-rw-r--r--source3/auth/token_util.c4
-rwxr-xr-xsource3/autogen.sh16
-rw-r--r--source3/client/client.c42
-rw-r--r--source3/client/clitar.c28
-rw-r--r--source3/client/mount.cifs.c96
-rw-r--r--source3/client/smbspool.c2
-rw-r--r--source3/configure.in110
-rw-r--r--source3/dynconfig.c1
-rw-r--r--source3/groupdb/mapping_ldb.c4
-rw-r--r--source3/groupdb/mapping_tdb.c5
-rw-r--r--source3/include/ads.h5
-rw-r--r--source3/include/byteorder.h176
-rw-r--r--source3/include/charset.h2
-rw-r--r--source3/include/client.h2
-rw-r--r--source3/include/dcerpc.h0
-rw-r--r--source3/include/debug.h12
-rw-r--r--source3/include/dlinklist.h113
-rw-r--r--source3/include/dynconfig.h4
-rw-r--r--source3/include/fake_file.h3
-rw-r--r--source3/include/hmacmd5.h29
-rw-r--r--source3/include/idmap.h3
-rw-r--r--source3/include/includes.h316
-rw-r--r--source3/include/interfaces.h4
-rw-r--r--source3/include/libmsrpc.h3045
-rw-r--r--source3/include/libmsrpc_internal.h73
-rw-r--r--source3/include/md5.h19
-rw-r--r--source3/include/messages.h7
-rw-r--r--source3/include/module.h1
-rw-r--r--source3/include/msdfs.h8
-rw-r--r--source3/include/nameserv.h15
-rw-r--r--source3/include/ndr.h1
-rw-r--r--source3/include/nss_info.h10
-rw-r--r--source3/include/ntdomain.h57
-rw-r--r--source3/include/ntlmssp.h6
-rw-r--r--source3/include/ntquotas.h26
-rw-r--r--source3/include/packet.h4
-rw-r--r--source3/include/printing.h1
-rw-r--r--source3/include/proto.h2074
-rw-r--r--source3/include/rbtree.h132
-rw-r--r--source3/include/rpc_lsa.h1
-rw-r--r--source3/include/rpc_secdes.h3
-rw-r--r--source3/include/rpc_svcctl.h26
-rw-r--r--source3/include/secrets.h2
-rw-r--r--source3/include/smb.h26
-rw-r--r--source3/include/smb_macros.h16
-rw-r--r--source3/include/smbprofile.h8
-rw-r--r--source3/include/sysquotas.h20
-rw-r--r--source3/include/talloc_stack.h2
-rw-r--r--source3/include/util_tdb.h32
-rw-r--r--source3/include/vfs.h22
-rw-r--r--source3/include/xfile.h48
-rw-r--r--source3/iniparser_build/dictionary.c2
-rw-r--r--source3/iniparser_build/iniparser.c2
-rw-r--r--source3/iniparser_build/strlib.c2
-rw-r--r--source3/intl/lang_tdb.c6
-rw-r--r--source3/lib/access.c6
-rw-r--r--source3/lib/arc4.c79
-rw-r--r--source3/lib/async_sock.c3
-rw-r--r--source3/lib/charcnv.c58
-rw-r--r--source3/lib/compression/mszip.c676
-rw-r--r--source3/lib/compression/mszip.h33
-rw-r--r--source3/lib/crc32.c103
-rw-r--r--source3/lib/ctdbd_conn.c12
-rw-r--r--source3/lib/data_blob.c180
-rw-r--r--source3/lib/dbwrap_ctdb.c18
-rw-r--r--source3/lib/dbwrap_file.c2
-rw-r--r--source3/lib/dbwrap_rbt.c2
-rw-r--r--source3/lib/dbwrap_tdb.c6
-rw-r--r--source3/lib/debug.c16
-rw-r--r--source3/lib/display_sec.c10
-rw-r--r--source3/lib/dprintf.c2
-rw-r--r--source3/lib/dummysmbd.c15
-rw-r--r--source3/lib/errmap_unix.c136
-rw-r--r--source3/lib/events.c2
-rw-r--r--source3/lib/fsusage.c157
-rw-r--r--source3/lib/genrand.c17
-rw-r--r--source3/lib/hmacmd5.c135
-rw-r--r--source3/lib/interfaces.c2
-rw-r--r--source3/lib/ldb/common/ldb.c1
-rw-r--r--source3/lib/ldb/ldb_tdb/ldb_tdb.h2
-rw-r--r--source3/lib/ldb/libldb.m432
-rw-r--r--source3/lib/md4.c174
-rw-r--r--source3/lib/md5.c247
-rw-r--r--source3/lib/memcache.c2
-rw-r--r--source3/lib/messages_local.c4
-rw-r--r--source3/lib/netapi/examples/Makefile.in96
-rw-r--r--source3/lib/netapi/examples/user/user_modalsset.c1
-rw-r--r--source3/lib/netapi/file.c3
-rw-r--r--source3/lib/netapi/getdc.c4
-rw-r--r--source3/lib/netapi/group.c2
-rw-r--r--source3/lib/netapi/localgroup.c4
-rw-r--r--source3/lib/netapi/share.c3
-rw-r--r--source3/lib/netapi/tests/Makefile.in8
-rw-r--r--source3/lib/netapi/tests/common.h2
-rw-r--r--source3/lib/netapi/tests/netapitest.c5
-rw-r--r--source3/lib/netapi/tests/netfile.c145
-rw-r--r--source3/lib/netapi/tests/netgroup.c10
-rw-r--r--source3/lib/netapi/tests/netlocalgroup.c6
-rw-r--r--source3/lib/netapi/tests/netshare.c8
-rw-r--r--source3/lib/netapi/tests/netuser.c20
-rw-r--r--source3/lib/netapi/user.c53
-rw-r--r--source3/lib/nss_wrapper/config.m419
-rw-r--r--source3/lib/nss_wrapper/config.mk10
-rw-r--r--source3/lib/nss_wrapper/nss_wrapper.c1130
-rw-r--r--source3/lib/nss_wrapper/nss_wrapper.h165
-rw-r--r--source3/lib/nss_wrapper/nss_wrapper.pl265
-rw-r--r--source3/lib/packet.c12
-rw-r--r--source3/lib/rbtree.c422
-rw-r--r--source3/lib/readline.c21
-rw-r--r--source3/lib/replace/.checker_innocent4
-rw-r--r--source3/lib/replace/Makefile.in63
-rw-r--r--source3/lib/replace/README113
-rw-r--r--source3/lib/replace/aclocal.m41
-rw-r--r--source3/lib/replace/autoconf-2.60.m4210
-rwxr-xr-xsource3/lib/replace/autogen.sh13
-rwxr-xr-xsource3/lib/replace/config.guess1464
-rwxr-xr-xsource3/lib/replace/config.sub1577
-rw-r--r--source3/lib/replace/configure.ac30
-rw-r--r--source3/lib/replace/dlfcn.c75
-rw-r--r--source3/lib/replace/dlfcn.m431
-rw-r--r--source3/lib/replace/getaddrinfo.c497
-rw-r--r--source3/lib/replace/getaddrinfo.h89
-rw-r--r--source3/lib/replace/getifaddrs.c361
-rw-r--r--source3/lib/replace/getpass.c222
-rw-r--r--source3/lib/replace/getpass.m424
-rw-r--r--source3/lib/replace/inet_aton.c33
-rw-r--r--source3/lib/replace/inet_ntoa.c39
-rw-r--r--source3/lib/replace/inet_ntop.c191
-rw-r--r--source3/lib/replace/inet_pton.c213
-rwxr-xr-xsource3/lib/replace/install-sh238
-rw-r--r--source3/lib/replace/libreplace.m4303
-rw-r--r--source3/lib/replace/libreplace_cc.m4182
-rw-r--r--source3/lib/replace/libreplace_ld.m4319
-rw-r--r--source3/lib/replace/libreplace_macros.m4332
-rw-r--r--source3/lib/replace/libreplace_network.m4377
-rw-r--r--source3/lib/replace/repdir.m478
-rw-r--r--source3/lib/replace/repdir_getdents.c166
-rw-r--r--source3/lib/replace/repdir_getdirentries.c183
-rw-r--r--source3/lib/replace/replace.c616
-rw-r--r--source3/lib/replace/replace.h582
-rw-r--r--source3/lib/replace/samba.m435
-rw-r--r--source3/lib/replace/snprintf.c1530
-rw-r--r--source3/lib/replace/socket.c35
-rw-r--r--source3/lib/replace/socketpair.c46
-rw-r--r--source3/lib/replace/strptime.c990
-rw-r--r--source3/lib/replace/strptime.m413
-rw-r--r--source3/lib/replace/system/README4
-rw-r--r--source3/lib/replace/system/aio.h32
-rw-r--r--source3/lib/replace/system/capability.h55
-rw-r--r--source3/lib/replace/system/config.m4130
-rw-r--r--source3/lib/replace/system/dir.h67
-rw-r--r--source3/lib/replace/system/filesys.h182
-rw-r--r--source3/lib/replace/system/glob.h37
-rw-r--r--source3/lib/replace/system/iconv.h57
-rw-r--r--source3/lib/replace/system/kerberos.h137
-rw-r--r--source3/lib/replace/system/locale.h38
-rw-r--r--source3/lib/replace/system/network.h332
-rw-r--r--source3/lib/replace/system/passwd.h110
-rw-r--r--source3/lib/replace/system/readline.h52
-rw-r--r--source3/lib/replace/system/select.h41
-rw-r--r--source3/lib/replace/system/shmem.h59
-rw-r--r--source3/lib/replace/system/syslog.h70
-rw-r--r--source3/lib/replace/system/terminal.h46
-rw-r--r--source3/lib/replace/system/time.h69
-rw-r--r--source3/lib/replace/system/wait.h55
-rw-r--r--source3/lib/replace/test/getifaddrs.c100
-rw-r--r--source3/lib/replace/test/os2_delete.c124
-rw-r--r--source3/lib/replace/test/shared_mmap.c68
-rw-r--r--source3/lib/replace/test/strptime.c172
-rw-r--r--source3/lib/replace/test/testsuite.c1080
-rw-r--r--source3/lib/replace/timegm.c78
-rw-r--r--source3/lib/replace/timegm.m41
-rw-r--r--source3/lib/replace/win32.m420
-rw-r--r--source3/lib/replace/win32_replace.h159
-rw-r--r--source3/lib/secace.c2
-rw-r--r--source3/lib/secdesc.c17
-rw-r--r--source3/lib/select.c4
-rw-r--r--source3/lib/sharesec.c8
-rw-r--r--source3/lib/signal.c138
-rw-r--r--source3/lib/smbconf/smbconf_txt.c2
-rw-r--r--source3/lib/smbldap.c9
-rw-r--r--source3/lib/socket_wrapper/config.m422
-rw-r--r--source3/lib/socket_wrapper/config.mk8
-rw-r--r--source3/lib/socket_wrapper/socket_wrapper.c1841
-rw-r--r--source3/lib/socket_wrapper/socket_wrapper.h136
-rw-r--r--source3/lib/socket_wrapper/testsuite.c105
-rw-r--r--source3/lib/sysquotas.c6
-rw-r--r--source3/lib/sysquotas_4A.c16
-rw-r--r--source3/lib/sysquotas_linux.c48
-rw-r--r--source3/lib/sysquotas_xfs.c16
-rw-r--r--source3/lib/talloc/Makefile.in43
-rw-r--r--source3/lib/talloc/NEWS13
-rw-r--r--source3/lib/talloc/aclocal.m41
-rwxr-xr-xsource3/lib/talloc/autogen.sh14
-rwxr-xr-xsource3/lib/talloc/config.guess1464
-rw-r--r--source3/lib/talloc/config.mk7
-rwxr-xr-xsource3/lib/talloc/config.sub1577
-rw-r--r--source3/lib/talloc/configure.ac24
-rwxr-xr-xsource3/lib/talloc/install-sh238
-rw-r--r--source3/lib/talloc/libtalloc.m433
-rw-r--r--source3/lib/talloc/rules.mk18
-rw-r--r--source3/lib/talloc/talloc.3.xml738
-rw-r--r--source3/lib/talloc/talloc.c1732
-rw-r--r--source3/lib/talloc/talloc.h183
-rw-r--r--source3/lib/talloc/talloc.i31
-rw-r--r--source3/lib/talloc/talloc.mk37
-rw-r--r--source3/lib/talloc/talloc.pc.in11
-rw-r--r--source3/lib/talloc/talloc_guide.txt685
-rw-r--r--source3/lib/talloc/testsuite.c1152
-rw-r--r--source3/lib/talloc/web/index.html46
-rw-r--r--source3/lib/tdb/Makefile.in59
-rw-r--r--source3/lib/tdb/aclocal.m41
-rwxr-xr-xsource3/lib/tdb/autogen.sh16
-rw-r--r--source3/lib/tdb/common/dump.c137
-rw-r--r--source3/lib/tdb/common/error.c57
-rw-r--r--source3/lib/tdb/common/freelist.c382
-rw-r--r--source3/lib/tdb/common/freelistcheck.c107
-rw-r--r--source3/lib/tdb/common/io.c473
-rw-r--r--source3/lib/tdb/common/lock.c553
-rw-r--r--source3/lib/tdb/common/open.c488
-rw-r--r--source3/lib/tdb/common/tdb.c802
-rw-r--r--source3/lib/tdb/common/tdb_private.h213
-rw-r--r--source3/lib/tdb/common/transaction.c1119
-rw-r--r--source3/lib/tdb/common/traverse.c348
-rwxr-xr-xsource3/lib/tdb/config.guess1464
-rw-r--r--source3/lib/tdb/config.mk57
-rwxr-xr-xsource3/lib/tdb/config.sub1577
-rw-r--r--source3/lib/tdb/configure.ac30
-rw-r--r--source3/lib/tdb/docs/README238
-rw-r--r--source3/lib/tdb/docs/tdb.magic10
-rw-r--r--source3/lib/tdb/include/tdb.h167
-rwxr-xr-xsource3/lib/tdb/install-sh238
-rw-r--r--source3/lib/tdb/libtdb.m430
-rw-r--r--source3/lib/tdb/python.mk10
-rw-r--r--source3/lib/tdb/python/tdbdump.py12
-rw-r--r--source3/lib/tdb/python/tests/simple.py152
-rw-r--r--source3/lib/tdb/rules.mk21
-rw-r--r--source3/lib/tdb/tdb.i323
-rw-r--r--source3/lib/tdb/tdb.mk86
-rw-r--r--source3/lib/tdb/tdb.pc.in11
-rw-r--r--source3/lib/tdb/tdb.py341
-rw-r--r--source3/lib/tdb/tdb_wrap.c4307
-rw-r--r--source3/lib/tdb/tools/tdbbackup.c300
-rw-r--r--source3/lib/tdb/tools/tdbdump.c116
-rw-r--r--source3/lib/tdb/tools/tdbtest.c265
-rw-r--r--source3/lib/tdb/tools/tdbtool.c659
-rw-r--r--source3/lib/tdb/tools/tdbtorture.c318
-rw-r--r--source3/lib/tdb/web/index.html42
-rw-r--r--source3/lib/time.c558
-rw-r--r--source3/lib/ufc.c770
-rw-r--r--source3/lib/util.c317
-rw-r--r--source3/lib/util_file.c352
-rw-r--r--source3/lib/util_pw.c4
-rw-r--r--source3/lib/util_seaccess.c32
-rw-r--r--source3/lib/util_sock.c12
-rw-r--r--source3/lib/util_str.c369
-rw-r--r--source3/lib/util_tdb.c297
-rw-r--r--source3/lib/util_uuid.c78
-rw-r--r--source3/lib/xfile.c417
-rw-r--r--source3/libaddns/dns.h2
-rw-r--r--source3/libaddns/dnsmarshall.c1
-rw-r--r--source3/libaddns/dnsrecord.c4
-rw-r--r--source3/libads/authdata.c19
-rw-r--r--source3/libads/cldap.c119
-rw-r--r--source3/libads/disp_sec.c8
-rw-r--r--source3/libads/krb5_setpw.c8
-rw-r--r--source3/libads/ldap.c13
-rw-r--r--source3/libads/ldap_schema.c15
-rw-r--r--source3/libads/util.c4
-rw-r--r--source3/libcli/nbt/libnbt.h353
-rw-r--r--source3/libcli/nbt/nbtname.c626
-rw-r--r--source3/libgpo/gpext/registry.c4
-rw-r--r--source3/libgpo/gpext/scripts.c2
-rw-r--r--source3/libgpo/gpext/security.c267
-rw-r--r--source3/libgpo/gpo_ini.c4
-rw-r--r--source3/libgpo/gpo_reg.c14
-rw-r--r--source3/libnet/libnet_dssync.c17
-rw-r--r--source3/libnet/libnet_dssync_keytab.c8
-rw-r--r--source3/libnet/libnet_join.c13
-rw-r--r--source3/libnet/libnet_proto.h2
-rw-r--r--source3/libnet/libnet_samsync.c4
-rw-r--r--source3/libnet/libnet_samsync_keytab.c1
-rw-r--r--source3/librpc/gen_ndr/cli_initshutdown.c4
-rw-r--r--source3/librpc/gen_ndr/cli_initshutdown.h4
-rw-r--r--source3/librpc/gen_ndr/cli_lsa.c70
-rw-r--r--source3/librpc/gen_ndr/cli_lsa.h39
-rw-r--r--source3/librpc/gen_ndr/cli_netlogon.c16
-rw-r--r--source3/librpc/gen_ndr/cli_netlogon.h16
-rw-r--r--source3/librpc/gen_ndr/cli_ntsvcs.c19
-rw-r--r--source3/librpc/gen_ndr/cli_ntsvcs.h8
-rw-r--r--source3/librpc/gen_ndr/cli_svcctl.c8
-rw-r--r--source3/librpc/gen_ndr/cli_svcctl.h6
-rw-r--r--source3/librpc/gen_ndr/cli_winreg.c20
-rw-r--r--source3/librpc/gen_ndr/cli_winreg.h12
-rw-r--r--source3/librpc/gen_ndr/dfs.h1
-rw-r--r--source3/librpc/gen_ndr/drsblobs.h189
-rw-r--r--source3/librpc/gen_ndr/drsuapi.h34
-rw-r--r--source3/librpc/gen_ndr/echo.h2
-rw-r--r--source3/librpc/gen_ndr/epmapper.h5
-rw-r--r--source3/librpc/gen_ndr/initshutdown.h16
-rw-r--r--source3/librpc/gen_ndr/krb5pac.h23
-rw-r--r--source3/librpc/gen_ndr/libnetapi.h2
-rw-r--r--source3/librpc/gen_ndr/lsa.h208
-rw-r--r--source3/librpc/gen_ndr/misc.h4
-rw-r--r--source3/librpc/gen_ndr/nbt.h358
-rw-r--r--source3/librpc/gen_ndr/ndr_dfs.c13
-rw-r--r--source3/librpc/gen_ndr/ndr_drsblobs.c1311
-rw-r--r--source3/librpc/gen_ndr/ndr_drsblobs.h50
-rw-r--r--source3/librpc/gen_ndr/ndr_drsuapi.c351
-rw-r--r--source3/librpc/gen_ndr/ndr_drsuapi.h12
-rw-r--r--source3/librpc/gen_ndr/ndr_echo.c4
-rw-r--r--source3/librpc/gen_ndr/ndr_echo.h2
-rw-r--r--source3/librpc/gen_ndr/ndr_epmapper.c69
-rw-r--r--source3/librpc/gen_ndr/ndr_eventlog.c32
-rw-r--r--source3/librpc/gen_ndr/ndr_initshutdown.c113
-rw-r--r--source3/librpc/gen_ndr/ndr_initshutdown.h4
-rw-r--r--source3/librpc/gen_ndr/ndr_krb5pac.c131
-rw-r--r--source3/librpc/gen_ndr/ndr_krb5pac.h8
-rw-r--r--source3/librpc/gen_ndr/ndr_libnetapi.c6
-rw-r--r--source3/librpc/gen_ndr/ndr_lsa.c1187
-rw-r--r--source3/librpc/gen_ndr/ndr_lsa.h21
-rw-r--r--source3/librpc/gen_ndr/ndr_misc.c2
-rw-r--r--source3/librpc/gen_ndr/ndr_nbt.c2599
-rw-r--r--source3/librpc/gen_ndr/ndr_nbt.h69
-rw-r--r--source3/librpc/gen_ndr/ndr_netlogon.c945
-rw-r--r--source3/librpc/gen_ndr/ndr_netlogon.h18
-rw-r--r--source3/librpc/gen_ndr/ndr_notify.c1
-rw-r--r--source3/librpc/gen_ndr/ndr_ntsvcs.c167
-rw-r--r--source3/librpc/gen_ndr/ndr_samr.c84
-rw-r--r--source3/librpc/gen_ndr/ndr_samr.h6
-rw-r--r--source3/librpc/gen_ndr/ndr_security.c26
-rw-r--r--source3/librpc/gen_ndr/ndr_security.h3
-rw-r--r--source3/librpc/gen_ndr/ndr_srvsvc.c12
-rw-r--r--source3/librpc/gen_ndr/ndr_svcctl.c414
-rw-r--r--source3/librpc/gen_ndr/ndr_svcctl.h4
-rw-r--r--source3/librpc/gen_ndr/ndr_winreg.c387
-rw-r--r--source3/librpc/gen_ndr/ndr_winreg.h34
-rw-r--r--source3/librpc/gen_ndr/ndr_xattr.c492
-rw-r--r--source3/librpc/gen_ndr/ndr_xattr.h17
-rw-r--r--source3/librpc/gen_ndr/netlogon.h158
-rw-r--r--source3/librpc/gen_ndr/notify.h1
-rw-r--r--source3/librpc/gen_ndr/ntsvcs.h14
-rw-r--r--source3/librpc/gen_ndr/samr.h18
-rw-r--r--source3/librpc/gen_ndr/security.h14
-rw-r--r--source3/librpc/gen_ndr/srv_dfs.c92
-rw-r--r--source3/librpc/gen_ndr/srv_dssetup.c44
-rw-r--r--source3/librpc/gen_ndr/srv_echo.c40
-rw-r--r--source3/librpc/gen_ndr/srv_epmapper.c32
-rw-r--r--source3/librpc/gen_ndr/srv_eventlog.c96
-rw-r--r--source3/librpc/gen_ndr/srv_initshutdown.c12
-rw-r--r--source3/librpc/gen_ndr/srv_lsa.c342
-rw-r--r--source3/librpc/gen_ndr/srv_netlogon.c188
-rw-r--r--source3/librpc/gen_ndr/srv_ntsvcs.c270
-rw-r--r--source3/librpc/gen_ndr/srv_samr.c272
-rw-r--r--source3/librpc/gen_ndr/srv_srvsvc.c216
-rw-r--r--source3/librpc/gen_ndr/srv_svcctl.c178
-rw-r--r--source3/librpc/gen_ndr/srv_winreg.c142
-rw-r--r--source3/librpc/gen_ndr/srv_wkssvc.c124
-rw-r--r--source3/librpc/gen_ndr/svcctl.h19
-rw-r--r--source3/librpc/gen_ndr/tables.c83
-rw-r--r--source3/librpc/gen_ndr/winreg.h31
-rw-r--r--source3/librpc/gen_ndr/xattr.h63
-rw-r--r--source3/librpc/idl/dfs.idl417
-rw-r--r--source3/librpc/idl/drsblobs.idl436
-rw-r--r--source3/librpc/idl/drsuapi.idl1601
-rw-r--r--source3/librpc/idl/dssetup.idl101
-rw-r--r--source3/librpc/idl/echo.idl127
-rw-r--r--source3/librpc/idl/epmapper.idl302
-rw-r--r--source3/librpc/idl/eventlog.idl181
-rw-r--r--source3/librpc/idl/idl_types.h86
-rw-r--r--source3/librpc/idl/initshutdown.idl46
-rw-r--r--source3/librpc/idl/krb5pac.idl120
-rw-r--r--source3/librpc/idl/libnetapi.idl2
-rw-r--r--source3/librpc/idl/lsa.idl301
-rw-r--r--source3/librpc/idl/misc.idl51
-rw-r--r--source3/librpc/idl/nbt.idl781
-rw-r--r--source3/librpc/idl/netlogon.idl167
-rw-r--r--source3/librpc/idl/notify.idl56
-rw-r--r--source3/librpc/idl/ntsvcs.idl375
-rw-r--r--source3/librpc/idl/samr.idl18
-rw-r--r--source3/librpc/idl/security.idl376
-rw-r--r--source3/librpc/idl/spoolss.idl1571
-rw-r--r--source3/librpc/idl/srvsvc.idl25
-rw-r--r--source3/librpc/idl/svcctl.idl528
-rw-r--r--source3/librpc/idl/winreg.idl395
-rw-r--r--source3/librpc/idl/wkssvc.idl795
-rw-r--r--source3/librpc/idl/xattr.idl54
-rw-r--r--source3/librpc/ndr/libndr.h354
-rw-r--r--source3/librpc/ndr/ndr.c1101
-rw-r--r--source3/librpc/ndr/ndr_basic.c859
-rw-r--r--source3/librpc/ndr/ndr_compression.c293
-rw-r--r--source3/librpc/ndr/ndr_compression.h51
-rw-r--r--source3/librpc/ndr/ndr_drsuapi.c177
-rw-r--r--source3/librpc/ndr/ndr_drsuapi.h35
-rw-r--r--source3/librpc/ndr/ndr_krb5pac.c141
-rw-r--r--source3/librpc/ndr/ndr_misc.c94
-rw-r--r--source3/librpc/ndr/ndr_string.c71
-rw-r--r--source3/librpc/ndr/util.c174
-rw-r--r--source3/librpc/ndr/uuid.c227
-rw-r--r--source3/librpc/rpc/binding.c709
-rw-r--r--source3/librpc/rpc/dcerpc.c4
-rw-r--r--source3/librpc/rpc/dcerpc.h48
-rw-r--r--source3/librpc/rpc/dcerpc_util.c1438
-rw-r--r--source3/librpc/tools/ndrdump.c20
-rw-r--r--source3/libsmb/async_smb.c4
-rw-r--r--source3/libsmb/clidgram.c95
-rw-r--r--source3/libsmb/clientgen.c4
-rw-r--r--source3/libsmb/clierror.c140
-rw-r--r--source3/libsmb/clifile.c12
-rw-r--r--source3/libsmb/clikrb5.c4
-rw-r--r--source3/libsmb/cliquota.c90
-rw-r--r--source3/libsmb/clireadwrite.c6
-rw-r--r--source3/libsmb/dsgetdcname.c418
-rw-r--r--source3/libsmb/libsmb_xattr.c2
-rw-r--r--source3/libsmb/ntlmssp_sign.c70
-rw-r--r--source3/libsmb/samlogon_cache.c5
-rw-r--r--source3/libsmb/smbdes.c13
-rw-r--r--source3/libsmb/smbencrypt.c4
-rw-r--r--source3/libsmb/trusts_util.c113
-rw-r--r--source3/locking/locking.c20
-rw-r--r--source3/locking/posix.c32
-rw-r--r--source3/m4/aclocal.m42
-rw-r--r--source3/m4/check_path.m419
-rw-r--r--source3/modules/nfs4_acls.c14
-rw-r--r--source3/modules/vfs_acl_xattr.c361
-rw-r--r--source3/modules/vfs_afsacl.c16
-rw-r--r--source3/modules/vfs_aixacl2.c4
-rw-r--r--source3/modules/vfs_cap.c8
-rw-r--r--source3/modules/vfs_default.c8
-rw-r--r--source3/modules/vfs_full_audit.c18
-rw-r--r--source3/modules/vfs_gpfs.c10
-rw-r--r--source3/modules/vfs_smb_traffic_analyzer.c427
-rw-r--r--source3/modules/vfs_xattr_tdb.c68
-rw-r--r--source3/modules/vfs_zfsacl.c4
-rw-r--r--source3/nmbd/nmbd.c4
-rw-r--r--source3/nmbd/nmbd_processlogon.c32
-rw-r--r--source3/nmbd/nmbd_winsserver.c6
-rw-r--r--source3/nsswitch/libwbclient/wbc_guid.c118
-rw-r--r--source3/nsswitch/libwbclient/wbc_idmap.c2
-rw-r--r--source3/nsswitch/libwbclient/wbc_pam.c301
-rw-r--r--source3/nsswitch/libwbclient/wbc_pwd.c2
-rw-r--r--source3/nsswitch/libwbclient/wbc_sid.c6
-rw-r--r--source3/nsswitch/libwbclient/wbc_util.c186
-rw-r--r--source3/nsswitch/libwbclient/wbclient.h114
-rw-r--r--source3/nsswitch/pam_winbind.c1140
-rw-r--r--source3/nsswitch/pam_winbind.h76
-rw-r--r--source3/nsswitch/wbinfo.c14
-rw-r--r--source3/nsswitch/winbind_krb5_locator.c52
-rw-r--r--source3/nsswitch/winbind_nss_config.h2
-rw-r--r--source3/nsswitch/winbind_nss_irix.c1
-rw-r--r--source3/nsswitch/winbind_struct_protocol.h17
-rw-r--r--source3/nsswitch/wins.c1
-rw-r--r--source3/param/loadparm.c313
-rw-r--r--source3/param/params.c590
-rw-r--r--source3/param/test_lp_load.c88
-rw-r--r--source3/passdb/machine_sid.c6
-rw-r--r--source3/passdb/secrets.c27
-rw-r--r--source3/popt/CHANGES46
-rw-r--r--source3/popt/COPYING22
-rw-r--r--source3/popt/README18
-rw-r--r--source3/popt/dummy.in0
-rw-r--r--source3/popt/findme.c50
-rw-r--r--source3/popt/findme.h20
-rw-r--r--source3/popt/popt.c1249
-rw-r--r--source3/popt/popt.h545
-rw-r--r--source3/popt/poptconfig.c190
-rw-r--r--source3/popt/popthelp.c740
-rw-r--r--source3/popt/poptint.h116
-rw-r--r--source3/popt/poptparse.c227
-rw-r--r--source3/popt/system.h76
-rw-r--r--source3/printing/load.c2
-rw-r--r--source3/printing/notify.c26
-rw-r--r--source3/printing/nt_printing.c45
-rw-r--r--source3/printing/pcap.c79
-rw-r--r--source3/printing/print_aix.c8
-rw-r--r--source3/printing/print_cups.c651
-rw-r--r--source3/printing/print_generic.c8
-rw-r--r--source3/printing/print_svid.c8
-rw-r--r--source3/printing/printfsp.c9
-rw-r--r--source3/printing/printing.c4
-rw-r--r--source3/printing/tests/README.vlp19
-rw-r--r--source3/printing/tests/vlp.c431
-rw-r--r--source3/registry/reg_dispatcher.c10
-rw-r--r--source3/registry/reg_perfcount.c12
-rw-r--r--source3/rpc_client/cli_netlogon.c111
-rw-r--r--source3/rpc_client/cli_pipe.c4
-rw-r--r--source3/rpc_client/cli_svcctl.c76
-rw-r--r--source3/rpc_client/init_netlogon.c17
-rw-r--r--source3/rpc_client/init_samr.c32
-rw-r--r--source3/rpc_client/ndr.c4
-rw-r--r--source3/rpc_parse/parse_svcctl.c116
-rw-r--r--source3/rpc_server/srv_eventlog.c1
-rw-r--r--source3/rpc_server/srv_eventlog_lib.c2
-rw-r--r--source3/rpc_server/srv_lsa_nt.c64
-rw-r--r--source3/rpc_server/srv_netlog_nt.c10
-rw-r--r--source3/rpc_server/srv_ntsvcs.c1
-rw-r--r--source3/rpc_server/srv_pipe_hnd.c401
-rw-r--r--source3/rpc_server/srv_samr_nt.c122
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c20
-rw-r--r--source3/rpc_server/srv_srvsvc_nt.c38
-rw-r--r--source3/rpc_server/srv_svcctl.c19
-rw-r--r--source3/rpc_server/srv_svcctl_nt.c51
-rw-r--r--source3/rpc_server/srv_winreg_nt.c20
-rw-r--r--source3/rpcclient/cmd_drsuapi.c19
-rw-r--r--source3/rpcclient/cmd_lsarpc.c11
-rw-r--r--source3/rpcclient/cmd_netlogon.c2
-rw-r--r--source3/rpcclient/cmd_samr.c48
-rw-r--r--source3/rpcclient/cmd_spoolss.c2
-rw-r--r--source3/samba4-templates.mk144
-rw-r--r--source3/samba4.m4162
-rw-r--r--source3/samba4.mk171
-rwxr-xr-xsource3/script/build_idl.sh18
-rwxr-xr-xsource3/script/tests/selftest.sh6
-rwxr-xr-xsource3/script/tests/wb_pad.sh82
-rw-r--r--source3/services/services_db.c56
-rw-r--r--source3/smbd/aio.c17
-rw-r--r--source3/smbd/blocking.c25
-rw-r--r--source3/smbd/chgpasswd.c2
-rw-r--r--source3/smbd/close.c25
-rw-r--r--source3/smbd/conn.c2
-rw-r--r--source3/smbd/connection.c116
-rw-r--r--source3/smbd/dfree.c36
-rw-r--r--source3/smbd/dosmode.c10
-rw-r--r--source3/smbd/fake_file.c18
-rw-r--r--source3/smbd/filename.c3
-rw-r--r--source3/smbd/files.c71
-rw-r--r--source3/smbd/ipc.c104
-rw-r--r--source3/smbd/lanman.c6
-rw-r--r--source3/smbd/map_username.c4
-rw-r--r--source3/smbd/noquotas.c6
-rw-r--r--source3/smbd/notify_internal.c8
-rw-r--r--source3/smbd/ntquotas.c26
-rw-r--r--source3/smbd/nttrans.c92
-rw-r--r--source3/smbd/open.c98
-rw-r--r--source3/smbd/password.c4
-rw-r--r--source3/smbd/pipes.c116
-rw-r--r--source3/smbd/posix_acls.c89
-rw-r--r--source3/smbd/process.c248
-rw-r--r--source3/smbd/quotas.c110
-rw-r--r--source3/smbd/reply.c374
-rw-r--r--source3/smbd/seal.c24
-rw-r--r--source3/smbd/server.c37
-rw-r--r--source3/smbd/service.c7
-rw-r--r--source3/smbd/session.c5
-rw-r--r--source3/smbd/statvfs.c2
-rw-r--r--source3/smbd/trans2.c170
-rw-r--r--source3/smbd/vfs.c12
-rw-r--r--source3/torture/cmd_vfs.c6
-rw-r--r--source3/torture/locktest.c6
-rw-r--r--source3/torture/torture.c19
-rw-r--r--source3/torture/vfstest.c2
-rw-r--r--source3/utils/net_ads.c26
-rw-r--r--source3/utils/net_dns.c26
-rw-r--r--source3/utils/net_proto.h2
-rw-r--r--source3/utils/net_rap.c11
-rw-r--r--source3/utils/net_registry_util.c2
-rw-r--r--source3/utils/net_rpc.c26
-rw-r--r--source3/utils/net_rpc_join.c10
-rw-r--r--source3/utils/net_rpc_printer.c2
-rw-r--r--source3/utils/net_rpc_registry.c4
-rw-r--r--source3/utils/net_rpc_service.c49
-rw-r--r--source3/utils/net_usershare.c4
-rw-r--r--source3/utils/net_util.c12
-rw-r--r--source3/utils/nmblookup.c2
-rw-r--r--source3/utils/ntlm_auth.c8
-rw-r--r--source3/utils/pdbedit.c23
-rw-r--r--source3/utils/sharesec.c4
-rw-r--r--source3/utils/smbcacls.c185
-rw-r--r--source3/utils/smbcquotas.c6
-rw-r--r--source3/utils/status_profile.c12
-rw-r--r--source3/utils/testparm.c25
-rw-r--r--source3/web/cgi.c7
-rw-r--r--source3/web/statuspage.c5
-rw-r--r--source3/web/swat.c7
-rw-r--r--source3/winbindd/idmap_ad.c260
-rw-r--r--source3/winbindd/idmap_adex/cell_util.c292
-rw-r--r--source3/winbindd/idmap_adex/domain_util.c286
-rw-r--r--source3/winbindd/idmap_adex/gc_util.c848
-rw-r--r--source3/winbindd/idmap_adex/idmap_adex.c460
-rw-r--r--source3/winbindd/idmap_adex/idmap_adex.h257
-rw-r--r--source3/winbindd/idmap_adex/likewise_cell.c443
-rw-r--r--source3/winbindd/idmap_adex/provider_unified.c1180
-rw-r--r--source3/winbindd/idmap_hash/idmap_hash.c393
-rw-r--r--source3/winbindd/idmap_hash/idmap_hash.h60
-rw-r--r--source3/winbindd/idmap_hash/mapfile.c175
-rw-r--r--source3/winbindd/idmap_tdb.c2
-rw-r--r--source3/winbindd/idmap_tdb2.c19
-rw-r--r--source3/winbindd/idmap_util.c2
-rw-r--r--source3/winbindd/nss_info.c41
-rw-r--r--source3/winbindd/nss_info_template.c32
-rw-r--r--source3/winbindd/winbindd.c4
-rw-r--r--source3/winbindd/winbindd_ads.c20
-rw-r--r--source3/winbindd/winbindd_async.c2
-rw-r--r--source3/winbindd/winbindd_cache.c249
-rw-r--r--source3/winbindd/winbindd_cm.c2
-rw-r--r--source3/winbindd/winbindd_dual.c43
-rw-r--r--source3/winbindd/winbindd_group.c190
-rw-r--r--source3/winbindd/winbindd_locator.c61
-rw-r--r--source3/winbindd/winbindd_pam.c62
-rw-r--r--source3/winbindd/winbindd_proto.h24
-rw-r--r--source3/winbindd/winbindd_rpc.c51
-rw-r--r--source3/winbindd/winbindd_user.c74
-rw-r--r--source3/winbindd/winbindd_util.c156
608 files changed, 21561 insertions, 82063 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index b67cfe8bb8..0e1d17f29e 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -56,6 +56,7 @@ PIDL_ARGS=@PIDL_ARGS@
TERMLDFLAGS=@TERMLDFLAGS@
TERMLIBS=@TERMLIBS@
PRINT_LIBS=@PRINT_LIBS@
+ZLIB_LIBS=@ZLIB_LIBS@
AUTH_LIBS=@AUTH_LIBS@
ACL_LIBS=@ACL_LIBS@
PASSDB_LIBS=@PASSDB_LIBS@
@@ -127,6 +128,7 @@ LOGFILEBASE = @logfilebase@
CONFIGFILE = $(CONFIGDIR)/smb.conf
LMHOSTSFILE = $(CONFIGDIR)/lmhosts
CTDBDIR = @ctdbdir@
+NCALRPCDIR = @ncalrpcdir@
# This is where smbpasswd et al go
PRIVATEDIR = @privatedir@
@@ -150,12 +152,7 @@ CODEPAGEDIR = @codepagedir@
# the directory where pid files go
PIDDIR = @piddir@
-FLAGS1 = $(CFLAGS) @FLAGS1@ @SAMBA_CPPFLAGS@ $(CPPFLAGS)
-FLAGS2 =
-FLAGS3 =
-FLAGS4 = -I$(CTDBDIR)/include
-FLAGS5 = $(FLAGS1) $(FLAGS2) $(FLAGS3) $(FLAGS4)
-FLAGS = $(ISA) $(FLAGS5) -I$(srcdir)/lib -D_SAMBA_BUILD_=3
+FLAGS = -I. -I$(srcdir) @FLAGS1@ @SAMBA_CPPFLAGS@ $(CPPFLAGS) -I$(CTDBDIR)/include $(ISA) -I$(srcdir)/lib -I.. -D_SAMBA_BUILD_=3 -I../source4
PATH_FLAGS = -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" \
-DPRIVATE_DIR=\"$(PRIVATE_DIR)\" \
@@ -171,6 +168,7 @@ PATH_FLAGS = -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" \
-DLOGFILEBASE=\"$(LOGFILEBASE)\" \
-DSHLIBEXT=\"@SHLIBEXT@\" \
-DCTDBDIR=\"$(CTDBDIR)\" \
+ -DNCALRPCDIR=\"$(NCALRPCDIR)\" \
-DCONFIGDIR=\"$(CONFIGDIR)\" \
-DCODEPAGEDIR=\"$(CODEPAGEDIR)\" \
-DCACHEDIR=\"$(CACHEDIR)\" \
@@ -198,7 +196,7 @@ TORTURE_PROGS = bin/smbtorture@EXEEXT@ bin/msgtest@EXEEXT@ \
bin/locktest2@EXEEXT@ bin/nsstest@EXEEXT@ bin/vfstest@EXEEXT@ \
bin/pdbtest@EXEEXT@ bin/talloctort@EXEEXT@ bin/replacetort@EXEEXT@ \
bin/tdbtorture@EXEEXT@ \
- bin/smbconftort@EXEEXT@
+ bin/smbconftort@EXEEXT@ bin/vlp@EXEEXT@
BIN_PROGS = @EXTRA_BIN_PROGS@ \
$(BIN_PROGS1) $(BIN_PROGS2) $(BIN_PROGS3) $(BIN_PROGS4)
@@ -230,7 +228,7 @@ MODULES = $(VFS_MODULES) $(PDB_MODULES) $(RPC_MODULES) $(IDMAP_MODULES) \
# object file lists
######################################################################
-TDB_LIB_OBJ = lib/util_tdb.o \
+TDB_LIB_OBJ = lib/util_tdb.o ../lib/util/util_tdb.o \
lib/dbwrap.o lib/dbwrap_tdb.o \
lib/dbwrap_ctdb.o \
lib/dbwrap_rbt.o @LIBTDB_STATIC@
@@ -249,25 +247,31 @@ SERVER_MUTEX_OBJ = lib/server_mutex.o
PASSCHANGE_OBJ = libsmb/passchange.o
-LIBNDR_DRSUAPI_OBJ = librpc/ndr/ndr_drsuapi.o \
- librpc/ndr/ndr_compression.o \
+LIBNDR_DRSUAPI_OBJ = ../librpc/ndr/ndr_drsuapi.o \
+ ../librpc/ndr/ndr_compression.o \
librpc/gen_ndr/ndr_drsuapi.o \
+ ../librpc/ndr/ndr_drsblobs.o \
librpc/gen_ndr/ndr_drsblobs.o
-COMPRESSION_OBJ = lib/compression/mszip.o
+ZLIB_OBJ = @ZLIB_OBJS@
+
+COMPRESSION_OBJ = ../lib/compression/mszip.o \
+ ../lib/compression/lzxpress.o \
+ $(ZLIB_OBJ)
DRSUAPI_OBJ = $(LIBNDR_DRSUAPI_OBJ) \
$(COMPRESSION_OBJ)
-LIBNDR_OBJ = librpc/ndr/ndr_basic.o \
- librpc/ndr/ndr.o \
- librpc/ndr/ndr_misc.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
+ ../librpc/ndr/uuid.o \
+ librpc/ndr/util.o
RPCCLIENT_NDR_OBJ = rpc_client/ndr.o
@@ -312,29 +316,37 @@ LIBSAMBAUTIL_OBJ = @LIBTALLOC_STATIC@ \
$(SOCKET_WRAPPER_OBJ) \
$(NSS_WRAPPER_OBJ)
-LIB_OBJ = $(LIBSAMBAUTIL_OBJ) \
+UTIL_OBJ = ../lib/util/rbtree.o ../lib/util/signal.o ../lib/util/time.o \
+ ../lib/util/xfile.o ../lib/util/util_strlist.o \
+ ../lib/util/util_file.o ../lib/util/data_blob.o \
+ ../lib/util/util.o ../lib/util/fsusage.o \
+ ../lib/util/params.o
+
+CRYPTO_OBJ = ../lib/crypto/crc32.o ../lib/crypto/md5.o \
+ ../lib/crypto/hmacmd5.o ../lib/crypto/arcfour.o \
+ ../lib/crypto/md4.o
+
+LIB_OBJ = $(LIBSAMBAUTIL_OBJ) $(UTIL_OBJ) $(CRYPTO_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/memcache.o \
+ lib/interfaces.o lib/memcache.o \
lib/util_transfer_file.o lib/async_req.o \
lib/async_sock.o \
$(TDB_LIB_OBJ) \
$(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \
- lib/interface.o lib/md4.o \
- lib/pidfile.o \
- lib/signal.o lib/system.o lib/sendfile.o lib/recvfile.o lib/time.o \
- lib/ufc.o lib/genrand.o lib/username.o \
+ lib/interface.o lib/pidfile.o \
+ lib/system.o lib/sendfile.o lib/recvfile.o lib/time.o \
+ lib/genrand.o lib/username.o \
lib/util_pw.o lib/access.o lib/smbrun.o \
- lib/bitmap.o lib/crc32.o lib/dprintf.o \
- lib/xfile.o lib/wins_srv.o $(UTIL_REG_OBJ) \
+ lib/bitmap.o lib/dprintf.o $(UTIL_REG_OBJ) \
+ lib/wins_srv.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_unistr.o lib/util_file.o \
lib/util.o lib/util_sock.o lib/sock_exec.o lib/util_sec.o \
- lib/substitute.o lib/fsusage.o lib/dbwrap_util.o \
+ lib/substitute.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 \
- lib/pam_errors.o intl/lang_tdb.o lib/conn_tdb.o \
+ lib/iconv.o lib/pam_errors.o intl/lang_tdb.o lib/conn_tdb.o \
lib/adt_tree.o lib/gencache.o \
lib/module.o lib/events.o lib/ldap_escape.o @CHARSET_STATIC@ \
lib/secdesc.o lib/util_seaccess.o lib/secace.o lib/secacl.o \
@@ -350,7 +362,7 @@ READLINE_OBJ = lib/readline.o
# Be sure to include them into your application
POPT_LIB_OBJ = lib/popt_common.o
-PARAM_WITHOUT_REG_OBJ = dynconfig.o param/loadparm.o param/params.o param/util.o lib/sharesec.o lib/ldap_debug_handler.o
+PARAM_WITHOUT_REG_OBJ = dynconfig.o param/loadparm.o param/util.o lib/sharesec.o lib/ldap_debug_handler.o
PARAM_REG_ADD_OBJ = $(REG_SMBCONF_OBJ) $(LIBSMBCONF_OBJ) $(PRIVILEGES_BASIC_OBJ)
PARAM_OBJ = $(PARAM_WITHOUT_REG_OBJ) $(PARAM_REG_ADD_OBJ)
@@ -376,12 +388,14 @@ LIBADS_OBJ = libads/ldap.o libads/ldap_printer.o \
libads/ldap_schema.o libads/util.o libads/ndr.o
LIBADS_SERVER_OBJ = libads/kerberos_verify.o libads/authdata.o \
- librpc/ndr/ndr_krb5pac.o \
+ ../librpc/ndr/ndr_krb5pac.o \
librpc/gen_ndr/ndr_krb5pac.o
SECRETS_OBJ = passdb/secrets.o passdb/machine_sid.o
-LIBNBT_OBJ = libcli/nbt/nbtname.o \
+LIBNBT_OBJ = ../libcli/nbt/nbtname.o \
+ ../libcli/netlogon.o \
+ ../libcli/ndr_netlogon.o \
librpc/gen_ndr/ndr_nbt.o \
librpc/gen_ndr/ndr_svcctl.o
@@ -433,7 +447,7 @@ LIBMSRPC_OBJ = rpc_client/cli_lsarpc.o rpc_client/cli_samr.o \
rpc_client/cli_svcctl.o \
rpc_client/init_samr.o \
librpc/rpc/dcerpc.o \
- librpc/rpc/binding.o
+ ../librpc/rpc/binding.o
LIBMSRPC_GEN_OBJ = librpc/gen_ndr/cli_lsa.o \
librpc/gen_ndr/cli_dfs.o \
@@ -623,6 +637,8 @@ VFS_TSMSM_OBJ = modules/vfs_tsmsm.o
VFS_FILEID_OBJ = modules/vfs_fileid.o
VFS_AIO_FORK_OBJ = modules/vfs_aio_fork.o
VFS_SYNCOPS_OBJ = modules/vfs_syncops.o
+VFS_ACL_XATTR_OBJ = modules/vfs_acl_xattr.o
+VFS_SMB_TRAFFIC_ANALYZER_OBJ = modules/vfs_smb_traffic_analyzer.o
PLAINTEXT_AUTH_OBJ = auth/pampass.o auth/pass_check.o
@@ -637,6 +653,7 @@ AUTH_SERVER_OBJ = auth/auth_server.o
AUTH_UNIX_OBJ = auth/auth_unix.o
AUTH_WINBIND_OBJ = auth/auth_winbind.o
AUTH_SCRIPT_OBJ = auth/auth_script.o
+AUTH_NETLOGOND_OBJ = auth/auth_netlogond.o
AUTH_OBJ = auth/auth.o @AUTH_STATIC@ auth/auth_util.o auth/token_util.o \
auth/auth_compat.o auth/auth_ntlmssp.o \
@@ -731,7 +748,7 @@ SMBCONTROL_OBJ = utils/smbcontrol.o $(LOCKING_OBJ) $(PARAM_OBJ) \
SMBTREE_OBJ = utils/smbtree.o $(PARAM_OBJ) \
$(PROFILE_OBJ) $(LIB_NONSMBD_OBJ) $(LIBSMB_OBJ) \
$(KRBCLIENT_OBJ) $(POPT_LIB_OBJ) \
- rpc_client/cli_pipe.o librpc/rpc/binding.o $(RPC_PARSE_OBJ2) \
+ rpc_client/cli_pipe.o ../librpc/rpc/binding.o $(RPC_PARSE_OBJ2) \
$(RPC_CLIENT_OBJ1) \
$(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(SMBLDAP_OBJ) $(LDB_OBJ) $(GROUPDB_OBJ) \
$(LIBMSRPC_GEN_OBJ)
@@ -740,6 +757,10 @@ TESTPARM_OBJ = utils/testparm.o \
$(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(POPT_LIB_OBJ) \
$(LIBSAMBA_OBJ)
+TEST_LP_LOAD_OBJ = param/test_lp_load.o \
+ $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \
+ $(POPT_LIB_OBJ) $(LIBSAMBA_OBJ)
+
PASSWD_UTIL_OBJ = utils/passwd_util.o
SMBPASSWD_OBJ = utils/smbpasswd.o $(PASSWD_UTIL_OBJ) $(PASSCHANGE_OBJ) \
@@ -811,7 +832,7 @@ LIBBIGBALLOFMUD_OBJ = $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \
$(GROUPDB_OBJ) $(KRBCLIENT_OBJ) $(SMBLDAP_OBJ) $(LDB_OBJ)
CLIENT_OBJ1 = client/client.o client/clitar.o rpc_client/cli_pipe.o \
- librpc/rpc/binding.o \
+ ../librpc/rpc/binding.o \
client/dnsbrowse.o \
$(RPC_CLIENT_OBJ1) \
$(RPC_PARSE_OBJ2)
@@ -899,7 +920,7 @@ SMBTORTURE_OBJ = $(SMBTORTURE_OBJ1) $(PARAM_OBJ) \
MASKTEST_OBJ = torture/masktest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
$(LIB_NONSMBD_OBJ) \
- $(LIBNDR_GEN_OBJ0)
+ $(LIBNDR_GEN_OBJ0) $(ZLIB_LIBS)
MSGTEST_OBJ = torture/msgtest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
$(LIB_NONSMBD_OBJ) \
@@ -907,7 +928,7 @@ MSGTEST_OBJ = torture/msgtest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
LOCKTEST_OBJ = torture/locktest.o $(PARAM_OBJ) $(LOCKING_OBJ) $(KRBCLIENT_OBJ) \
$(LIBSMB_OBJ) $(LIB_NONSMBD_OBJ) \
- $(LIBNDR_GEN_OBJ0)
+ $(LIBNDR_GEN_OBJ0) $(ZLIB_LIBS)
NSSTEST_OBJ = torture/nsstest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
$(LIB_NONSMBD_OBJ) \
@@ -926,7 +947,7 @@ LOG2PCAP_OBJ = utils/log2pcaphex.o
LOCKTEST2_OBJ = torture/locktest2.o $(PARAM_OBJ) $(LOCKING_OBJ) $(LIBSMB_OBJ) \
$(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) \
- $(LIBNDR_GEN_OBJ0)
+ $(LIBNDR_GEN_OBJ0) $(ZLIB_LIBS)
SMBCACLS_OBJ = utils/smbcacls.o $(PARAM_OBJ) $(LIBSMB_OBJ) \
$(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(RPC_PARSE_OBJ) \
@@ -950,19 +971,24 @@ SHARESEC_OBJ = $(SHARESEC_OBJ0) $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \
$(LIBSAMBA_OBJ) \
$(POPT_LIB_OBJ)
-TALLOCTORT_OBJ = @tallocdir@/testsuite.o $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) \
- $(LIBSAMBA_OBJ)
+TALLOCTORT_OBJ = @tallocdir@/testsuite.o @tallocdir@/testsuite_main.o \
+ $(PARAM_OBJ) $(LIB_NONSMBD_OBJ) $(LIBSAMBA_OBJ)
-REPLACETORT_OBJ = lib/replace/test/testsuite.o \
- lib/replace/test/getifaddrs.o \
- lib/replace/test/os2_delete.o \
- lib/replace/test/strptime.o \
+REPLACETORT_OBJ = @libreplacedir@/test/testsuite.o \
+ @libreplacedir@/test/getifaddrs.o \
+ @libreplacedir@/test/os2_delete.o \
+ @libreplacedir@/test/strptime.o \
+ @libreplacedir@/test/main.o \
$(LIBREPLACE_OBJ)
-NDRDUMP_OBJ = librpc/tools/ndrdump.o \
+NDRDUMP_OBJ = ../librpc/tools/ndrdump.o \
$(PARAM_OBJ) $(LIBNDR_GEN_OBJ) \
$(LIBSAMBA_OBJ) $(LIB_NONSMBD_OBJ) $(POPT_LIB_OBJ) \
- librpc/gen_ndr/ndr_svcctl.o
+ $(LIBNDR_DRSUAPI_OBJ) $(COMPRESSION_OBJ) \
+ librpc/gen_ndr/ndr_svcctl.o \
+ librpc/gen_ndr/tables.o ../librpc/ndr/ndr_table.o \
+ ../librpc/ndr/ndr_krb5pac.o \
+ librpc/gen_ndr/ndr_krb5pac.o libsmb/asn1.o
DEBUG2HTML_OBJ = utils/debug2html.o utils/debugparse.o
@@ -984,6 +1010,18 @@ IDMAP_OBJ = winbindd/idmap.o winbindd/idmap_util.o @IDMAP_STATIC@
NSS_INFO_OBJ = winbindd/nss_info.o @NSS_INFO_STATIC@
+IDMAP_HASH_OBJ = \
+ winbindd/idmap_hash/idmap_hash.o \
+ winbindd/idmap_hash/mapfile.o
+
+IDMAP_ADEX_OBJ = \
+ winbindd/idmap_adex/idmap_adex.o \
+ winbindd/idmap_adex/cell_util.o \
+ winbindd/idmap_adex/likewise_cell.o \
+ winbindd/idmap_adex/provider_unified.o \
+ winbindd/idmap_adex/gc_util.o \
+ winbindd/idmap_adex/domain_util.o
+
WINBINDD_OBJ1 = \
winbindd/winbindd.o \
winbindd/winbindd_user.o \
@@ -1059,10 +1097,10 @@ 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)
+WINBIND_KRB5_LOCATOR_OBJ = $(WINBIND_KRB5_LOCATOR_OBJ1) $(LIBREPLACE_OBJ)
-POPT_OBJ=popt/findme.o popt/popt.o popt/poptconfig.o \
- popt/popthelp.o popt/poptparse.o
+POPT_OBJ=../lib/popt/findme.o ../lib/popt/popt.o ../lib/popt/poptconfig.o \
+ ../lib/popt/popthelp.o ../lib/popt/poptparse.o
INIPARSER_OBJ = iniparser_build/iniparser.o iniparser_build/dictionary.o \
iniparser_build/strlib.o
@@ -1091,7 +1129,7 @@ NTLM_AUTH_OBJ = ${NTLM_AUTH_OBJ1} $(LIBSAMBA_OBJ) $(POPT_LIB_OBJ) \
$(LIBNDR_GEN_OBJ0) $(LIBNDR_GEN_OBJ1)
-VLP_OBJ1 = ../testsuite/printing/vlp.o $(RPC_CLIENT_OBJ1) $(RPC_PARSE_OBJ2) $(RPC_CLIENT_OBJ) librpc/rpc/binding.o
+VLP_OBJ1 = printing/tests/vlp.o $(RPC_CLIENT_OBJ1) $(RPC_PARSE_OBJ2) $(RPC_CLIENT_OBJ) ../librpc/rpc/binding.o
VLP_OBJ = $(VLP_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) \
$(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) $(LIBMSRPC_GEN_OBJ) \
@@ -1109,7 +1147,7 @@ RPC_OPEN_TCP_OBJ = torture/rpc_open_tcp.o \
$(RPC_PARSE_OBJ2) \
$(RPC_CLIENT_OBJ1) \
rpc_client/cli_pipe.o \
- librpc/rpc/binding.o \
+ ../librpc/rpc/binding.o \
$(LIBMSRPC_GEN_OBJ)
@@ -1127,7 +1165,9 @@ pam_smbpass: SHOWFLAGS bin/pam_smbpass.@SHLIBEXT@
pam_winbind: SHOWFLAGS bin/pam_winbind.@SHLIBEXT@
-torture:: SHOWFLAGS $(TORTURE_PROGS)
+gpext_modules:: $(GPEXT_MODULES)
+
+torture:: SHOWFLAGS $(TORTURE_PROGS)
smbtorture : SHOWFLAGS bin/smbtorture@EXEEXT@
@@ -1169,16 +1209,21 @@ modules:: SHOWFLAGS $(MODULES)
#####################################################################
## Perl IDL Compiler
-IDL_FILES = 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 xattr.idl misc.idl samr.idl security.idl \
- dssetup.idl krb5pac.idl ntsvcs.idl libnetapi.idl drsuapi.idl drsblobs.idl \
- nbt.idl
-
-idl::
- @IDL_FILES="$(IDL_FILES)" CPP="$(CPP)" PERL="$(PERL)" \
- srcdir="$(srcdir)" $(srcdir)/script/build_idl.sh $(PIDL_ARGS)
-
+samba3-idl::
+ @PIDL_ARGS="$(PIDL_ARGS)" CPP="$(CPP)" PIDL="../pidl/pidl" \
+ srcdir="$(srcdir)" $(srcdir)/script/build_idl.sh librpc/idl/lsa.idl \
+ ../librpc/idl/dfs.idl ../librpc/idl/echo.idl ../librpc/idl/winreg.idl \
+ ../librpc/idl/initshutdown.idl librpc/idl/srvsvc.idl ../librpc/idl/svcctl.idl \
+ ../librpc/idl/eventlog.idl ../librpc/idl/wkssvc.idl librpc/idl/netlogon.idl \
+ ../librpc/idl/notify.idl ../librpc/idl/epmapper.idl librpc/idl/messaging.idl \
+ ../librpc/idl/xattr.idl ../librpc/idl/misc.idl librpc/idl/samr.idl \
+ ../librpc/idl/security.idl ../librpc/idl/dssetup.idl ../librpc/idl/krb5pac.idl \
+ ../librpc/idl/ntsvcs.idl librpc/idl/libnetapi.idl ../librpc/idl/drsuapi.idl \
+ ../librpc/idl/drsblobs.idl ../librpc/idl/nbt.idl
+
+librpc/gen_ndr/tables.c:: librpc/gen_ndr/*.h
+ @echo "Generating $@"
+ @$(PERL) ../librpc/tables.pl $^ > $@
#####################################################################
@@ -1190,7 +1235,7 @@ everything:: all libtalloc libsmbclient libnetapi debug2html smbfilter talloctor
.SUFFIXES: .c .o .lo
SHOWFLAGS::
- @echo "Using FLAGS = $(FLAGS)"
+ @echo "Using CFLAGS = $(CFLAGS)"
@echo " PICFLAG = $(PICFLAG)"
@echo " LIBS = $(LIBS)"
@echo " LDFLAGS = $(LDFLAGS)"
@@ -1208,11 +1253,11 @@ MAKEDIR = || exec false; \
exec false; fi || exec false
# Run a static checker.
-CHECK_CC = $(CC_CHECKER) -I. -I$(srcdir) $(FLAGS) $(PICFLAG) -c $< -o $@
+CHECK_CC = $(CC_CHECKER) $(CFLAGS) $(PICFLAG) -c $< -o $@
# Compile a source file.
-COMPILE_CC = $(CC) -I. -I$(srcdir) $(FLAGS) $(PICFLAG) -c $< -o $@
+COMPILE_CC = $(CC) $(CFLAGS) $(PICFLAG) -c $< -o $@
# Compile a source file with the installation paths defined.
-COMPILE_CC_PATH = $(CC) -I. -I$(srcdir) $(PATH_FLAGS) $(FLAGS) $(PICFLAG) -c $< -o $@
+COMPILE_CC_PATH = $(CC) $(PATH_FLAGS) $(CFLAGS) $(PICFLAG) -c $< -o $@
COMPILE = $(COMPILE_CC)
@@ -1226,7 +1271,7 @@ COMPILE = $(COMPILE_CC)
@echo Compiling $*.c
@$(COMPILE) && exit 0;\
echo "The following command failed:" 1>&2;\
- echo "$(COMPILE_CC)" 1>&2;\
+ echo "$(subst ",\",$(COMPILE_CC))" 1>&2;\
$(COMPILE_CC) >/dev/null 2>&1
@BROKEN_CC@ -mv `echo $@ | sed 's%^.*/%%g'` $@
@@ -1292,40 +1337,41 @@ bin/smbd@EXEEXT@: $(BINARY_PREREQS) $(SMBD_OBJ) @LIBTALLOC_SHARED@ @LIBTDB_SHARE
$(KRB5LIBS) $(DYNEXP) $(PRINT_LIBS) $(AUTH_LIBS) \
$(ACL_LIBS) $(PASSDB_LIBS) $(LIBS) $(DNSSD_LIBS) \
$(POPT_LIBS) @SMBD_LIBS@ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) \
- $(WINBIND_LIBS)
+ $(WINBIND_LIBS) $(ZLIB_LIBS)
bin/nmbd@EXEEXT@: $(BINARY_PREREQS) $(NMBD_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(NMBD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \
$(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(POPT_LIBS) \
- $(KRB5LIBS) $(LDAP_LIBS)
+ $(KRB5LIBS) $(LDAP_LIBS) $(ZLIB_LIBS)
bin/swat@EXEEXT@: $(BINARY_PREREQS) $(SWAT_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(SWAT_OBJ) $(LDFLAGS) $(DYNEXP) $(PRINT_LIBS) \
$(AUTH_LIBS) $(LIBS) $(PASSDB_LIBS) $(POPT_LIBS) $(KRB5LIBS) \
- $(LDAP_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS)
+ $(LDAP_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) $(ZLIB_LIBS)
bin/rpcclient@EXEEXT@: $(BINARY_PREREQS) $(RPCCLIENT_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(LDFLAGS) $(PASSDB_LIBS) $(RPCCLIENT_OBJ) \
$(DYNEXP) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS) $(POPT_LIBS) \
$(KRB5LIBS) $(LDAP_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) \
- $(WINBIND_LIBS)
+ $(WINBIND_LIBS) $(ZLIB_LIBS)
bin/smbclient@EXEEXT@: $(BINARY_PREREQS) $(CLIENT_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(CLIENT_OBJ) $(LDFLAGS) $(DYNEXP) \
$(TERMLDFLAGS) $(TERMLIBS) $(LIBS) $(POPT_LIBS) \
$(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) $(DNSSD_LIBS) \
- $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS)
+ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) $(ZLIB_LIBS)
bin/net@EXEEXT@: $(BINARY_PREREQS) $(NET_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@ @LIBNETAPI_SHARED@
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(NET_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \
$(POPT_LIBS) $(KRB5LIBS) $(UUID_LIBS) $(LDAP_LIBS) \
$(PASSDB_LIBS) $(TERMLDFLAGS) $(TERMLIBS) $(NSCD_LIBS) \
- @INIPARSERLIBS@ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) $(LIBNETAPI_LIBS)
+ @INIPARSERLIBS@ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) $(LIBNETAPI_LIBS) \
+ $(ZLIB_LIBS)
bin/profiles@EXEEXT@: $(BINARY_PREREQS) $(PROFILES_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
@echo Linking $@
@@ -1335,7 +1381,7 @@ bin/profiles@EXEEXT@: $(BINARY_PREREQS) $(PROFILES_OBJ) @BUILD_POPT@ @LIBTALLOC_
bin/smbspool@EXEEXT@: $(BINARY_PREREQS) $(CUPS_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(CUPS_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \
- $(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
+ $(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(ZLIB_LIBS)
bin/mount.cifs@EXEEXT@: $(BINARY_PREREQS) $(CIFS_MOUNT_OBJ) @BUILD_POPT@
@echo Linking $@
@@ -1373,13 +1419,13 @@ bin/smbtree@EXEEXT@: $(BINARY_PREREQS) $(SMBTREE_OBJ) @BUILD_POPT@ @LIBTALLOC_SH
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(SMBTREE_OBJ) $(LDFLAGS) $(DYNEXP) \
$(LIBS) $(POPT_LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) \
- $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS)
+ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) $(ZLIB_LIBS)
bin/smbpasswd@EXEEXT@: $(BINARY_PREREQS) $(SMBPASSWD_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(SMBPASSWD_OBJ) $(LDFLAGS) $(PASSDB_LIBS) \
$(DYNEXP) $(LIBS) $(POPT_LIBS) $(KRB5LIBS) $(LDAP_LIBS) \
- $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS)
+ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) $(ZLIB_LIBS)
bin/pdbedit@EXEEXT@: $(BINARY_PREREQS) $(PDBEDIT_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
@echo Linking $@
@@ -1391,7 +1437,7 @@ bin/smbget@EXEEXT@: $(BINARY_PREREQS) $(SMBGET_OBJ) @BUILD_POPT@ @LIBTALLOC_SHAR
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(SMBGET_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \
$(POPT_LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) \
- $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS)
+ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) $(ZLIB_LIBS)
bin/nmblookup@EXEEXT@: $(BINARY_PREREQS) $(NMBLOOKUP_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
@echo Linking $@
@@ -1402,7 +1448,7 @@ bin/smbtorture@EXEEXT@: $(BINARY_PREREQS) $(SMBTORTURE_OBJ) @BUILD_POPT@ @LIBTAL
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(SMBTORTURE_OBJ) $(LDFLAGS) $(DYNEXP) \
$(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) $(LIBTALLOC_LIBS) \
- $(LIBTDB_LIBS)
+ $(LIBTDB_LIBS) $(ZLIB_LIBS)
bin/talloctort@EXEEXT@: $(BINARY_PREREQS) $(TALLOCTORT_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
@echo Linking $@
@@ -1425,25 +1471,25 @@ bin/masktest@EXEEXT@: $(BINARY_PREREQS) $(MASKTEST_OBJ) @BUILD_POPT@ @LIBTALLOC_
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(MASKTEST_OBJ) $(LDFLAGS) $(DYNEXP) \
$(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) \
- $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
+ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(ZLIB_LIBS)
bin/msgtest@EXEEXT@: $(BINARY_PREREQS) $(MSGTEST_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(MSGTEST_OBJ) $(LDFLAGS) $(DYNEXP) \
$(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) \
- $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
+ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(ZLIB_LIBS)
bin/smbcacls@EXEEXT@: $(BINARY_PREREQS) $(SMBCACLS_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(SMBCACLS_OBJ) $(DYNEXP) $(LDFLAGS) \
$(LIBS) $(POPT_LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) \
- $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS)
+ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) $(ZLIB_LIBS)
bin/smbcquotas@EXEEXT@: $(BINARY_PREREQS) $(SMBCQUOTAS_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(SMBCQUOTAS_OBJ) $(DYNEXP) $(LDFLAGS) \
$(LIBS) $(POPT_LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) \
- $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS)
+ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) $(ZLIB_LIBS)
bin/eventlogadm@EXEEXT@: $(BINARY_PREREQS) $(EVTLOGADM_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
@echo Linking $@
@@ -1459,19 +1505,19 @@ bin/locktest@EXEEXT@: $(BINARY_PREREQS) $(LOCKTEST_OBJ) @BUILD_POPT@ @LIBTALLOC_
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(LOCKTEST_OBJ) $(LDFLAGS) $(DYNEXP) \
$(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) \
- $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
+ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(ZLIB_LIBS)
bin/nsstest@EXEEXT@: $(BINARY_PREREQS) $(NSSTEST_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(NSSTEST_OBJ) $(LDFLAGS) $(DYNEXP) \
$(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) \
- $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
+ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(ZLIB_LIBS)
bin/pdbtest@EXEEXT@: $(BINARY_PREREQS) $(PDBTEST_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(PDBTEST_OBJ) $(LDFLAGS) $(DYNEXP) \
$(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(PASSDB_LIBS) \
- $(POPT_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS)
+ $(POPT_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) $(ZLIB_LIBS)
bin/vfstest@EXEEXT@: $(BINARY_PREREQS) $(VFSTEST_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
@echo Linking $@
@@ -1479,7 +1525,7 @@ bin/vfstest@EXEEXT@: $(BINARY_PREREQS) $(VFSTEST_OBJ) @BUILD_POPT@ @LIBTALLOC_SH
$(TERMLIBS) $(DYNEXP) $(PRINT_LIBS) $(AUTH_LIBS) \
$(ACL_LIBS) $(LIBS) $(POPT_LIBS) $(KRB5LIBS) $(LDAP_LIBS) \
@SMBD_LIBS@ $(NSCD_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) \
- $(WINBIND_LIBS)
+ $(WINBIND_LIBS) $(ZLIB_LIBS)
bin/smbiconv@EXEEXT@: $(BINARY_PREREQS) $(SMBICONV_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
@echo Linking $@
@@ -1496,12 +1542,12 @@ bin/locktest2@EXEEXT@: $(BINARY_PREREQS) $(LOCKTEST2_OBJ) @BUILD_POPT@ @LIBTALLO
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(LOCKTEST2_OBJ) $(LDFLAGS) $(DYNEXP) \
$(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) \
- $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
+ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(ZLIB_LIBS)
bin/ndrdump@EXEEXT@: $(BINARY_PREREQS) $(NDRDUMP_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(NDRDUMP_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \
- $(POPT_LIBS) $(LDAP_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
+ $(POPT_LIBS) $(LDAP_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(ZLIB_LIBS)
bin/debug2html@EXEEXT@: $(BINARY_PREREQS) $(DEBUG2HTML_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@
@echo Linking $@
@@ -1512,7 +1558,7 @@ bin/smbfilter@EXEEXT@: $(BINARY_PREREQS) $(SMBFILTER_OBJ) @BUILD_POPT@ @LIBTALLO
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(SMBFILTER_OBJ) $(LDFLAGS) $(LIBS) \
$(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) \
- $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
+ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(ZLIB_LIBS)
bin/ldbedit: $(BINARY_PREREQS) $(LDBEDIT_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
@echo Linking $@
@@ -1698,6 +1744,7 @@ LIBWBCLIENT_OBJ0 = nsswitch/libwbclient/wbclient.o \
nsswitch/libwbclient/wbc_pwd.o \
nsswitch/libwbclient/wbc_idmap.o \
nsswitch/libwbclient/wbc_sid.o \
+ nsswitch/libwbclient/wbc_guid.o \
nsswitch/libwbclient/wbc_pam.o
LIBWBCLIENT_OBJ = $(LIBWBCLIENT_OBJ0) \
$(WBCOMMON_OBJ) \
@@ -2135,14 +2182,16 @@ bin/winbindd@EXEEXT@: $(BINARY_PREREQS) $(WINBINDD_OBJ) @BUILD_POPT@ @LIBTALLOC_
@echo "Linking $@"
@$(CC) $(FLAGS) -o $@ $(WINBINDD_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \
$(POPT_LIBS) $(KRB5LIBS) $(LDAP_LIBS) \
- $(PASSDB_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS)
+ $(PASSDB_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) \
+ $(ZLIB_LIBS)
bin/vlp@EXEEXT@: $(BINARY_PREREQS) $(VLP_OBJ) @LIBTALLOC_SHARED@ @LIBTDB_SHARED@ @LIBWBCLIENT_SHARED@
@echo "Linking $@"
@$(CC) $(FLAGS) -o $@ $(VLP_OBJ) $(LDFLAGS) $(DYNEXP) \
$(TERMLDFLAGS) $(TERMLIBS) $(LIBS) $(POPT_LIBS) \
$(KRB5LIBS) $(LDAP_LIBS) $(NSCD_LIBS) \
- $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS)
+ $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) $(WINBIND_LIBS) \
+ $(ZLIB_LIBS)
@WINBIND_NSS@: $(BINARY_PREREQS) $(WINBIND_NSS_OBJ)
@echo "Linking $@"
@@ -2156,15 +2205,15 @@ bin/vlp@EXEEXT@: $(BINARY_PREREQS) $(VLP_OBJ) @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
$(LDAP_LIBS) $(KRB5LIBS) $(LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS) \
@SONAMEFLAG@`basename $@`@NSSSONAMEVERSIONSUFFIX@
-bin/winbind_krb5_locator.@SHLIBEXT@: $(BINARY_PREREQS) $(WINBIND_KRB5_LOCATOR_OBJ)
+bin/winbind_krb5_locator.@SHLIBEXT@: $(BINARY_PREREQS) $(WINBIND_KRB5_LOCATOR_OBJ) @LIBWBCLIENT_SHARED@
@echo "Linking $@"
- @$(SHLD) $(LDSHFLAGS) -o $@ $(WINBIND_KRB5_LOCATOR_OBJ) \
+ @$(SHLD) $(LDSHFLAGS) -o $@ $(WINBIND_KRB5_LOCATOR_OBJ) $(WINBIND_LIBS) \
@SONAMEFLAG@`basename $@`
-bin/pam_winbind.@SHLIBEXT@: $(BINARY_PREREQS) $(PAM_WINBIND_OBJ)
+bin/pam_winbind.@SHLIBEXT@: $(BINARY_PREREQS) $(PAM_WINBIND_OBJ) @LIBTALLOC_SHARED@ @LIBWBCLIENT_SHARED@
@echo "Linking shared library $@"
@$(SHLD) $(LDSHFLAGS) -o $@ $(PAM_WINBIND_OBJ) -lpam @INIPARSERLIBS@ \
- $(PAM_WINBIND_EXTRA_LIBS) @SONAMEFLAG@`basename $@`
+ $(PAM_WINBIND_EXTRA_LIBS) $(LIBTALLOC_LIBS) $(WINBIND_LIBS) @SONAMEFLAG@`basename $@`
bin/builtin.@SHLIBEXT@: $(BINARY_PREREQS) $(AUTH_BUILTIN_OBJ)
@echo "Building plugin $@"
@@ -2178,6 +2227,10 @@ bin/script.@SHLIBEXT@: $(BINARY_PREREQS) $(AUTH_SCRIPT_OBJ)
@echo "Building plugin $@"
@$(SHLD_MODULE) $(AUTH_SCRIPT_OBJ)
+bin/netlogond.@SHLIBEXT@: $(BINARY_PREREQS) $(AUTH_NETLOGOND_OBJ)
+ @echo "Building plugin $@"
+ @$(SHLD_MODULE) $(AUTH_NETLOGOND_OBJ)
+
bin/smbserver.@SHLIBEXT@: $(BINARY_PREREQS) $(AUTH_SERVER_OBJ)
@echo "Building plugin $@"
@$(SHLD_MODULE) $(AUTH_SERVER_OBJ)
@@ -2214,6 +2267,14 @@ bin/ad.@SHLIBEXT@: $(BINARY_PREREQS) winbindd/idmap_ad.o
@echo "Building plugin $@"
@$(SHLD_MODULE) winbindd/idmap_ad.o
+bin/hash.@SHLIBEXT@: $(BINARY_PREREQS) $(IDMAP_HASH_OBJ)
+ @echo "Building plugin $@"
+ @$(SHLD_MODULE) $(IDMAP_HASH_OBJ)
+
+bin/adex.@SHLIBEXT@: $(BINARY_PREREQS) $(IDMAP_ADEX_OBJ)
+ @echo "Building plugin $@"
+ @$(SHLD_MODULE) $(IDMAP_ADEX_OBJ)
+
bin/tdb2.@SHLIBEXT@: $(BINARY_PREREQS) winbindd/idmap_tdb2.o
@echo "Building plugin $@"
@$(SHLD_MODULE) winbindd/idmap_tdb2.o
@@ -2381,6 +2442,14 @@ bin/aio_fork.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_AIO_FORK_OBJ)
@echo "Building plugin $@"
@$(SHLD_MODULE) $(VFS_AIO_FORK_OBJ)
+bin/acl_xattr.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_ACL_XATTR_OBJ)
+ @echo "Building plugin $@"
+ @$(SHLD_MODULE) $(VFS_ACL_XATTR_OBJ)
+
+bin/smb_traffic_analyzer.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_SMB_TRAFFIC_ANALYZER_OBJ)
+ @echo "Building plugin $@"
+ @$(SHLD_MODULE) $(VFS_SMB_TRAFFIC_ANALYZER_OBJ)
+
bin/registry.@SHLIBEXT@: $(BINARY_PREREQS) libgpo/gpext/registry.o
@echo "Building plugin $@"
@$(SHLD_MODULE) libgpo/gpext/registry.o
@@ -2389,6 +2458,10 @@ bin/scripts.@SHLIBEXT@: $(BINARY_PREREQS) libgpo/gpext/scripts.o
@echo "Building plugin $@"
@$(SHLD_MODULE) libgpo/gpext/scripts.o
+bin/security.@SHLIBEXT@: $(BINARY_PREREQS) libgpo/gpext/security.o
+ @echo "Building plugin $@"
+ @$(SHLD_MODULE) libgpo/gpext/security.o
+
#########################################################
## IdMap NSS plugins
@@ -2461,6 +2534,13 @@ bin/rpc_open_tcp@EXEEXT@: $(BINARY_PREREQS) $(RPC_OPEN_TCP_OBJ) @LIBTALLOC_SHARE
$(LIBS) $(LIBTALLOC_LIBS) @LIBTDB_SHARED@ $(WINBIND_LIBS) \
$(LDAP_LIBS) $(KRB5LIBS) $(NSCD_LIBS)
+bin/test_lp_load@EXEEXT@: $(BINARY_PREREQS) $(TEST_LP_LOAD_OBJ) @BUILD_POPT@ @LIBTALLOC_SHARED@ @LIBTDB_SHARED@
+ @echo "Linking $@"
+ @$(CC) $(FLAGS) -o $@ $(TEST_LP_LOAD_OBJ) \
+ $(LDFLAGS) $(DYNEEXP) $(LIBS) \
+ $(LDAP_LIBS) \
+ $(POPT_LIBS) $(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
+
install:: installservers installbin @INSTALL_CIFSMOUNT@ @INSTALL_CIFSUPCALL@ installman \
installscripts installdat installmodules @SWAT_INSTALL_TARGETS@ \
@INSTALL_PAM_MODULES@ installlibs
@@ -2511,6 +2591,8 @@ installmodules:: modules installdirs
@$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(AUTHLIBDIR) domain.@SHLIBEXT@ trustdomain.@SHLIBEXT@ ntdomain.@SHLIBEXT@
@$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(AUTHLIBDIR) builtin.@SHLIBEXT@ guest.@SHLIBEXT@ fixed_challenge.@SHLIBEXT@ name_to_ntstatus.@SHLIBEXT@
@$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(NSSINFOLIBDIR) ../idmap/ad.@SHLIBEXT@ rfc2307.@SHLIBEXT@ sfu.@SHLIBEXT@ sfu20.@SHLIBEXT@
+ @$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(NSSINFOLIBDIR) ../idmap/adex.@SHLIBEXT@ adex.@SHLIBEXT@
+ @$(SHELL) $(srcdir)/script/linkmodules.sh $(DESTDIR)$(NSSINFOLIBDIR) ../idmap/hash.@SHLIBEXT@ hash.@SHLIBEXT@
installscripts:: installdirs
@$(SHELL) $(srcdir)/script/installscripts.sh $(INSTALLPERMS_BIN) $(DESTDIR)$(BINDIR) $(SCRIPTS)
@@ -2606,6 +2688,10 @@ uninstallpammodules::
# Toplevel clean files
TOPFILES=dynconfig.o
+cleanlibs::
+ -rm -f ../lib/*/*.o ../lib/*/*/*.o \
+ ../libcli/*.o ../libcli/*/*.o
+
clean:: cleanlibs
-rm -f include/build_env.h
-rm -f smbd/build_options.c
@@ -2618,7 +2704,10 @@ clean:: cleanlibs
$(MODULES) $(TORTURE_PROGS) \
$(EVERYTHING_PROGS) \
bin/timelimit \
- .headers.stamp */src/*.o
+ .headers.stamp */src/*.o \
+ ../lib/*/*.o \
+ ../libcli/*.o ../libcli/*/*.o \
+ ../librpc/*/*.o
-rm -rf t_dir
include/build_env.h: script/build_env.sh
@@ -2627,18 +2716,14 @@ include/build_env.h: script/build_env.sh
> $(builddir)/include/build_env.h
proto::
- @echo
- @echo "NOTE: 'proto' is no longer a valid make target as proto.h"
- @echo "and other prototype headers are not generated anymore."
- @echo
-
-.PHONY: proto
-etags:
+etags::
etags `find $(srcdir) -name "*.[ch]"`
+ etags --append `find $(srcdir)/../lib -name "*.[ch]"`
+ etags --append `find $(srcdir)/../source4 -name "*.[ch]"`
-ctags:
- ctags `find $(srcdir) -name "*.[ch]"`
+ctags::
+ ctags `find $(srcdir)/.. -name "*.[ch]"`
realclean:: clean
-rm -f config.log bin/.dummy script/findsmb script/gen-8bit-gap.sh
@@ -2722,13 +2807,23 @@ valgrindtest:: all torture timelimit
VALGRIND="valgrind -q --num-callers=30 --log-file=${selftest_prefix}/valgrind.log" \
PERL="$(PERL)" $(srcdir)/script/tests/selftest.sh ${selftest_prefix} all "${smbtorture4_path}"
+# Check for Winbind struct 32/64bit padding
+test_wbpad:
+ @echo "Testing winbind request/response structure for 32/64bit padding"
+ @./script/tests/wb_pad.sh || exit 1;
##
## Examples:
##
-libsmbclient_examples:
+libsmbclient_examples: libsmbclient
$(MAKE) -C ../examples/libsmbclient -f Makefile.internal
clean_libsmbclient_examples:
$(MAKE) -C ../examples/libsmbclient -f Makefile.internal clean
+
+libnetapi_examples: libnetapi
+ $(MAKE) -C lib/netapi/examples
+
+clean_libnetapi_examples:
+ $(MAKE) -C lib/netapi/examples clean
diff --git a/source3/auth/auth.c b/source3/auth/auth.c
index 754cb7a508..7f95656bef 100644
--- a/source3/auth/auth.c
+++ b/source3/auth/auth.c
@@ -459,8 +459,8 @@ NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context)
NTSTATUS nt_status;
if (lp_auth_methods()
- && !str_list_copy(talloc_tos(), &auth_method_list,
- lp_auth_methods())) {
+ && !(auth_method_list = str_list_copy(talloc_tos(),
+ lp_auth_methods()))) {
return NT_STATUS_NO_MEMORY;
}
diff --git a/source3/auth/auth_domain.c b/source3/auth/auth_domain.c
index c25e62ab80..f11dbe60ee 100644
--- a/source3/auth/auth_domain.c
+++ b/source3/auth/auth_domain.c
@@ -26,6 +26,71 @@
extern bool global_machine_password_needs_changing;
static struct named_mutex *mutex;
+/*
+ * Change machine password (called from main loop
+ * idle timeout. Must be done as root.
+ */
+
+void attempt_machine_password_change(void)
+{
+ unsigned char trust_passwd_hash[16];
+ time_t lct;
+ void *lock;
+
+ if (!global_machine_password_needs_changing) {
+ return;
+ }
+
+ if (lp_security() != SEC_DOMAIN) {
+ return;
+ }
+
+ /*
+ * We're in domain level security, and the code that
+ * read the machine password flagged that the machine
+ * password needs changing.
+ */
+
+ /*
+ * First, open the machine password file with an exclusive lock.
+ */
+
+ lock = secrets_get_trust_account_lock(NULL, lp_workgroup());
+
+ if (lock == NULL) {
+ DEBUG(0,("attempt_machine_password_change: unable to lock "
+ "the machine account password for machine %s in "
+ "domain %s.\n",
+ global_myname(), lp_workgroup() ));
+ return;
+ }
+
+ if(!secrets_fetch_trust_account_password(lp_workgroup(),
+ trust_passwd_hash, &lct, NULL)) {
+ DEBUG(0,("attempt_machine_password_change: unable to read the "
+ "machine account password for %s in domain %s.\n",
+ global_myname(), lp_workgroup()));
+ TALLOC_FREE(lock);
+ return;
+ }
+
+ /*
+ * Make sure someone else hasn't already done this.
+ */
+
+ if(time(NULL) < lct + lp_machine_password_timeout()) {
+ global_machine_password_needs_changing = false;
+ TALLOC_FREE(lock);
+ return;
+ }
+
+ /* always just contact the PDC here */
+
+ change_trust_account_password( lp_workgroup(), NULL);
+ global_machine_password_needs_changing = false;
+ TALLOC_FREE(lock);
+}
+
/**
* Connect to a remote server for (inter)domain security authenticaion.
*
diff --git a/source3/auth/auth_netlogond.c b/source3/auth/auth_netlogond.c
new file mode 100644
index 0000000000..a57f3b74a3
--- /dev/null
+++ b/source3/auth/auth_netlogond.c
@@ -0,0 +1,321 @@
+/*
+ Unix SMB/CIFS implementation.
+ Authenticate against a netlogon pipe listening on a unix domain socket
+ Copyright (C) Volker Lendecke 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_AUTH
+
+static NTSTATUS netlogond_validate(TALLOC_CTX *mem_ctx,
+ const struct auth_context *auth_context,
+ const char *ncalrpc_sockname,
+ uint8_t schannel_key[16],
+ const auth_usersupplied_info *user_info,
+ struct netr_SamInfo3 **pinfo3,
+ NTSTATUS *schannel_bind_result)
+{
+ struct rpc_pipe_client *p;
+ struct cli_pipe_auth_data *auth;
+ struct netr_SamInfo3 *info3 = NULL;
+ NTSTATUS status;
+
+ *schannel_bind_result = NT_STATUS_OK;
+
+ status = rpc_pipe_open_ncalrpc(talloc_tos(), ncalrpc_sockname,
+ &ndr_table_netlogon.syntax_id, &p);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(10, ("rpc_pipe_open_ncalrpc failed: %s\n",
+ nt_errstr(status)));
+ return status;
+ }
+
+ status = rpccli_schannel_bind_data(p, lp_workgroup(),
+ PIPE_AUTH_LEVEL_PRIVACY,
+ schannel_key, &auth);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(10, ("rpccli_schannel_bind_data failed: %s\n",
+ nt_errstr(status)));
+ TALLOC_FREE(p);
+ return status;
+ }
+
+ status = rpc_pipe_bind(p, auth);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(10, ("rpc_pipe_bind failed: %s\n", nt_errstr(status)));
+ TALLOC_FREE(p);
+ *schannel_bind_result = status;
+ return status;
+ }
+
+ /*
+ * We have to fake a struct dcinfo, so that
+ * rpccli_netlogon_sam_network_logon_ex can decrypt the session keys.
+ */
+
+ p->dc = talloc(p, struct dcinfo);
+ if (p->dc == NULL) {
+ DEBUG(0, ("talloc failed\n"));
+ TALLOC_FREE(p);
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ memcpy(p->dc->sess_key, schannel_key, 16);
+
+ status = rpccli_netlogon_sam_network_logon_ex(
+ p, p,
+ user_info->logon_parameters,/* flags such as 'allow
+ * workstation logon' */
+ global_myname(), /* server name */
+ user_info->smb_name, /* user name logging on. */
+ user_info->client_domain, /* domain name */
+ user_info->wksta_name, /* workstation name */
+ (uchar *)auth_context->challenge.data, /* 8 byte challenge. */
+ user_info->lm_resp, /* lanman 24 byte response */
+ user_info->nt_resp, /* nt 24 byte response */
+ &info3); /* info3 out */
+
+ DEBUG(10, ("rpccli_netlogon_sam_network_logon_ex returned %s\n",
+ nt_errstr(status)));
+
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(p);
+ return status;
+ }
+
+ *pinfo3 = talloc_move(mem_ctx, &info3);
+
+ TALLOC_FREE(p);
+ return NT_STATUS_OK;
+}
+
+static char *mymachinepw(TALLOC_CTX *mem_ctx)
+{
+ fstring pwd;
+ const char *script;
+ char *to_free = NULL;
+ ssize_t nread;
+ int ret, fd;
+
+ script = lp_parm_const_string(
+ GLOBAL_SECTION_SNUM, "auth_netlogond", "machinepwscript",
+ NULL);
+
+ if (script == NULL) {
+ to_free = talloc_asprintf(talloc_tos(), "%s/%s",
+ get_dyn_SBINDIR(), "mymachinepw");
+ script = to_free;
+ }
+ if (script == NULL) {
+ return NULL;
+ }
+
+ ret = smbrun(script, &fd);
+ DEBUG(ret ? 0 : 3, ("mymachinepw: Running the command `%s' gave %d\n",
+ script, ret));
+ TALLOC_FREE(to_free);
+
+ if (ret != 0) {
+ return NULL;
+ }
+
+ pwd[sizeof(pwd)-1] = '\0';
+
+ nread = read(fd, pwd, sizeof(pwd)-1);
+ close(fd);
+
+ if (nread <= 0) {
+ DEBUG(3, ("mymachinepwd: Could not read password\n"));
+ return NULL;
+ }
+
+ DEBUG(0, ("pwd: %d [%s]\n", (int)nread, pwd));
+
+ if (pwd[nread-1] == '\n') {
+ pwd[nread-1] = '\0';
+ }
+
+ return talloc_strdup(mem_ctx, pwd);
+}
+
+static NTSTATUS check_netlogond_security(const struct auth_context *auth_context,
+ void *my_private_data,
+ TALLOC_CTX *mem_ctx,
+ const auth_usersupplied_info *user_info,
+ auth_serversupplied_info **server_info)
+{
+ TALLOC_CTX *frame = talloc_stackframe();
+ struct netr_SamInfo3 *info3 = NULL;
+ struct rpc_pipe_client *p;
+ struct cli_pipe_auth_data *auth;
+ uint32_t neg_flags = NETLOGON_NEG_AUTH2_ADS_FLAGS;
+ char *plaintext_machinepw;
+ uint8_t machine_password[16];
+ uint8_t schannel_key[16];
+ NTSTATUS schannel_bind_result, status;
+ struct named_mutex *mutex;
+ const char *ncalrpcsock;
+
+ ncalrpcsock = lp_parm_const_string(
+ GLOBAL_SECTION_SNUM, "auth_netlogond", "socket", NULL);
+
+ if (ncalrpcsock == NULL) {
+ ncalrpcsock = talloc_asprintf(talloc_tos(), "%s/%s",
+ get_dyn_NCALRPCDIR(), "DEFAULT");
+ }
+
+ if (ncalrpcsock == NULL) {
+ status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
+
+ if (!secrets_fetch_local_schannel_key(schannel_key)) {
+ goto new_key;
+ }
+
+ status = netlogond_validate(talloc_tos(), auth_context, ncalrpcsock,
+ schannel_key, user_info, &info3,
+ &schannel_bind_result);
+
+ DEBUG(10, ("netlogond_validate returned %s\n", nt_errstr(status)));
+
+ if (NT_STATUS_IS_OK(status)) {
+ goto okay;
+ }
+
+ if (NT_STATUS_IS_OK(schannel_bind_result)) {
+ /*
+ * This is a real failure from the DC
+ */
+ goto done;
+ }
+
+ new_key:
+
+ mutex = grab_named_mutex(talloc_tos(), "LOCAL_SCHANNEL_KEY", 60);
+ if (mutex == NULL) {
+ DEBUG(10, ("Could not get mutex LOCAL_SCHANNEL_KEY\n"));
+ status = NT_STATUS_ACCESS_DENIED;
+ goto done;
+ }
+
+ DEBUG(10, ("schannel bind failed, setting up new key\n"));
+
+ status = rpc_pipe_open_ncalrpc(talloc_tos(), ncalrpcsock,
+ &ndr_table_netlogon.syntax_id, &p);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(10, ("rpc_pipe_open_ncalrpc failed: %s\n",
+ nt_errstr(status)));
+ goto done;
+ }
+
+ status = rpccli_anon_bind_data(p, &auth);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(10, ("rpccli_anon_bind_data failed: %s\n",
+ nt_errstr(status)));
+ goto done;
+ }
+
+ status = rpc_pipe_bind(p, auth);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(10, ("rpc_pipe_bind failed: %s\n", nt_errstr(status)));
+ goto done;
+ }
+
+ TALLOC_FREE(auth);
+
+ plaintext_machinepw = mymachinepw(talloc_tos());
+ if (plaintext_machinepw == NULL) {
+ status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
+
+ E_md4hash(plaintext_machinepw, machine_password);
+
+ TALLOC_FREE(plaintext_machinepw);
+
+ status = rpccli_netlogon_setup_creds(
+ p, global_myname(), lp_workgroup(), global_myname(),
+ global_myname(), machine_password, SEC_CHAN_BDC, &neg_flags);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(10, ("rpccli_netlogon_setup_creds failed: %s\n",
+ nt_errstr(status)));
+ goto done;
+ }
+
+ memcpy(schannel_key, p->dc->sess_key, 16);
+ secrets_store_local_schannel_key(schannel_key);
+
+ TALLOC_FREE(p);
+
+ /*
+ * Retry the authentication with the mutex held. This way nobody else
+ * can step on our toes.
+ */
+
+ status = netlogond_validate(talloc_tos(), auth_context, ncalrpcsock,
+ schannel_key, user_info, &info3,
+ &schannel_bind_result);
+
+ DEBUG(10, ("netlogond_validate returned %s\n", nt_errstr(status)));
+
+ if (!NT_STATUS_IS_OK(status)) {
+ goto done;
+ }
+
+ okay:
+
+ status = make_server_info_info3(mem_ctx, user_info->smb_name,
+ user_info->domain, server_info,
+ info3);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(10, ("make_server_info_info3 failed: %s\n",
+ nt_errstr(status)));
+ TALLOC_FREE(frame);
+ return status;
+ }
+
+ status = NT_STATUS_OK;
+
+ done:
+ TALLOC_FREE(frame);
+ return status;
+}
+
+/* module initialisation */
+static NTSTATUS auth_init_netlogond(struct auth_context *auth_context,
+ const char *param,
+ auth_methods **auth_method)
+{
+ if (!make_auth_methods(auth_context, auth_method)) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ (*auth_method)->name = "netlogond";
+ (*auth_method)->auth = check_netlogond_security;
+ return NT_STATUS_OK;
+}
+
+NTSTATUS auth_netlogond_init(void)
+{
+ smb_register_auth(AUTH_INTERFACE_VERSION, "netlogond",
+ auth_init_netlogond);
+ return NT_STATUS_OK;
+}
diff --git a/source3/auth/auth_sam.c b/source3/auth/auth_sam.c
index 50bf15318b..7fe76fbfd6 100644
--- a/source3/auth/auth_sam.c
+++ b/source3/auth/auth_sam.c
@@ -176,7 +176,7 @@ static NTSTATUS sam_account_ok(TALLOC_CTX *mem_ctx,
/* check for expired password */
if (must_change_time < time(NULL) && must_change_time != 0) {
DEBUG(1,("sam_account_ok: Account for user '%s' password expired!.\n", pdb_get_username(sampass)));
- DEBUG(1,("sam_account_ok: Password expired at '%s' (%ld) unix time.\n", http_timestring(must_change_time), (long)must_change_time));
+ DEBUG(1,("sam_account_ok: Password expired at '%s' (%ld) unix time.\n", http_timestring(talloc_tos(), must_change_time), (long)must_change_time));
return NT_STATUS_PASSWORD_EXPIRED;
}
}
diff --git a/source3/auth/token_util.c b/source3/auth/token_util.c
index d6cd2ea3a8..e739fdaabe 100644
--- a/source3/auth/token_util.c
+++ b/source3/auth/token_util.c
@@ -84,7 +84,7 @@ NT_USER_TOKEN *get_root_nt_token( void )
cache_data = memcache_lookup_talloc(
NULL, SINGLETON_CACHE_TALLOC,
- data_blob_string_const("root_nt_token"));
+ data_blob_string_const_null("root_nt_token"));
if (cache_data != NULL) {
return talloc_get_type_abort(
@@ -109,7 +109,7 @@ NT_USER_TOKEN *get_root_nt_token( void )
memcache_add_talloc(
NULL, SINGLETON_CACHE_TALLOC,
- data_blob_string_const("root_nt_token"), token);
+ data_blob_string_const_null("root_nt_token"), token);
return token;
}
diff --git a/source3/autogen.sh b/source3/autogen.sh
index 018944e684..61316a8f70 100755
--- a/source3/autogen.sh
+++ b/source3/autogen.sh
@@ -2,6 +2,18 @@
# Run this script to build samba from GIT.
+while true; do
+ case $1 in
+ (--version-file)
+ VERSION_FILE=$2
+ shift 2
+ ;;
+ (*)
+ break
+ ;;
+ esac
+done
+
## insert all possible names (only works with
## autoconf 2.x)
TESTAUTOHEADER="autoheader autoheader-2.53 autoheader2.50 autoheader259 autoheader253"
@@ -48,12 +60,12 @@ if test "$AUTOCONFFOUND" = "0" -o "$AUTOHEADERFOUND" = "0"; then
fi
echo "$0: running script/mkversion.sh"
-./script/mkversion.sh || exit 1
+./script/mkversion.sh $VERSION_FILE || exit 1
rm -rf autom4te*.cache
rm -f configure include/config.h*
-IPATHS="-Im4 -Ilib/replace"
+IPATHS="-Im4 -I../lib/replace -I../source4"
echo "$0: running $AUTOHEADER $IPATHS"
$AUTOHEADER $IPATHS || exit 1
diff --git a/source3/client/client.c b/source3/client/client.c
index 1c05c4035d..26badc4051 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -84,9 +84,9 @@ static struct sockaddr_storage dest_ss;
static bool abort_mget = true;
/* timing globals */
-SMB_BIG_UINT get_total_size = 0;
+uint64_t get_total_size = 0;
unsigned int get_total_time_ms = 0;
-static SMB_BIG_UINT put_total_size = 0;
+static uint64_t put_total_size = 0;
static unsigned int put_total_time_ms = 0;
/* totals globals */
@@ -1203,7 +1203,7 @@ static void do_mget(file_info *finfo, const char *dir)
strlower_m(finfo->name);
}
- if (!directory_exist(finfo->name,NULL) &&
+ if (!directory_exist(finfo->name) &&
mkdir(finfo->name,0777) != 0) {
d_printf("failed to create directory %s\n",finfo->name);
client_set_cur_dir(saved_curdir);
@@ -1752,7 +1752,7 @@ static int cmd_put(void)
SMB_STRUCT_STAT st;
/* allow '-' to represent stdin
jdblair, 24.jun.98 */
- if (!file_exist(lname,&st) &&
+ if (!file_exist_stat(lname,&st) &&
(strcmp(lname,"-"))) {
d_printf("%s does not exist\n",lname);
return 1;
@@ -2555,7 +2555,7 @@ static int cmd_lock(void)
{
TALLOC_CTX *ctx = talloc_tos();
char *buf = NULL;
- SMB_BIG_UINT start, len;
+ uint64_t start, len;
enum brl_type lock_type;
int fnum;
@@ -2584,14 +2584,14 @@ static int cmd_lock(void)
return 1;
}
- start = (SMB_BIG_UINT)strtol(buf, (char **)NULL, 16);
+ start = (uint64_t)strtol(buf, (char **)NULL, 16);
if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("lock <fnum> [r|w] <hex-start> <hex-len>\n");
return 1;
}
- len = (SMB_BIG_UINT)strtol(buf, (char **)NULL, 16);
+ len = (uint64_t)strtol(buf, (char **)NULL, 16);
if (!cli_posix_lock(cli, fnum, start, len, true, lock_type)) {
d_printf("lock failed %d: %s\n", fnum, cli_errstr(cli));
@@ -2604,7 +2604,7 @@ static int cmd_unlock(void)
{
TALLOC_CTX *ctx = talloc_tos();
char *buf = NULL;
- SMB_BIG_UINT start, len;
+ uint64_t start, len;
int fnum;
if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
@@ -2618,14 +2618,14 @@ static int cmd_unlock(void)
return 1;
}
- start = (SMB_BIG_UINT)strtol(buf, (char **)NULL, 16);
+ start = (uint64_t)strtol(buf, (char **)NULL, 16);
if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("unlock <fnum> <hex-start> <hex-len>\n");
return 1;
}
- len = (SMB_BIG_UINT)strtol(buf, (char **)NULL, 16);
+ len = (uint64_t)strtol(buf, (char **)NULL, 16);
if (!cli_posix_unlock(cli, fnum, start, len)) {
d_printf("unlock failed %d: %s\n", fnum, cli_errstr(cli));
@@ -3038,7 +3038,7 @@ static int cmd_getfacl(void)
break;
case SMB_POSIX_ACL_GROUP:
uorg = IVAL(retbuf,SMB_POSIX_ACL_HEADER_SIZE+(i*SMB_POSIX_ACL_ENTRY_SIZE)+2);
- d_printf("group:%u", uorg);
+ d_printf("group:%u:", uorg);
break;
case SMB_POSIX_ACL_MASK:
d_printf("mask::");
@@ -3075,7 +3075,7 @@ static int cmd_getfacl(void)
break;
case SMB_POSIX_ACL_GROUP:
uorg = IVAL(retbuf,SMB_POSIX_ACL_HEADER_SIZE+((i+num_file_acls)*SMB_POSIX_ACL_ENTRY_SIZE)+2);
- d_printf("default:group:%u", uorg);
+ d_printf("default:group:%u:", uorg);
break;
case SMB_POSIX_ACL_MASK:
d_printf("default:mask::");
@@ -3566,7 +3566,7 @@ static int cmd_reput(void)
return 1;
}
- if (!file_exist(local_name, &st)) {
+ if (!file_exist_stat(local_name, &st)) {
d_printf("%s does not exist\n", local_name);
return 1;
}
@@ -4345,6 +4345,8 @@ cleanup:
}
}
+static bool finished;
+
/****************************************************************************
Make sure we swallow keepalives during idle time.
****************************************************************************/
@@ -4391,6 +4393,8 @@ static void readline_callback(void)
DEBUG(0, ("Read from server failed, maybe it closed "
"the connection\n"));
+ finished = true;
+ smb_readline_done();
if (NT_STATUS_EQUAL(status, NT_STATUS_END_OF_FILE)) {
set_smb_read_error(&cli->smb_rw_error,
SMB_READ_EOF);
@@ -4417,9 +4421,17 @@ static void readline_callback(void)
/* Ping the server to keep the connection alive using SMBecho. */
{
+ NTSTATUS status;
unsigned char garbage[16];
memset(garbage, 0xf0, sizeof(garbage));
- cli_echo(cli, 1, data_blob_const(garbage, sizeof(garbage)));
+ status = cli_echo(cli, 1, data_blob_const(garbage, sizeof(garbage)));
+
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0, ("SMBecho failed. Maybe server has closed "
+ "the connection\n"));
+ finished = true;
+ smb_readline_done();
+ }
}
}
@@ -4431,7 +4443,7 @@ static int process_stdin(void)
{
int rc = 0;
- while (1) {
+ while (!finished) {
TALLOC_CTX *frame = talloc_stackframe();
char *tok = NULL;
char *the_prompt = NULL;
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index 084f87e399..7ad8a73e9c 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -112,11 +112,11 @@ extern int get_total_size;
static int blocksize=20;
static int tarhandle;
-static void writetarheader(int f, const char *aname, SMB_BIG_UINT size, time_t mtime,
+static void writetarheader(int f, const char *aname, uint64_t size, time_t mtime,
const char *amode, unsigned char ftype);
static void do_atar(const char *rname_in,char *lname,file_info *finfo1);
static void do_tar(file_info *finfo, const char *dir);
-static void oct_it(SMB_BIG_UINT value, int ndgs, char *p);
+static void oct_it(uint64_t value, int ndgs, char *p);
static void fixtarname(char *tptr, const char *fp, size_t l);
static int dotarbuf(int f, char *b, int n);
static void dozerobuf(int f, int n);
@@ -154,7 +154,7 @@ static char *string_create_s(int size)
Write a tar header to buffer
****************************************************************************/
-static void writetarheader(int f, const char *aname, SMB_BIG_UINT size, time_t mtime,
+static void writetarheader(int f, const char *aname, uint64_t size, time_t mtime,
const char *amode, unsigned char ftype)
{
union hblock hb;
@@ -195,10 +195,10 @@ static void writetarheader(int f, const char *aname, SMB_BIG_UINT size, time_t m
hb.dbuf.name[NAMSIZ-1]='\0';
safe_strcpy(hb.dbuf.mode, amode, sizeof(hb.dbuf.mode)-1);
- oct_it((SMB_BIG_UINT)0, 8, hb.dbuf.uid);
- oct_it((SMB_BIG_UINT)0, 8, hb.dbuf.gid);
- oct_it((SMB_BIG_UINT) size, 13, hb.dbuf.size);
- if (size > (SMB_BIG_UINT)077777777777LL) {
+ oct_it((uint64_t)0, 8, hb.dbuf.uid);
+ oct_it((uint64_t)0, 8, hb.dbuf.gid);
+ oct_it((uint64_t) size, 13, hb.dbuf.size);
+ if (size > (uint64_t)077777777777LL) {
/* This is a non-POSIX compatible extention to store files
greater than 8GB. */
@@ -207,7 +207,7 @@ static void writetarheader(int f, const char *aname, SMB_BIG_UINT size, time_t m
for (i = 8, jp=(char*)&size; i; i--)
hb.dbuf.size[i+3] = *(jp++);
}
- oct_it((SMB_BIG_UINT) mtime, 13, hb.dbuf.mtime);
+ oct_it((uint64_t) mtime, 13, hb.dbuf.mtime);
memcpy(hb.dbuf.chksum, " ", sizeof(hb.dbuf.chksum));
memset(hb.dbuf.linkname, 0, NAMSIZ);
hb.dbuf.linkflag=ftype;
@@ -215,7 +215,7 @@ static void writetarheader(int f, const char *aname, SMB_BIG_UINT size, time_t m
for (chk=0, i=sizeof(hb.dummy), jp=hb.dummy; --i>=0;)
chk+=(0xFF & *jp++);
- oct_it((SMB_BIG_UINT) chk, 8, hb.dbuf.chksum);
+ oct_it((uint64_t) chk, 8, hb.dbuf.chksum);
hb.dbuf.chksum[6] = '\0';
(void) dotarbuf(f, hb.dummy, sizeof(hb.dummy));
@@ -431,7 +431,7 @@ static void fixtarname(char *tptr, const char *fp, size_t l)
Convert from decimal to octal string
****************************************************************************/
-static void oct_it (SMB_BIG_UINT value, int ndgs, char *p)
+static void oct_it (uint64_t value, int ndgs, char *p)
{
/* Converts long to octal string, pads with leading zeros */
@@ -567,7 +567,7 @@ static bool ensurepath(const char *fname)
return True;
}
-static int padit(char *buf, SMB_BIG_UINT bufsize, SMB_BIG_UINT padsize)
+static int padit(char *buf, uint64_t bufsize, uint64_t padsize)
{
int berr= 0;
int bytestowrite;
@@ -607,7 +607,7 @@ append one remote file to the tar file
static void do_atar(const char *rname_in,char *lname,file_info *finfo1)
{
int fnum = -1;
- SMB_BIG_UINT nread=0;
+ uint64_t nread=0;
char ftype;
file_info2 finfo;
bool shallitime=True;
@@ -738,7 +738,7 @@ static void do_atar(const char *rname_in,char *lname,file_info *finfo1)
if (nread < finfo.size) {
DEBUG(0, ("Didn't get entire file. size=%.0f, nread=%d\n",
(double)finfo.size, (int)nread));
- if (padit(data, (SMB_BIG_UINT)sizeof(data), finfo.size - nread))
+ if (padit(data, (uint64_t)sizeof(data), finfo.size - nread))
DEBUG(0,("Error writing tar file - %s\n", strerror(errno)));
}
@@ -992,7 +992,7 @@ static int skip_file(int skipsize)
static int get_file(file_info2 finfo)
{
int fnum = -1, pos = 0, dsize = 0, bpos = 0;
- SMB_BIG_UINT rsize = 0;
+ uint64_t rsize = 0;
DEBUG(5, ("get_file: file: %s, size %.0f\n", finfo.name, (double)finfo.size));
diff --git a/source3/client/mount.cifs.c b/source3/client/mount.cifs.c
index 3b56e5f861..fd8014cf9f 100644
--- a/source3/client/mount.cifs.c
+++ b/source3/client/mount.cifs.c
@@ -56,6 +56,10 @@
#endif /* _SAMBA_BUILD_ */
#endif /* MOUNT_CIFS_VENDOR_SUFFIX */
+#ifdef _SAMBA_BUILD_
+#include "include/config.h"
+#endif
+
#ifndef MS_MOVE
#define MS_MOVE 8192
#endif
@@ -75,6 +79,15 @@
#define MOUNT_PASSWD_SIZE 64
#define DOMAIN_SIZE 64
+/* exit status - bits below are ORed */
+#define EX_USAGE 1 /* incorrect invocation or permission */
+#define EX_SYSERR 2 /* out of memory, cannot fork, ... */
+#define EX_SOFTWARE 4 /* internal mount bug or wrong version */
+#define EX_USER 8 /* user interrupt */
+#define EX_FILEIO 16 /* problems writing, locking, ... mtab/fstab */
+#define EX_FAIL 32 /* mount failure */
+#define EX_SOMEOK 64 /* some mount succeeded */
+
const char *thisprogram;
int verboseflag = 0;
static int got_password = 0;
@@ -94,6 +107,8 @@ char * prefixpath = NULL;
/* like strncpy but does not 0 fill the buffer and always null
* terminates. bufsize is the size of the destination buffer */
+
+#ifndef HAVE_STRLCPY
static size_t strlcpy(char *d, const char *s, size_t bufsize)
{
size_t len = strlen(s);
@@ -104,10 +119,13 @@ static size_t strlcpy(char *d, const char *s, size_t bufsize)
d[len] = 0;
return ret;
}
+#endif
/* like strncat but does not 0 fill the buffer and always null
* terminates. bufsize is the length of the buffer, which should
* be one more than the maximum resulting string length */
+
+#ifndef HAVE_STRLCAT
static size_t strlcat(char *d, const char *s, size_t bufsize)
{
size_t len1 = strlen(d);
@@ -126,6 +144,7 @@ static size_t strlcat(char *d, const char *s, size_t bufsize)
}
return ret;
}
+#endif
/* BB finish BB
@@ -164,7 +183,7 @@ static void mount_cifs_usage(void)
printf("\n\t%s -V\n",thisprogram);
SAFE_FREE(mountpassword);
- exit(1);
+ exit(EX_USAGE);
}
/* caller frees username if necessary */
@@ -223,7 +242,7 @@ static int open_cred_file(char * file_name)
if(length > 4086) {
printf("mount.cifs failed due to malformed username in credentials file");
memset(line_buf,0,4096);
- exit(1);
+ exit(EX_USAGE);
} else {
got_user = 1;
user_name = (char *)calloc(1 + length,1);
@@ -247,7 +266,7 @@ static int open_cred_file(char * file_name)
if(length > MOUNT_PASSWD_SIZE) {
printf("mount.cifs failed: password in credentials file too long\n");
memset(line_buf,0, 4096);
- exit(1);
+ exit(EX_USAGE);
} else {
if(mountpassword == NULL) {
mountpassword = (char *)calloc(MOUNT_PASSWD_SIZE+1,1);
@@ -275,7 +294,7 @@ static int open_cred_file(char * file_name)
}
if(length > DOMAIN_SIZE) {
printf("mount.cifs failed: domain in credentials file too long\n");
- exit(1);
+ exit(EX_USAGE);
} else {
if(domain_name == NULL) {
domain_name = (char *)calloc(DOMAIN_SIZE+1,1);
@@ -308,7 +327,7 @@ static int get_password_from_file(int file_descript, char * filename)
if (mountpassword == NULL) {
printf("malloc failed\n");
- exit(1);
+ exit(EX_SYSERR);
}
if(filename != NULL) {
@@ -316,7 +335,7 @@ static int get_password_from_file(int file_descript, char * filename)
if(file_descript < 0) {
printf("mount.cifs failed. %s attempting to open password file %s\n",
strerror(errno),filename);
- exit(1);
+ exit(EX_SYSERR);
}
}
/* else file already open and fd provided */
@@ -327,7 +346,7 @@ static int get_password_from_file(int file_descript, char * filename)
printf("mount.cifs failed. Error %s reading password file\n",strerror(errno));
if(filename != NULL)
close(file_descript);
- exit(1);
+ exit(EX_SYSERR);
} else if(rc == 0) {
if(mountpassword[0] == 0) {
if(verboseflag)
@@ -553,7 +572,7 @@ static int parse_options(char ** optionsp, int * filesys_flags)
if (!(pw = getpwnam(value))) {
printf("bad user name \"%s\"\n", value);
- exit(1);
+ exit(EX_USAGE);
}
snprintf(user, sizeof(user), "%u", pw->pw_uid);
} else {
@@ -569,7 +588,7 @@ static int parse_options(char ** optionsp, int * filesys_flags)
if (!(gr = getgrnam(value))) {
printf("bad group name \"%s\"\n", value);
- exit(1);
+ exit(EX_USAGE);
}
snprintf(group, sizeof(group), "%u", gr->gr_gid);
} else {
@@ -664,7 +683,7 @@ static int parse_options(char ** optionsp, int * filesys_flags)
out = (char *)realloc(out, out_len + word_len + 2);
if (out == NULL) {
perror("malloc");
- exit(1);
+ exit(EX_SYSERR);
}
if (out_len) {
@@ -689,7 +708,7 @@ nocopy:
out = (char *)realloc(out, out_len + word_len + 6);
if (out == NULL) {
perror("malloc");
- exit(1);
+ exit(EX_SYSERR);
}
if (out_len) {
@@ -705,7 +724,7 @@ nocopy:
out = (char *)realloc(out, out_len + 1 + word_len + 6);
if (out == NULL) {
perror("malloc");
- exit(1);
+ exit(EX_SYSERR);
}
if (out_len) {
@@ -986,12 +1005,12 @@ static struct option longopts[] = {
};
/* convert a string to uppercase. return false if the string
- * wasn't ASCII or was a NULL ptr */
+ * wasn't ASCII. Return success on a NULL ptr */
static int
uppercase_string(char *string)
{
if (!string)
- return 0;
+ return 1;
while (*string) {
/* check for unicode */
@@ -1040,7 +1059,7 @@ int main(int argc, char ** argv)
thisprogram = argv[0];
} else {
mount_cifs_usage();
- exit(1);
+ exit(EX_USAGE);
}
if(thisprogram == NULL)
@@ -1057,12 +1076,12 @@ int main(int argc, char ** argv)
share_name = strndup(argv[1], MAX_UNC_LEN);
if (share_name == NULL) {
fprintf(stderr, "%s: %s", argv[0], strerror(ENOMEM));
- exit(1);
+ exit(EX_SYSERR);
}
mountpoint = argv[2];
} else {
mount_cifs_usage();
- exit(1);
+ exit(EX_USAGE);
}
/* add sharename in opts string as unc= parm */
@@ -1084,7 +1103,7 @@ int main(int argc, char ** argv)
case '?':
case 'h': /* help */
mount_cifs_usage ();
- exit(1);
+ exit(EX_USAGE);
case 'n':
++nomtab;
break;
@@ -1138,14 +1157,14 @@ int main(int argc, char ** argv)
uid = strtoul(optarg, &ep, 10);
if (*ep) {
printf("bad uid value \"%s\"\n", optarg);
- exit(1);
+ exit(EX_USAGE);
}
} else {
struct passwd *pw;
if (!(pw = getpwnam(optarg))) {
printf("bad user name \"%s\"\n", optarg);
- exit(1);
+ exit(EX_USAGE);
}
uid = pw->pw_uid;
endpwent();
@@ -1158,14 +1177,14 @@ int main(int argc, char ** argv)
gid = strtoul(optarg, &ep, 10);
if (*ep) {
printf("bad gid value \"%s\"\n", optarg);
- exit(1);
+ exit(EX_USAGE);
}
} else {
struct group *gr;
if (!(gr = getgrnam(optarg))) {
printf("bad user name \"%s\"\n", optarg);
- exit(1);
+ exit(EX_USAGE);
}
gid = gr->gr_gid;
endpwent();
@@ -1195,13 +1214,13 @@ int main(int argc, char ** argv)
default:
printf("unknown mount option %c\n",c);
mount_cifs_usage();
- exit(1);
+ exit(EX_USAGE);
}
}
if((argc < 3) || (dev_name == NULL) || (mountpoint == NULL)) {
mount_cifs_usage();
- exit(1);
+ exit(EX_USAGE);
}
if (getenv("PASSWD")) {
@@ -1218,13 +1237,13 @@ int main(int argc, char ** argv)
}
if (orgoptions && parse_options(&orgoptions, &flags)) {
- rc = -1;
+ rc = EX_USAGE;
goto mount_exit;
}
ipaddr = parse_server(&share_name);
if((ipaddr == NULL) && (got_ip == 0)) {
printf("No ip address specified and hostname not found\n");
- rc = -1;
+ rc = EX_USAGE;
goto mount_exit;
}
@@ -1239,19 +1258,19 @@ int main(int argc, char ** argv)
}
if(chdir(mountpoint)) {
printf("mount error: can not change directory into mount target %s\n",mountpoint);
- rc = -1;
+ rc = EX_USAGE;
goto mount_exit;
}
if(stat (".", &statbuf)) {
printf("mount error: mount point %s does not exist\n",mountpoint);
- rc = -1;
+ rc = EX_USAGE;
goto mount_exit;
}
if (S_ISDIR(statbuf.st_mode) == 0) {
printf("mount error: mount point %s is not a directory\n",mountpoint);
- rc = -1;
+ rc = EX_USAGE;
goto mount_exit;
}
@@ -1264,7 +1283,7 @@ int main(int argc, char ** argv)
#endif
} else {
printf("mount error: permission denied or not superuser and mount.cifs not installed SUID\n");
- return -1;
+ exit(EX_USAGE);
}
}
@@ -1279,7 +1298,7 @@ int main(int argc, char ** argv)
mountpassword = (char *)calloc(MOUNT_PASSWD_SIZE+1,1);
if (!tmp_pass || !mountpassword) {
printf("Password not entered, exiting\n");
- return -1;
+ exit(EX_USAGE);
}
strlcpy(mountpassword, tmp_pass, MOUNT_PASSWD_SIZE+1);
got_password = 1;
@@ -1297,7 +1316,7 @@ mount_retry:
else {
printf("No server share name specified\n");
printf("\nMounting the DFS root for server not implemented yet\n");
- exit(1);
+ exit(EX_USAGE);
}
if(user_name)
optlen += strlen(user_name) + 6;
@@ -1311,7 +1330,7 @@ mount_retry:
if(options == NULL) {
printf("Could not allocate memory for mount options\n");
- return -1;
+ exit(EX_SYSERR);
}
options[0] = 0;
@@ -1390,8 +1409,7 @@ mount_retry:
printf("mount error %d = %s\n",errno,strerror(errno));
}
printf("Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)\n");
- rc = -1;
- goto mount_exit;
+ rc = EX_FAIL;
} else {
pmntfile = setmntent(MOUNTED, "a+");
if(pmntfile) {
@@ -1429,11 +1447,13 @@ mount_retry:
rc = addmntent(pmntfile,&mountent);
endmntent(pmntfile);
SAFE_FREE(mountent.mnt_opts);
+ if (rc)
+ rc = EX_FILEIO;
} else {
- printf("could not update mount table\n");
+ printf("could not update mount table\n");
+ rc = EX_FILEIO;
}
}
- rc = 0;
mount_exit:
if(mountpassword) {
int len = strlen(mountpassword);
@@ -1445,5 +1465,5 @@ mount_exit:
SAFE_FREE(orgoptions);
SAFE_FREE(resolved_path);
SAFE_FREE(share_name);
- return rc;
+ exit(rc);
}
diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c
index 4a173714fe..1910ccd4fe 100644
--- a/source3/client/smbspool.c
+++ b/source3/client/smbspool.c
@@ -482,7 +482,7 @@ smb_connect(const char *workgroup, /* I - Workgroup */
/*
* Get the names and addresses of the client and server...
*/
- myname = get_myname(talloc_tos());
+ myname = talloc_get_myname(talloc_tos());
if (!myname) {
return NULL;
}
diff --git a/source3/configure.in b/source3/configure.in
index f813e87fb7..a97d535c77 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -23,7 +23,7 @@ m4_include(m4/check_path.m4)
AC_LIBREPLACE_CC_CHECKS
-m4_include(lib/talloc/libtalloc.m4)
+m4_include(../lib/talloc/libtalloc.m4)
LIBTALLOC_OBJ0=""
for obj in ${TALLOC_OBJ}; do
@@ -33,7 +33,7 @@ AC_SUBST(LIBTALLOC_OBJ0)
# TODO: These should come from m4_include(lib/tdb/libtdb.m4)
# but currently this fails: things have to get merged from s4.
-tdbdir="lib/tdb"
+tdbdir="../lib/tdb"
AC_SUBST(tdbdir)
TDB_CFLAGS="-I${srcdir-.}/$tdbdir/include"
AC_SUBST(TDB_CFLAGS)
@@ -43,18 +43,18 @@ for o in common/tdb.o common/dump.o common/transaction.o common/error.o \
common/traverse.o common/freelist.o common/freelistcheck.o \
common/io.o common/lock.o common/open.o;
do
- LIBTDB_OBJ0="$LIBTDB_OBJ0 lib/tdb/$o"
+ LIBTDB_OBJ0="$LIBTDB_OBJ0 $tdbdir/$o"
done
AC_SUBST(LIBTDB_OBJ0)
SAMBA_CPPFLAGS="-Iinclude -I${srcdir-.}/include -I. -I${srcdir-.}"
-SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/lib/replace"
+SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/../lib/replace"
SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TALLOC_CFLAGS}"
SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TDB_CFLAGS}"
SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/libaddns"
SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/librpc"
-SAMBA_CONFIGURE_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/popt"
+SAMBA_CONFIGURE_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/../lib/popt"
## cleanup the $(srcdir) in the Makefile if we are outside of the tree
if test "x${srcdir-.}" != "x."; then
@@ -128,13 +128,11 @@ fi
if test "x$debug" = "xyes" ; then
CFLAGS="${CFLAGS} -g"
else
- CFLAGS="-O"
+ CFLAGS="${CFLAGS} -O"
fi
-CFLAGS="${CFLAGS} -D_SAMBA_BUILD_=3"
-
-m4_include(lib/socket_wrapper/config.m4)
-m4_include(lib/nss_wrapper/config.m4)
+m4_include(../lib/socket_wrapper/config.m4)
+m4_include(../lib/nss_wrapper/config.m4)
m4_include(m4/swat.m4)
@@ -352,7 +350,7 @@ AC_CACHE_CHECK([that the C compiler understands negative enum values],samba_cv_C
],
samba_cv_CC_NEGATIVE_ENUM_VALUES=yes,samba_cv__CC_NEGATIVE_ENUM_VALUES=no)])
if test x"$samba_cv_CC_NEGATIVE_ENUM_VALUES" != x"yes"; then
- AC_MSG_WARN([using --unit-enums for pidl])
+ AC_MSG_WARN([using --uint-enums for pidl])
PIDL_ARGS="$PIDL_ARGS --uint-enums"
fi
@@ -406,10 +404,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_lsarpc rpc_samr rpc_winreg rpc_initshutdown rpc_dssetup rpc_wkssvc rpc_svcctl2 rpc_ntsvcs2 rpc_netlogon rpc_netdfs rpc_srvsvc 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_lsarpc rpc_samr rpc_winreg rpc_initshutdown rpc_dssetup rpc_wkssvc rpc_svcctl2 rpc_ntsvcs2 rpc_netlogon rpc_netdfs rpc_srvsvc rpc_spoolss rpc_eventlog2 auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin auth_netlogond 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 vfs_shadow_copy2 charset_CP850 charset_CP437 auth_script vfs_readahead vfs_xattr_tdb vfs_streams_xattr"
+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_xattr_tdb vfs_streams_xattr vfs_acl_xattr vfs_smb_traffic_analyzer"
if test "x$developer" = xyes; then
default_static_modules="$default_static_modules rpc_rpcecho"
@@ -659,6 +657,8 @@ AC_SUBST(LIBREPLACE_OBJS)
# add -ldl to the global LIBS
LIBS="${LIBS} ${LIBDL} ${LIBREPLACE_NETWORK_LIBS}"
+AUTH_LIBS="${AUTH_LIBS} ${CRYPT_LIBS}"
+
AC_CHECK_HEADERS(aio.h sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h rpc/nettype.h)
AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h memory.h alloca.h)
@@ -878,6 +878,21 @@ if test x"$samba_cv_sig_atomic_t" = x"yes"; then
AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE,1,[Whether we have the atomic_t variable type])
fi
+AC_CACHE_CHECK([for struct sigevent type],samba_cv_struct_sigevent, [
+ AC_TRY_COMPILE([
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+#include <signal.h>],[struct sigevent s;],
+ samba_cv_struct_sigevent=yes,samba_cv_struct_sigevent=no)])
+if test x"$samba_cv_struct_sigevent" = x"yes"; then
+ AC_DEFINE(HAVE_STRUCT_SIGEVENT,1,[Whether we have the struct sigevent])
+ AC_CHECK_MEMBERS([struct sigevent.sigev_value.sival_ptr,struct sigevent.sigev_value.sigval_ptr], , ,
+ [#include <signal.h>])
+fi
+
AC_CACHE_CHECK([for struct timespec type],samba_cv_struct_timespec, [
AC_TRY_COMPILE([
#include <sys/types.h>
@@ -4305,12 +4320,6 @@ AC_ARG_WITH(pam_smbpass,
)
-###############################################
-# test for where we get crypt() from
-AC_SEARCH_LIBS(crypt, [crypt],
- [test "$ac_cv_search_crypt" = "none required" || AUTH_LIBS="-lcrypt $AUTH_LIBS"
- AC_DEFINE(HAVE_CRYPT,1,[Whether the system has the crypt() function])])
-
##
## moved after the check for -lcrypt in order to
## ensure that the necessary libraries are included
@@ -5859,7 +5868,7 @@ if test x"$INCLUDED_POPT" = x"yes"; then
AC_MSG_RESULT(yes)
BUILD_POPT='$(POPT_OBJ)'
POPTLIBS='$(POPT_OBJ)'
- FLAGS1="-I\$(srcdir)/popt"
+ FLAGS1="-I\$(srcdir)/../lib/popt"
else
AC_MSG_RESULT(no)
BUILD_POPT=""
@@ -6044,6 +6053,8 @@ 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)
SMB_MODULE(idmap_ad, winbindd/idmap_ad.o, "bin/ad.$SHLIBEXT", IDMAP)
+SMB_MODULE(idmap_hash, \$(IDMAP_HASH_OBJ), "bin/hash.$SHLIBEXT", IDMAP)
+SMB_MODULE(idmap_adex, \$(IDMAP_ADEX_OBJ), "bin/adex.$SHLIBEXT", IDMAP)
SMB_SUBSYSTEM(IDMAP, winbindd/idmap.o)
SMB_MODULE(nss_info_template, winbindd/nss_info_template.o, "bin/template.$SHLIBEXT", NSS_INFO)
@@ -6062,6 +6073,7 @@ SMB_MODULE(auth_server, \$(AUTH_SERVER_OBJ), "bin/smbserver.$SHLIBEXT", AUTH)
SMB_MODULE(auth_domain, \$(AUTH_DOMAIN_OBJ), "bin/domain.$SHLIBEXT", AUTH)
SMB_MODULE(auth_builtin, \$(AUTH_BUILTIN_OBJ), "bin/builtin.$SHLIBEXT", AUTH)
SMB_MODULE(auth_script, \$(AUTH_SCRIPT_OBJ), "bin/script.$SHLIBEXT", AUTH)
+SMB_MODULE(auth_netlogond, \$(AUTH_NETLOGOND_OBJ), "bin/netlogond.$SHLIBEXT", AUTH)
SMB_SUBSYSTEM(AUTH,auth/auth.o)
SMB_MODULE(vfs_default, \$(VFS_DEFAULT_OBJ), "bin/default.$SHLIBEXT", VFS)
@@ -6100,12 +6112,14 @@ SMB_MODULE(vfs_aio_fork, \$(VFS_AIO_FORK_OBJ), "bin/aio_fork.$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_MODULE(vfs_acl_xattr, \$(VFS_ACL_XATTR_OBJ), "bin/acl_xattr.$SHLIBEXT", VFS)
+SMB_MODULE(vfs_smb_traffic_analyzer, \$(VFS_SMB_TRAFFIC_ANALYZER_OBJ), "bin/smb_traffic_analyzer.$SHLIBEXT", VFS)
SMB_SUBSYSTEM(VFS,smbd/vfs.o)
SMB_MODULE(gpext_registry, libgpo/gpext/registry.o, "bin/registry.$SHLIBEXT", GPEXT)
SMB_MODULE(gpext_scripts, libgpo/gpext/scripts.o, "bin/scripts.$SHLIBEXT", GPEXT)
+SMB_MODULE(gpext_security, libgpo/gpext/security.o, "bin/security.$SHLIBEXT", GPEXT)
SMB_SUBSYSTEM(GPEXT, libgpo/gpext/gpext.o)
AC_DEFINE_UNQUOTED(STRING_STATIC_MODULES, "$string_static_modules", [String list of builtin modules])
@@ -6200,6 +6214,50 @@ MSG
fi
+AC_ARG_ENABLE(merged-build,
+[AS_HELP_STRING([--enable-merged-build], [Build Samba 4 as well])],
+[ enable_merged_build=$enableval ], [ enable_merged_build=auto ])
+
+if test x$enable_merged_build = xauto; then
+ merged_build_possible=yes
+
+ # Check for GNU make
+ m4_include(../source4/build/m4/check_make.m4)
+ AC_SAMBA_GNU_MAKE([true], [merged_build_possible=no])
+
+ # Check for perl
+ m4_include(../source4/build/m4/check_perl.m4)
+ AC_SAMBA_PERL([true], [merged_build_possible=no])
+
+ # Check for python
+ m4_include(../source4/build/m4/check_python.m4)
+ AC_SAMBA_PYTHON_DEVEL([true], [merged_build_possible=no])
+
+ AC_MSG_CHECKING([whether it would be possible to do a merged build])
+ AC_MSG_RESULT([$merged_build_possible])
+
+ dnl FIXME: enable_merged_build=$merged_build_possible
+fi
+
+if test x$enable_merged_build = xyes; then
+ MERGED_BUILD=1
+ m4_include(samba4.m4)
+fi
+
+m4_include(../lib/zlib/zlib.m4)
+AC_SUBST(ZLIB_LIBS)
+AC_SUBST(ZLIB_OBJS)
+AC_ZLIB([ZLIB_OBJS=""], [
+ ZLIB_LIBS=""
+ for o in adler32.o compress.o crc32.o gzio.o uncompr.o \
+ deflate.o trees.o zutil.o inflate.o infback.o \
+ inftrees.o inffast.o
+ do
+ ZLIB_OBJS="$ZLIB_OBJS ../lib/zlib/$o"
+ done
+ CFLAGS="$CFLAGS -I../lib/zlib"
+])
+
dnl Remove -L/usr/lib/? from LDFLAGS and LIBS
LIB_REMOVE_USR_LIB(LDFLAGS)
LIB_REMOVE_USR_LIB(LIBS)
@@ -6248,6 +6306,16 @@ fi
SMBD_LIBS="$samba_dmapi_libs"
AC_SUBST(SMBD_LIBS)
+CFLAGS="${CFLAGS} \$(FLAGS)"
+
+if test x$MERGED_BUILD != x1; then
+ CFLAGS="${CFLAGS} -D_SAMBA_BUILD_=3"
+else
+ if test x"$BLDSHARED" = x"true" ; then
+ LDFLAGS="$LDFLAGS -L./bin"
+ fi
+fi
+
AC_OUTPUT(Makefile
script/findsmb smbadduser script/gen-8bit-gap.sh script/installbin.sh script/uninstallbin.sh
lib/netapi/examples/Makefile
diff --git a/source3/dynconfig.c b/source3/dynconfig.c
index 3a54507599..6125f9944c 100644
--- a/source3/dynconfig.c
+++ b/source3/dynconfig.c
@@ -77,6 +77,7 @@ DEFINE_DYN_CONFIG_PARAM(MODULESDIR)
DEFINE_DYN_CONFIG_PARAM(SHLIBEXT)
DEFINE_DYN_CONFIG_PARAM(LOCKDIR)
DEFINE_DYN_CONFIG_PARAM(PIDDIR)
+DEFINE_DYN_CONFIG_PARAM(NCALRPCDIR)
DEFINE_DYN_CONFIG_PARAM(SMB_PASSWD_FILE)
DEFINE_DYN_CONFIG_PARAM(PRIVATE_DIR)
diff --git a/source3/groupdb/mapping_ldb.c b/source3/groupdb/mapping_ldb.c
index 7ce879fb6e..1a6b99fa18 100644
--- a/source3/groupdb/mapping_ldb.c
+++ b/source3/groupdb/mapping_ldb.c
@@ -63,7 +63,7 @@ static bool init_group_mapping(void)
/* Ensure this db is created read/write for root only. */
ldb_set_create_perms(ldb, 0600);
- existed = file_exist(db_path, NULL);
+ existed = file_exist(db_path);
if (lp_parm_bool(-1, "groupmap", "nosync", False)) {
flags |= LDB_FLG_NOSYNC;
@@ -99,7 +99,7 @@ static bool init_group_mapping(void)
/* possibly upgrade */
tdb_path = state_path("group_mapping.tdb");
- if (file_exist(tdb_path, NULL) && !mapping_upgrade(tdb_path)) {
+ if (file_exist(tdb_path) && !mapping_upgrade(tdb_path)) {
unlink(state_path("group_mapping.ldb"));
goto failed;
}
diff --git a/source3/groupdb/mapping_tdb.c b/source3/groupdb/mapping_tdb.c
index 7cee53a968..29927eb592 100644
--- a/source3/groupdb/mapping_tdb.c
+++ b/source3/groupdb/mapping_tdb.c
@@ -666,8 +666,7 @@ static NTSTATUS del_aliasmem(const DOM_SID *alias, const DOM_SID *member)
if (num == 0) {
status = dbwrap_delete_bystring(db, key);
- TALLOC_FREE(sids);
- goto cancel;
+ goto commit;
}
member_string = talloc_strdup(sids, "");
@@ -693,7 +692,7 @@ static NTSTATUS del_aliasmem(const DOM_SID *alias, const DOM_SID *member)
status = dbwrap_store_bystring(
db, key, string_term_tdb_data(member_string), 0);
-
+ commit:
TALLOC_FREE(sids);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source3/include/ads.h b/source3/include/ads.h
index 97faf0b6eb..b72d250940 100644
--- a/source3/include/ads.h
+++ b/source3/include/ads.h
@@ -133,6 +133,7 @@ struct posix_schema {
char *posix_uidnumber_attr;
char *posix_gidnumber_attr;
char *posix_gecos_attr;
+ char *posix_uid_attr;
};
@@ -179,6 +180,7 @@ typedef void **ADS_MODLIST;
#define ADS_ATTR_SFU_HOMEDIR_OID "1.2.840.113556.1.6.18.1.344"
#define ADS_ATTR_SFU_SHELL_OID "1.2.840.113556.1.6.18.1.312"
#define ADS_ATTR_SFU_GECOS_OID "1.2.840.113556.1.6.18.1.337"
+#define ADS_ATTR_SFU_UID_OID "1.2.840.113556.1.6.18.1.309"
/* ldap attribute oids (Services for Unix 2.0) */
#define ADS_ATTR_SFU20_UIDNUMBER_OID "1.2.840.113556.1.4.7000.187.70"
@@ -186,6 +188,8 @@ typedef void **ADS_MODLIST;
#define ADS_ATTR_SFU20_HOMEDIR_OID "1.2.840.113556.1.4.7000.187.106"
#define ADS_ATTR_SFU20_SHELL_OID "1.2.840.113556.1.4.7000.187.72"
#define ADS_ATTR_SFU20_GECOS_OID "1.2.840.113556.1.4.7000.187.97"
+#define ADS_ATTR_SFU20_UID_OID "1.2.840.113556.1.4.7000.187.102"
+
/* ldap attribute oids (RFC2307) */
#define ADS_ATTR_RFC2307_UIDNUMBER_OID "1.3.6.1.1.1.1.0"
@@ -193,6 +197,7 @@ typedef void **ADS_MODLIST;
#define ADS_ATTR_RFC2307_HOMEDIR_OID "1.3.6.1.1.1.1.3"
#define ADS_ATTR_RFC2307_SHELL_OID "1.3.6.1.1.1.1.4"
#define ADS_ATTR_RFC2307_GECOS_OID "1.3.6.1.1.1.1.2"
+#define ADS_ATTR_RFC2307_UID_OID "0.9.2342.19200300.100.1.1"
/* ldap bitwise searches */
#define ADS_LDAP_MATCHING_RULE_BIT_AND "1.2.840.113556.1.4.803"
diff --git a/source3/include/byteorder.h b/source3/include/byteorder.h
deleted file mode 100644
index 9ced9cea3a..0000000000
--- a/source3/include/byteorder.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- SMB Byte handling
- Copyright (C) Andrew Tridgell 1992-1998
-
- 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 _BYTEORDER_H
-#define _BYTEORDER_H
-
-/*
- This file implements macros for machine independent short and
- int manipulation
-
-Here is a description of this file that I emailed to the samba list once:
-
-> I am confused about the way that byteorder.h works in Samba. I have
-> looked at it, and I would have thought that you might make a distinction
-> between LE and BE machines, but you only seem to distinguish between 386
-> and all other architectures.
->
-> Can you give me a clue?
-
-sure.
-
-The distinction between 386 and other architectures is only there as
-an optimisation. You can take it out completely and it will make no
-difference. The routines (macros) in byteorder.h are totally byteorder
-independent. The 386 optimsation just takes advantage of the fact that
-the x86 processors don't care about alignment, so we don't have to
-align ints on int boundaries etc. If there are other processors out
-there that aren't alignment sensitive then you could also define
-CAREFUL_ALIGNMENT=0 on those processors as well.
-
-Ok, now to the macros themselves. I'll take a simple example, say we
-want to extract a 2 byte integer from a SMB packet and put it into a
-type called uint16 that is in the local machines byte order, and you
-want to do it with only the assumption that uint16 is _at_least_ 16
-bits long (this last condition is very important for architectures
-that don't have any int types that are 2 bytes long)
-
-You do this:
-
-#define CVAL(buf,pos) (((unsigned char *)(buf))[pos])
-#define PVAL(buf,pos) ((unsigned)CVAL(buf,pos))
-#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8)
-
-then to extract a uint16 value at offset 25 in a buffer you do this:
-
-char *buffer = foo_bar();
-uint16 xx = SVAL(buffer,25);
-
-We are using the byteoder independence of the ANSI C bitshifts to do
-the work. A good optimising compiler should turn this into efficient
-code, especially if it happens to have the right byteorder :-)
-
-I know these macros can be made a bit tidier by removing some of the
-casts, but you need to look at byteorder.h as a whole to see the
-reasoning behind them. byteorder.h defines the following macros:
-
-SVAL(buf,pos) - extract a 2 byte SMB value
-IVAL(buf,pos) - extract a 4 byte SMB value
-SVALS(buf,pos) signed version of SVAL()
-IVALS(buf,pos) signed version of IVAL()
-
-SSVAL(buf,pos,val) - put a 2 byte SMB value into a buffer
-SIVAL(buf,pos,val) - put a 4 byte SMB value into a buffer
-SSVALS(buf,pos,val) - signed version of SSVAL()
-SIVALS(buf,pos,val) - signed version of SIVAL()
-
-RSVAL(buf,pos) - like SVAL() but for NMB byte ordering
-RSVALS(buf,pos) - like SVALS() but for NMB byte ordering
-RIVAL(buf,pos) - like IVAL() but for NMB byte ordering
-RIVALS(buf,pos) - like IVALS() but for NMB byte ordering
-RSSVAL(buf,pos,val) - like SSVAL() but for NMB ordering
-RSIVAL(buf,pos,val) - like SIVAL() but for NMB ordering
-RSIVALS(buf,pos,val) - like SIVALS() but for NMB ordering
-
-it also defines lots of intermediate macros, just ignore those :-)
-
-*/
-
-#undef CAREFUL_ALIGNMENT
-
-/* we know that the 386 can handle misalignment and has the "right"
- byteorder */
-#ifdef __i386__
-#define CAREFUL_ALIGNMENT 0
-#endif
-
-#ifndef CAREFUL_ALIGNMENT
-#define CAREFUL_ALIGNMENT 1
-#endif
-
-#define CVAL(buf,pos) ((unsigned)(((const unsigned char *)(buf))[pos]))
-#define CVAL_NC(buf,pos) (((unsigned char *)(buf))[pos]) /* Non-const version of CVAL */
-#define PVAL(buf,pos) (CVAL(buf,pos))
-#define SCVAL(buf,pos,val) (CVAL_NC(buf,pos) = (val))
-
-
-#if CAREFUL_ALIGNMENT
-
-#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8)
-#define IVAL(buf,pos) (SVAL(buf,pos)|SVAL(buf,(pos)+2)<<16)
-#define SSVALX(buf,pos,val) (CVAL_NC(buf,pos)=(unsigned char)((val)&0xFF),CVAL_NC(buf,pos+1)=(unsigned char)((val)>>8))
-#define SIVALX(buf,pos,val) (SSVALX(buf,pos,val&0xFFFF),SSVALX(buf,pos+2,val>>16))
-#define SVALS(buf,pos) ((int16)SVAL(buf,pos))
-#define IVALS(buf,pos) ((int32)IVAL(buf,pos))
-#define SSVAL(buf,pos,val) SSVALX((buf),(pos),((uint16)(val)))
-#define SIVAL(buf,pos,val) SIVALX((buf),(pos),((uint32)(val)))
-#define SSVALS(buf,pos,val) SSVALX((buf),(pos),((int16)(val)))
-#define SIVALS(buf,pos,val) SIVALX((buf),(pos),((int32)(val)))
-
-#else /* CAREFUL_ALIGNMENT */
-
-/* this handles things for architectures like the 386 that can handle
- alignment errors */
-/*
- WARNING: This section is dependent on the length of int16 and int32
- being correct
-*/
-
-/* get single value from an SMB buffer */
-#define SVAL(buf,pos) (*(const uint16 *)((const char *)(buf) + (pos)))
-#define SVAL_NC(buf,pos) (*(uint16 *)((char *)(buf) + (pos))) /* Non const version of above. */
-#define IVAL(buf,pos) (*(const uint32 *)((const char *)(buf) + (pos)))
-#define IVAL_NC(buf,pos) (*(uint32 *)((char *)(buf) + (pos))) /* Non const version of above. */
-#define SVALS(buf,pos) (*(const int16 *)((const char *)(buf) + (pos)))
-#define SVALS_NC(buf,pos) (*(int16 *)((char *)(buf) + (pos))) /* Non const version of above. */
-#define IVALS(buf,pos) (*(const int32 *)((const char *)(buf) + (pos)))
-#define IVALS_NC(buf,pos) (*(int32 *)((char *)(buf) + (pos))) /* Non const version of above. */
-
-/* store single value in an SMB buffer */
-#define SSVAL(buf,pos,val) SVAL_NC(buf,pos)=((uint16)(val))
-#define SIVAL(buf,pos,val) IVAL_NC(buf,pos)=((uint32)(val))
-#define SSVALS(buf,pos,val) SVALS_NC(buf,pos)=((int16)(val))
-#define SIVALS(buf,pos,val) IVALS_NC(buf,pos)=((int32)(val))
-
-#endif /* CAREFUL_ALIGNMENT */
-
-/* now the reverse routines - these are used in nmb packets (mostly) */
-#define SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF))
-#define IREV(x) ((SREV(x)<<16) | (SREV((x)>>16)))
-
-#define RSVAL(buf,pos) SREV(SVAL(buf,pos))
-#define RSVALS(buf,pos) SREV(SVALS(buf,pos))
-#define RIVAL(buf,pos) IREV(IVAL(buf,pos))
-#define RIVALS(buf,pos) IREV(IVALS(buf,pos))
-#define RSSVAL(buf,pos,val) SSVAL(buf,pos,SREV(val))
-#define RSSVALS(buf,pos,val) SSVALS(buf,pos,SREV(val))
-#define RSIVAL(buf,pos,val) SIVAL(buf,pos,IREV(val))
-#define RSIVALS(buf,pos,val) SIVALS(buf,pos,IREV(val))
-
-/* Alignment macros. */
-#define ALIGN4(p,base) ((p) + ((4 - (PTR_DIFF((p), (base)) & 3)) & 3))
-#define ALIGN2(p,base) ((p) + ((2 - (PTR_DIFF((p), (base)) & 1)) & 1))
-
-/* 64 bit macros */
-#define BVAL(p, ofs) (IVAL(p,ofs) | (((uint64_t)IVAL(p,(ofs)+4)) << 32))
-#define BVALS(p, ofs) ((int64_t)BVAL(p,ofs))
-#define SBVAL(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,((uint64_t)(v))>>32))
-#define SBVALS(p, ofs, v) (SBVAL(p,ofs,(uint64_t)v))
-
-#endif /* _BYTEORDER_H */
diff --git a/source3/include/charset.h b/source3/include/charset.h
index 4d04b5a1a6..1c2a5fb5f0 100644
--- a/source3/include/charset.h
+++ b/source3/include/charset.h
@@ -18,6 +18,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+struct smb_iconv_convenience;
+
/* this defines the charset types used in samba */
typedef enum {CH_UTF16LE=0, CH_UTF16=0, CH_UNIX=1, CH_DISPLAY=2, CH_DOS=3, CH_UTF8=4, CH_UTF16BE=5} charset_t;
diff --git a/source3/include/client.h b/source3/include/client.h
index 70b0421c6d..8d57fe1eed 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -232,7 +232,7 @@ struct cli_state {
typedef struct file_info {
struct cli_state *cli;
- SMB_BIG_UINT size;
+ uint64_t size;
uint16 mode;
uid_t uid;
gid_t gid;
diff --git a/source3/include/dcerpc.h b/source3/include/dcerpc.h
deleted file mode 100644
index e69de29bb2..0000000000
--- a/source3/include/dcerpc.h
+++ /dev/null
diff --git a/source3/include/debug.h b/source3/include/debug.h
index d1716320b3..56d0237c3f 100644
--- a/source3/include/debug.h
+++ b/source3/include/debug.h
@@ -40,11 +40,13 @@
int Debug1( const char *, ... ) PRINTF_ATTRIBUTE(1,2);
/* PRINTFLIKE1 */
bool dbgtext( const char *, ... ) PRINTF_ATTRIBUTE(1,2);
-bool dbghdr( int level, int cls, const char *file, const char *func, int line );
+bool dbghdrclass( int level, int cls, const char *location, const char *func);
+bool dbghdr( int level, const char *location, const char *func);
#if defined(sgi) && (_COMPILER_VERSION >= 730)
#pragma mips_frequency_hint NEVER Debug1
#pragma mips_frequency_hint NEVER dbgtext
+#pragma mips_frequency_hint NEVER dbghdrclass
#pragma mips_frequency_hint NEVER dbghdr
#endif
@@ -192,7 +194,7 @@ extern bool *DEBUGLEVEL_CLASS_ISSET;
#define DEBUGLVL( level ) \
( CHECK_DEBUGLVL(level) \
- && dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) ) )
+ && dbghdrclass( level, DBGC_CLASS, __location__, FUNCTION_MACRO ) )
#define DEBUGLVLC( dbgc_class, level ) \
@@ -200,7 +202,7 @@ extern bool *DEBUGLEVEL_CLASS_ISSET;
unlikely((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \
(!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \
DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \
- && dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) ) )
+ && dbghdrclass( level, DBGC_CLASS, __location__, FUNCTION_MACRO) )
#define DEBUG( level, body ) \
@@ -208,7 +210,7 @@ extern bool *DEBUGLEVEL_CLASS_ISSET;
unlikely((DEBUGLEVEL_CLASS[ DBGC_CLASS ] >= (level))|| \
(!DEBUGLEVEL_CLASS_ISSET[ DBGC_CLASS ] && \
DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \
- && (dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) )) \
+ && (dbghdrclass( level, DBGC_CLASS, __location__, FUNCTION_MACRO )) \
&& (dbgtext body) )
#define DEBUGC( dbgc_class, level, body ) \
@@ -216,7 +218,7 @@ extern bool *DEBUGLEVEL_CLASS_ISSET;
unlikely((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))|| \
(!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \
DEBUGLEVEL_CLASS[ DBGC_ALL ] >= (level)) ) \
- && (dbghdr( level, DBGC_CLASS, __FILE__, FUNCTION_MACRO, (__LINE__) )) \
+ && (dbghdrclass( level, DBGC_CLASS, __location__, FUNCTION_MACRO)) \
&& (dbgtext body) )
#define DEBUGADD( level, body ) \
diff --git a/source3/include/dlinklist.h b/source3/include/dlinklist.h
deleted file mode 100644
index 1a4ebb6fa0..0000000000
--- a/source3/include/dlinklist.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- some simple double linked list macros
- Copyright (C) Andrew Tridgell 1998
-
- 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/>.
-*/
-
-/* To use these macros you must have a structure containing a next and
- prev pointer */
-
-#ifndef _DLINKLIST_H
-#define _DLINKLIST_H
-
-
-/* hook into the front of the list */
-#define DLIST_ADD(list, p) \
-do { \
- if (!(list)) { \
- (list) = (p); \
- (p)->next = (p)->prev = NULL; \
- } else { \
- (list)->prev = (p); \
- (p)->next = (list); \
- (p)->prev = NULL; \
- (list) = (p); \
- }\
-} while (0)
-
-/* remove an element from a list - element doesn't have to be in list. */
-#define DLIST_REMOVE(list, p) \
-do { \
- if ((p) == (list)) { \
- (list) = (p)->next; \
- if (list) (list)->prev = NULL; \
- } else { \
- if ((p)->prev) (p)->prev->next = (p)->next; \
- if ((p)->next) (p)->next->prev = (p)->prev; \
- } \
- if ((p) != (list)) (p)->next = (p)->prev = NULL; \
-} while (0)
-
-/* promote an element to the top of the list */
-#define DLIST_PROMOTE(list, p) \
-do { \
- DLIST_REMOVE(list, p); \
- DLIST_ADD(list, p); \
-} while (0)
-
-/* hook into the end of the list - needs the entry type */
-#define DLIST_ADD_END(list, p, type) \
-do { \
- if (!(list)) { \
- (list) = (p); \
- (p)->next = (p)->prev = NULL; \
- } else { \
- type tmp; \
- for (tmp = (list); tmp->next; tmp = tmp->next) ; \
- tmp->next = (p); \
- (p)->next = NULL; \
- (p)->prev = tmp; \
- } \
-} while (0)
-
-/* insert 'p' after the given element 'el' in a list. If el is NULL then
- this is the same as a DLIST_ADD() */
-#define DLIST_ADD_AFTER(list, p, el) \
-do { \
- if (!(list) || !(el)) { \
- DLIST_ADD(list, p); \
- } else { \
- p->prev = el; \
- p->next = el->next; \
- el->next = p; \
- if (p->next) p->next->prev = p; \
- }\
-} while (0)
-
-/* demote an element to the end of the list, needs a tmp pointer */
-#define DLIST_DEMOTE(list, p, tmp) \
-do { \
- DLIST_REMOVE(list, p); \
- DLIST_ADD_END(list, p, tmp); \
-} while (0)
-
-/* concatenate two lists - putting all elements of the 2nd list at the
- end of the first list */
-#define DLIST_CONCATENATE(list1, list2, type) \
-do { \
- if (!(list1)) { \
- (list1) = (list2); \
- } else { \
- type tmp; \
- for (tmp = (list1); tmp->next; tmp = tmp->next) ; \
- tmp->next = (list2); \
- if (list2) { \
- (list2)->prev = tmp; \
- } \
- } \
-} while (0)
-
-#endif /* _DLINKLIST_H */
diff --git a/source3/include/dynconfig.h b/source3/include/dynconfig.h
index 758bde33cc..8267064f23 100644
--- a/source3/include/dynconfig.h
+++ b/source3/include/dynconfig.h
@@ -71,6 +71,10 @@ const char *get_dyn_PIDDIR(void);
const char *set_dyn_PIDDIR(const char *newpath);
bool is_default_dyn_PIDDIR(void);
+const char *get_dyn_NCALRPCDIR(void);
+const char *set_dyn_NCALRPCDIR(const char *newpath);
+bool is_default_dyn_NCALRPCDIR(void);
+
const char *get_dyn_SMB_PASSWD_FILE(void);
const char *set_dyn_SMB_PASSWD_FILE(const char *newpath);
bool is_default_dyn_SMB_PASSWD_FILE(void);
diff --git a/source3/include/fake_file.h b/source3/include/fake_file.h
index 93da106030..c4b271f85d 100644
--- a/source3/include/fake_file.h
+++ b/source3/include/fake_file.h
@@ -22,7 +22,8 @@
enum FAKE_FILE_TYPE {
FAKE_FILE_TYPE_NONE = 0,
- FAKE_FILE_TYPE_QUOTA
+ FAKE_FILE_TYPE_QUOTA,
+ FAKE_FILE_TYPE_NAMED_PIPE
};
/*
diff --git a/source3/include/hmacmd5.h b/source3/include/hmacmd5.h
deleted file mode 100644
index ae588fb889..0000000000
--- a/source3/include/hmacmd5.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Interface header: Scheduler service
- Copyright (C) Luke Kenneth Casson Leighton 1996-1999
- Copyright (C) Andrew Tridgell 1992-1999
-
- 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 _HMAC_MD5_H
-
-typedef struct {
- struct MD5Context ctx;
- unsigned char k_ipad[65];
- unsigned char k_opad[65];
-} HMACMD5Context;
-
-#endif /* _HMAC_MD5_H */
diff --git a/source3/include/idmap.h b/source3/include/idmap.h
index 95c3e4c0c2..4322192155 100644
--- a/source3/include/idmap.h
+++ b/source3/include/idmap.h
@@ -31,8 +31,9 @@
Updated to 3 for enum types by JRA. */
/* Updated to 4, completely new interface, SSS */
+/* Updated to 5, simplified interface by Volker */
-#define SMB_IDMAP_INTERFACE_VERSION 4
+#define SMB_IDMAP_INTERFACE_VERSION 5
struct idmap_domain {
const char *name;
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 9c5ea08f6d..c164d285c1 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -25,7 +25,7 @@
#undef SIZEOF_LONG
#endif
-#include "lib/replace/replace.h"
+#include "../replace/replace.h"
/* make sure we have included the correct config.h */
#ifndef NO_CONFIG_H /* for some tests */
@@ -71,23 +71,6 @@
#undef HAVE_TERMIOS_H
#endif
-#ifndef _PUBLIC_
-#ifdef HAVE_VISIBILITY_ATTR
-# define _PUBLIC_ __attribute__((visibility("default")))
-#else
-# define _PUBLIC_
-#endif
-#endif
-
-#if defined(__GNUC__) && !defined(__cplusplus)
-/** gcc attribute used on function parameters so that it does not emit
- * warnings about them being unused. **/
-# define UNUSED(param) param __attribute__ ((unused))
-#else
-# define UNUSED(param) param
-/** Feel free to add definitions for other compilers here. */
-#endif
-
#ifdef RELIANTUNIX
/*
* <unistd.h> has to be included before any other to get
@@ -286,36 +269,18 @@ typedef int ber_int_t;
#endif
/*
- * Define VOLATILE if needed.
- */
-
-#if defined(HAVE_VOLATILE)
-#define VOLATILE volatile
-#else
-#define VOLATILE
-#endif
-
-/*
* Define additional missing types
*/
-#if defined(HAVE_SIG_ATOMIC_T_TYPE) && defined(AIX)
+#if defined(AIX)
typedef sig_atomic_t SIG_ATOMIC_T;
-#elif defined(HAVE_SIG_ATOMIC_T_TYPE) && !defined(AIX)
-typedef sig_atomic_t VOLATILE SIG_ATOMIC_T;
#else
-typedef int VOLATILE SIG_ATOMIC_T;
+typedef sig_atomic_t volatile SIG_ATOMIC_T;
#endif
#ifndef uchar
#define uchar unsigned char
#endif
-#ifdef HAVE_UNSIGNED_CHAR
-#define schar signed char
-#else
-#define schar char
-#endif
-
/*
Samba needs type definitions for int16, int32, uint16 and uint32.
@@ -326,15 +291,11 @@ typedef int VOLATILE SIG_ATOMIC_T;
*/
#ifndef uint8
-#define uint8 unsigned char
+#define uint8 uint8_t
#endif
#if !defined(int16) && !defined(HAVE_INT16_FROM_RPC_RPC_H)
-# if (SIZEOF_SHORT == 4)
-# define int16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
-# else /* SIZEOF_SHORT != 4 */
-# define int16 short
-# endif /* SIZEOF_SHORT != 4 */
+# define int16 int16_t
/* needed to work around compile issue on HP-UX 11.x */
# define _INT16 1
#endif
@@ -344,25 +305,13 @@ typedef int VOLATILE SIG_ATOMIC_T;
* case as int16 may be a typedef from rpc/rpc.h
*/
+
#if !defined(uint16) && !defined(HAVE_UINT16_FROM_RPC_RPC_H)
-#if (SIZEOF_SHORT == 4)
-#define uint16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
-#else /* SIZEOF_SHORT != 4 */
-#define uint16 unsigned short
-#endif /* SIZEOF_SHORT != 4 */
+# define uint16 uint16_t
#endif
#if !defined(int32) && !defined(HAVE_INT32_FROM_RPC_RPC_H)
-# if (SIZEOF_INT == 4)
-# define int32 int
-# elif (SIZEOF_LONG == 4)
-# define int32 long
-# elif (SIZEOF_SHORT == 4)
-# define int32 short
-# else
- /* uggh - no 32 bit type?? probably a CRAY. just hope this works ... */
-# define int32 int
-# endif
+# define int32 int32_t
/* needed to work around compile issue on HP-UX 11.x */
# define _INT32 1
#endif
@@ -373,16 +322,7 @@ typedef int VOLATILE SIG_ATOMIC_T;
*/
#if !defined(uint32) && !defined(HAVE_UINT32_FROM_RPC_RPC_H)
-#if (SIZEOF_INT == 4)
-#define uint32 unsigned int
-#elif (SIZEOF_LONG == 4)
-#define uint32 unsigned long
-#elif (SIZEOF_SHORT == 4)
-#define uint32 unsigned short
-#else
-/* uggh - no 32 bit type?? probably a CRAY. just hope this works ... */
-#define uint32 unsigned
-#endif
+# define uint32 uint32_t
#endif
/*
@@ -390,19 +330,11 @@ typedef int VOLATILE SIG_ATOMIC_T;
*/
#if !defined(uint64)
-#if (SIZEOF_LONG == 8)
-#define uint64 unsigned long
-#elif (SIZEOF_LONG_LONG == 8)
-#define uint64 unsigned long long
-#endif /* don't lie. If we don't have it, then don't use it */
+# define uint64 uint64_t
#endif
#if !defined(int64)
-#if (SIZEOF_LONG == 8)
-#define int64 long
-#elif (SIZEOF_LONG_LONG == 8)
-#define int64 long long
-#endif /* don't lie. If we don't have it, then don't use it */
+# define int64 int64_t
#endif
@@ -426,7 +358,7 @@ typedef int VOLATILE SIG_ATOMIC_T;
#ifdef LARGE_SMB_DEV_T
#define SDEV_T_VAL(p, ofs, v) (SIVAL((p),(ofs),(v)&0xFFFFFFFF), SIVAL((p),(ofs)+4,(v)>>32))
-#define DEV_T_VAL(p, ofs) ((SMB_DEV_T)(((SMB_BIG_UINT)(IVAL((p),(ofs))))| (((SMB_BIG_UINT)(IVAL((p),(ofs)+4))) << 32)))
+#define DEV_T_VAL(p, ofs) ((SMB_DEV_T)(((uint64_t)(IVAL((p),(ofs))))| (((uint64_t)(IVAL((p),(ofs)+4))) << 32)))
#else
#define SDEV_T_VAL(p, ofs, v) (SIVAL((p),(ofs),v),SIVAL((p),(ofs)+4,0))
#define DEV_T_VAL(p, ofs) ((SMB_DEV_T)(IVAL((p),(ofs))))
@@ -452,7 +384,7 @@ typedef int VOLATILE SIG_ATOMIC_T;
#ifdef LARGE_SMB_INO_T
#define SINO_T_VAL(p, ofs, v) (SIVAL((p),(ofs),(v)&0xFFFFFFFF), SIVAL((p),(ofs)+4,(v)>>32))
-#define INO_T_VAL(p, ofs) ((SMB_INO_T)(((SMB_BIG_UINT)(IVAL(p,ofs)))| (((SMB_BIG_UINT)(IVAL(p,(ofs)+4))) << 32)))
+#define INO_T_VAL(p, ofs) ((SMB_INO_T)(((uint64_t)(IVAL(p,ofs)))| (((uint64_t)(IVAL(p,(ofs)+4))) << 32)))
#else
#define SINO_T_VAL(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
#define INO_T_VAL(p, ofs) ((SMB_INO_T)(IVAL((p),(ofs))))
@@ -466,20 +398,13 @@ typedef int VOLATILE SIG_ATOMIC_T;
# endif
#endif
-#if defined(HAVE_LONGLONG)
-#define SMB_BIG_UINT unsigned long long
-#define SMB_BIG_INT long long
#define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
-#else
-#define SMB_BIG_UINT unsigned long
-#define SMB_BIG_INT long
-#define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
-#endif
+#define IVAL2_TO_SMB_BIG_UINT(buf,off) ( (((uint64_t)(IVAL((buf),(off)))) & ((uint64_t)0xFFFFFFFF)) | \
+ (( ((uint64_t)(IVAL((buf),(off+4)))) & ((uint64_t)0xFFFFFFFF) ) << 32 ) )
-#define SMB_BIG_UINT_BITS (sizeof(SMB_BIG_UINT)*8)
/* this should really be a 64 bit type if possible */
-#define br_off SMB_BIG_UINT
+typedef uint64_t br_off;
#define SMB_OFF_T_BITS (sizeof(SMB_OFF_T)*8)
@@ -497,15 +422,11 @@ typedef int VOLATILE SIG_ATOMIC_T;
#ifdef LARGE_SMB_OFF_T
#define SOFF_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
#define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,(v)&0xFFFFFFFF), SIVAL(p,ofs,(v)>>32))
-#define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((SMB_BIG_UINT)(IVAL((buf),(off)))) & ((SMB_BIG_UINT)0xFFFFFFFF) )))
-#define IVAL2_TO_SMB_BIG_UINT(buf,off) ( (((SMB_BIG_UINT)(IVAL((buf),(off)))) & ((SMB_BIG_UINT)0xFFFFFFFF)) | \
- (( ((SMB_BIG_UINT)(IVAL((buf),(off+4)))) & ((SMB_BIG_UINT)0xFFFFFFFF) ) << 32 ) )
+#define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((uint64_t)(IVAL((buf),(off)))) & ((uint64_t)0xFFFFFFFF) )))
#else
#define SOFF_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
#define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,v),SIVAL(p,ofs,0))
#define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((uint32)(IVAL((buf),(off)))) & 0xFFFFFFFF )))
-#define IVAL2_TO_SMB_BIG_UINT(buf,off) ( (((SMB_BIG_UINT)(IVAL((buf),(off)))) & ((SMB_BIG_UINT)0xFFFFFFFF)) | \
- (( ((SMB_BIG_UINT)(IVAL((buf),(off+4)))) & ((SMB_BIG_UINT)0xFFFFFFFF) ) << 32 ) )
#endif
/*
@@ -645,14 +566,24 @@ struct timespec {
typedef char fstring[FSTRING_LEN];
#endif
+/* Samba 3 doesn't use iconv_convenience: */
+extern void *global_loadparm;
+extern void *cmdline_lp_ctx;
+struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx);
+
/* Lists, trees, caching, database... */
-#include "xfile.h"
+#include "../lib/util/xfile.h"
+#include "../lib/util/memory.h"
+#include "../lib/util/attr.h"
#include "intl.h"
-#include "dlinklist.h"
+#include "../lib/util/dlinklist.h"
#include "tdb.h"
#include "util_tdb.h"
-#include "lib/talloc/talloc.h"
+#include "../talloc/talloc.h"
+
+#include "../lib/util/data_blob.h"
+#include "../lib/util/time.h"
/* And a little extension. Abort on type mismatch */
#define talloc_get_type_abort(ptr, type) \
(type *)talloc_check_name_abort(ptr, #type)
@@ -675,7 +606,7 @@ typedef char fstring[FSTRING_LEN];
#include "smb.h"
#include "nameserv.h"
#include "secrets.h"
-#include "byteorder.h"
+#include "../lib/util/byteorder.h"
#include "privileges.h"
#include "rpc_misc.h"
#include "rpc_dce.h"
@@ -686,8 +617,10 @@ typedef char fstring[FSTRING_LEN];
#include "authdata.h"
#include "msdfs.h"
#include "rap.h"
-#include "md5.h"
-#include "hmacmd5.h"
+#include "../lib/crypto/md5.h"
+#include "../lib/crypto/arcfour.h"
+#include "../lib/crypto/crc32.h"
+#include "../lib/crypto/hmacmd5.h"
#include "ntlmssp.h"
#include "auth.h"
#include "ntdomain.h"
@@ -703,6 +636,7 @@ typedef char fstring[FSTRING_LEN];
#include "librpc/gen_ndr/notify.h"
#include "librpc/gen_ndr/xattr.h"
#include "librpc/gen_ndr/messaging.h"
+#include "librpc/gen_ndr/ndr_nbt.h"
#include "librpc/rpc/dcerpc.h"
#include "nt_printing.h"
#include "idmap.h"
@@ -782,14 +716,6 @@ enum flush_reason_enum {
#include "modules/nfs4_acls.h"
#include "nsswitch/libwbclient/wbclient.h"
-/* generated rpc server implementation functions */
-#include "librpc/gen_ndr/srv_echo.h"
-#include "librpc/gen_ndr/srv_svcctl.h"
-#include "librpc/gen_ndr/srv_lsa.h"
-#include "librpc/gen_ndr/srv_eventlog.h"
-#include "librpc/gen_ndr/srv_winreg.h"
-#include "librpc/gen_ndr/srv_initshutdown.h"
-
/***** automatically generated prototypes *****/
#ifndef NO_PROTO_H
#include "proto.h"
@@ -830,14 +756,6 @@ enum flush_reason_enum {
/* prototypes from lib/util_transfer_file.c */
#include "transfer_file.h"
-#ifdef __COMPAR_FN_T
-#define QSORT_CAST (__compar_fn_t)
-#endif
-
-#ifndef QSORT_CAST
-#define QSORT_CAST (int (*)(const void *, const void *))
-#endif
-
#ifndef DEFAULT_PRINTING
#ifdef HAVE_CUPS
#define DEFAULT_PRINTING PRINT_CUPS
@@ -887,26 +805,6 @@ enum flush_reason_enum {
#define SYNC_DNS 1
#endif
-#ifndef SEEK_SET
-#define SEEK_SET 0
-#endif
-
-#ifndef INADDR_LOOPBACK
-#define INADDR_LOOPBACK 0x7f000001
-#endif
-
-#ifndef INADDR_NONE
-#define INADDR_NONE 0xffffffff
-#endif
-
-#ifndef HAVE_CRYPT
-#define crypt ufc_crypt
-#endif
-
-#ifndef O_ACCMODE
-#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
-#endif
-
#if defined(HAVE_CRYPT16) && defined(HAVE_GETAUTHUID)
#define ULTRIX_AUTH 1
#endif
@@ -919,26 +817,9 @@ int setresuid(uid_t ruid, uid_t euid, uid_t suid);
int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
#endif
-/*
- * Some older systems seem not to have MAXHOSTNAMELEN
- * defined.
- */
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 255
-#endif
-
/* yuck, I'd like a better way of doing this */
#define DIRP_SIZE (256 + 32)
-/*
- * glibc on linux doesn't seem to have MSG_WAITALL
- * defined. I think the kernel has it though..
- */
-
-#ifndef MSG_WAITALL
-#define MSG_WAITALL 0
-#endif
-
/* default socket options. Dave Miller thinks we should default to TCP_NODELAY
given the socket IO pattern that Samba uses */
#ifdef TCP_NODELAY
@@ -954,84 +835,6 @@ int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
#endif
-/* Some POSIX definitions for those without */
-
-#ifndef S_IFDIR
-#define S_IFDIR 0x4000
-#endif
-#ifndef S_ISDIR
-#define S_ISDIR(mode) ((mode & 0xF000) == S_IFDIR)
-#endif
-#ifndef S_IRWXU
-#define S_IRWXU 00700 /* read, write, execute: owner */
-#endif
-#ifndef S_IRUSR
-#define S_IRUSR 00400 /* read permission: owner */
-#endif
-#ifndef S_IWUSR
-#define S_IWUSR 00200 /* write permission: owner */
-#endif
-#ifndef S_IXUSR
-#define S_IXUSR 00100 /* execute permission: owner */
-#endif
-#ifndef S_IRWXG
-#define S_IRWXG 00070 /* read, write, execute: group */
-#endif
-#ifndef S_IRGRP
-#define S_IRGRP 00040 /* read permission: group */
-#endif
-#ifndef S_IWGRP
-#define S_IWGRP 00020 /* write permission: group */
-#endif
-#ifndef S_IXGRP
-#define S_IXGRP 00010 /* execute permission: group */
-#endif
-#ifndef S_IRWXO
-#define S_IRWXO 00007 /* read, write, execute: other */
-#endif
-#ifndef S_IROTH
-#define S_IROTH 00004 /* read permission: other */
-#endif
-#ifndef S_IWOTH
-#define S_IWOTH 00002 /* write permission: other */
-#endif
-#ifndef S_IXOTH
-#define S_IXOTH 00001 /* execute permission: other */
-#endif
-
-/* For sys_adminlog(). */
-#ifndef LOG_EMERG
-#define LOG_EMERG 0 /* system is unusable */
-#endif
-
-#ifndef LOG_ALERT
-#define LOG_ALERT 1 /* action must be taken immediately */
-#endif
-
-#ifndef LOG_CRIT
-#define LOG_CRIT 2 /* critical conditions */
-#endif
-
-#ifndef LOG_ERR
-#define LOG_ERR 3 /* error conditions */
-#endif
-
-#ifndef LOG_WARNING
-#define LOG_WARNING 4 /* warning conditions */
-#endif
-
-#ifndef LOG_NOTICE
-#define LOG_NOTICE 5 /* normal but significant condition */
-#endif
-
-#ifndef LOG_INFO
-#define LOG_INFO 6 /* informational */
-#endif
-
-#ifndef LOG_DEBUG
-#define LOG_DEBUG 7 /* debug-level messages */
-#endif
-
#if HAVE_KERNEL_SHARE_MODES
#ifndef LOCK_MAND
#define LOCK_MAND 32 /* This is a mandatory flock */
@@ -1059,19 +862,6 @@ extern int DEBUGLEVEL;
#endif
-/* Needed for sys_dlopen/sys_dlsym/sys_dlclose */
-#ifndef RTLD_GLOBAL
-#define RTLD_GLOBAL 0
-#endif
-
-#ifndef RTLD_LAZY
-#define RTLD_LAZY 0
-#endif
-
-#ifndef RTLD_NOW
-#define RTLD_NOW 0
-#endif
-
/* needed for some systems without iconv. Doesn't really matter
what error code we use */
#ifndef EILSEQ
@@ -1104,17 +894,6 @@ char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...) PRINTF_ATT
#define slprintf snprintf
#define vslprintf vsnprintf
-/* we need to use __va_copy() on some platforms */
-#ifdef HAVE_VA_COPY
-#define VA_COPY(dest, src) va_copy(dest, src)
-#else
-#ifdef HAVE___VA_COPY
-#define VA_COPY(dest, src) __va_copy(dest, src)
-#else
-#define VA_COPY(dest, src) (dest) = (src)
-#endif
-#endif
-
/*
* Veritas File System. Often in addition to native.
* Quotas different.
@@ -1270,10 +1049,6 @@ LDAP *ldap_open_with_timeout(const char *server, int port, unsigned int to);
ssize_t readahead(int fd, off64_t offset, size_t count);
#endif
-/* TRUE and FALSE are part of the C99 standard and gcc, but
- unfortunately many vendor compilers don't support them. Use True
- and False instead. */
-
#ifdef TRUE
#undef TRUE
#endif
@@ -1292,21 +1067,12 @@ ssize_t readahead(int fd, off64_t offset, size_t count);
#endif
#define CONST_DISCARD(type, ptr) ((type) ((void *) (ptr)))
-#define CONST_ADD(type, ptr) ((type) ((const void *) (ptr)))
-
-#ifndef NORETURN_ATTRIBUTE
-#if (__GNUC__ >= 3)
-#define NORETURN_ATTRIBUTE __attribute__ ((noreturn))
-#else
-#define NORETURN_ATTRIBUTE
-#endif
-#endif
-void smb_panic( const char *why ) NORETURN_ATTRIBUTE ;
-void dump_core(void) NORETURN_ATTRIBUTE ;
-void exit_server(const char *const reason) NORETURN_ATTRIBUTE ;
-void exit_server_cleanly(const char *const reason) NORETURN_ATTRIBUTE ;
-void exit_server_fault(void) NORETURN_ATTRIBUTE ;
+void smb_panic( const char *why ) _NORETURN_;
+void dump_core(void) _NORETURN_;
+void exit_server(const char *const reason) _NORETURN_;
+void exit_server_cleanly(const char *const reason) _NORETURN_;
+void exit_server_fault(void) _NORETURN_;
#ifdef HAVE_LIBNSCD
#include "libnscd.h"
diff --git a/source3/include/interfaces.h b/source3/include/interfaces.h
index 84501cee41..9a19c33b57 100644
--- a/source3/include/interfaces.h
+++ b/source3/include/interfaces.h
@@ -24,8 +24,8 @@
#ifndef _INTERFACES_H
#define _INTERFACES_H
-#include "lib/replace/replace.h"
-#include "lib/replace/system/network.h"
+#include "../replace/replace.h"
+#include "../replace/system/network.h"
#define MAX_INTERFACES 128
diff --git a/source3/include/libmsrpc.h b/source3/include/libmsrpc.h
deleted file mode 100644
index 3f2a7260ca..0000000000
--- a/source3/include/libmsrpc.h
+++ /dev/null
@@ -1,3045 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- * MS-RPC client library API definitions/prototypes
- *
- * Copyright (C) Chris Nicholls 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/>.
- */
-
-#ifndef LIBMSRPC_H
-#define LIBMSRPC_H
-
-
-#include "includes.h"
-#include "libsmbclient.h"
-#include "libsmb_internal.h"
-
-/*server capability levels*/
-#define SRV_WIN_NT4 1
-#define SRV_WIN_2K 2
-#define SRV_WIN_2K_SP3 3
-#define SRV_WIN_2K3 4
-
-/**@defgroup handle Server Handle*/
-/**@defgroup Library_Functions Library/Utility Functions*/
-/**@defgroup lsa_defs LSA Definitions*/
-/**@defgroup LSA_Functions LSA Functions*/
-/**@defgroup reg_defs Registry Definitions*/
-/**@defgroup Reg_Functions Registry Functions*/
-/**@defgroup sam_defs SAM Definitions*/
-/**@defgroup SAM_Functions SAM Functions*/
-/**@defgroup svc_defs Service Control Definitions*/
-/**@defgroup SCM_Functions Service Control Functions*/
-
-/**Operation was unsuccessful*/
-#define CAC_FAILURE 0
-/**Operation was successful*/
-#define CAC_SUCCESS 1
-/**Operation was only partially successful
- * an example of this is if you try to lookup a list of accounts to SIDs and not all accounts can be resolved*/
-#define CAC_PARTIAL_SUCCESS 2
-
-/**@ingroup CAC_errors Use this to see if the last operation failed - useful for enumeration functions that use multiple calls*/
-#define CAC_OP_FAILED(status) !NT_STATUS_IS_OK(status) && \
- NT_STATUS_V(status) != NT_STATUS_V(STATUS_SOME_UNMAPPED) && \
- NT_STATUS_V(status) != NT_STATUS_V(STATUS_NO_MORE_FILES) && \
- NT_STATUS_V(status) != NT_STATUS_V(NT_STATUS_NO_MORE_ENTRIES) && \
- NT_STATUS_V(status) != NT_STATUS_V(NT_STATUS_NONE_MAPPED) && \
- NT_STATUS_V(status) != NT_STATUS_V(NT_STATUS_GUIDS_EXHAUSTED)
-
-
-/**Privilege string constants*/
-#define CAC_SE_CREATE_TOKEN "SeCreateTokenPrivilege"
-#define CAC_SE_ASSIGN_PRIMARY_TOKEN "SeAssignPrimaryTokenPrivilege"
-#define CAC_SE_LOCK_MEMORY "SeLockMemoryPrivilege"
-#define CAC_SE_INCREASE_QUOTA "SeIncreaseQuotaPrivilege"
-#define CAC_SE_MACHINE_ACCOUNT "SeMachineAccountPrivilege"
-#define CAC_SE_TCB "SeTcbPrivilege"
-#define CAC_SE_SECURITY "SeSecurityPrivilege"
-#define CAC_SE_TAKE_OWNERSHIP "SeTakeOwnershipPrivilege"
-#define CAC_SE_LOAD_DRIVER "SeLoadDriverPrivilege"
-#define CAC_SE_SYSTEM_PROFILE "SeSystemProfilePrivilege"
-#define CAC_SE_SYSTEM_TIME "SeSystemtimePrivilege"
-#define CAC_SE_PROFILE_SINGLE_PROC "SeProfileSingleProcessPrivilege"
-#define CAC_SE_INCREASE_BASE_PRIORITY "SeIncreaseBasePriorityPrivilege"
-#define CAC_SE_CREATE_PAGEFILE "SeCreatePagefilePrivilege"
-#define CAC_SE_CREATE_PERMANENT "SeCreatePermanentPrivilege"
-#define CAC_SE_BACKUP "SeBackupPrivilege"
-#define CAC_SE_RESTORE "SeRestorePrivilege"
-#define CAC_SE_SHUTDOWN "SeShutdownPrivilege"
-#define CAC_SE_DEBUG "SeDebugPrivilege"
-#define CAC_SE_AUDIT "SeAuditPrivilege"
-#define CAC_SE_SYSTEM_ENV "SeSystemEnvironmentPrivilege"
-#define CAC_SE_CHANGE_NOTIFY "SeChangeNotifyPrivilege"
-#define CAC_SE_REMOTE_SHUTDOWN "SeRemoteShutdownPrivilege"
-#define CAC_SE_UNDOCK "SeUndockPrivilege"
-#define CAC_SE_SYNC_AGENT "SeSyncAgentPrivilege"
-#define CAC_SE_ENABLE_DELEGATION "SeEnableDelegationPrivilege"
-#define CAC_SE_MANAGE_VOLUME "SeManageVolumePrivilege"
-#define CAC_SE_IMPERSONATE "SeImpersonatePrivilege"
-#define CAC_SE_CREATE_GLOBAL "SeCreateGlobalPrivilege"
-#define CAC_SE_PRINT_OPERATOR "SePrintOperatorPrivilege"
-#define CAC_SE_NETWORK_LOGON "SeNetworkLogonRight"
-#define CAC_SE_INTERACTIVE_LOGON "SeInteractiveLogonRight"
-#define CAC_SE_BATCH_LOGON "SeBatchLogonRight"
-#define CAC_SE_SERVICE_LOGON "SeServiceLogonRight"
-#define CAC_SE_ADD_USERS "SeAddUsersPrivilege"
-#define CAC_SE_DISK_OPERATOR "SeDiskOperatorPrivilege"
-
-/**
- * @addtogroup lsa_defs
- * @{
- */
-/**used to specify what data to retrieve using cac_LsaQueryTrustedDomainInformation*/
-#define CAC_INFO_TRUSTED_DOMAIN_NAME 0x1
-#define CAC_INFO_TRUSTED_DOMAIN_POSIX_OFFSET 0x3
-#define CAC_INFO_TRUSTED_DOMAIN_PASSWORD 0x4
-
-/**Used when requesting machine domain information*/
-#define CAC_DOMAIN_INFO 0x0003
-
-/**Used when requesting machine local information*/
-#define CAC_LOCAL_INFO 0x0005
-
-/**Stores information about a SID*/
-typedef struct _CACSIDINFO {
- /**The actual SID*/
- DOM_SID sid;
-
- /**The name of the object which maps to this SID*/
- char *name;
-
- /**The domain the SID belongs to*/
- char *domain;
-} CacSidInfo;
-/* @} */
-
-/**
- * @addtogroup reg_defs
- * @{
- */
-/**Null terminated string*/
-typedef char* REG_SZ_DATA;
-
-/**Null terminated string with windows environment variables that should be expanded*/
-typedef char* REG_EXPAND_SZ_DATA;
-
-/**Binary data of some kind*/
-typedef struct _REGBINARYDATA {
- uint32 data_length;
- uint8 * data;
-} REG_BINARY_DATA;
-
-/**32-bit (little endian) number*/
-typedef uint32 REG_DWORD_DATA;
-
-/**32-bit big endian number*/
-typedef uint32 REG_DWORD_BE_DATA;
-
-/**array of strings*/
-typedef struct _REGMULTISZDATA {
- uint32 num_strings;
-
- char **strings;
-} REG_MULTI_SZ_DATA;
-
-typedef union _REGVALUEDATA {
- REG_SZ_DATA reg_sz;
- REG_EXPAND_SZ_DATA reg_expand_sz;
- REG_BINARY_DATA reg_binary;
- REG_DWORD_DATA reg_dword;
- REG_DWORD_BE_DATA reg_dword_be;
- REG_MULTI_SZ_DATA reg_multi_sz;
-} REG_VALUE_DATA;
-/**@}*/
-
-/**
- * @addtogroup sam_defs
- * @{
- */
-
-#define CAC_USER_RID 0x1
-#define CAC_GROUP_RID 0x2
-
-typedef struct _CACLOOKUPRIDSRECORD {
- char *name;
- uint32 rid;
-
- /**If found, this will be one of:
- * - CAC_USER_RID
- * - CAC_GROUP_RID
- */
- uint32 type;
-
- /*if the name or RID was looked up, then found = True*/
- bool found;
-} CacLookupRidsRecord;
-
-typedef struct _CACUSERINFO {
- /**Last logon time*/
- time_t logon_time;
-
- /**Last logoff time*/
- time_t logoff_time;
-
- /**Last kickoff time*/
- time_t kickoff_time;
-
- /**Last password set time*/
- time_t pass_last_set_time;
-
- /**Time password can change*/
- time_t pass_can_change_time;
-
- /**Time password must change*/
- time_t pass_must_change_time;
-
- /**LM user password*/
- uint8 lm_password[8];
-
- /**NT user password*/
- uint8 nt_password[8];
-
- /**User's RID*/
- uint32 rid;
-
- /**RID of primary group*/
- uint32 group_rid;
-
- /**User's ACB mask*/
- uint32 acb_mask;
-
- /**Bad password count*/
- uint16 bad_passwd_count;
-
- /**Number of logons*/
- uint16 logon_count;
-
- /**Change password at next logon?*/
- bool pass_must_change;
-
- /**Username*/
- char *username;
-
- /**User's full name*/
- char *full_name;
-
- /**User's home directory*/
- char *home_dir;
-
- /**Home directory drive*/
- char *home_drive;
-
- /**Logon script*/
- char *logon_script;
-
- /**Path to profile*/
- char *profile_path;
-
- /**Account description*/
- char *description;
-
- /**Login from workstations*/
- char *workstations;
-
- char *dial;
-
- /**Possible logon hours*/
- LOGON_HRS *logon_hours;
-
-} CacUserInfo;
-
-typedef struct _CACGROUPINFO {
- /**Group name*/
- char *name;
-
- /**Description*/
- char *description;
-
- /**Number of members*/
- uint32 num_members;
-} CacGroupInfo, CacAliasInfo;
-
-/**Represents a period (duration) of time*/
-typedef struct _CACTIME {
- /**Number of days*/
- uint32 days;
-
- /**Number of hours*/
- uint32 hours;
-
- /**Number of minutes*/
- uint32 minutes;
-
- /**number of seconds*/
- uint32 seconds;
-} CacTime;
-
-
-typedef struct _CACDOMINFO {
- /**The server role. Should be one of:
- * ROLE_STANDALONE
- * ROLE_DOMAIN_MEMBER
- * ROLE_DOMAIN_BDC
- * ROLE_DOMAIN_PDC
- * see include/smb.h
- */
- uint32 server_role;
-
- /**Number of domain users*/
- uint32 num_users;
-
- /**Number of domain groups*/
- uint32 num_domain_groups;
-
- /**Number of local groups*/
- uint32 num_local_groups;
-
- /**Comment*/
- char *comment;
-
- /**Domain name*/
- char *domain_name;
-
- /**Server name*/
- char *server_name;
-
- /**Minimum password length*/
- uint16 min_pass_length;
-
- /**How many previous passwords to remember - ie, password cannot be the same as N previous passwords*/
- uint16 pass_history;
-
- /**How long (from now) before passwords expire*/
- CacTime expire;
-
- /**How long (from now) before passwords can be changed*/
- CacTime min_pass_age;
-
- /**How long users are locked out for too many bad password attempts*/
- CacTime lockout_duration;
-
- /**How long before lockouts are reset*/
- CacTime lockout_reset;
-
- /**How many bad password attempts before lockout occurs*/
- uint16 num_bad_attempts;
-} CacDomainInfo;
-
-/**@}*/ /*sam_defs*/
-
-/**@addtogroup svc_defs
- * @{
- */
-typedef struct _CACSERVICE {
- /**The service name*/
- char *service_name;
-
- /**The display name of the service*/
- char *display_name;
-
- /**Current status of the service - see include/rpc_svcctl.h for SERVICE_STATUS definition*/
- SERVICE_STATUS status;
-} CacService;
-
-typedef struct __CACSERVICECONFIG {
- /**The service type*/
- uint32 type;
-
- /**The start type. Should be one of:
- * - SVCCTL_BOOT_START
- * - SVCCTL_SYSTEM_START
- * - SVCCTL_AUTO_START
- * - SVCCTL_DEMAND_START
- */
- uint32 start_type;
-
- uint32 error_control;
-
- /**Path to executable*/
- char *exe_path;
-
- /***/
- char *load_order_group;
-
- uint32 tag_id;
-
- /**Any dependencies for the service*/
- char *dependencies;
-
- /**Run as...*/
- char *start_name;
-
- /**Service display name*/
- char *display_name;
-
-} CacServiceConfig;
-/**@}*/ /*svc_defs*/
-
-#include "libmsrpc_internal.h"
-
-/**
- * @addtogroup handle
- * @{
- */
-
-/**
- * Server handle used to keep track of client/server/pipe information. Use cac_NewServerHandle() to allocate.
- * Initiliaze as many values as possible before calling cac_Connect().
- *
- * @note When allocating memory for the fields, use SMB_MALLOC() (or equivalent) instead of talloc() (or equivalent) -
- * If memory is not allocated for a field, cac_Connect will allocate sizeof(fstring) bytes for it.
- *
- * @note It may be wise to allocate large buffers for these fields and strcpy data into them.
- *
- * @see cac_NewServerHandle()
- * @see cac_FreeHandle()
- */
-typedef struct _CACSERVERHANDLE {
- /** debug level
- */
- int debug;
-
- /** netbios name used to make connections
- */
- char *netbios_name;
-
- /** domain name used to make connections
- */
- char *domain;
-
- /** username used to make connections
- */
- char *username;
-
- /** user's password plain text string
- */
- char *password;
-
- /** name or IP address of server we are currently working with
- */
- char *server;
-
- /**stores the latest NTSTATUS code
- */
- NTSTATUS status;
-
- /** internal. do not modify!
- */
- struct CacServerHandleInternal _internal;
-
-} CacServerHandle;
-
-/*@}*/
-
-/**internal function. do not call this function*/
-SMBCSRV *cac_GetServer(CacServerHandle *hnd);
-
-
-/** @addtogroup Library_Functions
- * @{
- */
-/**
- * Initializes the library - do not need to call this function. Open's smb.conf as well as initializes logging.
- * @param debug Debug level for library to use
- */
-
-void cac_Init(int debug);
-
-/**
- * Creates an un-initialized CacServerHandle
- * @param allocate_fields If True, the function will allocate sizeof(fstring) bytes for all char * fields in the handle
- * @return - un-initialized server handle
- * - NULL if no memory could be allocated
- */
-CacServerHandle * cac_NewServerHandle(bool allocate_fields);
-
-/**
- * Specifies the smbc_get_auth_data_fn to use if you do not want to use the default.
- * @param hnd non-NULL server handle
- * @param auth_fn auth_data_fn to set in server handle
- */
-
-void cac_SetAuthDataFn(CacServerHandle *hnd, smbc_get_auth_data_fn auth_fn);
-
-/** Use your own libsmbclient context - not necessary.
- * @note You must still call cac_Connect() after specifying your own libsmbclient context
- * @param hnd Initialized, but not connected CacServerHandle
- * @param ctx The libsmbclient context you would like to use.
- */
-void cac_SetSmbcContext(CacServerHandle *hnd, SMBCCTX *ctx);
-
-/** Connects to a specified server. If there is already a connection to a different server,
- * it will be cleaned up before connecting to the new server.
- * @param hnd Pre-initialized CacServerHandle
- * @param srv (Optional) Name or IP of the server to connect to. If NULL, server from the CacServerHandle will be used.
- *
- * @return CAC_FAILURE if the operation could not be completed successfully (hnd->status will also be set with a NTSTATUS code)
- * @return CAC_SUCCESS if the operation succeeded
- */
-int cac_Connect(CacServerHandle *hnd, const char *srv);
-
-
-/**
- * Cleans up any data used by the CacServerHandle. If the libsmbclient context was set using cac_SetSmbcContext(), it will not be free'd.
- * @param hnd the CacServerHandle to destroy
- */
-void cac_FreeHandle(CacServerHandle * hnd);
-
-/**
- * Initializes a CacTime structure based on an NTTIME structure
- * If the function fails, then the CacTime structure will be zero'd out
- */
-void cac_InitCacTime(CacTime *cactime, NTTIME nttime);
-
-/**
- * Called by cac_NewServerHandle() if allocate_fields = True. You can call this if you want to, allocates sizeof(fstring) char's for every char * field
- * @param hnd Uninitialized server handle
- * @return CAC_FAILURE Memory could not be allocated
- * @return CAC_SUCCESS Memory was allocated
- */
-int cac_InitHandleMem(CacServerHandle *hnd);
-
-/**
- * Default smbc_get_auth_data_fn for libmsrpc. This function is called when libmsrpc needs to get more information about the
- * client (username/password, workgroup).
- * This function provides simple prompts to the user to enter the information. This description his here so you know how to re-define this function.
- * @see cac_SetAuthDataFn()
- * @param pServer Name/IP of the server to connect to.
- * @param pShare Share name to connect to
- * @param pWorkgroup libmsrpc passes in the workgroup/domain name from hnd->domain. It can be modified in the function.
- * @param maxLenWorkgroup The maximum length of a string pWogroup can hold.
- * @param pUsername libmsrpc passes in the username from hnd->username. It can be modified in the function.
- * @param maxLenUsername The maximum length of a string pUsername can hold.
- * @param pPassword libmsrpc pass in the password from hnd->password. It can be modified in the function.
- * @param maxLenPassword The maximum length of a string pPassword can hold.
- */
-void cac_GetAuthDataFn(const char * pServer,
- const char * pShare,
- char * pWorkgroup,
- int maxLenWorkgroup,
- char * pUsername,
- int maxLenUsername,
- char * pPassword,
- int maxLenPassword);
-
-
-/**@}*/
-
-/*****************
- * LSA Functions *
- *****************/
-
-/** @addtogroup LSA_Functions
- * @{
- */
-
-struct LsaOpenPolicy {
- /**Inputs*/
- struct {
- /**Access Mask. Refer to Security Access Masks in include/rpc_secdes.h*/
- uint32 access;
-
- /**Use security quality of service? (True/False)*/
- bool security_qos;
- } in;
-
- /**Outputs*/
- struct {
- /**Handle to the open policy (needed for all other operations)*/
- POLICY_HND *pol;
- } out;
-};
-
-/**
- * Opens a policy handle on a remote machine.
- * @param hnd fully initialized CacServerHandle for remote machine
- * @param mem_ctx Talloc context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE if the policy could not be opened. hnd->status set with appropriate NTSTATUS
- * @return CAC_SUCCESS if the policy could be opened, the policy handle can be found
- */
-int cac_LsaOpenPolicy(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaOpenPolicy *op);
-
-
-/**
- * Closes an LSA policy handle (Retrieved using cac_LsaOpenPolicy).
- * If successful, the handle will be closed on the server, and memory for pol will be freed
- * @param hnd - An initialized and connected server handle
- * @param mem_ctx Talloc context for memory allocation
- * @param pol - the policy handle to close
- * @return CAC_FAILURE could not close the policy handle, hnd->status is set to the appropriate NTSTATUS error code
- * @return CAC_SUCCESS the policy handle was closed
- */
-int cac_LsaClosePolicy(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *pol);
-
-
-struct LsaGetNamesFromSids {
- struct {
- /**handle to and open LSA policy*/
- POLICY_HND *pol;
-
- /**the number of SIDs to lookup*/
- uint32 num_sids;
-
- /**array of SIDs to lookup*/
- DOM_SID *sids;
- } in;
-
- struct {
- /**The number of names returned (in case of CAC_PARTIAL_SUCCESS)*/
- uint32 num_found;
-
- /**array of SID info each index is one sid */
- CacSidInfo *sids;
-
- /**in case of partial success, an array of SIDs that could not be looked up (NULL if all sids were looked up)*/
- DOM_SID *unknown;
- } out;
-};
-
-/**
- * Looks up the names for a list of SIDS
- * @param hnd initialized and connected server handle
- * @param mem_ctx Talloc context for memory allocation
- * @param op input and output parameters
- * @return CAC_FAILURE none of the SIDs could be looked up hnd->status is set with appropriate NTSTATUS error code
- * @return CAC_SUCCESS all of the SIDs were translated and a list of names has been output
- * @return CAC_PARTIAL_SUCCESS not all of the SIDs were translated, as a result the number of returned names is less than the original list of SIDs
- */
-int cac_LsaGetNamesFromSids(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaGetNamesFromSids *op);
-
-struct LsaGetSidsFromNames {
- struct {
- /**handle to an open LSA policy*/
- POLICY_HND *pol;
-
- /**number of SIDs to lookup*/
- uint32 num_names;
-
- /**array of strings listing the names*/
- char **names;
- } in;
-
- struct {
- /**The number of SIDs returned (in case of partial success*/
- uint32 num_found;
-
- /**array of SID info for the looked up names*/
- CacSidInfo *sids;
-
- /**in case of partial success, the names that were not looked up*/
- char **unknown;
- } out;
-};
-
-/**
- * Looks up the SIDs for a list of names
- * @param hnd initialized and connected server handle
- * @param mem_ctx Talloc context for memory allocation
- * @param op input and output parameters
- * @return CAC_FAILURE none of the SIDs could be looked up hnd->status is set with appropriate NTSTATUS error code
- * @return CAC_SUCCESS all of the SIDs were translated and a list of names has been output
- * @return CAC_PARTIAL_SUCCESS not all of the SIDs were translated, as a result the number of returned names is less than the original list of SIDs
- */
-int cac_LsaGetSidsFromNames(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaGetSidsFromNames *op);
-
-struct LsaFetchSid {
- struct {
- /**handle to an open LSA policy*/
- POLICY_HND *pol;
-
- /**can be CAC_LOCAL_INFO, CAC_DOMAIN_INFO, or (CAC_LOCAL_INFO | CAC_DOMAIN_INFO)*/
- uint16 info_class;
- } in;
-
- struct {
- /**the machine's local SID and domain name (NULL if not asked for)*/
- CacSidInfo *local_sid;
-
- /**the machine's domain SID and name (NULL if not asked for)*/
- CacSidInfo *domain_sid;
-
- } out;
-};
-
-/**
- * Looks up the domain or local sid of a machine with an open LSA policy handle
- * @param hnd initialized and connected server handle
- * @param mem_ctx Talloc context for memory allocation
- * @param op input and output parameters
- * @return CAC_FAILURE if the SID could not be fetched
- * @return CAC_SUCCESS if the SID was fetched
- * @return CAC_PARTIAL_SUCCESS if you asked for both local and domain sids but only one was returned
- */
-int cac_LsaFetchSid(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaFetchSid *op);
-
-struct LsaQueryInfoPolicy {
- struct {
- /**Open LSA policy handle on remote server*/
- POLICY_HND *pol;
- } in;
-
- struct {
- /**remote server's domain name*/
- char *domain_name;
-
- /**remote server's dns name*/
- char *dns_name;
-
- /**remote server's forest name*/
- char *forest_name;
-
- /**remote server's domain guid*/
- struct GUID *domain_guid;
-
- /**remote server's domain SID*/
- DOM_SID *domain_sid;
- } out;
-};
-
-/**
- * Retrieves information about the LSA machine/domain
- * @param hnd initialized and connected server handle
- * @param mem_ctx Talloc context for memory allocation
- * @param op input and output parameters
- * Note: for pre-Windows 2000 machines, only op->out.SID and op->out.domain will be set. @see cac_LsaFetchSid
- * @return - CAC_FAILURE if the operation was not successful. hnd->status will be set with an accurate NT_STATUS code
- * @return CAC_SUCCESS the operation was successful.
- */
-int cac_LsaQueryInfoPolicy(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaQueryInfoPolicy *op);
-
-struct LsaEnumSids {
- struct {
- /**Open LSA Policy handle*/
- POLICY_HND *pol;
-
- /**The prefered maximum number of SIDs returned per call*/
- uint32 pref_max_sids;
- } in;
-
- struct {
- /**used to keep track of how many sids have been retrieved over multiple calls
- * should be set to zero via ZERO_STRUCT() befrore the first call. Use the same struct LsaEnumSids for multiple calls*/
- uint32 resume_idx;
-
- /**The number of sids returned this call*/
- uint32 num_sids;
-
- /**Array of sids returned*/
- DOM_SID *sids;
-
- } out;
-};
-
-/**
- * Enumerates the SIDs in the LSA. Can be enumerated in blocks by calling the function multiple times.
- * Example: while(cac_LsaEnumSids(hnd, mem_ctx, op) { ... }
- * @param hnd - An initialized and connected server handle
- * @param mem_ctx Talloc context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE there was an error during operations OR there are no more results
- * @return CAC_SUCCESS the operation completed and results were returned
- */
-int cac_LsaEnumSids(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaEnumSids *op);
-
-struct LsaEnumAccountRights {
- struct {
- /**Open LSA Policy handle*/
- POLICY_HND *pol;
-
- /**(Optional) SID of the account - must supply either sid or name*/
- DOM_SID *sid;
-
- /**(Optional) name of the account - must supply either sid or name*/
- char *name;
- } in;
-
- struct {
- /**Count of rights for this account*/
- uint32 num_privs;
-
- /**array of privilege names*/
- char **priv_names;
- } out;
-};
-
-/**
- * Enumerates rights assigned to a given account. Takes a SID instead of account handle as input
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @return CAC_FAILURE the rights could not be retrieved. hnd->status is set with NT_STATUS code
- * @return CAC_SUCCESS the operation was successful.
- */
-
-int cac_LsaEnumAccountRights(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaEnumAccountRights *op);
-
-struct LsaEnumTrustedDomains {
- struct {
- /**Open LSA policy handle*/
- POLICY_HND *pol;
- } in;
-
- struct {
- /**used to keep track of how many domains have been retrieved over multiple calls
- * should be set to zero via ZERO_STRUCT() before the first call. Use the same struct LsaEnumSids for multiple calls*/
- uint32 resume_idx;
-
- /**The number of domains returned by the remote server this call*/
- uint32 num_domains;
-
- /**array of trusted domain names returned by the remote server*/
- char **domain_names;
-
- /**array of trusted domain sids returned by the remote server*/
- DOM_SID *domain_sids;
- } out;
-};
-
-/**
- * Enumerates the trusted domains in the LSA.
- * @param hnd - An initialized and connected server handle
- * @param mem_ctx Talloc context for memory allocation
- * @param op - initialized parameters
- * @return CAC_FAILURE there was an error during operations OR there are no more results
- * @return CAC_SUCCESS the operation completed and results were returned
- */
-int cac_LsaEnumTrustedDomains(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaEnumTrustedDomains *op);
-
-struct LsaOpenTrustedDomain {
- struct {
- /**an open LSA policy handle*/
- POLICY_HND *pol;
-
- /**SID of the trusted domain to open*/
- DOM_SID *domain_sid;
-
- /**Desired access on the open domain*/
- uint32 access;
- } in;
-
- struct {
- /**A handle to the policy that is opened*/
- POLICY_HND *domain_pol;
- } out;
-};
-
-/**
- * Opens a trusted domain by SID.
- * @param hnd An initialized and connected server handle
- * @param mem_ctx Talloc context for memory allocation
- * @param op initialized I/O parameters
- * @return CAC_FAILURE a handle to the domain could not be opened. hnd->status is set with approriate NT_STATUS code
- * @return CAC_SUCCESS the domain was opened successfully
- */
-int cac_LsaOpenTrustedDomain(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaOpenTrustedDomain *op);
-
-struct LsaQueryTrustedDomainInfo {
- struct {
- /**Open LSA policy handle*/
- POLICY_HND *pol;
-
- /**Info class of returned data*/
- uint16 info_class;
-
- /**(Optional)SID of trusted domain to query (must specify either SID or name of trusted domain)*/
- DOM_SID *domain_sid;
-
- /**(Optional)Name of trusted domain to query (must specify either SID or name of trusted domain)*/
- char *domain_name;
- } in;
-
- struct {
- /**information about the trusted domain*/
- LSA_TRUSTED_DOMAIN_INFO *info;
- } out;
-};
-
-/**
- * Retrieves information a trusted domain.
- * @param hnd An initialized and connected server handle
- * @param mem_ctx Talloc context for memory allocation
- * @param op initialized I/O parameters
- * @return CAC_FAILURE a handle to the domain could not be opened. hnd->status is set with approriate NT_STATUS code
- * @return CAC_SUCCESS the domain was opened successfully
- */
-
-int cac_LsaQueryTrustedDomainInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaQueryTrustedDomainInfo *op);
-
-struct LsaEnumPrivileges {
- struct {
- /**An open LSA policy handle*/
- POLICY_HND *pol;
-
- /**The _preferred_ maxinum number of privileges returned per call*/
- uint32 pref_max_privs;
- } in;
-
- struct {
- /**Used to keep track of how many privileges have been retrieved over multiple calls. Do not modify this value between calls*/
- uint32 resume_idx;
-
- /**The number of privileges returned this call*/
- uint32 num_privs;
-
- /**Array of privilege names*/
- char **priv_names;
-
- /**Array of high bits for privilege LUID*/
- uint32 *high_bits;
-
- /**Array of low bits for privilege LUID*/
- uint32 *low_bits;
- } out;
-};
-
-/**
- * Enumerates the Privileges supported by the LSA. Can be enumerated in blocks by calling the function multiple times.
- * Example: while(cac_LsaEnumPrivileges(hnd, mem_ctx, op) { ... }
- * @param hnd An initialized and connected server handle
- * @param mem_ctx Talloc context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE there was an error during operations OR there are no more results
- * @return CAC_SUCCESS the operation completed and results were returned
- * @see CAC_OP_FAILED()
- */
-int cac_LsaEnumPrivileges(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaEnumPrivileges *op);
-
-struct LsaOpenAccount {
- struct {
- /**An open LSA policy handle*/
- POLICY_HND *pol;
-
- /**(Optional) account SID - must supply either sid or name*/
- DOM_SID *sid;
-
- /**(Optional) account name - must supply either sid or name*/
- char *name;
-
- /**desired access for the handle*/
- uint32 access;
- } in;
-
- struct {
- /**A handle to the opened user*/
- POLICY_HND *user;
- } out;
-};
-
-/**
- * Opens a handle to an account in the LSA
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @return CAC_FAILURE the account could not be opened. hnd->status has appropriate NT_STATUS code
- * @return CAC_SUCCESS the account was opened
- */
-int cac_LsaOpenAccount(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaOpenAccount *op);
-
-struct LsaAddPrivileges {
- struct {
- /**An open LSA policy handle*/
- POLICY_HND *pol;
-
- /**(Optional) The user's SID (must specify at least sid or name)*/
- DOM_SID *sid;
-
- /**(Optional) The user's name (must specify at least sid or name)*/
- char *name;
-
- /**The privilege names of the privileges to add for the account*/
- char **priv_names;
-
- /**The number of privileges in the priv_names array*/
- uint32 num_privs;
-
- } in;
-};
-
-/**
- * Adds Privileges an account.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @return CAC_FAILURE the privileges could not be set. hnd->status has appropriate NT_STATUS code
- * @return CAC_SUCCESS the privileges were set.
- */
-int cac_LsaAddPrivileges(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaAddPrivileges *op);
-
-struct LsaRemovePrivileges {
- struct {
- /**An open handle to the LSA*/
- POLICY_HND *pol;
-
- /**(Optional) The account SID (must specify at least sid or name)*/
- DOM_SID *sid;
-
- /**(Optional) The account name (must specify at least sid or name)*/
- char *name;
-
- /**The privilege names of the privileges to remove from the account*/
- char **priv_names;
-
- /**The number of privileges in the priv_names array*/
- uint32 num_privs;
-
- } in;
-
-};
-
-/**
- * Removes a _specific_ set of privileges from an account
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @return CAC_FAILURE the privileges could not be removed. hnd->status is set with NT_STATUS code
- * @return CAC_SUCCESS the privileges were removed
- */
-int cac_LsaRemovePrivileges(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaRemovePrivileges *op);
-
-struct LsaClearPrivileges {
- struct {
- /**An open handle to the LSA*/
- POLICY_HND *pol;
-
- /**(Optional) The user's SID (must specify at least sid or name)*/
- DOM_SID *sid;
-
- /**(Optional) The user's name (must specify at least sid or name)*/
- char *name;
- } in;
-
-};
-
-/**
- * Removes ALL privileges from an account
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @return CAC_FAILURE the operation was not successful, hnd->status set with NT_STATUS code
- * @return CAC_SUCCESS the opeartion was successful.
- */
-int cac_LsaClearPrivileges(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaClearPrivileges *op);
-
-/**
- * Sets an accounts priviliges. Removes all privileges and then adds specified privileges.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @return CAC_FAILURE The operation could not complete successfully
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_LsaSetPrivileges(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaAddPrivileges *op);
-
-struct LsaGetSecurityObject {
- struct {
- /**Open LSA policy handle*/
- POLICY_HND *pol;
- } in;
-
- struct {
- /**Returned security descriptor information*/
- SEC_DESC_BUF *sec;
- } out;
-};
-
-/**
- * Retrieves Security Descriptor information about the LSA
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @return CAC_FAILURE The operation could not complete successfully
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_LsaGetSecurityObject(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct LsaGetSecurityObject *op);
-
-
-/**@}*/ /*LSA_Functions*/
-
-/**********************
- * Registry Functions *
- *********************/
-
-/**@addtogroup Reg_Functions
- * @{
- */
-
-struct RegConnect {
- struct {
- /** must be one of :
- * HKEY_CLASSES_ROOT,
- * HKEY_LOCAL_MACHINE,
- * HKEY_USERS,
- * HKEY_PERFORMANCE_DATA,
- */
- int root;
-
- /**desired access on the root key
- * combination of:
- * REG_KEY_READ,
- * REG_KEY_WRITE,
- * REG_KEY_EXECUTE,
- * REG_KEY_ALL,
- * found in include/rpc_secdes.h*/
- uint32 access;
- } in;
-
- struct {
- POLICY_HND *key;
- } out;
-};
-
-/**
- * Opens a handle to the registry on the server
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_RegConnect(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegConnect *op);
-
-/**
- * Closes an open registry handle
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param key The Key/Handle to close
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_RegClose(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *key);
-
-struct RegOpenKey {
- struct {
- /**(Optional)parent key.
- * If this is NULL, then cac_RegOpenKey() will attempt to connect to the registry, name MUST start with something like:<br>
- * HKEY_LOCAL_MACHINE\ or an abbreviation like HKCR\
- *
- * supported root names:
- * - HKEY_LOCAL_MACHINE\ or HKLM\
- * - HKEY_CLASSES_ROOT\ or HKCR\
- * - HKEY_USERS\ or HKU\
- * - HKEY_PERFORMANCE_DATA or HKPD\
- */
- POLICY_HND *parent_key;
-
- /**name/path of key*/
- char *name;
-
- /**desired access on this key*/
- uint32 access;
- } in;
-
- struct {
- POLICY_HND *key;
- } out;
-};
-
-/**
- * Opens a registry key
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-
-int cac_RegOpenKey(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegOpenKey *op);
-
-struct RegEnumKeys {
- struct {
- /**enumerate subkeys of this key*/
- POLICY_HND *key;
-
- /**maximum number of keys to enumerate each call*/
- uint32 max_keys;
- } in;
-
- struct {
- /**keeps track of the index to resume enumerating*/
- uint32 resume_idx;
-
- /**the number of keys returned this call*/
- uint32 num_keys;
-
- /**array of key names*/
- char **key_names;
-
- /**class names of the keys*/
- char **class_names;
-
- /**last modification time of the key*/
- time_t *mod_times;
- } out;
-};
-
-/**
- * Enumerates Subkeys of a given key. Can be run in a loop. Example: while(cac_RegEnumKeys(hnd, mem_ctx, op)) { ... }
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @see CAC_OP_FAILED()
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_RegEnumKeys(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegEnumKeys *op);
-
-
-struct RegCreateKey {
- struct {
- /**create a subkey of parent_key*/
- POLICY_HND *parent_key;
-
- /**name of the key to create*/
- char *key_name;
-
- /**class of the key*/
- char *class_name;
-
- /**Access mask to open the key with. See REG_KEY_* in include/rpc_secdes.h*/
- uint32 access;
- } in;
-
- struct {
- /**Open handle to the key*/
- POLICY_HND *key;
- } out;
-};
-
-/**
- * Creates a registry key, if the key already exists, it will be opened __Creating keys is not currently working__.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parmeters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_RegCreateKey(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegCreateKey *op);
-
-struct RegDeleteKey {
- struct {
- /**handle to open registry key*/
- POLICY_HND *parent_key;
-
- /**name of the key to delete*/
- char *name;
-
- /**delete recursively. WARNING: this might not always work as planned*/
- bool recursive;
- } in;
-
-};
-
-/**
- * Deletes a subkey of an open key. Note: if you run this with op->in.recursive == True, and the operation fails, it may leave the key in an inconsistent state.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-
-int cac_RegDeleteKey(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegDeleteKey *op);
-
-struct RegDeleteValue {
- struct {
- /**handle to open registry key*/
- POLICY_HND *parent_key;
-
- /**name of the value to delete*/
- char *name;
- } in;
-};
-
-/**
- * Deletes a registry value.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_RegDeleteValue(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegDeleteValue *op);
-
-struct RegQueryKeyInfo {
- struct {
- /**Open handle to the key to query*/
- POLICY_HND *key;
- } in;
-
- struct {
- /**name of the key class*/
- char *class_name;
-
- /**number of subkeys of the key*/
- uint32 num_subkeys;
-
- /**length (in characters) of the longest subkey name*/
- uint32 longest_subkey;
-
- /**length (in characters) of the longest class name*/
- uint32 longest_class;
-
- /**number of values in this key*/
- uint32 num_values;
-
- /**length (in characters) of the longest value name*/
- uint32 longest_value_name;
-
- /**length (in bytes) of the biggest value data*/
- uint32 longest_value_data;
-
- /**size (in bytes) of the security descriptor*/
- uint32 security_desc_size;
-
- /**time of the last write*/
- time_t last_write_time;
- } out;
-};
-
-/**
- * Retrieves information about an open key
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-
-int cac_RegQueryKeyInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegQueryKeyInfo *op);
-
-struct RegSaveKey {
- struct {
- /**Open key to be saved*/
- POLICY_HND *key;
-
- /**The path (on the remote computer) to save the file to*/
- char *filename;
- } in;
-};
-
-/**
- * Saves a key to a file on the remote machine __Not currently working__.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-
-int cac_RegSaveKey(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegSaveKey *op);
-
-struct RegQueryValue {
- struct {
- /**handle to open registry key*/
- POLICY_HND *key;
-
- /**name of the value to query*/
- char *val_name;
- } in;
-
- struct {
- /**Value type.
- * One of:
- * - REG_DWORD (equivalent to REG_DWORD_LE)
- * - REG_DWORD_BE
- * - REG_SZ
- * - REG_EXPAND_SZ
- * - REG_MULTI_SZ
- * - REG_BINARY
- */
- uint32 type;
-
- /**The value*/
- REG_VALUE_DATA *data;
- } out;
-};
-
-/**
- * Retrieves a value (type and data) _not currently working_.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-
-int cac_RegQueryValue(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegQueryValue *op);
-
-struct RegEnumValues {
- struct {
- /**handle to open key*/
- POLICY_HND *key;
-
- /**max number of values returned per call*/
- uint32 max_values;
-
- } in;
-
- struct {
- /**keeps track of the index to resume from - used over multiple calls*/
- uint32 resume_idx;
-
- /**the number of values that were returned this call*/
- uint32 num_values;
-
- /**Array of value types. A type can be one of:
- * - REG_DWORD (equivalent to REG_DWORD_LE)
- * - REG_DWORD_BE
- * - REG_SZ
- * - REG_EXPAND_SZ
- * - REG_MULTI_SZ
- * - REG_BINARY
- */
- uint32 *types;
-
- /**array of strings storing the names of the values*/
- char **value_names;
-
- /**array of pointers to the value data returned*/
- REG_VALUE_DATA **values;
- } out;
-};
-
-/**
- * Enumerates a number of Registry values in an open registry key.
- * Can be run in a loop. Example: while(cac_RegEnumValues(hnd, mem_ctx, op)) { ... }
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @see CAC_OP_FAILED()
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_RegEnumValues(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegEnumValues *op);
-
-struct RegSetValue {
- struct {
- /**Handle to open registry key*/
- POLICY_HND *key;
-
- /**Name of the value*/
- char *val_name;
-
- /**Value type.
- * One of:
- * - REG_DWORD (equivalent to REG_DWORD_LE)
- * - REG_DWORD_BE
- * - REG_SZ
- * - REG_EXPAND_SZ
- * - REG_MULTI_SZ
- * - REG_BINARY
- */
- uint32 type;
-
- /**the value*/
- REG_VALUE_DATA value;
- } in;
-};
-
-/**
- * Sets or creates value (type and data).
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_RegSetValue(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegSetValue *op);
-
-struct RegGetVersion {
- struct {
- /**open registry key*/
- POLICY_HND *key;
- } in;
-
- struct {
- /**version number*/
- uint32 version;
- } out;
-};
-
-/**
- * Retrieves the registry version number
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_RegGetVersion(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegGetVersion *op);
-
-struct RegGetKeySecurity {
- struct {
- /**Handle to key to query*/
- POLICY_HND *key;
-
- /**Info that you want. Should be a combination of (1 or more or'd):
- * - OWNER_SECURITY_INFORMATION
- * - GROUP_SECURITY_INFORMATION
- * - DACL_SECURITY_INFORMATION
- * - SACL_SECURITY_INFORMATION
- * - UNPROTECTED_SACL_SECURITY_INFORMATION
- * - UNPROTECTED_DACL_SECURITY_INFORMATION
- * - PROTECTED_SACL_SECURITY_INFORMATION
- * - PROTECTED_DACL_SECURITY_INFORMATION
- *
- * or use:
- * - ALL_SECURITY_INFORMATION
- *
- * all definitions from include/rpc_secdes.h
- */
- uint32 info_type;
- } in;
-
- struct {
- /**size of the data returned*/
- uint32 size;
-
- /**Security descriptor*/
- SEC_DESC *descriptor;
- } out;
-};
-
-/**
- * Retrieves a key security descriptor.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-
-int cac_RegGetKeySecurity(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegGetKeySecurity *op);
-
-struct RegSetKeySecurity {
- struct {
- /**Handle to key to query*/
- POLICY_HND *key;
-
- /**Info that you want. Should be a combination of (1 or more or'd):
- * - OWNER_SECURITY_INFORMATION
- * - GROUP_SECURITY_INFORMATION
- * - DACL_SECURITY_INFORMATION
- * - SACL_SECURITY_INFORMATION
- * - UNPROTECTED_SACL_SECURITY_INFORMATION
- * - UNPROTECTED_DACL_SECURITY_INFORMATION
- * - PROTECTED_SACL_SECURITY_INFORMATION
- * - PROTECTED_DACL_SECURITY_INFORMATION
- *
- * or use:
- * - ALL_SECURITY_INFORMATION
- *
- * all definitions from include/rpc_secdes.h
- */
- uint32 info_type;
-
- /**size of the descriptor*/
- size_t size;
-
- /**Security descriptor*/
- SEC_DESC *descriptor;
- } in;
-};
-
-/**
- * Sets the key security descriptor.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_RegSetKeySecurity(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct RegSetKeySecurity *op);
-
-/**@}*/ /*Reg_Functions*/
-
-struct Shutdown {
- struct {
- /**the message to display (can be NULL)*/
- char *message;
-
- /**timeout in seconds*/
- uint32 timeout;
-
- /**False = shutdown, True = reboot*/
- bool reboot;
-
- /**force the*/
- bool force;
-
- /*FIXME: make this useful*/
- uint32 reason;
- } in;
-};
-
-
-/**
- * Shutdown the server _not currently working_.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_Shutdown(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct Shutdown *op);
-
-/**
- * Attempt to abort initiated shutdown on the server _not currently working_.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_AbortShutdown(CacServerHandle *hnd, TALLOC_CTX *mem_ctx);
-
-/*****************
- * SAM Functions *
- *****************/
-
-/**@addtogroup SAM_Functions
- * @{
- */
-struct SamConnect {
- struct {
- /**Access mask to open with
- * see generic access masks in include/smb.h*/
- uint32 access;
- } in;
-
- struct {
- POLICY_HND *sam;
- } out;
-};
-
-/**
- * Connects to the SAM. This can be skipped by just calling cac_SamOpenDomain()
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-
-int cac_SamConnect(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamConnect *op);
-
-
-/**
- * Closes any (SAM, domain, user, group, etc.) SAM handle.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param sam Handle to close
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-
-int cac_SamClose(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *sam);
-
-struct SamOpenDomain {
- struct {
- /**The desired access. See generic access masks - include/smb.h*/
- uint32 access;
-
- /**(Optional) An open handle to the SAM. If it is NULL, the function will connect to the SAM with the access mask above*/
- POLICY_HND *sam;
-
- /**(Optional) The SID of the domain to open.
- * If this this is NULL, the function will attempt to open the domain specified in hnd->domain */
- DOM_SID *sid;
- } in;
-
- struct {
- /**handle to the open domain*/
- POLICY_HND *dom_hnd;
-
- /**Handle to the open SAM*/
- POLICY_HND *sam;
- } out;
-};
-
-/**
- * Opens a handle to a domain. This must be called before any other SAM functions
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamOpenDomain(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamOpenDomain *op);
-
-struct SamCreateUser {
- struct {
- /**Open domain handle*/
- POLICY_HND *dom_hnd;
-
- /**Username*/
- char *name;
-
- /**See Allowable account control bits in include/smb.h*/
- uint32 acb_mask;
- } in;
-
- struct {
- /**handle to the user*/
- POLICY_HND *user_hnd;
-
- /**rid of the user*/
- uint32 rid;
- } out;
-};
-
-/**
- * Creates a new domain user, if the account already exists it will _not_ be opened and hnd->status will be NT_STATUS_USER_EXISTS
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-
-int cac_SamCreateUser(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamCreateUser *op);
-
-struct SamOpenUser {
- struct {
- /**Handle to open SAM connection*/
- POLICY_HND *dom_hnd;
-
- /**desired access - see generic access masks in include/smb.h*/
- uint32 access;
-
- /**RID of the user*/
- uint32 rid;
-
- /**(Optional) name of the user - must supply either RID or user name*/
- char *name;
- } in;
-
- struct {
- /**Handle to the user*/
- POLICY_HND *user_hnd;
- } out;
-};
-
-/**
- * Opens a domain user.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamOpenUser(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamOpenUser *op);
-
-/**
- * Deletes a domain user.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param user_hnd Open handle to the user
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamDeleteUser(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *user_hnd);
-
-
-struct SamEnumUsers {
- struct {
- /**Open handle to a domain*/
- POLICY_HND *dom_hnd;
-
- /**Enumerate users with specific ACB. If 0, all users will be enumerated*/
- uint32 acb_mask;
- } in;
-
- struct {
- /**where to resume from. Used over multiple calls*/
- uint32 resume_idx;
-
- /**the number of users returned this call*/
- uint32 num_users;
-
- /**Array storing the rids of the returned users*/
- uint32 *rids;
-
- /**Array storing the names of all the users returned*/
- char **names;
-
- bool done;
- } out;
-};
-
-/**
- * Enumerates domain users. Can be used as a loop condition. Example: while(cac_SamEnumUsers(hnd, mem_ctx, op)) { ... }
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamEnumUsers(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamEnumUsers *op);
-
-struct SamGetNamesFromRids {
- struct {
- /**An open handle to the domain SAM from cac_SamOpenDomain()*/
- POLICY_HND *dom_hnd;
-
- /**Number of RIDs to resolve*/
- uint32 num_rids;
-
- /**Array of RIDs to resolve*/
- uint32 *rids;
- } in;
-
- struct {
- /**the number of names returned - if this is 0, the map is NULL*/
- uint32 num_names;
-
- /**array contiaing the Names and RIDs*/
- CacLookupRidsRecord *map;
- } out;
-};
-
-/**
- * Returns a list of names which map to a list of RIDs.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamGetNamesFromRids(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetNamesFromRids *op);
-
-struct SamGetRidsFromNames {
- struct {
- /**An open handle to the domain SAM from cac_SamOpenDomain()*/
- POLICY_HND *dom_hnd;
-
- /**Number of names to resolve*/
- uint32 num_names;
-
- /**Array of names to resolve*/
- char **names;
- } in;
-
- struct {
- /**the number of names returned - if this is 0, then map is NULL*/
- uint32 num_rids;
-
- /**array contiaing the Names and RIDs*/
- CacLookupRidsRecord *map;
- } out;
-};
-
-/**
- * Returns a list of RIDs which map to a list of names.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamGetRidsFromNames(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetRidsFromNames *op);
-
-struct SamGetGroupsForUser {
- struct {
- /**An open handle to the user*/
- POLICY_HND *user_hnd;
- } in;
-
- struct {
- /**The number of groups the user is a member of*/
- uint32 num_groups;
-
- /**The RIDs of the groups*/
- uint32 *rids;
-
- /**The attributes of the groups*/
- uint32 *attributes;
- } out;
-};
-/**
- * Retrieves a list of groups that a user is a member of.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamGetGroupsForUser(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetGroupsForUser *op);
-
-struct SamOpenGroup {
- struct {
- /**Open handle to the domain SAM*/
- POLICY_HND *dom_hnd;
-
- /**Desired access to open the group with. See Generic access masks in include/smb.h*/
- uint32 access;
-
- /**rid of the group*/
- uint32 rid;
- } in;
-
- struct {
- /**Handle to the group*/
- POLICY_HND *group_hnd;
- } out;
-};
-
-/**
- * Opens a domain group.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamOpenGroup(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamOpenGroup *op);
-
-struct SamCreateGroup {
- struct {
- /**Open handle to the domain SAM*/
- POLICY_HND *dom_hnd;
-
- /**Desired access to open the group with. See Generic access masks in include/smb.h*/
- uint32 access;
-
- /**The name of the group*/
- char *name;
- } in;
-
- struct {
- /**Handle to the group*/
- POLICY_HND *group_hnd;
- } out;
-};
-
-/**
- * Creates a group. If the group already exists it will not be opened.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamCreateGroup(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamCreateGroup *op);
-
-/**
- * Deletes a domain group.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param group_hnd Open handle to the group.
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamDeleteGroup(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *group_hnd);
-
-struct SamGetGroupMembers {
- struct {
- /**Open handle to a group*/
- POLICY_HND *group_hnd;
- } in;
-
- struct {
- /**The number of members in the group*/
- uint32 num_members;
-
- /**An array storing the RIDs of the users*/
- uint32 *rids;
-
- /**The attributes*/
- uint32 *attributes;
- } out;
-};
-
-/**
- * Retrives a list of users in a group.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamGetGroupMembers(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetGroupMembers *op);
-
-struct SamAddGroupMember {
- struct {
- /**Open handle to a group*/
- POLICY_HND *group_hnd;
-
- /**RID of new member*/
- uint32 rid;
- } in;
-};
-
-/**
- * Adds a user to a group.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamAddGroupMember(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamAddGroupMember *op);
-
-struct SamRemoveGroupMember {
- struct {
- /**Open handle to a group*/
- POLICY_HND *group_hnd;
-
- /**RID of member to remove*/
- uint32 rid;
- } in;
-};
-
-/**
- * Removes a user from a group.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamRemoveGroupMember(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamRemoveGroupMember *op);
-
-/**
- * Removes all the members of a group - warning: if this function fails is is possible that some but not all members were removed
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param group_hnd Open handle to the group to clear
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamClearGroupMembers(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *group_hnd);
-
-struct SamSetGroupMembers {
- struct {
- /**Open handle to the group*/
- POLICY_HND *group_hnd;
-
- /**Number of members in the group - if this is 0, all members of the group will be removed*/
- uint32 num_members;
-
- /**The RIDs of the users to add*/
- uint32 *rids;
- } in;
-};
-
-/**
- * Clears the members of a group and adds a list of members to the group
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamSetGroupMembers(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamSetGroupMembers *op);
-
-struct SamEnumGroups {
- struct {
- /**Open handle to a domain*/
- POLICY_HND *dom_hnd;
- } in;
-
- struct {
- /**Where to resume from _do not_ modify this value. Used over multiple calls.*/
- uint32 resume_idx;
-
- /**the number of users returned this call*/
- uint32 num_groups;
-
- /**Array storing the rids of the returned groups*/
- uint32 *rids;
-
- /**Array storing the names of all the groups returned*/
- char **names;
-
- /**Array storing the descriptions of all the groups returned*/
- char **descriptions;
-
- bool done;
- } out;
-};
-
-/**
- * Enumerates domain groups. Can be used as a loop condition. Example: while(cac_SamEnumGroups(hnd, mem_ctx, op)) { ... }
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamEnumGroups(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamEnumGroups *op);
-
-struct SamEnumAliases {
- struct {
- /**Open handle to a domain*/
- POLICY_HND *dom_hnd;
- } in;
-
- struct {
- /**where to resume from. Used over multiple calls*/
- uint32 resume_idx;
-
- /**the number of users returned this call*/
- uint32 num_aliases;
-
- /**Array storing the rids of the returned groups*/
- uint32 *rids;
-
- /**Array storing the names of all the groups returned*/
- char **names;
-
- /**Array storing the descriptions of all the groups returned*/
- char **descriptions;
-
- bool done;
- } out;
-};
-
-/**
- * Enumerates domain aliases. Can be used as a loop condition. Example: while(cac_SamEnumAliases(hnd, mem_ctx, op)) { ... }
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamEnumAliases(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamEnumAliases *op);
-
-struct SamCreateAlias {
- struct {
- /**Open handle to the domain SAM*/
- POLICY_HND *dom_hnd;
-
- /**The name of the alias*/
- char *name;
- } in;
-
- struct {
- /**Handle to the group*/
- POLICY_HND *alias_hnd;
- } out;
-};
-
-/**
- * Creates an alias. If the alias already exists it will not be opened.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-
-int cac_SamCreateAlias(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamCreateAlias *op);
-
-struct SamOpenAlias {
- struct {
- /**Open handle to the domain SAM*/
- POLICY_HND *dom_hnd;
-
- /**Desired access to open the group with. See Generic access masks in include/smb.h*/
- uint32 access;
-
- /**rid of the alias*/
- uint32 rid;
- } in;
-
- struct {
- /**Handle to the alias*/
- POLICY_HND *alias_hnd;
- } out;
-};
-
-/**
- * Opens a handle to an alias.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamOpenAlias(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamOpenAlias *op);
-
-/**
- * Deletes an alias.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param alias_hnd Open handle to the alias
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamDeleteAlias(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *alias_hnd);
-
-struct SamAddAliasMember {
- struct {
- /**Open handle to a alias*/
- POLICY_HND *alias_hnd;
-
- /**SID of new member*/
- DOM_SID *sid;
- } in;
-};
-
-/**
- * Adds an account to an alias.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamAddAliasMember(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamAddAliasMember *op);
-
-struct SamRemoveAliasMember {
- struct {
- /**Open handle to the alias*/
- POLICY_HND *alias_hnd;
-
- /**The SID of the member*/
- DOM_SID *sid;
- } in;
-};
-
-/**
- * Removes an account from an alias.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamRemoveAliasMember(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamRemoveAliasMember *op);
-
-struct SamGetAliasMembers {
- struct {
- /**Open handle to the alias*/
- POLICY_HND *alias_hnd;
- } in;
-
- struct {
- /**The number of members*/
- uint32 num_members;
-
- /**An array storing the SIDs of the accounts*/
- DOM_SID *sids;
- } out;
-};
-
-/**
- * Retrieves a list of all accounts in an alias.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamGetAliasMembers(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetAliasMembers *op);
-
-/**
- * Removes all the members of an alias - warning: if this function fails is is possible that some but not all members were removed
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param alias_hnd Handle to the alias to clear
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-
-int cac_SamClearAliasMembers(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *alias_hnd);
-
-struct SamSetAliasMembers {
- struct {
- /**Open handle to the group*/
- POLICY_HND *alias_hnd;
-
- /**Number of members in the group - if this is 0, all members of the group will be removed*/
- uint32 num_members;
-
- /**The SIDs of the accounts to add*/
- DOM_SID *sids;
- } in;
-};
-
-/**
- * Clears the members of an alias and adds a list of members to the alias
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamSetAliasMembers(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamSetAliasMembers *op);
-
-
-struct SamUserChangePasswd {
- struct {
- /**The username*/
- char *username;
-
- /**The current password*/
- char *password;
-
- /**The new password*/
- char *new_password;
- } in;
-};
-/**Used by a user to change their password*/
-int cac_SamUserChangePasswd(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamUserChangePasswd *op);
-
-/**
- * Enables a user
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param user_hnd Open handle to the user to enable
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamEnableUser(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *user_hnd);
-
-/**
- * Disables a user
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param user_hnd Open handle to the user to disables
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamDisableUser(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *user_hnd);
-
-struct SamSetPassword {
- struct {
- /**Open handle to a user*/
- POLICY_HND *user_hnd;
-
- /**The new password*/
- char *password;
- } in;
-};
-
-/**
- * Sets a user's password
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-
-int cac_SamSetPassword(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamSetPassword *op);
-
-struct SamGetUserInfo {
- struct {
- /**Open Handle to a user*/
- POLICY_HND *user_hnd;
- } in;
-
- struct {
- CacUserInfo *info;
- } out;
-};
-
-/**
- * Retrieves user information using a CacUserInfo structure. If you would like to use a SAM_USERINFO_CTR directly, use cac_SamGetUserInfoCtr()
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @see cac_SamGetUserInfoCtr()
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamGetUserInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetUserInfo *op);
-
-struct SamSetUserInfo {
- struct {
- /**Open handle to a user*/
- POLICY_HND *user_hnd;
-
- /**Structure containing the data you would like to set*/
- CacUserInfo *info;
- } in;
-};
-
-/**
- * Sets the user info using a CacUserInfo structure. If you would like to use a SAM_USERINFO_CTR directly use cac_SamSetUserInfoCtr().
- * @note All fields in the CacUserInfo structure will be set. Best to call cac_GetUserInfo() modify fields that you want, and then call cac_SetUserInfo().
- * @note When calling this, you _must_ set the user's password.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @see cac_SamSetUserInfoCtr()
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamSetUserInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamSetUserInfo *op);
-
-struct SamGetUserInfoCtr {
- struct {
- /**Open handle to a user*/
- POLICY_HND *user_hnd;
-
- /**What USER_INFO structure you want. See include/rpc_samr.h*/
- uint16 info_class;
- } in;
-
- struct {
- /**returned user info*/
- SAM_USERINFO_CTR *ctr;
- } out;
-};
-
-/**
- * Retrieves user information using a SAM_USERINFO_CTR structure. If you don't want to use this structure, user SamGetUserInfo()
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @see cac_SamGetUserInfo()
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamGetUserInfoCtr(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetUserInfoCtr *op);
-
-struct SamSetUserInfoCtr {
- struct {
- /**Open handle to a user*/
- POLICY_HND *user_hnd;
-
- /**user info - make sure ctr->switch_value is set properly*/
- SAM_USERINFO_CTR *ctr;
- } in;
-};
-
-/**
- * Sets the user info using a SAM_USERINFO_CTR structure. If you don't want to use this structure, use cac_SamSetUserInfo()
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @see cac_SamSetUserInfo()
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-
-int cac_SamSetUserInfoCtr(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamSetUserInfoCtr *op);
-
-struct SamRenameUser {
- struct {
- /**Open handle to user*/
- POLICY_HND *user_hnd;
-
- /**New user name*/
- char *new_name;
- } in;
-};
-
-/**
- * Changes the name of a user.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamRenameUser(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamRenameUser *op);
-
-struct SamGetGroupInfo {
- struct {
- /**Open handle to a group*/
- POLICY_HND *group_hnd;
- } in;
-
- struct {
- /**Returned info about the group*/
- CacGroupInfo *info;
- } out;
-};
-
-/**
- * Retrieves information about a group.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamGetGroupInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetGroupInfo *op);
-
-struct SamSetGroupInfo {
- struct {
- /**Open handle to a group*/
- POLICY_HND *group_hnd;
-
- /**group info*/
- CacGroupInfo *info;
- } in;
-};
-
-/**
- * Sets information about a group.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamSetGroupInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamSetGroupInfo *op);
-
-struct SamRenameGroup {
- struct {
- /**Open handle to a group*/
- POLICY_HND *group_hnd;
-
- /**New name*/
- char *new_name;
- } in;
-};
-
-/**
- * Changes the name of a group
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-
-int cac_SamRenameGroup(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamRenameGroup *op);
-
-struct SamGetAliasInfo {
- struct {
- /**Open handle to an alias*/
- POLICY_HND *alias_hnd;
- } in;
-
- struct {
- /**Returned alias info*/
- CacAliasInfo *info;
- } out;
-};
-
-/**
- * Retrieves information about an alias.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamGetAliasInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetAliasInfo *op);
-
-struct SamSetAliasInfo {
- struct {
- /**Open handle to an alias*/
- POLICY_HND *alias_hnd;
-
- /**Returned alias info*/
- CacAliasInfo *info;
- } in;
-};
-
-/**
- * Sets information about an alias.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE The operation could not complete successfully. hnd->status is set with appropriate NTSTATUS code
- * @return CAC_SUCCESS The operation completed successfully
- */
-int cac_SamSetAliasInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamSetAliasInfo *op);
-
-struct SamGetDomainInfo {
- struct {
- /**Open handle to the domain SAM*/
- POLICY_HND *dom_hnd;
- } in;
-
- struct {
- /**Returned domain info*/
- CacDomainInfo *info;
- } out;
-};
-
-/**
- * Gets domain information in the form of a CacDomainInfo structure.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @see SamGetDomainInfoCtr()
- * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately
- * @return CAC_SUCCESS - the operation was successful
- * @return CAC_PARTIAL_SUCCESS - This function makes 3 rpc calls, if one or two fail and the rest succeed,
- * not all fields in the CacDomainInfo structure will be filled
- */
-int cac_SamGetDomainInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetDomainInfo *op);
-
-struct SamGetDomainInfoCtr {
- struct {
- /**Open handle to domain*/
- POLICY_HND *dom_hnd;
-
- /**What info level you want*/
- uint16 info_class;
- } in;
-
- struct {
- SAM_UNK_CTR *info;
- } out;
-};
-
-/**
- * Gets domain information in the form of a SAM_UNK_CTR structure.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @see SamGetDomainInfo()
- * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately
- * @return CAC_SUCCESS - the operation was successful
- */
-int cac_SamGetDomainInfoCtr(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetDomainInfoCtr *op);
-
-struct SamGetDisplayInfo {
- struct {
- /**Open handle to domain*/
- POLICY_HND *dom_hnd;
-
- /**What type of data*/
- uint16 info_class;
-
- /**(Optional)If 0, max_entries and max_size will be filled in by the function*/
- uint32 max_entries;
-
- /**(Optional)If 0, max_entries and max_size will be filled in by the function*/
- uint32 max_size;
- } in;
-
- struct {
- /**Do not modify this value, use the same value between multiple calls (ie in while loop)*/
- uint32 resume_idx;
-
- /**Number of entries returned*/
- uint32 num_entries;
-
- /**Returned display info*/
- SAM_DISPINFO_CTR ctr;
-
- /**Internal value. Do not modify.*/
- uint32 loop_count;
-
- bool done;
- } out;
-};
-
-/**
- * Gets dislpay information using a SAM_DISPINFO_CTR.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately
- * @return CAC_SUCCESS - the operation was successful
- */
-int cac_SamGetDisplayInfo(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetDisplayInfo *op);
-
-struct SamLookupDomain {
- struct {
- /**Open handle to the sam (opened with cac_SamConnect() or cac_SamOpenDomain()*/
- POLICY_HND *sam;
-
- /**Name of the domain to lookup*/
- char *name;
- } in;
-
- struct {
- /**SID of the domain*/
- DOM_SID *sid;
- } out;
-};
-
-/**
- * Looks up a Domain SID given it's name.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately
- * @return CAC_SUCCESS - the operation was successful
- */
-int cac_SamLookupDomain(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamLookupDomain *op);
-
-struct SamGetSecurityObject {
- struct {
- /**An open handle (SAM, domain or user)*/
- POLICY_HND *pol;
- } in;
-
- struct {
- SEC_DESC_BUF *sec;
- } out;
-};
-
-/**
- * Retrievies Security descriptor information for a SAM/Domain/user
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately
- * @return CAC_SUCCESS - the operation was successful
- */
-int cac_SamGetSecurityObject(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamGetSecurityObject *op);
-
-struct SamFlush {
- struct {
- /**Open handle to the domain SAM*/
- POLICY_HND *dom_hnd;
-
- /**(Optional)Domain SID. If NULL, the domain in hnd->domain will be opened*/
- DOM_SID *sid;
-
- /**(Optional)Desired access to re-open the domain with. If 0, MAXIMUM_ALLOWED_ACCESS is used.*/
- uint32 access;
- } in;
-};
-
-/**
- * Closes the domain handle, then re-opens it - effectively flushing any changes made.
- * WARNING: if this fails you will no longer have an open handle to the domain SAM.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately
- * @return CAC_SUCCESS - the operation was successful
- */
-int cac_SamFlush(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SamFlush *op);
-
-/**@}*/ /*SAM_Functions*/
-
-/**@addtogroup SCM_Functions
- * @{
- */
-
-struct SvcOpenScm {
- struct {
- /**Desired access to open the Handle with. See SC_RIGHT_MGR_* or SC_MANAGER_* in include/rpc_secdes.h*/
- uint32 access;
- } in;
-
- struct {
- /**Handle to the SCM*/
- POLICY_HND *scm_hnd;
- } out;
-};
-
-/**
- * Opens a handle to the SCM on the remote machine.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately
- * @return CAC_SUCCESS - the operation was successful
- */
-int cac_SvcOpenScm(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcOpenScm *op);
-
-/**
- * Closes an Svc handle (SCM or Service)
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param scm_hnd The handle to close
- * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately
- * @return CAC_SUCCESS - the operation was successful
- */
-int cac_SvcClose(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *scm_hnd);
-
-struct SvcEnumServices {
- struct {
- /**Open handle to the SCM*/
- POLICY_HND *scm_hnd;
-
- /**(Optional)Type of service to enumerate. Possible values:
- * - SVCCTL_TYPE_WIN32
- * - SVCCTL_TYPE_DRIVER
- * If this is 0, (SVCCTL_TYPE_DRIVER | SVCCTL_TYPE_WIN32) is assumed.
- */
- uint32 type;
-
- /**(Optional)State of service to enumerate. Possible values:
- * - SVCCTL_STATE_ACTIVE
- * - SVCCTL_STATE_INACTIVE
- * - SVCCTL_STATE_ALL
- * If this is 0, SVCCTL_STATE_ALL is assumed.
- */
- uint32 state;
- } in;
-
- struct {
- /**Number of services returned*/
- uint32 num_services;
-
- /**Array of service structures*/
- CacService *services;
- } out;
-};
-
-/**
- * Enumerates services on the remote machine.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized parameters
- * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately
- * @return CAC_SUCCESS - the operation was successful
- */
-int cac_SvcEnumServices(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcEnumServices *op);
-
-struct SvcOpenService {
- struct {
- /**Handle to the Service Control Manager*/
- POLICY_HND *scm_hnd;
-
- /**Access mask to open service with see SERVICE_* or SC_RIGHT_SVC_* in include/rpc_secdes.h*/
- uint32 access;
-
- /**The name of the service. _not_ the display name*/
- char *name;
- } in;
-
- struct {
- /**Handle to the open service*/
- POLICY_HND *svc_hnd;
- } out;
-};
-
-/**
- * Opens a handle to a service.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately
- * @return CAC_SUCCESS - the operation was successful
- */
-
-int cac_SvcOpenService(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcOpenService *op);
-
-struct SvcGetStatus {
- struct {
- /**Open handle to the service to query*/
- POLICY_HND *svc_hnd;
- } in;
-
- struct {
- /**The status of the service. See include/rpc_svcctl.h for SERVICE_STATUS definition.*/
- SERVICE_STATUS status;
- } out;
-};
-
-/**
- * Retrieves the status of a service.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately
- * @return CAC_SUCCESS - the operation was successful
- */
-int cac_SvcGetStatus(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcGetStatus *op);
-
-struct SvcStartService {
- struct {
- /**open handle to the service*/
- POLICY_HND *svc_hnd;
-
- /**Array of parameters to start the service with. Can be NULL if num_parms is 0*/
- char **parms;
-
- /**Number of parameters in the parms array*/
- uint32 num_parms;
-
- /**Number of seconds to wait for the service to actually start. If this is 0, then the status will not be checked after the initial call*/
- uint32 timeout;
- } in;
-};
-
-/**
- * Attempts to start a service.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately
- * @return CAC_SUCCESS - the operation was successful
- */
-
-int cac_SvcStartService(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcStartService *op);
-
-struct SvcControlService {
- struct {
- /**Open handle to the service to control*/
- POLICY_HND *svc_hnd;
-
- /**The control operation to perform. Possible values (from include/rpc_svcctl.h):
- * - SVCCTL_CONTROL_STOP
- * - SVCCTL_CONTROL_PAUSE
- * - SVCCTL_CONTROL_CONTINUE
- * - SVCCTL_CONTROL_SHUTDOWN
- */
- uint32 control;
- } in;
-
- struct {
- /**The returned status of the service, _immediately_ after the call*/
- SERVICE_STATUS *status;
- } out;
-};
-
-/**
- * Performs a control operation on a service and _immediately_ returns.
- * @see cac_SvcStopService()
- * @see cac_SvcPauseService()
- * @see cac_SvcContinueService()
- * @see cac_SvcShutdownService()
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately
- * @return CAC_SUCCESS - the operation was successful
- */
-int cac_SvcControlService(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcControlService *op);
-
-struct SvcStopService {
- struct {
- /**Open handle to the service*/
- POLICY_HND *svc_hnd;
-
- /**Number of seconds to wait for the service to actually start.
- * If this is 0, then the status will not be checked after the initial call and CAC_SUCCESS might be returned if the status isn't actually started
- */
- uint32 timeout;
- } in;
-
- struct {
- /**Status of the service after the operation*/
- SERVICE_STATUS status;
- } out;
-};
-
-/**
- * Attempts to stop a service.
- * @see cacSvcControlService()
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @return CAC_FAILURE - the operation was not successful. If hnd->status is NT_STATUS_OK, then a timeout occured.
- * @return CAC_SUCCESS - the operation was successful
- */
-int cac_SvcStopService(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcStopService *op);
-
-struct SvcPauseService {
- struct {
- /**Open handle to the service*/
- POLICY_HND *svc_hnd;
-
- /**Number of seconds to wait for the service to actually start.
- * If this is 0, then the status will not be checked after the initial call and CAC_SUCCESS might be returned if the status isn't actually started
- */
- uint32 timeout;
- } in;
-
- struct {
- /**Status of the service after the operation*/
- SERVICE_STATUS status;
- } out;
-};
-
-/**
- * Attempts to pause a service.
- * @see cacSvcControlService()
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @return CAC_FAILURE - the operation was not successful. If hnd->status is NT_STATUS_OK, then a timeout occured.
- * @return CAC_SUCCESS - the operation was successful
- */
-int cac_SvcPauseService(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcPauseService *op);
-
-struct SvcContinueService {
- struct {
- /**Open handle to the service*/
- POLICY_HND *svc_hnd;
-
- /**Number of seconds to wait for the service to actually start.
- * If this is 0, then the status will not be checked after the initial call and CAC_SUCCESS might be returned if the status isn't actually started
- */
- uint32 timeout;
- } in;
-
- struct {
- /**Status of the service after the operation*/
- SERVICE_STATUS status;
- } out;
-};
-
-/**
- * Attempts to continue a paused service.
- * @see cacSvcControlService()
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @return CAC_FAILURE - the operation was not successful. If hnd->status is NT_STATUS_OK, then a timeout occured.
- * @return CAC_SUCCESS - the operation was successful
- */
-int cac_SvcContinueService(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcContinueService *op);
-
-struct SvcGetDisplayName {
- struct {
- /**Open handle to the service*/
- POLICY_HND *svc_hnd;
- } in;
-
- struct {
- /**The returned display name of the service*/
- char *display_name;
- } out;
-};
-
-/**
- * Retrieves the display name of a service _not currently working_
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately
- * @return CAC_SUCCESS - the operation was successful
- */
-int cac_SvcGetDisplayName(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcGetDisplayName *op);
-
-struct SvcGetServiceConfig {
- struct {
- /**Open handle to the service*/
- POLICY_HND *svc_hnd;
- } in;
-
- struct {
- /**Returned Configuration information*/
- CacServiceConfig config;
- } out;
-};
-
-/**
- * Retrieves configuration information about a service.
- * @param hnd Initialized and connected server handle
- * @param mem_ctx Context for memory allocation
- * @param op Initialized Parameters
- * @return CAC_FAILURE - the operation was not successful hnd->status is set appropriately
- * @return CAC_SUCCESS - the operation was successful
- */
-int cac_SvcGetServiceConfig(CacServerHandle *hnd, TALLOC_CTX *mem_ctx, struct SvcGetServiceConfig *op);
-
-/**@}*/ /*SCM_Functions*/
-
-struct rpc_pipe_client *cac_GetPipe(CacServerHandle *hnd, int pi_idx);
-
-#endif /* LIBMSRPC_H */
-
-
diff --git a/source3/include/libmsrpc_internal.h b/source3/include/libmsrpc_internal.h
deleted file mode 100644
index 623c43f9c3..0000000000
--- a/source3/include/libmsrpc_internal.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- * MS-RPC client internal definitions
- * Copyright (C) Chris Nicholls 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/>.
- */
-
-#ifndef LIBMSRPC_INTERNAL_H
-#define LIBMSRPC_INTERNAL_H
-
-#include "libmsrpc.h"
-
-/*definitions*/
-
-struct CacServerHandleInternal {
- /*stores the os type of the server*/
- uint16 srv_level;
-
- /*stores the initialized/active pipes*/
- bool pipes[PI_MAX_PIPES];
-
- /*underlying smbc context*/
- SMBCCTX *ctx;
-
- /*did the user supply this SMBCCTX?*/
- bool user_supplied_ctx;
-};
-
-/*used to get a struct rpc_pipe_client* to be passed into rpccli* calls*/
-
-/*nessecary prototypes*/
-bool rid_in_list(uint32 rid, uint32 *list, uint32 list_len);
-
-int cac_ParseRegPath(char *path, uint32 *reg_type, char **key_name);
-
-REG_VALUE_DATA *cac_MakeRegValueData(TALLOC_CTX *mem_ctx, uint32 data_type, REGVAL_BUFFER buf);
-
-RPC_DATA_BLOB *cac_MakeRpcDataBlob(TALLOC_CTX *mem_ctx, uint32 data_type, REG_VALUE_DATA data);
-
-SAM_USERINFO_CTR *cac_MakeUserInfoCtr(TALLOC_CTX *mem_ctx, CacUserInfo *info);
-
-CacUserInfo *cac_MakeUserInfo(TALLOC_CTX *mem_ctx, SAM_USERINFO_CTR *ctr);
-CacGroupInfo *cac_MakeGroupInfo(TALLOC_CTX *mem_ctx, GROUP_INFO_CTR *ctr);
-GROUP_INFO_CTR *cac_MakeGroupInfoCtr(TALLOC_CTX *mem_ctx, CacGroupInfo *info);
-CacAliasInfo *cac_MakeAliasInfo(TALLOC_CTX *mem_ctx, ALIAS_INFO_CTR ctr);
-ALIAS_INFO_CTR *cac_MakeAliasInfoCtr(TALLOC_CTX *mem_ctx, CacAliasInfo *info);
-CacDomainInfo *cac_MakeDomainInfo(TALLOC_CTX *mem_ctx, SAM_UNK_INFO_1 *info1, SAM_UNK_INFO_2 *info2, SAM_UNK_INFO_12 *info12);
-CacService *cac_MakeServiceArray(TALLOC_CTX *mem_ctx, ENUM_SERVICES_STATUS *svc, uint32 num_services);
-int cac_InitCacServiceConfig(TALLOC_CTX *mem_ctx, SERVICE_CONFIG *src, CacServiceConfig *dest);
-
-/*moved to libmsrpc.h*/
-/*struct rpc_pipe_client *cac_GetPipe(CacServerHandle *hnd, int pi_idx);*/
-
-SMBCSRV *smbc_attr_server(SMBCCTX *context,
- const char *server, const char *share,
- fstring workgroup,
- fstring username, fstring password,
- POLICY_HND *pol);
-
-
-#endif /* LIBMSRPC_INTERNAL_H */
diff --git a/source3/include/md5.h b/source3/include/md5.h
deleted file mode 100644
index e4cd08ed5e..0000000000
--- a/source3/include/md5.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef MD5_H
-#define MD5_H
-#ifndef HEADER_MD5_H
-/* Try to avoid clashes with OpenSSL */
-#define HEADER_MD5_H
-#endif
-
-struct MD5Context {
- uint32 buf[4];
- uint32 bits[2];
- unsigned char in[64];
-};
-
-void MD5Init(struct MD5Context *context);
-void MD5Update(struct MD5Context *context, unsigned char const *buf,
- unsigned len);
-void MD5Final(unsigned char digest[16], struct MD5Context *context);
-
-#endif /* !MD5_H */
diff --git a/source3/include/messages.h b/source3/include/messages.h
index db805a2093..785f116e1c 100644
--- a/source3/include/messages.h
+++ b/source3/include/messages.h
@@ -82,7 +82,6 @@ struct server_id {
struct messaging_context;
struct messaging_rec;
-struct data_blob;
/*
* struct messaging_context belongs to messages.c, but because we still have
@@ -102,7 +101,7 @@ struct messaging_context {
struct messaging_backend {
NTSTATUS (*send_fn)(struct messaging_context *msg_ctx,
struct server_id pid, int msg_type,
- const struct data_blob *data,
+ const DATA_BLOB *data,
struct messaging_backend *backend);
void *private_data;
};
@@ -138,12 +137,12 @@ NTSTATUS messaging_register(struct messaging_context *msg_ctx,
void *private_data,
uint32_t msg_type,
struct server_id server_id,
- struct data_blob *data));
+ DATA_BLOB *data));
void messaging_deregister(struct messaging_context *ctx, uint32_t msg_type,
void *private_data);
NTSTATUS messaging_send(struct messaging_context *msg_ctx,
struct server_id server,
- uint32_t msg_type, const struct data_blob *data);
+ uint32_t msg_type, const DATA_BLOB *data);
NTSTATUS messaging_send_buf(struct messaging_context *msg_ctx,
struct server_id server, uint32_t msg_type,
const uint8 *buf, size_t len);
diff --git a/source3/include/module.h b/source3/include/module.h
index 20dbaba6b4..52245e01d2 100644
--- a/source3/include/module.h
+++ b/source3/include/module.h
@@ -23,6 +23,7 @@
/* Module support */
typedef NTSTATUS (init_module_function) (void);
+NTSTATUS init_samba_module(void);
typedef int smb_event_id_t;
#define SMB_EVENT_ID_INVALID (-1)
diff --git a/source3/include/msdfs.h b/source3/include/msdfs.h
index 4551325843..800393c75d 100644
--- a/source3/include/msdfs.h
+++ b/source3/include/msdfs.h
@@ -64,12 +64,4 @@ struct dfs_path {
bool posix_path;
};
-#define init_dfsroot(conn, inbuf, outbuf) \
-{ if (lp_msdfs_root(SNUM(conn)) && lp_host_msdfs()) { \
- DEBUG(2,("Serving %s as a Dfs root\n", \
- lp_servicename(SNUM(conn)) )); \
- SSVAL(outbuf, smb_vwv2, SMB_SHARE_IN_DFS \
- | SVAL(outbuf, smb_vwv2)); \
-} }
-
#endif /* _MSDFS_H */
diff --git a/source3/include/nameserv.h b/source3/include/nameserv.h
index 4377e3330a..496d87e2db 100644
--- a/source3/include/nameserv.h
+++ b/source3/include/nameserv.h
@@ -208,7 +208,7 @@ struct nmb_data {
time_t death_time; /* The time the record must be removed (do not remove if 0). */
time_t refresh_time; /* The time the record should be refreshed. */
- SMB_BIG_UINT id; /* unique id */
+ uint64_t id; /* unique id */
struct in_addr wins_ip; /* the adress of the wins server this record comes from */
int wins_flags; /* similar to the netbios flags but different ! */
@@ -539,17 +539,6 @@ struct packet_struct
} packet;
};
-/* NETLOGON opcodes */
-
-#define QUERYFORPDC 7 /* Query for PDC. */
-#define SAM_UAS_CHANGE 10 /* Announce change to UAS or SAM. */
-#define QUERYFORPDC_R 12 /* Response to Query for PDC. */
-#define SAMLOGON 18
-#define SAMLOGON_R 19
-#define SAMLOGON_UNK_R 21
-#define SAMLOGON_AD_UNK_R 23
-#define SAMLOGON_AD_R 25
-
/* Ids for netbios packet types. */
#define ANN_HostAnnouncement 1
@@ -617,7 +606,7 @@ typedef struct _WINS_RECORD {
char type;
int nb_flags;
int wins_flags;
- SMB_BIG_UINT id;
+ uint64_t id;
int num_ips;
struct in_addr ip[25];
struct in_addr wins_ip;
diff --git a/source3/include/ndr.h b/source3/include/ndr.h
deleted file mode 100644
index a416866ef2..0000000000
--- a/source3/include/ndr.h
+++ /dev/null
@@ -1 +0,0 @@
-/* dummy file to deal with pidl autogenerated ndr files */
diff --git a/source3/include/nss_info.h b/source3/include/nss_info.h
index 1ff9ebcd55..e756136b76 100644
--- a/source3/include/nss_info.h
+++ b/source3/include/nss_info.h
@@ -66,6 +66,10 @@ struct nss_info_methods {
TALLOC_CTX *ctx,
ADS_STRUCT *ads, LDAPMessage *msg,
char **homedir, char **shell, char **gecos, gid_t *p_gid);
+ NTSTATUS (*map_to_alias)( TALLOC_CTX *mem_ctx, const char *domain,
+ const char *name, char **alias );
+ NTSTATUS (*map_from_alias)( TALLOC_CTX *mem_ctx, const char *domain,
+ const char *alias, char **name );
NTSTATUS (*close_fn)( void );
};
@@ -84,6 +88,12 @@ NTSTATUS nss_get_info( const char *domain, const DOM_SID *user_sid,
char **homedir, char **shell, char **gecos,
gid_t *p_gid);
+NTSTATUS nss_map_to_alias( TALLOC_CTX *mem_ctx, const char *domain,
+ const char *name, char **alias );
+
+NTSTATUS nss_map_from_alias( TALLOC_CTX *mem_ctx, const char *domain,
+ const char *alias, char **name );
+
NTSTATUS nss_close( const char *parameters );
#endif /* _IDMAP_NSS_H_ */
diff --git a/source3/include/ntdomain.h b/source3/include/ntdomain.h
index de0a313609..e6c97c69dc 100644
--- a/source3/include/ntdomain.h
+++ b/source3/include/ntdomain.h
@@ -287,63 +287,6 @@ typedef struct pipes_struct {
} pipes_struct;
-typedef struct smb_np_struct {
- struct smb_np_struct *next, *prev;
- int pnum;
- connection_struct *conn;
- uint16 vuid; /* points to the unauthenticated user that opened this pipe. */
- bool open; /* open connection */
- uint16 device_state;
- uint16 priority;
- char *name;
-
- /* When replying to an SMBtrans, this is the maximum amount of
- data that can be sent in the initial reply. */
- int max_trans_reply;
-
- /*
- * NamedPipe state information.
- */
- struct pipes_struct *np_state;
-
- /*
- * NamedPipe functions, to be called to perform
- * Named Pipe transactions on request from an
- * SMB client.
- */
-
- /* call to create a named pipe connection.
- * returns: state information representing the connection.
- * is stored in np_state, above.
- */
- struct pipes_struct *(*namedpipe_create)(
- const char *pipe_name,
- const char *client_address,
- struct auth_serversupplied_info *server_info,
- uint16_t vuid);
-
- /* call to perform a write namedpipe operation
- */
- ssize_t (*namedpipe_write)(struct pipes_struct *p,
- char *data, size_t n);
-
- /* call to perform a read namedpipe operation.
- *
- * NOTE: the only reason that the pipe_outstanding
- * argument is here is because samba does not use
- * the namedpipe_transact function yet: instead,
- * it performs the same as what namedpipe_transact
- * does - a write, followed by a read.
- *
- * when samba is modified to use namedpipe_transact,
- * the pipe_outstanding argument may be removed.
- */
- ssize_t (*namedpipe_read)(struct pipes_struct *p,
- char *data, size_t max_len,
- bool *pipe_outstanding);
-
-} smb_np_struct;
-
struct api_struct {
const char *name;
uint8 opnum;
diff --git a/source3/include/ntlmssp.h b/source3/include/ntlmssp.h
index 3fb41c5613..b014b2170c 100644
--- a/source3/include/ntlmssp.h
+++ b/source3/include/ntlmssp.h
@@ -157,14 +157,14 @@ typedef struct ntlmssp_state
unsigned char recv_sign_key[16];
unsigned char recv_seal_key[16];
- unsigned char send_seal_arc4_state[258];
- unsigned char recv_seal_arc4_state[258];
+ struct arcfour_state send_seal_arc4_state;
+ struct arcfour_state recv_seal_arc4_state;
uint32 ntlm2_send_seq_num;
uint32 ntlm2_recv_seq_num;
/* ntlmv1 */
- unsigned char ntlmv1_arc4_state[258];
+ struct arcfour_state ntlmv1_arc4_state;
uint32 ntlmv1_seq_num;
/* it turns out that we don't always get the
diff --git a/source3/include/ntquotas.h b/source3/include/ntquotas.h
index ed503b3854..9aa8b9139e 100644
--- a/source3/include/ntquotas.h
+++ b/source3/include/ntquotas.h
@@ -47,16 +47,16 @@
#define QUOTAS_4000 0x4000
#define QUOTAS_8000 0x8000
-#define SMB_NTQUOTAS_NO_LIMIT ((SMB_BIG_UINT)(-1))
-#define SMB_NTQUOTAS_NO_ENTRY ((SMB_BIG_UINT)(-2))
-#define SMB_NTQUOTAS_NO_SPACE ((SMB_BIG_UINT)(0))
-#define SMB_NTQUOTAS_1_B (SMB_BIG_UINT)0x0000000000000001
-#define SMB_NTQUOTAS_1KB (SMB_BIG_UINT)0x0000000000000400
-#define SMB_NTQUOTAS_1MB (SMB_BIG_UINT)0x0000000000100000
-#define SMB_NTQUOTAS_1GB (SMB_BIG_UINT)0x0000000040000000
-#define SMB_NTQUOTAS_1TB (SMB_BIG_UINT)0x0000010000000000
-#define SMB_NTQUOTAS_1PB (SMB_BIG_UINT)0x0004000000000000
-#define SMB_NTQUOTAS_1EB (SMB_BIG_UINT)0x1000000000000000
+#define SMB_NTQUOTAS_NO_LIMIT ((uint64_t)(-1))
+#define SMB_NTQUOTAS_NO_ENTRY ((uint64_t)(-2))
+#define SMB_NTQUOTAS_NO_SPACE ((uint64_t)(0))
+#define SMB_NTQUOTAS_1_B (uint64_t)0x0000000000000001
+#define SMB_NTQUOTAS_1KB (uint64_t)0x0000000000000400
+#define SMB_NTQUOTAS_1MB (uint64_t)0x0000000000100000
+#define SMB_NTQUOTAS_1GB (uint64_t)0x0000000040000000
+#define SMB_NTQUOTAS_1TB (uint64_t)0x0000010000000000
+#define SMB_NTQUOTAS_1PB (uint64_t)0x0004000000000000
+#define SMB_NTQUOTAS_1EB (uint64_t)0x1000000000000000
enum SMB_QUOTA_TYPE {
SMB_INVALID_QUOTA_TYPE = -1,
@@ -68,9 +68,9 @@ enum SMB_QUOTA_TYPE {
typedef struct _SMB_NTQUOTA_STRUCT {
enum SMB_QUOTA_TYPE qtype;
- SMB_BIG_UINT usedspace;
- SMB_BIG_UINT softlim;
- SMB_BIG_UINT hardlim;
+ uint64_t usedspace;
+ uint64_t softlim;
+ uint64_t hardlim;
uint32 qflags;
DOM_SID sid;
} SMB_NTQUOTA_STRUCT;
diff --git a/source3/include/packet.h b/source3/include/packet.h
index d5174229ca..05974da8fc 100644
--- a/source3/include/packet.h
+++ b/source3/include/packet.h
@@ -46,10 +46,10 @@ NTSTATUS packet_fd_read_sync(struct packet_context *ctx);
* Otherwise return True and store the callback result in *status
*/
bool packet_handler(struct packet_context *ctx,
- bool (*full_req)(const struct data_blob *data,
+ bool (*full_req)(const DATA_BLOB *data,
size_t *length,
void *private_data),
- NTSTATUS (*callback)(const struct data_blob *data,
+ NTSTATUS (*callback)(const DATA_BLOB *data,
void *private_data),
void *private_data,
NTSTATUS *status);
diff --git a/source3/include/printing.h b/source3/include/printing.h
index 2788143cc5..d91917b528 100644
--- a/source3/include/printing.h
+++ b/source3/include/printing.h
@@ -77,6 +77,7 @@ extern struct printif iprint_printif;
#define NEXT_JOBID(j) ((j+1) % PRINT_MAX_JOBID > 0 ? (j+1) % PRINT_MAX_JOBID : 1)
#define MAX_CACHE_VALID_TIME 3600
+#define CUPS_DEFAULT_CONNECTION_TIMEOUT 30
#ifndef PRINT_SPOOL_PREFIX
#define PRINT_SPOOL_PREFIX "smbprn."
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 2901911c70..9b3950229e 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -43,7 +43,10 @@ bool password_ok(const char *smb_name, DATA_BLOB password_blob);
/* The following definitions come from auth/auth_domain.c */
-NTSTATUS auth_domain_init(void) ;
+void attempt_machine_password_change(void);
+NTSTATUS auth_domain_init(void);
+
+NTSTATUS auth_netlogond_init(void);
/* The following definitions come from auth/auth_ntlmssp.c */
@@ -312,11 +315,6 @@ int afs_syscall( int subcall,
bool afs_settoken_str(const char *token_string);
bool afs_settoken_str(const char *token_string);
-/* The following definitions come from lib/arc4.c */
-
-void smb_arc4_init(unsigned char arc4_state_out[258], const unsigned char *key, size_t keylen);
-void smb_arc4_crypt(unsigned char arc4_state_inout[258], unsigned char *data, size_t len);
-
/* The following definitions come from lib/audit.c */
const char *audit_category_str(uint32 category);
@@ -437,22 +435,6 @@ int connections_forall(int (*fn)(struct db_record *rec,
void *private_data);
bool connections_init(bool rw);
-/* The following definitions come from lib/crc32.c */
-
-uint32 crc32_calc_buffer(const char *buf, size_t size);
-
-/* The following definitions come from lib/data_blob.c */
-
-DATA_BLOB data_blob(const void *p, size_t length);
-DATA_BLOB data_blob_talloc(TALLOC_CTX *mem_ctx, const void *p, size_t length);
-void data_blob_free(DATA_BLOB *d);
-void data_blob_clear(DATA_BLOB *d);
-void data_blob_clear_free(DATA_BLOB *d);
-DATA_BLOB data_blob_string_const(const char *str);
-DATA_BLOB data_blob_const(const void *p, size_t length);
-DATA_BLOB data_blob_talloc_zero(TALLOC_CTX *mem_ctx, size_t length);
-_PUBLIC_ char *data_blob_hex_string(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob);
-
/* The following definitions come from lib/dbwrap_util.c */
int32_t dbwrap_fetch_int32(struct db_context *db, const char *keystr);
@@ -492,13 +474,14 @@ void force_check_log_size( void );
bool need_to_check_log_size( void );
void check_log_size( void );
void dbgflush( void );
-bool dbghdr(int level, int cls, const char *file, const char *func, int line);
+bool dbghdrclass(int level, int cls, const char *location, const char *func);
+bool dbghdr(int level, const char *location, const char *func);
TALLOC_CTX *debug_ctx(void);
/* The following definitions come from lib/display_sec.c */
char *get_sec_mask_str(TALLOC_CTX *ctx, uint32 type);
-void display_sec_access(SEC_ACCESS *info);
+void display_sec_access(uint32_t *info);
void display_sec_ace_flags(uint8_t flags);
void display_sec_ace(SEC_ACE *ace);
void display_sec_acl(SEC_ACL *sec_acl);
@@ -516,6 +499,7 @@ void display_set_stderr(void);
/* The following definitions come from lib/errmap_unix.c */
NTSTATUS map_nt_error_from_unix(int unix_error);
+int map_errno_from_nt_status(NTSTATUS status);
/* The following definitions come from lib/events.c */
@@ -573,7 +557,7 @@ void pull_file_id_16(char *buf, struct file_id *id);
/* The following definitions come from lib/fsusage.c */
-int sys_fsusage(const char *path, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
+int sys_fsusage(const char *path, uint64_t *dfree, uint64_t *dsize);
/* The following definitions come from lib/gencache.c */
@@ -593,18 +577,8 @@ void gencache_unlock_entry( const char *key );
void set_rand_reseed_callback(void (*fn)(int *));
void set_need_random_reseed(void);
-void generate_random_buffer( unsigned char *out, int len);
-char *generate_random_str(size_t len);
-
-/* The following definitions come from lib/hmacmd5.c */
-
-void hmac_md5_init_rfc2104(const unsigned char *key, int key_len, HMACMD5Context *ctx);
-void hmac_md5_init_limK_to_64(const unsigned char* key, int key_len,
- HMACMD5Context *ctx);
-void hmac_md5_update(const unsigned char *text, int text_len, HMACMD5Context *ctx);
-void hmac_md5_final(unsigned char *digest, HMACMD5Context *ctx);
-void hmac_md5( unsigned char key[16], const unsigned char *data, int data_len,
- unsigned char *digest);
+void generate_random_buffer(uint8_t *out, int len);
+char *generate_random_str(TALLOC_CTX *mem_ctx, size_t len);
/* The following definitions come from lib/iconv.c */
@@ -649,12 +623,6 @@ char *escape_rdn_val_string_alloc(const char *s);
void mdfour(unsigned char *out, const unsigned char *in, int n);
-/* The following definitions come from lib/md5.c */
-
-void MD5Init(struct MD5Context *ctx);
-void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len);
-void MD5Final(unsigned char digest[16], struct MD5Context *ctx);
-
/* The following definitions come from lib/module.c */
NTSTATUS smb_load_module(const char *module_name);
@@ -727,6 +695,7 @@ bool privilege_set_to_se_priv( SE_PRIV *mask, struct lsa_PrivilegeSet *privset )
/* The following definitions come from lib/readline.c */
+void smb_readline_done(void);
char *smb_readline(const char *prompt, void (*callback)(void),
char **(completion_fn)(const char *text, int start, int end));
const char *smb_readline_get_line_buffer(void);
@@ -791,7 +760,6 @@ NTSTATUS sec_desc_mod_sid(SEC_DESC *sd, DOM_SID *sid, uint32 mask);
NTSTATUS sec_desc_del_sid(TALLOC_CTX *ctx, SEC_DESC **psd, DOM_SID *sid, size_t *sd_size);
SEC_DESC_BUF *se_create_child_secdesc(TALLOC_CTX *ctx, SEC_DESC *parent_ctr,
bool child_container);
-void init_sec_access(uint32 *t, uint32 mask);
/* The following definitions come from lib/select.c */
@@ -802,12 +770,6 @@ int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorf
/* The following definitions come from lib/sendfile.c */
ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
-ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
-ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
-ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
-ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
-ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
-ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, SMB_OFF_T offset, size_t count);
/* The following definitions come from lib/server_mutex.c */
@@ -1147,11 +1109,9 @@ void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset);
time_t pull_dos_date(const uint8_t *date_ptr, int zone_offset);
time_t pull_dos_date2(const uint8_t *date_ptr, int zone_offset);
time_t pull_dos_date3(const uint8_t *date_ptr, int zone_offset);
-char *http_timestring(time_t t);
char *timestring(TALLOC_CTX *mem_ctx, time_t t);
const char *nt_time_string(TALLOC_CTX *mem_ctx, NTTIME nt);
NTTIME nttime_from_string(const char *s);
-int64_t usec_time_diff(struct timeval *tv1, struct timeval *tv2);
struct timeval timeval_zero(void);
bool timeval_is_zero(const struct timeval *tv);
struct timeval timeval_current(void);
@@ -1224,10 +1184,6 @@ const char *time_to_asc(const time_t t);
const char *display_time(NTTIME nttime);
bool nt_time_is_set(const NTTIME *nt);
-/* The following definitions come from lib/ufc.c */
-
-char *ufc_crypt(const char *key,const char *salt);
-
/* The following definitions come from lib/username.c */
char *get_user_home_dir(TALLOC_CTX *mem_ctx, const char *user);
@@ -1235,6 +1191,7 @@ struct passwd *Get_Pwnam_alloc(TALLOC_CTX *mem_ctx, const char *user);
/* The following definitions come from lib/util.c */
+bool all_zero(const uint8_t *ptr, size_t size);
bool set_global_myname(const char *myname);
const char *global_myname(void);
bool set_global_myworkgroup(const char *myworkgroup);
@@ -1266,10 +1223,12 @@ const char *tmpdir(void);
bool add_gid_to_array_unique(TALLOC_CTX *mem_ctx, gid_t gid,
gid_t **gids, size_t *num_gids);
const char *get_numlist(const char *p, uint32 **num, int *count);
-bool file_exist(const char *fname,SMB_STRUCT_STAT *sbuf);
+bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf);
+bool file_exist(const char *fname);
bool socket_exist(const char *fname);
time_t file_modtime(const char *fname);
-bool directory_exist(char *dname,SMB_STRUCT_STAT *st);
+bool directory_exist_stat(char *dname,SMB_STRUCT_STAT *st);
+bool directory_exist(const char *dname);
SMB_OFF_T get_file_size(char *file_name);
char *attrib_string(uint16 mode);
void show_msg(char *buf);
@@ -1297,7 +1256,7 @@ void add_to_large_array(TALLOC_CTX *mem_ctx, size_t element_size,
void *element, void *_array, uint32 *num_elements,
ssize_t *array_size);
void safe_free(void *p);
-char *get_myname(TALLOC_CTX *ctx);
+char *talloc_get_myname(TALLOC_CTX *ctx);
char *get_mydnsdomname(TALLOC_CTX *ctx);
int interpret_protocol(const char *str,int def);
char *automount_lookup(TALLOC_CTX *ctx, const char *user_name);
@@ -1325,6 +1284,7 @@ enum remote_arch_types get_remote_arch(void);
void print_asc(int level, const unsigned char *buf,int len);
void dump_data(int level, const unsigned char *buf1,int len);
void dump_data_pw(const char *msg, const uchar * data, size_t len);
+void dump_data_skip_zeros(int level, const uint8_t *buf, int len);
const char *tab_depth(int level, int depth);
int str_checksum(const char *s);
void zero_free(void *p, size_t size);
@@ -1396,16 +1356,16 @@ const char *strip_hostname(const char *s);
/* The following definitions come from lib/util_file.c */
char *fgets_slash(char *s2,int maxlen,XFILE *f);
-char *fd_load(int fd, size_t *psize, size_t maxsize);
-char *file_load(const char *fname, size_t *size, size_t maxsize);
+char *file_load(const char *fname, size_t *size, size_t maxsize, TALLOC_CTX *mem_ctx);
+char **file_lines_parse(char *p, size_t size, int *numlines, TALLOC_CTX *mem_ctx);
bool unmap_file(void* start, size_t size);
-void *map_file(char *fname, size_t size);
-char **file_lines_load(const char *fname, int *numlines, size_t maxsize);
-char **fd_lines_load(int fd, int *numlines, size_t maxsize);
-char **file_lines_pload(char *syscmd, int *numlines);
+void *map_file(const char *fname, size_t size);
+char **file_lines_load(const char *fname, int *numlines, size_t maxsize, TALLOC_CTX *mem_ctx);
+char **fd_lines_load(int fd, int *numlines, size_t maxsize, TALLOC_CTX *mem_ctx);
+char **file_lines_pload(const char *syscmd, int *numlines);
void file_lines_free(char **lines);
void file_lines_slashcont(char **lines);
-bool file_save(const char *fname, void *packet, size_t length);
+bool file_save(const char *fname, const void *packet, size_t length);
/* The following definitions come from lib/util_nscd.c */
@@ -1446,6 +1406,7 @@ WERROR registry_push_value(TALLOC_CTX *mem_ctx,
/* The following definitions come from lib/util_seaccess.c */
void se_map_generic(uint32 *access_mask, const struct generic_mapping *mapping);
+void security_acl_map_generic(struct security_acl *sa, const struct generic_mapping *mapping);
void se_map_standard(uint32 *access_mask, struct standard_mapping *mapping);
bool se_access_check(const SEC_DESC *sd, const NT_USER_TOKEN *token,
uint32 acc_desired, uint32 *acc_granted,
@@ -1644,7 +1605,7 @@ char *alpha_strcpy_fn(const char *fn,
char *StrnCpy_fn(const char *fn, int line,char *dest,const char *src,size_t n);
size_t strhex_to_str(char *buf, size_t buf_len, const char *strhex, size_t strhex_len);
DATA_BLOB strhex_to_data_blob(TALLOC_CTX *mem_ctx, const char *strhex);
-char *hex_encode(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, size_t len);
+char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, size_t len);
bool in_list(const char *s, const char *list, bool casesensitive);
void string_free(char **s);
bool string_set(char **dest,const char *src);
@@ -1693,9 +1654,9 @@ char *binary_string_rfc2254(char *buf, int len);
char *binary_string(char *buf, int len);
int fstr_sprintf(fstring s, const char *fmt, ...);
char **str_list_make(TALLOC_CTX *mem_ctx, const char *string, const char *sep);
-bool str_list_copy(TALLOC_CTX *mem_ctx, char ***dest, const char **src);
-bool str_list_compare(char **list1, char **list2);
-int str_list_count( const char **list );
+char **str_list_copy(TALLOC_CTX *mem_ctx, const char **list);
+bool str_list_equal(const char **list1, const char **list2);
+size_t str_list_length( const char * const*list );
bool str_list_sub_basic( char **list, const char *smb_name,
const char *domain_name );
bool str_list_substitute(char **list, const char *pattern, const char *insert);
@@ -1708,7 +1669,7 @@ void rfc1738_unescape(char *buf);
DATA_BLOB base64_decode_data_blob(const char *s);
void base64_decode_inplace(char *s);
char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data);
-SMB_BIG_UINT STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr);
+uint64_t STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr);
SMB_OFF_T conv_str_size(const char * str);
void string_append(char **left, const char *right);
bool add_string_to_array(TALLOC_CTX *mem_ctx,
@@ -1794,9 +1755,6 @@ int islower_ascii(int c);
void smb_uuid_pack(const struct GUID uu, UUID_FLAT *ptr);
void smb_uuid_unpack(const UUID_FLAT in, struct GUID *uu);
-void smb_uuid_generate_random(struct GUID *uu);
-const char *smb_uuid_string(TALLOC_CTX *mem_ctx, const struct GUID uu);
-bool smb_string_to_uuid(const char *in, struct GUID* uu);
char *guid_binstring(const struct GUID *guid);
/* The following definitions come from lib/version.c */
@@ -1927,20 +1885,15 @@ NTSTATUS kerberos_return_info3_from_pac(TALLOC_CTX *mem_ctx,
struct netr_SamInfo3 **info3);
/* The following definitions come from libads/cldap.c */
-
bool ads_cldap_netlogon(TALLOC_CTX *mem_ctx,
const char *server,
const char *realm,
- uint32_t *nt_version,
- union nbt_cldap_netlogon **reply);
+ uint32_t nt_version,
+ struct netlogon_samlogon_response **reply);
bool ads_cldap_netlogon_5(TALLOC_CTX *mem_ctx,
const char *server,
const char *realm,
- struct nbt_cldap_netlogon_5 *reply5);
-bool pull_mailslot_cldap_reply(TALLOC_CTX *mem_ctx,
- const DATA_BLOB *blob,
- union nbt_cldap_netlogon *r,
- uint32_t *nt_version);
+ struct NETLOGON_SAM_LOGON_RESPONSE_EX *reply5);
/* The following definitions come from libads/disp_sec.c */
@@ -2204,23 +2157,6 @@ ADS_STATUS ads_change_trust_account_password(ADS_STRUCT *ads, char *host_princip
ADS_STATUS ads_guess_service_principal(ADS_STRUCT *ads,
char **returned_principal);
-/* The following definitions come from libcli/nbt/nbtname.c */
-
-_PUBLIC_ void ndr_print_nbt_string(struct ndr_print *ndr, const char *name, const char *s);
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_string(struct ndr_pull *ndr, int ndr_flags, const char **s);
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_string(struct ndr_push *ndr, int ndr_flags, const char *s);
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_name *r);
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name *r);
-_PUBLIC_ NTSTATUS nbt_name_dup(TALLOC_CTX *mem_ctx, struct nbt_name *name, struct nbt_name *newname);
-_PUBLIC_ NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct nbt_name *name);
-_PUBLIC_ NTSTATUS nbt_name_from_blob(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, struct nbt_name *name);
-_PUBLIC_ void nbt_choose_called_name(TALLOC_CTX *mem_ctx,
- struct nbt_name *n, const char *name, int type);
-_PUBLIC_ char *nbt_name_string(TALLOC_CTX *mem_ctx, const struct nbt_name *name);
-_PUBLIC_ enum ndr_err_code ndr_pull_wrepl_nbt_name(struct ndr_pull *ndr, int ndr_flags, const struct nbt_name **_r);
-_PUBLIC_ enum ndr_err_code ndr_push_wrepl_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name *r);
-_PUBLIC_ void ndr_print_wrepl_nbt_name(struct ndr_print *ndr, const char *name, const struct nbt_name *r);
-
/* The following definitions come from libgpo/gpext/gpext.c */
struct gp_extension *get_gp_extension_list(void);
@@ -2444,1652 +2380,48 @@ ADS_STATUS gp_get_machine_token(ADS_STRUCT *ads,
const char *dn,
struct nt_user_token **token);
-/* The following definitions come from librpc/gen_ndr/ndr_dfs.c */
-
-_PUBLIC_ void ndr_print_dfs_ManagerVersion(struct ndr_print *ndr, const char *name, enum dfs_ManagerVersion r);
-_PUBLIC_ void ndr_print_dfs_Info0(struct ndr_print *ndr, const char *name, const struct dfs_Info0 *r);
-_PUBLIC_ void ndr_print_dfs_Info1(struct ndr_print *ndr, const char *name, const struct dfs_Info1 *r);
-_PUBLIC_ enum ndr_err_code ndr_push_dfs_VolumeState(struct ndr_push *ndr, int ndr_flags, uint32_t r);
-_PUBLIC_ enum ndr_err_code ndr_pull_dfs_VolumeState(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
-_PUBLIC_ void ndr_print_dfs_VolumeState(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_dfs_Info2(struct ndr_print *ndr, const char *name, const struct dfs_Info2 *r);
-_PUBLIC_ enum ndr_err_code ndr_push_dfs_StorageState(struct ndr_push *ndr, int ndr_flags, uint32_t r);
-_PUBLIC_ enum ndr_err_code ndr_pull_dfs_StorageState(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
-_PUBLIC_ void ndr_print_dfs_StorageState(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_dfs_StorageInfo(struct ndr_print *ndr, const char *name, const struct dfs_StorageInfo *r);
-_PUBLIC_ void ndr_print_dfs_Info3(struct ndr_print *ndr, const char *name, const struct dfs_Info3 *r);
-_PUBLIC_ void ndr_print_dfs_Info4(struct ndr_print *ndr, const char *name, const struct dfs_Info4 *r);
-_PUBLIC_ enum ndr_err_code ndr_push_dfs_PropertyFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r);
-_PUBLIC_ enum ndr_err_code ndr_pull_dfs_PropertyFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
-_PUBLIC_ void ndr_print_dfs_PropertyFlags(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_dfs_Info5(struct ndr_print *ndr, const char *name, const struct dfs_Info5 *r);
-_PUBLIC_ void ndr_print_dfs_Target_PriorityClass(struct ndr_print *ndr, const char *name, enum dfs_Target_PriorityClass r);
-_PUBLIC_ void ndr_print_dfs_Target_Priority(struct ndr_print *ndr, const char *name, const struct dfs_Target_Priority *r);
-_PUBLIC_ void ndr_print_dfs_StorageInfo2(struct ndr_print *ndr, const char *name, const struct dfs_StorageInfo2 *r);
-_PUBLIC_ void ndr_print_dfs_Info6(struct ndr_print *ndr, const char *name, const struct dfs_Info6 *r);
-_PUBLIC_ void ndr_print_dfs_Info7(struct ndr_print *ndr, const char *name, const struct dfs_Info7 *r);
-_PUBLIC_ void ndr_print_dfs_Info100(struct ndr_print *ndr, const char *name, const struct dfs_Info100 *r);
-_PUBLIC_ void ndr_print_dfs_Info101(struct ndr_print *ndr, const char *name, const struct dfs_Info101 *r);
-_PUBLIC_ void ndr_print_dfs_Info102(struct ndr_print *ndr, const char *name, const struct dfs_Info102 *r);
-_PUBLIC_ void ndr_print_dfs_Info103(struct ndr_print *ndr, const char *name, const struct dfs_Info103 *r);
-_PUBLIC_ void ndr_print_dfs_Info104(struct ndr_print *ndr, const char *name, const struct dfs_Info104 *r);
-_PUBLIC_ void ndr_print_dfs_Info105(struct ndr_print *ndr, const char *name, const struct dfs_Info105 *r);
-_PUBLIC_ void ndr_print_dfs_Info106(struct ndr_print *ndr, const char *name, const struct dfs_Info106 *r);
-_PUBLIC_ void ndr_print_dfs_Info200(struct ndr_print *ndr, const char *name, const struct dfs_Info200 *r);
-_PUBLIC_ void ndr_print_dfs_VolumeFlavor(struct ndr_print *ndr, const char *name, enum dfs_VolumeFlavor r);
-_PUBLIC_ void ndr_print_dfs_Info300(struct ndr_print *ndr, const char *name, const struct dfs_Info300 *r);
-_PUBLIC_ void ndr_print_dfs_Info(struct ndr_print *ndr, const char *name, const union dfs_Info *r);
-_PUBLIC_ void ndr_print_dfs_EnumArray1(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray1 *r);
-_PUBLIC_ void ndr_print_dfs_EnumArray2(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray2 *r);
-_PUBLIC_ void ndr_print_dfs_EnumArray3(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray3 *r);
-_PUBLIC_ void ndr_print_dfs_EnumArray4(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray4 *r);
-_PUBLIC_ void ndr_print_dfs_EnumArray5(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray5 *r);
-_PUBLIC_ void ndr_print_dfs_EnumArray6(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray6 *r);
-_PUBLIC_ void ndr_print_dfs_EnumArray200(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray200 *r);
-_PUBLIC_ void ndr_print_dfs_EnumArray300(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray300 *r);
-_PUBLIC_ void ndr_print_dfs_EnumInfo(struct ndr_print *ndr, const char *name, const union dfs_EnumInfo *r);
-_PUBLIC_ void ndr_print_dfs_EnumStruct(struct ndr_print *ndr, const char *name, const struct dfs_EnumStruct *r);
-_PUBLIC_ void ndr_print_dfs_UnknownStruct(struct ndr_print *ndr, const char *name, const struct dfs_UnknownStruct *r);
-_PUBLIC_ enum ndr_err_code ndr_push_dfs_GetManagerVersion(struct ndr_push *ndr, int flags, const struct dfs_GetManagerVersion *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_dfs_GetManagerVersion(struct ndr_pull *ndr, int flags, struct dfs_GetManagerVersion *r);
-_PUBLIC_ void ndr_print_dfs_GetManagerVersion(struct ndr_print *ndr, const char *name, int flags, const struct dfs_GetManagerVersion *r);
-_PUBLIC_ void ndr_print_dfs_Add(struct ndr_print *ndr, const char *name, int flags, const struct dfs_Add *r);
-_PUBLIC_ void ndr_print_dfs_Remove(struct ndr_print *ndr, const char *name, int flags, const struct dfs_Remove *r);
-_PUBLIC_ void ndr_print_dfs_SetInfo(struct ndr_print *ndr, const char *name, int flags, const struct dfs_SetInfo *r);
-_PUBLIC_ void ndr_print_dfs_GetInfo(struct ndr_print *ndr, const char *name, int flags, const struct dfs_GetInfo *r);
-_PUBLIC_ void ndr_print_dfs_Enum(struct ndr_print *ndr, const char *name, int flags, const struct dfs_Enum *r);
-_PUBLIC_ void ndr_print_dfs_Rename(struct ndr_print *ndr, const char *name, int flags, const struct dfs_Rename *r);
-_PUBLIC_ void ndr_print_dfs_Move(struct ndr_print *ndr, const char *name, int flags, const struct dfs_Move *r);
-_PUBLIC_ void ndr_print_dfs_ManagerGetConfigInfo(struct ndr_print *ndr, const char *name, int flags, const struct dfs_ManagerGetConfigInfo *r);
-_PUBLIC_ void ndr_print_dfs_ManagerSendSiteInfo(struct ndr_print *ndr, const char *name, int flags, const struct dfs_ManagerSendSiteInfo *r);
-_PUBLIC_ void ndr_print_dfs_AddFtRoot(struct ndr_print *ndr, const char *name, int flags, const struct dfs_AddFtRoot *r);
-_PUBLIC_ void ndr_print_dfs_RemoveFtRoot(struct ndr_print *ndr, const char *name, int flags, const struct dfs_RemoveFtRoot *r);
-_PUBLIC_ void ndr_print_dfs_AddStdRoot(struct ndr_print *ndr, const char *name, int flags, const struct dfs_AddStdRoot *r);
-_PUBLIC_ void ndr_print_dfs_RemoveStdRoot(struct ndr_print *ndr, const char *name, int flags, const struct dfs_RemoveStdRoot *r);
-_PUBLIC_ void ndr_print_dfs_ManagerInitialize(struct ndr_print *ndr, const char *name, int flags, const struct dfs_ManagerInitialize *r);
-_PUBLIC_ void ndr_print_dfs_AddStdRootForced(struct ndr_print *ndr, const char *name, int flags, const struct dfs_AddStdRootForced *r);
-_PUBLIC_ void ndr_print_dfs_GetDcAddress(struct ndr_print *ndr, const char *name, int flags, const struct dfs_GetDcAddress *r);
-_PUBLIC_ void ndr_print_dfs_SetDcAddress(struct ndr_print *ndr, const char *name, int flags, const struct dfs_SetDcAddress *r);
-_PUBLIC_ void ndr_print_dfs_FlushFtTable(struct ndr_print *ndr, const char *name, int flags, const struct dfs_FlushFtTable *r);
-_PUBLIC_ void ndr_print_dfs_Add2(struct ndr_print *ndr, const char *name, int flags, const struct dfs_Add2 *r);
-_PUBLIC_ void ndr_print_dfs_Remove2(struct ndr_print *ndr, const char *name, int flags, const struct dfs_Remove2 *r);
-_PUBLIC_ enum ndr_err_code ndr_push_dfs_EnumEx(struct ndr_push *ndr, int flags, const struct dfs_EnumEx *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_dfs_EnumEx(struct ndr_pull *ndr, int flags, struct dfs_EnumEx *r);
-_PUBLIC_ void ndr_print_dfs_EnumEx(struct ndr_print *ndr, const char *name, int flags, const struct dfs_EnumEx *r);
-_PUBLIC_ void ndr_print_dfs_SetInfo2(struct ndr_print *ndr, const char *name, int flags, const struct dfs_SetInfo2 *r);
-
-/* The following definitions come from librpc/gen_ndr/ndr_dssetup.c */
-
-_PUBLIC_ void ndr_print_dssetup_DsRole(struct ndr_print *ndr, const char *name, enum dssetup_DsRole r);
-_PUBLIC_ void ndr_print_dssetup_DsRoleFlags(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_dssetup_DsRolePrimaryDomInfoBasic(struct ndr_print *ndr, const char *name, const struct dssetup_DsRolePrimaryDomInfoBasic *r);
-_PUBLIC_ void ndr_print_dssetup_DsUpgrade(struct ndr_print *ndr, const char *name, enum dssetup_DsUpgrade r);
-_PUBLIC_ void ndr_print_dssetup_DsPrevious(struct ndr_print *ndr, const char *name, enum dssetup_DsPrevious r);
-_PUBLIC_ void ndr_print_dssetup_DsRoleUpgradeStatus(struct ndr_print *ndr, const char *name, const struct dssetup_DsRoleUpgradeStatus *r);
-_PUBLIC_ void ndr_print_dssetup_DsRoleOp(struct ndr_print *ndr, const char *name, enum dssetup_DsRoleOp r);
-_PUBLIC_ void ndr_print_dssetup_DsRoleOpStatus(struct ndr_print *ndr, const char *name, const struct dssetup_DsRoleOpStatus *r);
-_PUBLIC_ void ndr_print_dssetup_DsRoleInfoLevel(struct ndr_print *ndr, const char *name, enum dssetup_DsRoleInfoLevel r);
-_PUBLIC_ void ndr_print_dssetup_DsRoleInfo(struct ndr_print *ndr, const char *name, const union dssetup_DsRoleInfo *r);
-_PUBLIC_ void ndr_print_dssetup_DsRoleGetPrimaryDomainInformation(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleGetPrimaryDomainInformation *r);
-_PUBLIC_ void ndr_print_dssetup_DsRoleDnsNameToFlatName(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDnsNameToFlatName *r);
-_PUBLIC_ void ndr_print_dssetup_DsRoleDcAsDc(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDcAsDc *r);
-_PUBLIC_ void ndr_print_dssetup_DsRoleDcAsReplica(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDcAsReplica *r);
-_PUBLIC_ void ndr_print_dssetup_DsRoleDemoteDc(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleDemoteDc *r);
-_PUBLIC_ void ndr_print_dssetup_DsRoleGetDcOperationProgress(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleGetDcOperationProgress *r);
-_PUBLIC_ void ndr_print_dssetup_DsRoleGetDcOperationResults(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleGetDcOperationResults *r);
-_PUBLIC_ void ndr_print_dssetup_DsRoleCancel(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleCancel *r);
-_PUBLIC_ void ndr_print_dssetup_DsRoleServerSaveStateForUpgrade(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleServerSaveStateForUpgrade *r);
-_PUBLIC_ void ndr_print_dssetup_DsRoleUpgradeDownlevelServer(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleUpgradeDownlevelServer *r);
-_PUBLIC_ void ndr_print_dssetup_DsRoleAbortDownlevelServerUpgrade(struct ndr_print *ndr, const char *name, int flags, const struct dssetup_DsRoleAbortDownlevelServerUpgrade *r);
-
-/* The following definitions come from librpc/gen_ndr/ndr_echo.c */
-
-_PUBLIC_ void ndr_print_echo_info1(struct ndr_print *ndr, const char *name, const struct echo_info1 *r);
-_PUBLIC_ void ndr_print_echo_info2(struct ndr_print *ndr, const char *name, const struct echo_info2 *r);
-_PUBLIC_ void ndr_print_echo_info3(struct ndr_print *ndr, const char *name, const struct echo_info3 *r);
-_PUBLIC_ void ndr_print_STRUCT_echo_info4(struct ndr_print *ndr, const char *name, const struct echo_info4 *r);
-_PUBLIC_ void ndr_print_echo_info5(struct ndr_print *ndr, const char *name, const struct echo_info5 *r);
-_PUBLIC_ void ndr_print_echo_info6(struct ndr_print *ndr, const char *name, const struct echo_info6 *r);
-_PUBLIC_ void ndr_print_echo_info7(struct ndr_print *ndr, const char *name, const struct echo_info7 *r);
-_PUBLIC_ void ndr_print_echo_Info(struct ndr_print *ndr, const char *name, const union echo_Info *r);
-_PUBLIC_ void ndr_print_echo_Enum1(struct ndr_print *ndr, const char *name, enum echo_Enum1 r);
-_PUBLIC_ void ndr_print_echo_Enum1_32(struct ndr_print *ndr, const char *name, enum echo_Enum1_32 r);
-_PUBLIC_ void ndr_print_echo_Enum2(struct ndr_print *ndr, const char *name, const struct echo_Enum2 *r);
-_PUBLIC_ void ndr_print_echo_Enum3(struct ndr_print *ndr, const char *name, const union echo_Enum3 *r);
-_PUBLIC_ void ndr_print_echo_Surrounding(struct ndr_print *ndr, const char *name, const struct echo_Surrounding *r);
-_PUBLIC_ void ndr_print_echo_AddOne(struct ndr_print *ndr, const char *name, int flags, const struct echo_AddOne *r);
-_PUBLIC_ void ndr_print_echo_EchoData(struct ndr_print *ndr, const char *name, int flags, const struct echo_EchoData *r);
-_PUBLIC_ void ndr_print_echo_SinkData(struct ndr_print *ndr, const char *name, int flags, const struct echo_SinkData *r);
-_PUBLIC_ void ndr_print_echo_SourceData(struct ndr_print *ndr, const char *name, int flags, const struct echo_SourceData *r);
-_PUBLIC_ void ndr_print_echo_TestCall(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestCall *r);
-_PUBLIC_ void ndr_print_echo_TestCall2(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestCall2 *r);
-_PUBLIC_ void ndr_print_echo_TestSleep(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestSleep *r);
-_PUBLIC_ void ndr_print_echo_TestEnum(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestEnum *r);
-_PUBLIC_ void ndr_print_echo_TestSurrounding(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestSurrounding *r);
-_PUBLIC_ void ndr_print_echo_TestDoublePointer(struct ndr_print *ndr, const char *name, int flags, const struct echo_TestDoublePointer *r);
-
-/* The following definitions come from librpc/gen_ndr/ndr_eventlog.c */
-
-_PUBLIC_ void ndr_print_eventlog_OpenUnknown0(struct ndr_print *ndr, const char *name, const struct eventlog_OpenUnknown0 *r);
-_PUBLIC_ enum ndr_err_code ndr_push_eventlog_Record(struct ndr_push *ndr, int ndr_flags, const struct eventlog_Record *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_eventlog_Record(struct ndr_pull *ndr, int ndr_flags, struct eventlog_Record *r);
-_PUBLIC_ void ndr_print_eventlog_Record(struct ndr_print *ndr, const char *name, const struct eventlog_Record *r);
-_PUBLIC_ void ndr_print_eventlog_ClearEventLogW(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_ClearEventLogW *r);
-_PUBLIC_ void ndr_print_eventlog_BackupEventLogW(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_BackupEventLogW *r);
-_PUBLIC_ void ndr_print_eventlog_CloseEventLog(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_CloseEventLog *r);
-_PUBLIC_ void ndr_print_eventlog_DeregisterEventSource(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_DeregisterEventSource *r);
-_PUBLIC_ void ndr_print_eventlog_GetNumRecords(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_GetNumRecords *r);
-_PUBLIC_ void ndr_print_eventlog_GetOldestRecord(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_GetOldestRecord *r);
-_PUBLIC_ void ndr_print_eventlog_ChangeNotify(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_ChangeNotify *r);
-_PUBLIC_ void ndr_print_eventlog_OpenEventLogW(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_OpenEventLogW *r);
-_PUBLIC_ void ndr_print_eventlog_RegisterEventSourceW(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_RegisterEventSourceW *r);
-_PUBLIC_ void ndr_print_eventlog_OpenBackupEventLogW(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_OpenBackupEventLogW *r);
-_PUBLIC_ void ndr_print_eventlog_ReadEventLogW(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_ReadEventLogW *r);
-_PUBLIC_ void ndr_print_eventlog_ReportEventW(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_ReportEventW *r);
-_PUBLIC_ void ndr_print_eventlog_ClearEventLogA(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_ClearEventLogA *r);
-_PUBLIC_ void ndr_print_eventlog_BackupEventLogA(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_BackupEventLogA *r);
-_PUBLIC_ void ndr_print_eventlog_OpenEventLogA(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_OpenEventLogA *r);
-_PUBLIC_ void ndr_print_eventlog_RegisterEventSourceA(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_RegisterEventSourceA *r);
-_PUBLIC_ void ndr_print_eventlog_OpenBackupEventLogA(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_OpenBackupEventLogA *r);
-_PUBLIC_ void ndr_print_eventlog_ReadEventLogA(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_ReadEventLogA *r);
-_PUBLIC_ void ndr_print_eventlog_ReportEventA(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_ReportEventA *r);
-_PUBLIC_ void ndr_print_eventlog_RegisterClusterSvc(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_RegisterClusterSvc *r);
-_PUBLIC_ void ndr_print_eventlog_DeregisterClusterSvc(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_DeregisterClusterSvc *r);
-_PUBLIC_ void ndr_print_eventlog_WriteClusterEvents(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_WriteClusterEvents *r);
-_PUBLIC_ void ndr_print_eventlog_GetLogIntormation(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_GetLogIntormation *r);
-_PUBLIC_ void ndr_print_eventlog_FlushEventLog(struct ndr_print *ndr, const char *name, int flags, const struct eventlog_FlushEventLog *r);
-
-/* The following definitions come from librpc/gen_ndr/ndr_initshutdown.c */
-
-_PUBLIC_ void ndr_print_initshutdown_String_sub(struct ndr_print *ndr, const char *name, const struct initshutdown_String_sub *r);
-_PUBLIC_ enum ndr_err_code ndr_push_initshutdown_String(struct ndr_push *ndr, int ndr_flags, const struct initshutdown_String *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_initshutdown_String(struct ndr_pull *ndr, int ndr_flags, struct initshutdown_String *r);
-_PUBLIC_ void ndr_print_initshutdown_String(struct ndr_print *ndr, const char *name, const struct initshutdown_String *r);
-_PUBLIC_ void ndr_print_initshutdown_Init(struct ndr_print *ndr, const char *name, int flags, const struct initshutdown_Init *r);
-_PUBLIC_ void ndr_print_initshutdown_Abort(struct ndr_print *ndr, const char *name, int flags, const struct initshutdown_Abort *r);
-_PUBLIC_ void ndr_print_initshutdown_InitEx(struct ndr_print *ndr, const char *name, int flags, const struct initshutdown_InitEx *r);
-
-/* The following definitions come from librpc/gen_ndr/ndr_krb5pac.c */
-
-_PUBLIC_ void ndr_print_PAC_LOGON_NAME(struct ndr_print *ndr, const char *name, const struct PAC_LOGON_NAME *r);
-_PUBLIC_ enum ndr_err_code ndr_push_PAC_SIGNATURE_DATA(struct ndr_push *ndr, int ndr_flags, const struct PAC_SIGNATURE_DATA *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_PAC_SIGNATURE_DATA(struct ndr_pull *ndr, int ndr_flags, struct PAC_SIGNATURE_DATA *r);
-_PUBLIC_ void ndr_print_PAC_SIGNATURE_DATA(struct ndr_print *ndr, const char *name, const struct PAC_SIGNATURE_DATA *r);
-_PUBLIC_ void ndr_print_PAC_LOGON_INFO(struct ndr_print *ndr, const char *name, const struct PAC_LOGON_INFO *r);
-_PUBLIC_ enum ndr_err_code ndr_push_PAC_LOGON_INFO_CTR(struct ndr_push *ndr, int ndr_flags, const struct PAC_LOGON_INFO_CTR *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_PAC_LOGON_INFO_CTR(struct ndr_pull *ndr, int ndr_flags, struct PAC_LOGON_INFO_CTR *r);
-_PUBLIC_ void ndr_print_PAC_LOGON_INFO_CTR(struct ndr_print *ndr, const char *name, const struct PAC_LOGON_INFO_CTR *r);
-_PUBLIC_ enum ndr_err_code ndr_push_PAC_TYPE(struct ndr_push *ndr, int ndr_flags, enum PAC_TYPE r);
-_PUBLIC_ enum ndr_err_code ndr_pull_PAC_TYPE(struct ndr_pull *ndr, int ndr_flags, enum PAC_TYPE *r);
-_PUBLIC_ void ndr_print_PAC_TYPE(struct ndr_print *ndr, const char *name, enum PAC_TYPE r);
-_PUBLIC_ void ndr_print_DATA_BLOB_REM(struct ndr_print *ndr, const char *name, const struct DATA_BLOB_REM *r);
-_PUBLIC_ enum ndr_err_code ndr_push_PAC_INFO(struct ndr_push *ndr, int ndr_flags, const union PAC_INFO *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_PAC_INFO(struct ndr_pull *ndr, int ndr_flags, union PAC_INFO *r);
-_PUBLIC_ void ndr_print_PAC_INFO(struct ndr_print *ndr, const char *name, const union PAC_INFO *r);
-_PUBLIC_ size_t ndr_size_PAC_INFO(const union PAC_INFO *r, uint32_t level, int flags);
-_PUBLIC_ enum ndr_err_code ndr_push_PAC_DATA(struct ndr_push *ndr, int ndr_flags, const struct PAC_DATA *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_PAC_DATA(struct ndr_pull *ndr, int ndr_flags, struct PAC_DATA *r);
-_PUBLIC_ void ndr_print_PAC_DATA(struct ndr_print *ndr, const char *name, const struct PAC_DATA *r);
-_PUBLIC_ enum ndr_err_code ndr_push_PAC_BUFFER_RAW(struct ndr_push *ndr, int ndr_flags, const struct PAC_BUFFER_RAW *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_PAC_BUFFER_RAW(struct ndr_pull *ndr, int ndr_flags, struct PAC_BUFFER_RAW *r);
-_PUBLIC_ void ndr_print_PAC_BUFFER_RAW(struct ndr_print *ndr, const char *name, const struct PAC_BUFFER_RAW *r);
-_PUBLIC_ enum ndr_err_code ndr_push_PAC_DATA_RAW(struct ndr_push *ndr, int ndr_flags, const struct PAC_DATA_RAW *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_PAC_DATA_RAW(struct ndr_pull *ndr, int ndr_flags, struct PAC_DATA_RAW *r);
-_PUBLIC_ void ndr_print_PAC_DATA_RAW(struct ndr_print *ndr, const char *name, const struct PAC_DATA_RAW *r);
-_PUBLIC_ enum ndr_err_code ndr_push_netsamlogoncache_entry(struct ndr_push *ndr, int ndr_flags, const struct netsamlogoncache_entry *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_netsamlogoncache_entry(struct ndr_pull *ndr, int ndr_flags, struct netsamlogoncache_entry *r);
-_PUBLIC_ void ndr_print_netsamlogoncache_entry(struct ndr_print *ndr, const char *name, const struct netsamlogoncache_entry *r);
-_PUBLIC_ void ndr_print_decode_pac(struct ndr_print *ndr, const char *name, int flags, const struct decode_pac *r);
-_PUBLIC_ void ndr_print_decode_pac_raw(struct ndr_print *ndr, const char *name, int flags, const struct decode_pac_raw *r);
-_PUBLIC_ void ndr_print_decode_login_info(struct ndr_print *ndr, const char *name, int flags, const struct decode_login_info *r);
-
-/* The following definitions come from librpc/gen_ndr/ndr_lsa.c */
-
-_PUBLIC_ enum ndr_err_code ndr_push_lsa_String(struct ndr_push *ndr, int ndr_flags, const struct lsa_String *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_lsa_String(struct ndr_pull *ndr, int ndr_flags, struct lsa_String *r);
-_PUBLIC_ void ndr_print_lsa_String(struct ndr_print *ndr, const char *name, const struct lsa_String *r);
-_PUBLIC_ enum ndr_err_code ndr_push_lsa_StringLarge(struct ndr_push *ndr, int ndr_flags, const struct lsa_StringLarge *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_lsa_StringLarge(struct ndr_pull *ndr, int ndr_flags, struct lsa_StringLarge *r);
-_PUBLIC_ void ndr_print_lsa_StringLarge(struct ndr_print *ndr, const char *name, const struct lsa_StringLarge *r);
-_PUBLIC_ enum ndr_err_code ndr_push_lsa_Strings(struct ndr_push *ndr, int ndr_flags, const struct lsa_Strings *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_lsa_Strings(struct ndr_pull *ndr, int ndr_flags, struct lsa_Strings *r);
-_PUBLIC_ void ndr_print_lsa_Strings(struct ndr_print *ndr, const char *name, const struct lsa_Strings *r);
-_PUBLIC_ enum ndr_err_code ndr_push_lsa_AsciiString(struct ndr_push *ndr, int ndr_flags, const struct lsa_AsciiString *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_lsa_AsciiString(struct ndr_pull *ndr, int ndr_flags, struct lsa_AsciiString *r);
-_PUBLIC_ void ndr_print_lsa_AsciiString(struct ndr_print *ndr, const char *name, const struct lsa_AsciiString *r);
-_PUBLIC_ enum ndr_err_code ndr_push_lsa_AsciiStringLarge(struct ndr_push *ndr, int ndr_flags, const struct lsa_AsciiStringLarge *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_lsa_AsciiStringLarge(struct ndr_pull *ndr, int ndr_flags, struct lsa_AsciiStringLarge *r);
-_PUBLIC_ void ndr_print_lsa_AsciiStringLarge(struct ndr_print *ndr, const char *name, const struct lsa_AsciiStringLarge *r);
-_PUBLIC_ enum ndr_err_code ndr_push_lsa_BinaryString(struct ndr_push *ndr, int ndr_flags, const struct lsa_BinaryString *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_lsa_BinaryString(struct ndr_pull *ndr, int ndr_flags, struct lsa_BinaryString *r);
-_PUBLIC_ void ndr_print_lsa_BinaryString(struct ndr_print *ndr, const char *name, const struct lsa_BinaryString *r);
-_PUBLIC_ void ndr_print_lsa_LUID(struct ndr_print *ndr, const char *name, const struct lsa_LUID *r);
-_PUBLIC_ void ndr_print_lsa_PrivEntry(struct ndr_print *ndr, const char *name, const struct lsa_PrivEntry *r);
-_PUBLIC_ void ndr_print_lsa_PrivArray(struct ndr_print *ndr, const char *name, const struct lsa_PrivArray *r);
-_PUBLIC_ void ndr_print_lsa_QosInfo(struct ndr_print *ndr, const char *name, const struct lsa_QosInfo *r);
-_PUBLIC_ void ndr_print_lsa_ObjectAttribute(struct ndr_print *ndr, const char *name, const struct lsa_ObjectAttribute *r);
-_PUBLIC_ enum ndr_err_code ndr_push_lsa_PolicyAccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r);
-_PUBLIC_ enum ndr_err_code ndr_pull_lsa_PolicyAccessMask(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
-_PUBLIC_ void ndr_print_lsa_PolicyAccessMask(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_lsa_AuditLogInfo(struct ndr_print *ndr, const char *name, const struct lsa_AuditLogInfo *r);
-_PUBLIC_ void ndr_print_lsa_PolicyAuditPolicy(struct ndr_print *ndr, const char *name, enum lsa_PolicyAuditPolicy r);
-_PUBLIC_ void ndr_print_lsa_AuditEventsInfo(struct ndr_print *ndr, const char *name, const struct lsa_AuditEventsInfo *r);
-_PUBLIC_ void ndr_print_lsa_DomainInfo(struct ndr_print *ndr, const char *name, const struct lsa_DomainInfo *r);
-_PUBLIC_ void ndr_print_lsa_PDAccountInfo(struct ndr_print *ndr, const char *name, const struct lsa_PDAccountInfo *r);
-_PUBLIC_ void ndr_print_lsa_ServerRole(struct ndr_print *ndr, const char *name, const struct lsa_ServerRole *r);
-_PUBLIC_ void ndr_print_lsa_ReplicaSourceInfo(struct ndr_print *ndr, const char *name, const struct lsa_ReplicaSourceInfo *r);
-_PUBLIC_ void ndr_print_lsa_DefaultQuotaInfo(struct ndr_print *ndr, const char *name, const struct lsa_DefaultQuotaInfo *r);
-_PUBLIC_ void ndr_print_lsa_ModificationInfo(struct ndr_print *ndr, const char *name, const struct lsa_ModificationInfo *r);
-_PUBLIC_ void ndr_print_lsa_AuditFullSetInfo(struct ndr_print *ndr, const char *name, const struct lsa_AuditFullSetInfo *r);
-_PUBLIC_ void ndr_print_lsa_AuditFullQueryInfo(struct ndr_print *ndr, const char *name, const struct lsa_AuditFullQueryInfo *r);
-_PUBLIC_ void ndr_print_lsa_DnsDomainInfo(struct ndr_print *ndr, const char *name, const struct lsa_DnsDomainInfo *r);
-_PUBLIC_ void ndr_print_lsa_PolicyInfo(struct ndr_print *ndr, const char *name, enum lsa_PolicyInfo r);
-_PUBLIC_ void ndr_print_lsa_PolicyInformation(struct ndr_print *ndr, const char *name, const union lsa_PolicyInformation *r);
-_PUBLIC_ void ndr_print_lsa_SidPtr(struct ndr_print *ndr, const char *name, const struct lsa_SidPtr *r);
-_PUBLIC_ enum ndr_err_code ndr_push_lsa_SidArray(struct ndr_push *ndr, int ndr_flags, const struct lsa_SidArray *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_lsa_SidArray(struct ndr_pull *ndr, int ndr_flags, struct lsa_SidArray *r);
-_PUBLIC_ void ndr_print_lsa_SidArray(struct ndr_print *ndr, const char *name, const struct lsa_SidArray *r);
-_PUBLIC_ void ndr_print_lsa_DomainList(struct ndr_print *ndr, const char *name, const struct lsa_DomainList *r);
-_PUBLIC_ void ndr_print_lsa_SidType(struct ndr_print *ndr, const char *name, enum lsa_SidType r);
-_PUBLIC_ void ndr_print_lsa_TranslatedSid(struct ndr_print *ndr, const char *name, const struct lsa_TranslatedSid *r);
-_PUBLIC_ void ndr_print_lsa_TransSidArray(struct ndr_print *ndr, const char *name, const struct lsa_TransSidArray *r);
-_PUBLIC_ void ndr_print_lsa_RefDomainList(struct ndr_print *ndr, const char *name, const struct lsa_RefDomainList *r);
-_PUBLIC_ void ndr_print_lsa_LookupNamesLevel(struct ndr_print *ndr, const char *name, enum lsa_LookupNamesLevel r);
-_PUBLIC_ void ndr_print_lsa_TranslatedName(struct ndr_print *ndr, const char *name, const struct lsa_TranslatedName *r);
-_PUBLIC_ void ndr_print_lsa_TransNameArray(struct ndr_print *ndr, const char *name, const struct lsa_TransNameArray *r);
-_PUBLIC_ void ndr_print_lsa_LUIDAttribute(struct ndr_print *ndr, const char *name, const struct lsa_LUIDAttribute *r);
-_PUBLIC_ void ndr_print_lsa_PrivilegeSet(struct ndr_print *ndr, const char *name, const struct lsa_PrivilegeSet *r);
-_PUBLIC_ void ndr_print_lsa_DATA_BUF(struct ndr_print *ndr, const char *name, const struct lsa_DATA_BUF *r);
-_PUBLIC_ void ndr_print_lsa_DATA_BUF2(struct ndr_print *ndr, const char *name, const struct lsa_DATA_BUF2 *r);
-_PUBLIC_ void ndr_print_lsa_TrustDomInfoEnum(struct ndr_print *ndr, const char *name, enum lsa_TrustDomInfoEnum r);
-_PUBLIC_ void ndr_print_lsa_TrustDomainInfoName(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoName *r);
-_PUBLIC_ void ndr_print_lsa_TrustDomainInfoPosixOffset(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoPosixOffset *r);
-_PUBLIC_ void ndr_print_lsa_TrustDomainInfoPassword(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoPassword *r);
-_PUBLIC_ void ndr_print_lsa_TrustDomainInfoBasic(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoBasic *r);
-_PUBLIC_ void ndr_print_lsa_TrustDomainInfoInfoEx(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoInfoEx *r);
-_PUBLIC_ void ndr_print_lsa_TrustDomainInfoBuffer(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoBuffer *r);
-_PUBLIC_ void ndr_print_lsa_TrustDomainInfoAuthInfo(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoAuthInfo *r);
-_PUBLIC_ void ndr_print_lsa_TrustDomainInfoFullInfo(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoFullInfo *r);
-_PUBLIC_ void ndr_print_lsa_TrustDomainInfo11(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfo11 *r);
-_PUBLIC_ void ndr_print_lsa_TrustDomainInfoInfoAll(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoInfoAll *r);
-_PUBLIC_ void ndr_print_lsa_TrustedDomainInfo(struct ndr_print *ndr, const char *name, const union lsa_TrustedDomainInfo *r);
-_PUBLIC_ void ndr_print_lsa_DATA_BUF_PTR(struct ndr_print *ndr, const char *name, const struct lsa_DATA_BUF_PTR *r);
-_PUBLIC_ void ndr_print_lsa_RightSet(struct ndr_print *ndr, const char *name, const struct lsa_RightSet *r);
-_PUBLIC_ void ndr_print_lsa_DomainListEx(struct ndr_print *ndr, const char *name, const struct lsa_DomainListEx *r);
-_PUBLIC_ void ndr_print_lsa_DomainInfoKerberos(struct ndr_print *ndr, const char *name, const struct lsa_DomainInfoKerberos *r);
-_PUBLIC_ void ndr_print_lsa_DomainInfoEfs(struct ndr_print *ndr, const char *name, const struct lsa_DomainInfoEfs *r);
-_PUBLIC_ void ndr_print_lsa_DomainInformationPolicy(struct ndr_print *ndr, const char *name, const union lsa_DomainInformationPolicy *r);
-_PUBLIC_ void ndr_print_lsa_TranslatedName2(struct ndr_print *ndr, const char *name, const struct lsa_TranslatedName2 *r);
-_PUBLIC_ void ndr_print_lsa_TransNameArray2(struct ndr_print *ndr, const char *name, const struct lsa_TransNameArray2 *r);
-_PUBLIC_ void ndr_print_lsa_TranslatedSid2(struct ndr_print *ndr, const char *name, const struct lsa_TranslatedSid2 *r);
-_PUBLIC_ void ndr_print_lsa_TransSidArray2(struct ndr_print *ndr, const char *name, const struct lsa_TransSidArray2 *r);
-_PUBLIC_ void ndr_print_lsa_TranslatedSid3(struct ndr_print *ndr, const char *name, const struct lsa_TranslatedSid3 *r);
-_PUBLIC_ void ndr_print_lsa_TransSidArray3(struct ndr_print *ndr, const char *name, const struct lsa_TransSidArray3 *r);
-_PUBLIC_ void ndr_print_lsa_ForestTrustBinaryData(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustBinaryData *r);
-_PUBLIC_ void ndr_print_lsa_ForestTrustDomainInfo(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustDomainInfo *r);
-_PUBLIC_ void ndr_print_lsa_ForestTrustData(struct ndr_print *ndr, const char *name, const union lsa_ForestTrustData *r);
-_PUBLIC_ void ndr_print_lsa_ForestTrustRecordType(struct ndr_print *ndr, const char *name, enum lsa_ForestTrustRecordType r);
-_PUBLIC_ void ndr_print_lsa_ForestTrustRecord(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustRecord *r);
-_PUBLIC_ enum ndr_err_code ndr_push_lsa_ForestTrustInformation(struct ndr_push *ndr, int ndr_flags, const struct lsa_ForestTrustInformation *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_lsa_ForestTrustInformation(struct ndr_pull *ndr, int ndr_flags, struct lsa_ForestTrustInformation *r);
-_PUBLIC_ void ndr_print_lsa_ForestTrustInformation(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustInformation *r);
-_PUBLIC_ void ndr_print_lsa_Close(struct ndr_print *ndr, const char *name, int flags, const struct lsa_Close *r);
-_PUBLIC_ 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_pull_lsa_Delete(struct ndr_pull *ndr, int flags, struct lsa_Delete *r);
-_PUBLIC_ void ndr_print_lsa_Delete(struct ndr_print *ndr, const char *name, int flags, const struct lsa_Delete *r);
-_PUBLIC_ 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_pull_lsa_EnumPrivs(struct ndr_pull *ndr, int flags, struct lsa_EnumPrivs *r);
-_PUBLIC_ void ndr_print_lsa_EnumPrivs(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumPrivs *r);
-_PUBLIC_ void ndr_print_lsa_QuerySecurity(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QuerySecurity *r);
-_PUBLIC_ void ndr_print_lsa_SetSecObj(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetSecObj *r);
-_PUBLIC_ void ndr_print_lsa_ChangePassword(struct ndr_print *ndr, const char *name, int flags, const struct lsa_ChangePassword *r);
-_PUBLIC_ 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_pull_lsa_OpenPolicy(struct ndr_pull *ndr, int flags, struct lsa_OpenPolicy *r);
-_PUBLIC_ void ndr_print_lsa_OpenPolicy(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenPolicy *r);
-_PUBLIC_ void ndr_print_lsa_QueryInfoPolicy(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QueryInfoPolicy *r);
-_PUBLIC_ void ndr_print_lsa_SetInfoPolicy(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetInfoPolicy *r);
-_PUBLIC_ void ndr_print_lsa_ClearAuditLog(struct ndr_print *ndr, const char *name, int flags, const struct lsa_ClearAuditLog *r);
-_PUBLIC_ 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_pull_lsa_CreateAccount(struct ndr_pull *ndr, int flags, struct lsa_CreateAccount *r);
-_PUBLIC_ void ndr_print_lsa_CreateAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CreateAccount *r);
-_PUBLIC_ 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_pull_lsa_EnumAccounts(struct ndr_pull *ndr, int flags, struct lsa_EnumAccounts *r);
-_PUBLIC_ void ndr_print_lsa_EnumAccounts(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumAccounts *r);
-_PUBLIC_ 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_pull_lsa_CreateTrustedDomain(struct ndr_pull *ndr, int flags, struct lsa_CreateTrustedDomain *r);
-_PUBLIC_ void ndr_print_lsa_CreateTrustedDomain(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CreateTrustedDomain *r);
-_PUBLIC_ void ndr_print_lsa_EnumTrustDom(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumTrustDom *r);
-_PUBLIC_ 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_pull_lsa_LookupNames(struct ndr_pull *ndr, int flags, struct lsa_LookupNames *r);
-_PUBLIC_ void ndr_print_lsa_LookupNames(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupNames *r);
-_PUBLIC_ 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_pull_lsa_LookupSids(struct ndr_pull *ndr, int flags, struct lsa_LookupSids *r);
-_PUBLIC_ void ndr_print_lsa_LookupSids(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupSids *r);
-_PUBLIC_ 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_pull_lsa_CreateSecret(struct ndr_pull *ndr, int flags, struct lsa_CreateSecret *r);
-_PUBLIC_ void ndr_print_lsa_CreateSecret(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CreateSecret *r);
-_PUBLIC_ void ndr_print_lsa_OpenAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenAccount *r);
-_PUBLIC_ void ndr_print_lsa_EnumPrivsAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumPrivsAccount *r);
-_PUBLIC_ void ndr_print_lsa_AddPrivilegesToAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_AddPrivilegesToAccount *r);
-_PUBLIC_ void ndr_print_lsa_RemovePrivilegesFromAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_RemovePrivilegesFromAccount *r);
-_PUBLIC_ void ndr_print_lsa_GetQuotasForAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_GetQuotasForAccount *r);
-_PUBLIC_ void ndr_print_lsa_SetQuotasForAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetQuotasForAccount *r);
-_PUBLIC_ void ndr_print_lsa_GetSystemAccessAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_GetSystemAccessAccount *r);
-_PUBLIC_ void ndr_print_lsa_SetSystemAccessAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetSystemAccessAccount *r);
-_PUBLIC_ void ndr_print_lsa_OpenTrustedDomain(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenTrustedDomain *r);
-_PUBLIC_ void ndr_print_lsa_QueryTrustedDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QueryTrustedDomainInfo *r);
-_PUBLIC_ void ndr_print_lsa_SetInformationTrustedDomain(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetInformationTrustedDomain *r);
-_PUBLIC_ 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_pull_lsa_OpenSecret(struct ndr_pull *ndr, int flags, struct lsa_OpenSecret *r);
-_PUBLIC_ void ndr_print_lsa_OpenSecret(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenSecret *r);
-_PUBLIC_ 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_pull_lsa_SetSecret(struct ndr_pull *ndr, int flags, struct lsa_SetSecret *r);
-_PUBLIC_ void ndr_print_lsa_SetSecret(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetSecret *r);
-_PUBLIC_ 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_pull_lsa_QuerySecret(struct ndr_pull *ndr, int flags, struct lsa_QuerySecret *r);
-_PUBLIC_ void ndr_print_lsa_QuerySecret(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QuerySecret *r);
-_PUBLIC_ void ndr_print_lsa_LookupPrivValue(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupPrivValue *r);
-_PUBLIC_ void ndr_print_lsa_LookupPrivName(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupPrivName *r);
-_PUBLIC_ void ndr_print_lsa_LookupPrivDisplayName(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupPrivDisplayName *r);
-_PUBLIC_ void ndr_print_lsa_DeleteObject(struct ndr_print *ndr, const char *name, int flags, const struct lsa_DeleteObject *r);
-_PUBLIC_ void ndr_print_lsa_EnumAccountsWithUserRight(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumAccountsWithUserRight *r);
-_PUBLIC_ void ndr_print_lsa_EnumAccountRights(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumAccountRights *r);
-_PUBLIC_ void ndr_print_lsa_AddAccountRights(struct ndr_print *ndr, const char *name, int flags, const struct lsa_AddAccountRights *r);
-_PUBLIC_ void ndr_print_lsa_RemoveAccountRights(struct ndr_print *ndr, const char *name, int flags, const struct lsa_RemoveAccountRights *r);
-_PUBLIC_ void ndr_print_lsa_QueryTrustedDomainInfoBySid(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QueryTrustedDomainInfoBySid *r);
-_PUBLIC_ void ndr_print_lsa_SetTrustedDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetTrustedDomainInfo *r);
-_PUBLIC_ void ndr_print_lsa_DeleteTrustedDomain(struct ndr_print *ndr, const char *name, int flags, const struct lsa_DeleteTrustedDomain *r);
-_PUBLIC_ void ndr_print_lsa_StorePrivateData(struct ndr_print *ndr, const char *name, int flags, const struct lsa_StorePrivateData *r);
-_PUBLIC_ void ndr_print_lsa_RetrievePrivateData(struct ndr_print *ndr, const char *name, int flags, const struct lsa_RetrievePrivateData *r);
-_PUBLIC_ 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_pull_lsa_OpenPolicy2(struct ndr_pull *ndr, int flags, struct lsa_OpenPolicy2 *r);
-_PUBLIC_ void ndr_print_lsa_OpenPolicy2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenPolicy2 *r);
-_PUBLIC_ void ndr_print_lsa_GetUserName(struct ndr_print *ndr, const char *name, int flags, const struct lsa_GetUserName *r);
-_PUBLIC_ void ndr_print_lsa_QueryInfoPolicy2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QueryInfoPolicy2 *r);
-_PUBLIC_ void ndr_print_lsa_SetInfoPolicy2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetInfoPolicy2 *r);
-_PUBLIC_ void ndr_print_lsa_QueryTrustedDomainInfoByName(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QueryTrustedDomainInfoByName *r);
-_PUBLIC_ void ndr_print_lsa_SetTrustedDomainInfoByName(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetTrustedDomainInfoByName *r);
-_PUBLIC_ void ndr_print_lsa_EnumTrustedDomainsEx(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumTrustedDomainsEx *r);
-_PUBLIC_ void ndr_print_lsa_CreateTrustedDomainEx(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CreateTrustedDomainEx *r);
-_PUBLIC_ void ndr_print_lsa_CloseTrustedDomainEx(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CloseTrustedDomainEx *r);
-_PUBLIC_ void ndr_print_lsa_QueryDomainInformationPolicy(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QueryDomainInformationPolicy *r);
-_PUBLIC_ void ndr_print_lsa_SetDomainInformationPolicy(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetDomainInformationPolicy *r);
-_PUBLIC_ void ndr_print_lsa_OpenTrustedDomainByName(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenTrustedDomainByName *r);
-_PUBLIC_ void ndr_print_lsa_TestCall(struct ndr_print *ndr, const char *name, int flags, const struct lsa_TestCall *r);
-_PUBLIC_ 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_pull_lsa_LookupSids2(struct ndr_pull *ndr, int flags, struct lsa_LookupSids2 *r);
-_PUBLIC_ void ndr_print_lsa_LookupSids2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupSids2 *r);
-_PUBLIC_ 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_pull_lsa_LookupNames2(struct ndr_pull *ndr, int flags, struct lsa_LookupNames2 *r);
-_PUBLIC_ void ndr_print_lsa_LookupNames2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupNames2 *r);
-_PUBLIC_ void ndr_print_lsa_CreateTrustedDomainEx2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CreateTrustedDomainEx2 *r);
-_PUBLIC_ void ndr_print_lsa_CREDRWRITE(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRWRITE *r);
-_PUBLIC_ void ndr_print_lsa_CREDRREAD(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRREAD *r);
-_PUBLIC_ void ndr_print_lsa_CREDRENUMERATE(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRENUMERATE *r);
-_PUBLIC_ void ndr_print_lsa_CREDRWRITEDOMAINCREDENTIALS(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRWRITEDOMAINCREDENTIALS *r);
-_PUBLIC_ void ndr_print_lsa_CREDRREADDOMAINCREDENTIALS(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRREADDOMAINCREDENTIALS *r);
-_PUBLIC_ void ndr_print_lsa_CREDRDELETE(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRDELETE *r);
-_PUBLIC_ void ndr_print_lsa_CREDRGETTARGETINFO(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRGETTARGETINFO *r);
-_PUBLIC_ void ndr_print_lsa_CREDRPROFILELOADED(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRPROFILELOADED *r);
-_PUBLIC_ 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_pull_lsa_LookupNames3(struct ndr_pull *ndr, int flags, struct lsa_LookupNames3 *r);
-_PUBLIC_ void ndr_print_lsa_LookupNames3(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupNames3 *r);
-_PUBLIC_ void ndr_print_lsa_CREDRGETSESSIONTYPES(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRGETSESSIONTYPES *r);
-_PUBLIC_ void ndr_print_lsa_LSARREGISTERAUDITEVENT(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARREGISTERAUDITEVENT *r);
-_PUBLIC_ void ndr_print_lsa_LSARGENAUDITEVENT(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARGENAUDITEVENT *r);
-_PUBLIC_ void ndr_print_lsa_LSARUNREGISTERAUDITEVENT(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARUNREGISTERAUDITEVENT *r);
-_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_LSARSETFORESTTRUSTINFORMATION(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARSETFORESTTRUSTINFORMATION *r);
-_PUBLIC_ void ndr_print_lsa_CREDRRENAME(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRRENAME *r);
-_PUBLIC_ 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_pull_lsa_LookupSids3(struct ndr_pull *ndr, int flags, struct lsa_LookupSids3 *r);
-_PUBLIC_ void ndr_print_lsa_LookupSids3(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupSids3 *r);
-_PUBLIC_ void ndr_print_lsa_LookupNames4(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupNames4 *r);
-_PUBLIC_ void ndr_print_lsa_LSAROPENPOLICYSCE(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSAROPENPOLICYSCE *r);
-_PUBLIC_ void ndr_print_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARADTREGISTERSECURITYEVENTSOURCE *r);
-_PUBLIC_ void ndr_print_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE *r);
-_PUBLIC_ void ndr_print_lsa_LSARADTREPORTSECURITYEVENT(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARADTREPORTSECURITYEVENT *r);
-
-/* The following definitions come from librpc/gen_ndr/ndr_misc.c */
-
-_PUBLIC_ enum ndr_err_code ndr_push_GUID(struct ndr_push *ndr, int ndr_flags, const struct GUID *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_GUID(struct ndr_pull *ndr, int ndr_flags, struct GUID *r);
-_PUBLIC_ size_t ndr_size_GUID(const struct GUID *r, int flags);
-_PUBLIC_ enum ndr_err_code ndr_push_ndr_syntax_id(struct ndr_push *ndr, int ndr_flags, const struct ndr_syntax_id *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_ndr_syntax_id(struct ndr_pull *ndr, int ndr_flags, struct ndr_syntax_id *r);
-_PUBLIC_ void ndr_print_ndr_syntax_id(struct ndr_print *ndr, const char *name, const struct ndr_syntax_id *r);
-_PUBLIC_ enum ndr_err_code ndr_push_policy_handle(struct ndr_push *ndr, int ndr_flags, const struct policy_handle *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_policy_handle(struct ndr_pull *ndr, int ndr_flags, struct policy_handle *r);
-_PUBLIC_ void ndr_print_policy_handle(struct ndr_print *ndr, const char *name, const struct policy_handle *r);
-_PUBLIC_ enum ndr_err_code ndr_push_netr_SchannelType(struct ndr_push *ndr, int ndr_flags, enum netr_SchannelType r);
-_PUBLIC_ enum ndr_err_code ndr_pull_netr_SchannelType(struct ndr_pull *ndr, int ndr_flags, enum netr_SchannelType *r);
-_PUBLIC_ void ndr_print_netr_SchannelType(struct ndr_print *ndr, const char *name, enum netr_SchannelType r);
-_PUBLIC_ enum ndr_err_code ndr_push_netr_SamDatabaseID(struct ndr_push *ndr, int ndr_flags, enum netr_SamDatabaseID r);
-_PUBLIC_ enum ndr_err_code ndr_pull_netr_SamDatabaseID(struct ndr_pull *ndr, int ndr_flags, enum netr_SamDatabaseID *r);
-_PUBLIC_ void ndr_print_netr_SamDatabaseID(struct ndr_print *ndr, const char *name, enum netr_SamDatabaseID r);
-_PUBLIC_ enum ndr_err_code ndr_push_samr_RejectReason(struct ndr_push *ndr, int ndr_flags, enum samr_RejectReason r);
-_PUBLIC_ enum ndr_err_code ndr_pull_samr_RejectReason(struct ndr_pull *ndr, int ndr_flags, enum samr_RejectReason *r);
-_PUBLIC_ void ndr_print_samr_RejectReason(struct ndr_print *ndr, const char *name, enum samr_RejectReason r);
-
-/* The following definitions come from librpc/gen_ndr/ndr_nbt.c */
-
-_PUBLIC_ void ndr_print_nbt_operation(struct ndr_print *ndr, const char *name, uint16_t r);
-_PUBLIC_ void ndr_print_nbt_name_type(struct ndr_print *ndr, const char *name, enum nbt_name_type r);
-_PUBLIC_ void ndr_print_nbt_name(struct ndr_print *ndr, const char *name, const struct nbt_name *r);
-_PUBLIC_ void ndr_print_nbt_qclass(struct ndr_print *ndr, const char *name, enum nbt_qclass r);
-_PUBLIC_ void ndr_print_nbt_qtype(struct ndr_print *ndr, const char *name, enum nbt_qtype r);
-_PUBLIC_ void ndr_print_nbt_name_question(struct ndr_print *ndr, const char *name, const struct nbt_name_question *r);
-_PUBLIC_ void ndr_print_nb_flags(struct ndr_print *ndr, const char *name, uint16_t r);
-_PUBLIC_ void ndr_print_nbt_rdata_address(struct ndr_print *ndr, const char *name, const struct nbt_rdata_address *r);
-_PUBLIC_ void ndr_print_nbt_rdata_netbios(struct ndr_print *ndr, const char *name, const struct nbt_rdata_netbios *r);
-_PUBLIC_ void ndr_print_nbt_statistics(struct ndr_print *ndr, const char *name, const struct nbt_statistics *r);
-_PUBLIC_ void ndr_print_nbt_status_name(struct ndr_print *ndr, const char *name, const struct nbt_status_name *r);
-_PUBLIC_ void ndr_print_nbt_rdata_status(struct ndr_print *ndr, const char *name, const struct nbt_rdata_status *r);
-_PUBLIC_ void ndr_print_nbt_rdata_data(struct ndr_print *ndr, const char *name, const struct nbt_rdata_data *r);
-_PUBLIC_ void ndr_print_nbt_rdata(struct ndr_print *ndr, const char *name, const union nbt_rdata *r);
-_PUBLIC_ void ndr_print_nbt_res_rec(struct ndr_print *ndr, const char *name, const struct nbt_res_rec *r);
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_name_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_name_packet *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_name_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_name_packet *r);
-_PUBLIC_ void ndr_print_nbt_name_packet(struct ndr_print *ndr, const char *name, const struct nbt_name_packet *r);
-_PUBLIC_ void ndr_print_dgram_msg_type(struct ndr_print *ndr, const char *name, enum dgram_msg_type r);
-_PUBLIC_ void ndr_print_dgram_flags(struct ndr_print *ndr, const char *name, uint8_t r);
-_PUBLIC_ void ndr_print_smb_command(struct ndr_print *ndr, const char *name, enum smb_command r);
-_PUBLIC_ void ndr_print_smb_trans_body(struct ndr_print *ndr, const char *name, const struct smb_trans_body *r);
-_PUBLIC_ void ndr_print_smb_body(struct ndr_print *ndr, const char *name, const union smb_body *r);
-_PUBLIC_ enum ndr_err_code ndr_push_dgram_smb_packet(struct ndr_push *ndr, int ndr_flags, const struct dgram_smb_packet *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_dgram_smb_packet(struct ndr_pull *ndr, int ndr_flags, struct dgram_smb_packet *r);
-_PUBLIC_ void ndr_print_dgram_smb_packet(struct ndr_print *ndr, const char *name, const struct dgram_smb_packet *r);
-_PUBLIC_ void ndr_print_dgram_message_body(struct ndr_print *ndr, const char *name, const union dgram_message_body *r);
-_PUBLIC_ void ndr_print_dgram_message(struct ndr_print *ndr, const char *name, const struct dgram_message *r);
-_PUBLIC_ void ndr_print_dgram_err_code(struct ndr_print *ndr, const char *name, enum dgram_err_code r);
-_PUBLIC_ void ndr_print_dgram_data(struct ndr_print *ndr, const char *name, const union dgram_data *r);
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_dgram_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_dgram_packet *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_dgram_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_dgram_packet *r);
-_PUBLIC_ void ndr_print_nbt_dgram_packet(struct ndr_print *ndr, const char *name, const struct nbt_dgram_packet *r);
-_PUBLIC_ void ndr_print_nbt_netlogon_command(struct ndr_print *ndr, const char *name, enum nbt_netlogon_command r);
-_PUBLIC_ void ndr_print_nbt_netlogon_version(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_nbt_netlogon_query_for_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_query_for_pdc *r);
-_PUBLIC_ void ndr_print_nbt_netlogon_query_for_pdc2(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_query_for_pdc2 *r);
-_PUBLIC_ void ndr_print_nbt_netlogon_response_from_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_response_from_pdc *r);
-_PUBLIC_ void ndr_print_nbt_server_type(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_nbt_dc_sock_addr(struct ndr_print *ndr, const char *name, const struct nbt_dc_sock_addr *r);
-_PUBLIC_ void ndr_print_nbt_netlogon_response_from_pdc2(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_response_from_pdc2 *r);
-_PUBLIC_ void ndr_print_nbt_db_change(struct ndr_print *ndr, const char *name, const struct nbt_db_change *r);
-_PUBLIC_ void ndr_print_nbt_netlogon_announce_uas(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_announce_uas *r);
-_PUBLIC_ void ndr_print_nbt_netlogon_request(struct ndr_print *ndr, const char *name, const union nbt_netlogon_request *r);
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_netlogon_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_packet *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_netlogon_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_packet *r);
-_PUBLIC_ void ndr_print_nbt_netlogon_packet(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_packet *r);
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon_1(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_1 *r);
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon_3(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_3 *r);
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_cldap_netlogon_5(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_5 *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_cldap_netlogon_5(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_5 *r);
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon_5(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_5 *r);
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon_13(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_13 *r);
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_cldap_netlogon_15(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_15 *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_cldap_netlogon_15(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_15 *r);
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon_15(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_15 *r);
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_cldap_netlogon_29(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_29 *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_cldap_netlogon_29(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_29 *r);
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon_29(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_29 *r);
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_cldap_netlogon(struct ndr_push *ndr, int ndr_flags, const union nbt_cldap_netlogon *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_cldap_netlogon(struct ndr_pull *ndr, int ndr_flags, union nbt_cldap_netlogon *r);
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon(struct ndr_print *ndr, const char *name, const union nbt_cldap_netlogon *r);
-_PUBLIC_ void ndr_print_nbt_ntlogon_command(struct ndr_print *ndr, const char *name, enum nbt_ntlogon_command r);
-_PUBLIC_ void ndr_print_nbt_ntlogon_sam_logon(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_sam_logon *r);
-_PUBLIC_ void ndr_print_nbt_ntlogon_sam_logon_reply(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_sam_logon_reply *r);
-_PUBLIC_ void ndr_print_nbt_ntlogon_request(struct ndr_print *ndr, const char *name, const union nbt_ntlogon_request *r);
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_ntlogon_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_ntlogon_packet *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_ntlogon_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_ntlogon_packet *r);
-_PUBLIC_ void ndr_print_nbt_ntlogon_packet(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_packet *r);
-_PUBLIC_ void ndr_print_nbt_browse_opcode(struct ndr_print *ndr, const char *name, enum nbt_browse_opcode r);
-_PUBLIC_ void ndr_print_nbt_browse_host_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_host_announcement *r);
-_PUBLIC_ void ndr_print_nbt_browse_announcement_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_announcement_request *r);
-_PUBLIC_ void ndr_print_nbt_browse_election_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_election_request *r);
-_PUBLIC_ void ndr_print_nbt_browse_backup_list_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_backup_list_request *r);
-_PUBLIC_ void ndr_print_nbt_browse_backup_list_response(struct ndr_print *ndr, const char *name, const struct nbt_browse_backup_list_response *r);
-_PUBLIC_ void ndr_print_nbt_browse_become_backup(struct ndr_print *ndr, const char *name, const struct nbt_browse_become_backup *r);
-_PUBLIC_ void ndr_print_nbt_browse_domain_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_domain_announcement *r);
-_PUBLIC_ void ndr_print_nbt_browse_master_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_master_announcement *r);
-_PUBLIC_ void ndr_print_nbt_browse_reset_state(struct ndr_print *ndr, const char *name, const struct nbt_browse_reset_state *r);
-_PUBLIC_ void ndr_print_nbt_browse_local_master_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_local_master_announcement *r);
-_PUBLIC_ void ndr_print_nbt_browse_payload(struct ndr_print *ndr, const char *name, const union nbt_browse_payload *r);
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_browse_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_browse_packet *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_browse_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_browse_packet *r);
-_PUBLIC_ void ndr_print_nbt_browse_packet(struct ndr_print *ndr, const char *name, const struct nbt_browse_packet *r);
-
-/* The following definitions come from librpc/gen_ndr/ndr_netlogon.c */
-
-_PUBLIC_ void ndr_print_netr_UasInfo(struct ndr_print *ndr, const char *name, const struct netr_UasInfo *r);
-_PUBLIC_ void ndr_print_netr_UasLogoffInfo(struct ndr_print *ndr, const char *name, const struct netr_UasLogoffInfo *r);
-_PUBLIC_ enum ndr_err_code ndr_push_netr_AcctLockStr(struct ndr_push *ndr, int ndr_flags, const struct netr_AcctLockStr *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_netr_AcctLockStr(struct ndr_pull *ndr, int ndr_flags, struct netr_AcctLockStr *r);
-_PUBLIC_ void ndr_print_netr_AcctLockStr(struct ndr_print *ndr, const char *name, const struct netr_AcctLockStr *r);
-_PUBLIC_ enum ndr_err_code ndr_push_netr_LogonParameterControl(struct ndr_push *ndr, int ndr_flags, uint32_t r);
-_PUBLIC_ enum ndr_err_code ndr_pull_netr_LogonParameterControl(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
-_PUBLIC_ void ndr_print_netr_LogonParameterControl(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_netr_IdentityInfo(struct ndr_print *ndr, const char *name, const struct netr_IdentityInfo *r);
-_PUBLIC_ void ndr_print_netr_PasswordInfo(struct ndr_print *ndr, const char *name, const struct netr_PasswordInfo *r);
-_PUBLIC_ void ndr_print_netr_ChallengeResponse(struct ndr_print *ndr, const char *name, const struct netr_ChallengeResponse *r);
-_PUBLIC_ void ndr_print_netr_NetworkInfo(struct ndr_print *ndr, const char *name, const struct netr_NetworkInfo *r);
-_PUBLIC_ enum ndr_err_code ndr_push_netr_LogonInfo(struct ndr_push *ndr, int ndr_flags, const union netr_LogonInfo *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_netr_LogonInfo(struct ndr_pull *ndr, int ndr_flags, union netr_LogonInfo *r);
-_PUBLIC_ void ndr_print_netr_LogonInfo(struct ndr_print *ndr, const char *name, const union netr_LogonInfo *r);
-_PUBLIC_ enum ndr_err_code ndr_push_netr_UserSessionKey(struct ndr_push *ndr, int ndr_flags, const struct netr_UserSessionKey *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_netr_UserSessionKey(struct ndr_pull *ndr, int ndr_flags, struct netr_UserSessionKey *r);
-_PUBLIC_ void ndr_print_netr_UserSessionKey(struct ndr_print *ndr, const char *name, const struct netr_UserSessionKey *r);
-_PUBLIC_ enum ndr_err_code ndr_push_netr_LMSessionKey(struct ndr_push *ndr, int ndr_flags, const struct netr_LMSessionKey *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_netr_LMSessionKey(struct ndr_pull *ndr, int ndr_flags, struct netr_LMSessionKey *r);
-_PUBLIC_ void ndr_print_netr_LMSessionKey(struct ndr_print *ndr, const char *name, const struct netr_LMSessionKey *r);
-_PUBLIC_ enum ndr_err_code ndr_push_netr_UserFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r);
-_PUBLIC_ enum ndr_err_code ndr_pull_netr_UserFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
-_PUBLIC_ void ndr_print_netr_UserFlags(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_netr_SamBaseInfo(struct ndr_print *ndr, const char *name, const struct netr_SamBaseInfo *r);
-_PUBLIC_ void ndr_print_netr_SamInfo2(struct ndr_print *ndr, const char *name, const struct netr_SamInfo2 *r);
-_PUBLIC_ void ndr_print_netr_SidAttr(struct ndr_print *ndr, const char *name, const struct netr_SidAttr *r);
-_PUBLIC_ enum ndr_err_code ndr_push_netr_SamInfo3(struct ndr_push *ndr, int ndr_flags, const struct netr_SamInfo3 *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_netr_SamInfo3(struct ndr_pull *ndr, int ndr_flags, struct netr_SamInfo3 *r);
-_PUBLIC_ void ndr_print_netr_SamInfo3(struct ndr_print *ndr, const char *name, const struct netr_SamInfo3 *r);
-_PUBLIC_ void ndr_print_netr_SamInfo6(struct ndr_print *ndr, const char *name, const struct netr_SamInfo6 *r);
-_PUBLIC_ void ndr_print_netr_PacInfo(struct ndr_print *ndr, const char *name, const struct netr_PacInfo *r);
-_PUBLIC_ enum ndr_err_code ndr_push_netr_Validation(struct ndr_push *ndr, int ndr_flags, const union netr_Validation *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_netr_Validation(struct ndr_pull *ndr, int ndr_flags, union netr_Validation *r);
-_PUBLIC_ void ndr_print_netr_Validation(struct ndr_print *ndr, const char *name, const union netr_Validation *r);
-_PUBLIC_ enum ndr_err_code ndr_push_netr_Credential(struct ndr_push *ndr, int ndr_flags, const struct netr_Credential *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_netr_Credential(struct ndr_pull *ndr, int ndr_flags, struct netr_Credential *r);
-_PUBLIC_ void ndr_print_netr_Credential(struct ndr_print *ndr, const char *name, const struct netr_Credential *r);
-_PUBLIC_ enum ndr_err_code ndr_push_netr_Authenticator(struct ndr_push *ndr, int ndr_flags, const struct netr_Authenticator *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_netr_Authenticator(struct ndr_pull *ndr, int ndr_flags, struct netr_Authenticator *r);
-_PUBLIC_ void ndr_print_netr_Authenticator(struct ndr_print *ndr, const char *name, const struct netr_Authenticator *r);
-_PUBLIC_ void ndr_print_netr_LogonLevel(struct ndr_print *ndr, const char *name, enum netr_LogonLevel r);
-_PUBLIC_ void ndr_print_netr_DELTA_DELETE_USER(struct ndr_print *ndr, const char *name, const struct netr_DELTA_DELETE_USER *r);
-_PUBLIC_ void ndr_print_netr_USER_KEY16(struct ndr_print *ndr, const char *name, const struct netr_USER_KEY16 *r);
-_PUBLIC_ void ndr_print_netr_PasswordHistory(struct ndr_print *ndr, const char *name, const struct netr_PasswordHistory *r);
-_PUBLIC_ void ndr_print_netr_USER_KEYS2(struct ndr_print *ndr, const char *name, const struct netr_USER_KEYS2 *r);
-_PUBLIC_ void ndr_print_netr_USER_KEY_UNION(struct ndr_print *ndr, const char *name, const struct netr_USER_KEY_UNION *r);
-_PUBLIC_ enum ndr_err_code ndr_push_netr_USER_KEYS(struct ndr_push *ndr, int ndr_flags, const struct netr_USER_KEYS *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_netr_USER_KEYS(struct ndr_pull *ndr, int ndr_flags, struct netr_USER_KEYS *r);
-_PUBLIC_ void ndr_print_netr_USER_KEYS(struct ndr_print *ndr, const char *name, const struct netr_USER_KEYS *r);
-_PUBLIC_ void ndr_print_netr_USER_PRIVATE_INFO(struct ndr_print *ndr, const char *name, const struct netr_USER_PRIVATE_INFO *r);
-_PUBLIC_ void ndr_print_netr_DELTA_USER(struct ndr_print *ndr, const char *name, const struct netr_DELTA_USER *r);
-_PUBLIC_ void ndr_print_netr_DELTA_DOMAIN(struct ndr_print *ndr, const char *name, const struct netr_DELTA_DOMAIN *r);
-_PUBLIC_ void ndr_print_netr_DELTA_GROUP(struct ndr_print *ndr, const char *name, const struct netr_DELTA_GROUP *r);
-_PUBLIC_ void ndr_print_netr_DELTA_RENAME(struct ndr_print *ndr, const char *name, const struct netr_DELTA_RENAME *r);
-_PUBLIC_ void ndr_print_netr_DELTA_GROUP_MEMBER(struct ndr_print *ndr, const char *name, const struct netr_DELTA_GROUP_MEMBER *r);
-_PUBLIC_ void ndr_print_netr_DELTA_ALIAS(struct ndr_print *ndr, const char *name, const struct netr_DELTA_ALIAS *r);
-_PUBLIC_ void ndr_print_netr_DELTA_ALIAS_MEMBER(struct ndr_print *ndr, const char *name, const struct netr_DELTA_ALIAS_MEMBER *r);
-_PUBLIC_ void ndr_print_netr_QUOTA_LIMITS(struct ndr_print *ndr, const char *name, const struct netr_QUOTA_LIMITS *r);
-_PUBLIC_ void ndr_print_netr_DELTA_POLICY(struct ndr_print *ndr, const char *name, const struct netr_DELTA_POLICY *r);
-_PUBLIC_ void ndr_print_netr_DELTA_TRUSTED_DOMAIN(struct ndr_print *ndr, const char *name, const struct netr_DELTA_TRUSTED_DOMAIN *r);
-_PUBLIC_ void ndr_print_netr_DELTA_DELETE_TRUST(struct ndr_print *ndr, const char *name, const struct netr_DELTA_DELETE_TRUST *r);
-_PUBLIC_ void ndr_print_netr_DELTA_ACCOUNT(struct ndr_print *ndr, const char *name, const struct netr_DELTA_ACCOUNT *r);
-_PUBLIC_ void ndr_print_netr_DELTA_DELETE_ACCOUNT(struct ndr_print *ndr, const char *name, const struct netr_DELTA_DELETE_ACCOUNT *r);
-_PUBLIC_ void ndr_print_netr_DELTA_DELETE_SECRET(struct ndr_print *ndr, const char *name, const struct netr_DELTA_DELETE_SECRET *r);
-_PUBLIC_ void ndr_print_netr_CIPHER_VALUE(struct ndr_print *ndr, const char *name, const struct netr_CIPHER_VALUE *r);
-_PUBLIC_ void ndr_print_netr_DELTA_SECRET(struct ndr_print *ndr, const char *name, const struct netr_DELTA_SECRET *r);
-_PUBLIC_ void ndr_print_netr_DeltaEnum(struct ndr_print *ndr, const char *name, enum netr_DeltaEnum r);
-_PUBLIC_ void ndr_print_netr_DELTA_UNION(struct ndr_print *ndr, const char *name, const union netr_DELTA_UNION *r);
-_PUBLIC_ void ndr_print_netr_DELTA_ID_UNION(struct ndr_print *ndr, const char *name, const union netr_DELTA_ID_UNION *r);
-_PUBLIC_ void ndr_print_netr_DELTA_ENUM(struct ndr_print *ndr, const char *name, const struct netr_DELTA_ENUM *r);
-_PUBLIC_ void ndr_print_netr_DELTA_ENUM_ARRAY(struct ndr_print *ndr, const char *name, const struct netr_DELTA_ENUM_ARRAY *r);
-_PUBLIC_ void ndr_print_netr_UAS_INFO_0(struct ndr_print *ndr, const char *name, const struct netr_UAS_INFO_0 *r);
-_PUBLIC_ void ndr_print_netr_AccountBuffer(struct ndr_print *ndr, const char *name, const struct netr_AccountBuffer *r);
-_PUBLIC_ void ndr_print_netr_InfoFlags(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_netr_NETLOGON_INFO_1(struct ndr_print *ndr, const char *name, const struct netr_NETLOGON_INFO_1 *r);
-_PUBLIC_ void ndr_print_netr_NETLOGON_INFO_2(struct ndr_print *ndr, const char *name, const struct netr_NETLOGON_INFO_2 *r);
-_PUBLIC_ void ndr_print_netr_NETLOGON_INFO_3(struct ndr_print *ndr, const char *name, const struct netr_NETLOGON_INFO_3 *r);
-_PUBLIC_ void ndr_print_netr_CONTROL_QUERY_INFORMATION(struct ndr_print *ndr, const char *name, const union netr_CONTROL_QUERY_INFORMATION *r);
-_PUBLIC_ void ndr_print_netr_LogonControlCode(struct ndr_print *ndr, const char *name, enum netr_LogonControlCode r);
-_PUBLIC_ void ndr_print_netr_CONTROL_DATA_INFORMATION(struct ndr_print *ndr, const char *name, const union netr_CONTROL_DATA_INFORMATION *r);
-_PUBLIC_ void ndr_print_netr_NegotiateFlags(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_netr_Blob(struct ndr_print *ndr, const char *name, const struct netr_Blob *r);
-_PUBLIC_ void ndr_print_netr_DsRGetDCName_flags(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_netr_DsRGetDCNameInfo_AddressType(struct ndr_print *ndr, const char *name, enum netr_DsRGetDCNameInfo_AddressType r);
-_PUBLIC_ void ndr_print_netr_DsR_DcFlags(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ enum ndr_err_code ndr_push_netr_DsRGetDCNameInfo(struct ndr_push *ndr, int ndr_flags, const struct netr_DsRGetDCNameInfo *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_netr_DsRGetDCNameInfo(struct ndr_pull *ndr, int ndr_flags, struct netr_DsRGetDCNameInfo *r);
-_PUBLIC_ void ndr_print_netr_DsRGetDCNameInfo(struct ndr_print *ndr, const char *name, const struct netr_DsRGetDCNameInfo *r);
-_PUBLIC_ void ndr_print_netr_BinaryString(struct ndr_print *ndr, const char *name, const struct netr_BinaryString *r);
-_PUBLIC_ void ndr_print_netr_DomainQuery1(struct ndr_print *ndr, const char *name, const struct netr_DomainQuery1 *r);
-_PUBLIC_ void ndr_print_netr_DomainQuery(struct ndr_print *ndr, const char *name, const union netr_DomainQuery *r);
-_PUBLIC_ void ndr_print_netr_DomainTrustInfo(struct ndr_print *ndr, const char *name, const struct netr_DomainTrustInfo *r);
-_PUBLIC_ void ndr_print_netr_DomainInfo1(struct ndr_print *ndr, const char *name, const struct netr_DomainInfo1 *r);
-_PUBLIC_ void ndr_print_netr_DomainInfo(struct ndr_print *ndr, const char *name, const union netr_DomainInfo *r);
-_PUBLIC_ void ndr_print_netr_CryptPassword(struct ndr_print *ndr, const char *name, const struct netr_CryptPassword *r);
-_PUBLIC_ void ndr_print_netr_DsRAddressToSitenamesWCtr(struct ndr_print *ndr, const char *name, const struct netr_DsRAddressToSitenamesWCtr *r);
-_PUBLIC_ void ndr_print_netr_DsRAddress(struct ndr_print *ndr, const char *name, const struct netr_DsRAddress *r);
-_PUBLIC_ void ndr_print_netr_TrustFlags(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_netr_TrustType(struct ndr_print *ndr, const char *name, enum netr_TrustType r);
-_PUBLIC_ void ndr_print_netr_TrustAttributes(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_netr_DomainTrust(struct ndr_print *ndr, const char *name, const struct netr_DomainTrust *r);
-_PUBLIC_ void ndr_print_netr_DomainTrustList(struct ndr_print *ndr, const char *name, const struct netr_DomainTrustList *r);
-_PUBLIC_ void ndr_print_netr_DsRAddressToSitenamesExWCtr(struct ndr_print *ndr, const char *name, const struct netr_DsRAddressToSitenamesExWCtr *r);
-_PUBLIC_ void ndr_print_DcSitesCtr(struct ndr_print *ndr, const char *name, const struct DcSitesCtr *r);
-_PUBLIC_ void ndr_print_netr_LogonUasLogon(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonUasLogon *r);
-_PUBLIC_ void ndr_print_netr_LogonUasLogoff(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonUasLogoff *r);
-_PUBLIC_ void ndr_print_netr_LogonSamLogon(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonSamLogon *r);
-_PUBLIC_ void ndr_print_netr_LogonSamLogoff(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonSamLogoff *r);
-_PUBLIC_ void ndr_print_netr_ServerReqChallenge(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerReqChallenge *r);
-_PUBLIC_ void ndr_print_netr_ServerAuthenticate(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerAuthenticate *r);
-_PUBLIC_ void ndr_print_netr_ServerPasswordSet(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerPasswordSet *r);
-_PUBLIC_ void ndr_print_netr_DatabaseDeltas(struct ndr_print *ndr, const char *name, int flags, const struct netr_DatabaseDeltas *r);
-_PUBLIC_ void ndr_print_netr_DatabaseSync(struct ndr_print *ndr, const char *name, int flags, const struct netr_DatabaseSync *r);
-_PUBLIC_ void ndr_print_netr_AccountDeltas(struct ndr_print *ndr, const char *name, int flags, const struct netr_AccountDeltas *r);
-_PUBLIC_ void ndr_print_netr_AccountSync(struct ndr_print *ndr, const char *name, int flags, const struct netr_AccountSync *r);
-_PUBLIC_ void ndr_print_netr_GetDcName(struct ndr_print *ndr, const char *name, int flags, const struct netr_GetDcName *r);
-_PUBLIC_ void ndr_print_netr_LogonControl(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonControl *r);
-_PUBLIC_ void ndr_print_netr_GetAnyDCName(struct ndr_print *ndr, const char *name, int flags, const struct netr_GetAnyDCName *r);
-_PUBLIC_ void ndr_print_netr_LogonControl2(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonControl2 *r);
-_PUBLIC_ void ndr_print_netr_ServerAuthenticate2(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerAuthenticate2 *r);
-_PUBLIC_ void ndr_print_netr_DatabaseSync2(struct ndr_print *ndr, const char *name, int flags, const struct netr_DatabaseSync2 *r);
-_PUBLIC_ void ndr_print_netr_DatabaseRedo(struct ndr_print *ndr, const char *name, int flags, const struct netr_DatabaseRedo *r);
-_PUBLIC_ void ndr_print_netr_LogonControl2Ex(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonControl2Ex *r);
-_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_DsRGetDCName(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetDCName *r);
-_PUBLIC_ void ndr_print_netr_NETRLOGONDUMMYROUTINE1(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONDUMMYROUTINE1 *r);
-_PUBLIC_ void ndr_print_netr_NETRLOGONSETSERVICEBITS(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONSETSERVICEBITS *r);
-_PUBLIC_ void ndr_print_netr_LogonGetTrustRid(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonGetTrustRid *r);
-_PUBLIC_ void ndr_print_netr_NETRLOGONCOMPUTESERVERDIGEST(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONCOMPUTESERVERDIGEST *r);
-_PUBLIC_ void ndr_print_netr_NETRLOGONCOMPUTECLIENTDIGEST(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r);
-_PUBLIC_ void ndr_print_netr_ServerAuthenticate3(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerAuthenticate3 *r);
-_PUBLIC_ void ndr_print_netr_DsRGetDCNameEx(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetDCNameEx *r);
-_PUBLIC_ void ndr_print_netr_DsRGetSiteName(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetSiteName *r);
-_PUBLIC_ void ndr_print_netr_LogonGetDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonGetDomainInfo *r);
-_PUBLIC_ void ndr_print_netr_ServerPasswordSet2(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerPasswordSet2 *r);
-_PUBLIC_ void ndr_print_netr_ServerPasswordGet(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerPasswordGet *r);
-_PUBLIC_ void ndr_print_netr_NETRLOGONSENDTOSAM(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONSENDTOSAM *r);
-_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_DsRGetDCNameEx2(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetDCNameEx2 *r);
-_PUBLIC_ void ndr_print_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r);
-_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_DsRAddressToSitenamesExW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRAddressToSitenamesExW *r);
-_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_LogonSamLogonEx(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonSamLogonEx *r);
-_PUBLIC_ void ndr_print_netr_DsrEnumerateDomainTrusts(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsrEnumerateDomainTrusts *r);
-_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_ServerTrustPasswordsGet(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerTrustPasswordsGet *r);
-_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_GetForestTrustInformation(struct ndr_print *ndr, const char *name, int flags, const struct netr_GetForestTrustInformation *r);
-_PUBLIC_ void ndr_print_netr_LogonSamLogonWithFlags(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonSamLogonWithFlags *r);
-_PUBLIC_ void ndr_print_netr_NETRSERVERGETTRUSTINFO(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRSERVERGETTRUSTINFO *r);
-
-/* The following definitions come from librpc/gen_ndr/ndr_notify.c */
-
-_PUBLIC_ enum ndr_err_code ndr_push_notify_entry(struct ndr_push *ndr, int ndr_flags, const struct notify_entry *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_notify_entry(struct ndr_pull *ndr, int ndr_flags, struct notify_entry *r);
-_PUBLIC_ void ndr_print_notify_entry(struct ndr_print *ndr, const char *name, const struct notify_entry *r);
-_PUBLIC_ void ndr_print_notify_depth(struct ndr_print *ndr, const char *name, const struct notify_depth *r);
-_PUBLIC_ enum ndr_err_code ndr_push_notify_array(struct ndr_push *ndr, int ndr_flags, const struct notify_array *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_notify_array(struct ndr_pull *ndr, int ndr_flags, struct notify_array *r);
-_PUBLIC_ void ndr_print_notify_array(struct ndr_print *ndr, const char *name, const struct notify_array *r);
-_PUBLIC_ enum ndr_err_code ndr_push_notify_event(struct ndr_push *ndr, int ndr_flags, const struct notify_event *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_notify_event(struct ndr_pull *ndr, int ndr_flags, struct notify_event *r);
-_PUBLIC_ void ndr_print_notify_event(struct ndr_print *ndr, const char *name, const struct notify_event *r);
-
-/* The following definitions come from librpc/gen_ndr/ndr_ntsvcs.c */
-
-_PUBLIC_ void ndr_print_PNP_HwProfInfo(struct ndr_print *ndr, const char *name, const struct PNP_HwProfInfo *r);
-_PUBLIC_ void ndr_print_PNP_Disconnect(struct ndr_print *ndr, const char *name, int flags, const struct PNP_Disconnect *r);
-_PUBLIC_ void ndr_print_PNP_Connect(struct ndr_print *ndr, const char *name, int flags, const struct PNP_Connect *r);
-_PUBLIC_ void ndr_print_PNP_GetVersion(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetVersion *r);
-_PUBLIC_ void ndr_print_PNP_GetGlobalState(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetGlobalState *r);
-_PUBLIC_ void ndr_print_PNP_InitDetection(struct ndr_print *ndr, const char *name, int flags, const struct PNP_InitDetection *r);
-_PUBLIC_ void ndr_print_PNP_ReportLogOn(struct ndr_print *ndr, const char *name, int flags, const struct PNP_ReportLogOn *r);
-_PUBLIC_ void ndr_print_PNP_ValidateDeviceInstance(struct ndr_print *ndr, const char *name, int flags, const struct PNP_ValidateDeviceInstance *r);
-_PUBLIC_ void ndr_print_PNP_GetRootDeviceInstance(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetRootDeviceInstance *r);
-_PUBLIC_ void ndr_print_PNP_GetRelatedDeviceInstance(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetRelatedDeviceInstance *r);
-_PUBLIC_ void ndr_print_PNP_EnumerateSubKeys(struct ndr_print *ndr, const char *name, int flags, const struct PNP_EnumerateSubKeys *r);
-_PUBLIC_ void ndr_print_PNP_GetDeviceList(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetDeviceList *r);
-_PUBLIC_ void ndr_print_PNP_GetDeviceListSize(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetDeviceListSize *r);
-_PUBLIC_ void ndr_print_PNP_GetDepth(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetDepth *r);
-_PUBLIC_ void ndr_print_PNP_GetDeviceRegProp(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetDeviceRegProp *r);
-_PUBLIC_ void ndr_print_PNP_SetDeviceRegProp(struct ndr_print *ndr, const char *name, int flags, const struct PNP_SetDeviceRegProp *r);
-_PUBLIC_ void ndr_print_PNP_GetClassInstance(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetClassInstance *r);
-_PUBLIC_ void ndr_print_PNP_CreateKey(struct ndr_print *ndr, const char *name, int flags, const struct PNP_CreateKey *r);
-_PUBLIC_ void ndr_print_PNP_DeleteRegistryKey(struct ndr_print *ndr, const char *name, int flags, const struct PNP_DeleteRegistryKey *r);
-_PUBLIC_ void ndr_print_PNP_GetClassCount(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetClassCount *r);
-_PUBLIC_ void ndr_print_PNP_GetClassName(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetClassName *r);
-_PUBLIC_ void ndr_print_PNP_DeleteClassKey(struct ndr_print *ndr, const char *name, int flags, const struct PNP_DeleteClassKey *r);
-_PUBLIC_ void ndr_print_PNP_GetInterfaceDeviceAlias(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetInterfaceDeviceAlias *r);
-_PUBLIC_ void ndr_print_PNP_GetInterfaceDeviceList(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetInterfaceDeviceList *r);
-_PUBLIC_ void ndr_print_PNP_GetInterfaceDeviceListSize(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetInterfaceDeviceListSize *r);
-_PUBLIC_ void ndr_print_PNP_RegisterDeviceClassAssociation(struct ndr_print *ndr, const char *name, int flags, const struct PNP_RegisterDeviceClassAssociation *r);
-_PUBLIC_ void ndr_print_PNP_UnregisterDeviceClassAssociation(struct ndr_print *ndr, const char *name, int flags, const struct PNP_UnregisterDeviceClassAssociation *r);
-_PUBLIC_ void ndr_print_PNP_GetClassRegProp(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetClassRegProp *r);
-_PUBLIC_ void ndr_print_PNP_SetClassRegProp(struct ndr_print *ndr, const char *name, int flags, const struct PNP_SetClassRegProp *r);
-_PUBLIC_ void ndr_print_PNP_CreateDevInst(struct ndr_print *ndr, const char *name, int flags, const struct PNP_CreateDevInst *r);
-_PUBLIC_ void ndr_print_PNP_DeviceInstanceAction(struct ndr_print *ndr, const char *name, int flags, const struct PNP_DeviceInstanceAction *r);
-_PUBLIC_ void ndr_print_PNP_GetDeviceStatus(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetDeviceStatus *r);
-_PUBLIC_ void ndr_print_PNP_SetDeviceProblem(struct ndr_print *ndr, const char *name, int flags, const struct PNP_SetDeviceProblem *r);
-_PUBLIC_ void ndr_print_PNP_DisableDevInst(struct ndr_print *ndr, const char *name, int flags, const struct PNP_DisableDevInst *r);
-_PUBLIC_ void ndr_print_PNP_UninstallDevInst(struct ndr_print *ndr, const char *name, int flags, const struct PNP_UninstallDevInst *r);
-_PUBLIC_ void ndr_print_PNP_AddID(struct ndr_print *ndr, const char *name, int flags, const struct PNP_AddID *r);
-_PUBLIC_ void ndr_print_PNP_RegisterDriver(struct ndr_print *ndr, const char *name, int flags, const struct PNP_RegisterDriver *r);
-_PUBLIC_ void ndr_print_PNP_QueryRemove(struct ndr_print *ndr, const char *name, int flags, const struct PNP_QueryRemove *r);
-_PUBLIC_ void ndr_print_PNP_RequestDeviceEject(struct ndr_print *ndr, const char *name, int flags, const struct PNP_RequestDeviceEject *r);
-_PUBLIC_ void ndr_print_PNP_IsDockStationPresent(struct ndr_print *ndr, const char *name, int flags, const struct PNP_IsDockStationPresent *r);
-_PUBLIC_ void ndr_print_PNP_RequestEjectPC(struct ndr_print *ndr, const char *name, int flags, const struct PNP_RequestEjectPC *r);
-_PUBLIC_ void ndr_print_PNP_HwProfFlags(struct ndr_print *ndr, const char *name, int flags, const struct PNP_HwProfFlags *r);
-_PUBLIC_ void ndr_print_PNP_GetHwProfInfo(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetHwProfInfo *r);
-_PUBLIC_ void ndr_print_PNP_AddEmptyLogConf(struct ndr_print *ndr, const char *name, int flags, const struct PNP_AddEmptyLogConf *r);
-_PUBLIC_ void ndr_print_PNP_FreeLogConf(struct ndr_print *ndr, const char *name, int flags, const struct PNP_FreeLogConf *r);
-_PUBLIC_ void ndr_print_PNP_GetFirstLogConf(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetFirstLogConf *r);
-_PUBLIC_ void ndr_print_PNP_GetNextLogConf(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetNextLogConf *r);
-_PUBLIC_ void ndr_print_PNP_GetLogConfPriority(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetLogConfPriority *r);
-_PUBLIC_ void ndr_print_PNP_AddResDes(struct ndr_print *ndr, const char *name, int flags, const struct PNP_AddResDes *r);
-_PUBLIC_ void ndr_print_PNP_FreeResDes(struct ndr_print *ndr, const char *name, int flags, const struct PNP_FreeResDes *r);
-_PUBLIC_ void ndr_print_PNP_GetNextResDes(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetNextResDes *r);
-_PUBLIC_ void ndr_print_PNP_GetResDesData(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetResDesData *r);
-_PUBLIC_ void ndr_print_PNP_GetResDesDataSize(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetResDesDataSize *r);
-_PUBLIC_ void ndr_print_PNP_ModifyResDes(struct ndr_print *ndr, const char *name, int flags, const struct PNP_ModifyResDes *r);
-_PUBLIC_ void ndr_print_PNP_DetectResourceLimit(struct ndr_print *ndr, const char *name, int flags, const struct PNP_DetectResourceLimit *r);
-_PUBLIC_ void ndr_print_PNP_QueryResConfList(struct ndr_print *ndr, const char *name, int flags, const struct PNP_QueryResConfList *r);
-_PUBLIC_ void ndr_print_PNP_SetHwProf(struct ndr_print *ndr, const char *name, int flags, const struct PNP_SetHwProf *r);
-_PUBLIC_ void ndr_print_PNP_QueryArbitratorFreeData(struct ndr_print *ndr, const char *name, int flags, const struct PNP_QueryArbitratorFreeData *r);
-_PUBLIC_ void ndr_print_PNP_QueryArbitratorFreeSize(struct ndr_print *ndr, const char *name, int flags, const struct PNP_QueryArbitratorFreeSize *r);
-_PUBLIC_ void ndr_print_PNP_RunDetection(struct ndr_print *ndr, const char *name, int flags, const struct PNP_RunDetection *r);
-_PUBLIC_ void ndr_print_PNP_RegisterNotification(struct ndr_print *ndr, const char *name, int flags, const struct PNP_RegisterNotification *r);
-_PUBLIC_ void ndr_print_PNP_UnregisterNotification(struct ndr_print *ndr, const char *name, int flags, const struct PNP_UnregisterNotification *r);
-_PUBLIC_ void ndr_print_PNP_GetCustomDevProp(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetCustomDevProp *r);
-_PUBLIC_ void ndr_print_PNP_GetVersionInternal(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetVersionInternal *r);
-_PUBLIC_ void ndr_print_PNP_GetBlockedDriverInfo(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetBlockedDriverInfo *r);
-_PUBLIC_ void ndr_print_PNP_GetServerSideDeviceInstallFlags(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetServerSideDeviceInstallFlags *r);
-
-/* The following definitions come from librpc/gen_ndr/ndr_samr.c */
-
-_PUBLIC_ enum ndr_err_code ndr_push_samr_AcctFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r);
-_PUBLIC_ enum ndr_err_code ndr_pull_samr_AcctFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
-_PUBLIC_ void ndr_print_samr_AcctFlags(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_samr_ConnectAccessMask(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_samr_UserAccessMask(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_samr_DomainAccessMask(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_samr_GroupAccessMask(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_samr_AliasAccessMask(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_samr_SamEntry(struct ndr_print *ndr, const char *name, const struct samr_SamEntry *r);
-_PUBLIC_ void ndr_print_samr_SamArray(struct ndr_print *ndr, const char *name, const struct samr_SamArray *r);
-_PUBLIC_ void ndr_print_samr_Role(struct ndr_print *ndr, const char *name, enum samr_Role r);
-_PUBLIC_ enum ndr_err_code ndr_push_samr_PasswordProperties(struct ndr_push *ndr, int ndr_flags, uint32_t r);
-_PUBLIC_ enum ndr_err_code ndr_pull_samr_PasswordProperties(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
-_PUBLIC_ void ndr_print_samr_PasswordProperties(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_samr_DomInfo1(struct ndr_print *ndr, const char *name, const struct samr_DomInfo1 *r);
-_PUBLIC_ void ndr_print_samr_DomInfo2(struct ndr_print *ndr, const char *name, const struct samr_DomInfo2 *r);
-_PUBLIC_ void ndr_print_samr_DomInfo3(struct ndr_print *ndr, const char *name, const struct samr_DomInfo3 *r);
-_PUBLIC_ void ndr_print_samr_DomInfo4(struct ndr_print *ndr, const char *name, const struct samr_DomInfo4 *r);
-_PUBLIC_ void ndr_print_samr_DomInfo5(struct ndr_print *ndr, const char *name, const struct samr_DomInfo5 *r);
-_PUBLIC_ void ndr_print_samr_DomInfo6(struct ndr_print *ndr, const char *name, const struct samr_DomInfo6 *r);
-_PUBLIC_ void ndr_print_samr_DomInfo7(struct ndr_print *ndr, const char *name, const struct samr_DomInfo7 *r);
-_PUBLIC_ void ndr_print_samr_DomInfo8(struct ndr_print *ndr, const char *name, const struct samr_DomInfo8 *r);
-_PUBLIC_ void ndr_print_samr_DomInfo9(struct ndr_print *ndr, const char *name, const struct samr_DomInfo9 *r);
-_PUBLIC_ void ndr_print_samr_DomInfo11(struct ndr_print *ndr, const char *name, const struct samr_DomInfo11 *r);
-_PUBLIC_ void ndr_print_samr_DomInfo12(struct ndr_print *ndr, const char *name, const struct samr_DomInfo12 *r);
-_PUBLIC_ void ndr_print_samr_DomInfo13(struct ndr_print *ndr, const char *name, const struct samr_DomInfo13 *r);
-_PUBLIC_ void ndr_print_samr_DomainInfo(struct ndr_print *ndr, const char *name, const union samr_DomainInfo *r);
-_PUBLIC_ void ndr_print_samr_Ids(struct ndr_print *ndr, const char *name, const struct samr_Ids *r);
-_PUBLIC_ enum ndr_err_code ndr_push_samr_GroupAttrs(struct ndr_push *ndr, int ndr_flags, uint32_t r);
-_PUBLIC_ enum ndr_err_code ndr_pull_samr_GroupAttrs(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
-_PUBLIC_ void ndr_print_samr_GroupAttrs(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_samr_GroupInfoAll(struct ndr_print *ndr, const char *name, const struct samr_GroupInfoAll *r);
-_PUBLIC_ void ndr_print_samr_GroupInfoAttributes(struct ndr_print *ndr, const char *name, const struct samr_GroupInfoAttributes *r);
-_PUBLIC_ void ndr_print_samr_GroupInfoEnum(struct ndr_print *ndr, const char *name, enum samr_GroupInfoEnum r);
-_PUBLIC_ void ndr_print_samr_GroupInfo(struct ndr_print *ndr, const char *name, const union samr_GroupInfo *r);
-_PUBLIC_ void ndr_print_samr_RidTypeArray(struct ndr_print *ndr, const char *name, const struct samr_RidTypeArray *r);
-_PUBLIC_ void ndr_print_samr_AliasInfoAll(struct ndr_print *ndr, const char *name, const struct samr_AliasInfoAll *r);
-_PUBLIC_ void ndr_print_samr_AliasInfoEnum(struct ndr_print *ndr, const char *name, enum samr_AliasInfoEnum r);
-_PUBLIC_ void ndr_print_samr_AliasInfo(struct ndr_print *ndr, const char *name, const union samr_AliasInfo *r);
-_PUBLIC_ void ndr_print_samr_UserInfo1(struct ndr_print *ndr, const char *name, const struct samr_UserInfo1 *r);
-_PUBLIC_ void ndr_print_samr_UserInfo2(struct ndr_print *ndr, const char *name, const struct samr_UserInfo2 *r);
-_PUBLIC_ enum ndr_err_code ndr_push_samr_LogonHours(struct ndr_push *ndr, int ndr_flags, const struct samr_LogonHours *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_samr_LogonHours(struct ndr_pull *ndr, int ndr_flags, struct samr_LogonHours *r);
-_PUBLIC_ void ndr_print_samr_LogonHours(struct ndr_print *ndr, const char *name, const struct samr_LogonHours *r);
-_PUBLIC_ void ndr_print_samr_UserInfo3(struct ndr_print *ndr, const char *name, const struct samr_UserInfo3 *r);
-_PUBLIC_ void ndr_print_samr_UserInfo4(struct ndr_print *ndr, const char *name, const struct samr_UserInfo4 *r);
-_PUBLIC_ void ndr_print_samr_UserInfo5(struct ndr_print *ndr, const char *name, const struct samr_UserInfo5 *r);
-_PUBLIC_ void ndr_print_samr_UserInfo6(struct ndr_print *ndr, const char *name, const struct samr_UserInfo6 *r);
-_PUBLIC_ void ndr_print_samr_UserInfo7(struct ndr_print *ndr, const char *name, const struct samr_UserInfo7 *r);
-_PUBLIC_ void ndr_print_samr_UserInfo8(struct ndr_print *ndr, const char *name, const struct samr_UserInfo8 *r);
-_PUBLIC_ void ndr_print_samr_UserInfo9(struct ndr_print *ndr, const char *name, const struct samr_UserInfo9 *r);
-_PUBLIC_ void ndr_print_samr_UserInfo10(struct ndr_print *ndr, const char *name, const struct samr_UserInfo10 *r);
-_PUBLIC_ void ndr_print_samr_UserInfo11(struct ndr_print *ndr, const char *name, const struct samr_UserInfo11 *r);
-_PUBLIC_ void ndr_print_samr_UserInfo12(struct ndr_print *ndr, const char *name, const struct samr_UserInfo12 *r);
-_PUBLIC_ void ndr_print_samr_UserInfo13(struct ndr_print *ndr, const char *name, const struct samr_UserInfo13 *r);
-_PUBLIC_ void ndr_print_samr_UserInfo14(struct ndr_print *ndr, const char *name, const struct samr_UserInfo14 *r);
-_PUBLIC_ void ndr_print_samr_UserInfo16(struct ndr_print *ndr, const char *name, const struct samr_UserInfo16 *r);
-_PUBLIC_ void ndr_print_samr_UserInfo17(struct ndr_print *ndr, const char *name, const struct samr_UserInfo17 *r);
-_PUBLIC_ enum ndr_err_code ndr_push_samr_Password(struct ndr_push *ndr, int ndr_flags, const struct samr_Password *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_samr_Password(struct ndr_pull *ndr, int ndr_flags, struct samr_Password *r);
-_PUBLIC_ void ndr_print_samr_Password(struct ndr_print *ndr, const char *name, const struct samr_Password *r);
-_PUBLIC_ void ndr_print_samr_UserInfo18(struct ndr_print *ndr, const char *name, const struct samr_UserInfo18 *r);
-_PUBLIC_ void ndr_print_samr_UserInfo20(struct ndr_print *ndr, const char *name, const struct samr_UserInfo20 *r);
-_PUBLIC_ void ndr_print_samr_FieldsPresent(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_samr_UserInfo21(struct ndr_print *ndr, const char *name, const struct samr_UserInfo21 *r);
-_PUBLIC_ enum ndr_err_code ndr_push_samr_CryptPassword(struct ndr_push *ndr, int ndr_flags, const struct samr_CryptPassword *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_samr_CryptPassword(struct ndr_pull *ndr, int ndr_flags, struct samr_CryptPassword *r);
-_PUBLIC_ void ndr_print_samr_CryptPassword(struct ndr_print *ndr, const char *name, const struct samr_CryptPassword *r);
-_PUBLIC_ void ndr_print_samr_UserInfo23(struct ndr_print *ndr, const char *name, const struct samr_UserInfo23 *r);
-_PUBLIC_ void ndr_print_samr_UserInfo24(struct ndr_print *ndr, const char *name, const struct samr_UserInfo24 *r);
-_PUBLIC_ void ndr_print_samr_CryptPasswordEx(struct ndr_print *ndr, const char *name, const struct samr_CryptPasswordEx *r);
-_PUBLIC_ void ndr_print_samr_UserInfo25(struct ndr_print *ndr, const char *name, const struct samr_UserInfo25 *r);
-_PUBLIC_ void ndr_print_samr_UserInfo26(struct ndr_print *ndr, const char *name, const struct samr_UserInfo26 *r);
-_PUBLIC_ void ndr_print_samr_UserInfo(struct ndr_print *ndr, const char *name, const union samr_UserInfo *r);
-_PUBLIC_ enum ndr_err_code ndr_push_samr_RidWithAttribute(struct ndr_push *ndr, int ndr_flags, const struct samr_RidWithAttribute *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_samr_RidWithAttribute(struct ndr_pull *ndr, int ndr_flags, struct samr_RidWithAttribute *r);
-_PUBLIC_ void ndr_print_samr_RidWithAttribute(struct ndr_print *ndr, const char *name, const struct samr_RidWithAttribute *r);
-_PUBLIC_ enum ndr_err_code ndr_push_samr_RidWithAttributeArray(struct ndr_push *ndr, int ndr_flags, const struct samr_RidWithAttributeArray *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_samr_RidWithAttributeArray(struct ndr_pull *ndr, int ndr_flags, struct samr_RidWithAttributeArray *r);
-_PUBLIC_ void ndr_print_samr_RidWithAttributeArray(struct ndr_print *ndr, const char *name, const struct samr_RidWithAttributeArray *r);
-_PUBLIC_ void ndr_print_samr_DispEntryGeneral(struct ndr_print *ndr, const char *name, const struct samr_DispEntryGeneral *r);
-_PUBLIC_ void ndr_print_samr_DispInfoGeneral(struct ndr_print *ndr, const char *name, const struct samr_DispInfoGeneral *r);
-_PUBLIC_ void ndr_print_samr_DispEntryFull(struct ndr_print *ndr, const char *name, const struct samr_DispEntryFull *r);
-_PUBLIC_ void ndr_print_samr_DispInfoFull(struct ndr_print *ndr, const char *name, const struct samr_DispInfoFull *r);
-_PUBLIC_ void ndr_print_samr_DispEntryFullGroup(struct ndr_print *ndr, const char *name, const struct samr_DispEntryFullGroup *r);
-_PUBLIC_ void ndr_print_samr_DispInfoFullGroups(struct ndr_print *ndr, const char *name, const struct samr_DispInfoFullGroups *r);
-_PUBLIC_ void ndr_print_samr_DispEntryAscii(struct ndr_print *ndr, const char *name, const struct samr_DispEntryAscii *r);
-_PUBLIC_ void ndr_print_samr_DispInfoAscii(struct ndr_print *ndr, const char *name, const struct samr_DispInfoAscii *r);
-_PUBLIC_ void ndr_print_samr_DispInfo(struct ndr_print *ndr, const char *name, const union samr_DispInfo *r);
-_PUBLIC_ void ndr_print_samr_PwInfo(struct ndr_print *ndr, const char *name, const struct samr_PwInfo *r);
-_PUBLIC_ void ndr_print_samr_ConnectVersion(struct ndr_print *ndr, const char *name, enum samr_ConnectVersion r);
-_PUBLIC_ void ndr_print_samr_ChangeReject(struct ndr_print *ndr, const char *name, const struct samr_ChangeReject *r);
-_PUBLIC_ void ndr_print_samr_ConnectInfo1(struct ndr_print *ndr, const char *name, const struct samr_ConnectInfo1 *r);
-_PUBLIC_ void ndr_print_samr_ConnectInfo(struct ndr_print *ndr, const char *name, const union samr_ConnectInfo *r);
-_PUBLIC_ void ndr_print_samr_ValidateFieldsPresent(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_samr_ValidatePasswordLevel(struct ndr_print *ndr, const char *name, enum samr_ValidatePasswordLevel r);
-_PUBLIC_ void ndr_print_samr_ValidationStatus(struct ndr_print *ndr, const char *name, enum samr_ValidationStatus r);
-_PUBLIC_ void ndr_print_samr_ValidationBlob(struct ndr_print *ndr, const char *name, const struct samr_ValidationBlob *r);
-_PUBLIC_ void ndr_print_samr_ValidatePasswordInfo(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordInfo *r);
-_PUBLIC_ void ndr_print_samr_ValidatePasswordRepCtr(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordRepCtr *r);
-_PUBLIC_ void ndr_print_samr_ValidatePasswordRep(struct ndr_print *ndr, const char *name, const union samr_ValidatePasswordRep *r);
-_PUBLIC_ void ndr_print_samr_ValidatePasswordReq3(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordReq3 *r);
-_PUBLIC_ void ndr_print_samr_ValidatePasswordReq2(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordReq2 *r);
-_PUBLIC_ void ndr_print_samr_ValidatePasswordReq1(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordReq1 *r);
-_PUBLIC_ void ndr_print_samr_ValidatePasswordReq(struct ndr_print *ndr, const char *name, const union samr_ValidatePasswordReq *r);
-_PUBLIC_ void ndr_print_samr_Connect(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect *r);
-_PUBLIC_ enum ndr_err_code ndr_push_samr_Close(struct ndr_push *ndr, int flags, const struct samr_Close *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_samr_Close(struct ndr_pull *ndr, int flags, struct samr_Close *r);
-_PUBLIC_ void ndr_print_samr_Close(struct ndr_print *ndr, const char *name, int flags, const struct samr_Close *r);
-_PUBLIC_ void ndr_print_samr_SetSecurity(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetSecurity *r);
-_PUBLIC_ void ndr_print_samr_QuerySecurity(struct ndr_print *ndr, const char *name, int flags, const struct samr_QuerySecurity *r);
-_PUBLIC_ void ndr_print_samr_Shutdown(struct ndr_print *ndr, const char *name, int flags, const struct samr_Shutdown *r);
-_PUBLIC_ void ndr_print_samr_LookupDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_LookupDomain *r);
-_PUBLIC_ void ndr_print_samr_EnumDomains(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomains *r);
-_PUBLIC_ enum ndr_err_code ndr_push_samr_OpenDomain(struct ndr_push *ndr, int flags, const struct samr_OpenDomain *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_samr_OpenDomain(struct ndr_pull *ndr, int flags, struct samr_OpenDomain *r);
-_PUBLIC_ void ndr_print_samr_OpenDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenDomain *r);
-_PUBLIC_ void ndr_print_samr_QueryDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDomainInfo *r);
-_PUBLIC_ void ndr_print_samr_SetDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetDomainInfo *r);
-_PUBLIC_ void ndr_print_samr_CreateDomainGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateDomainGroup *r);
-_PUBLIC_ void ndr_print_samr_EnumDomainGroups(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomainGroups *r);
-_PUBLIC_ void ndr_print_samr_CreateUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateUser *r);
-_PUBLIC_ void ndr_print_samr_EnumDomainUsers(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomainUsers *r);
-_PUBLIC_ void ndr_print_samr_CreateDomAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateDomAlias *r);
-_PUBLIC_ void ndr_print_samr_EnumDomainAliases(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomainAliases *r);
-_PUBLIC_ void ndr_print_samr_GetAliasMembership(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetAliasMembership *r);
-_PUBLIC_ enum ndr_err_code ndr_push_samr_LookupNames(struct ndr_push *ndr, int flags, const struct samr_LookupNames *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_samr_LookupNames(struct ndr_pull *ndr, int flags, struct samr_LookupNames *r);
-_PUBLIC_ void ndr_print_samr_LookupNames(struct ndr_print *ndr, const char *name, int flags, const struct samr_LookupNames *r);
-_PUBLIC_ void ndr_print_samr_LookupRids(struct ndr_print *ndr, const char *name, int flags, const struct samr_LookupRids *r);
-_PUBLIC_ void ndr_print_samr_OpenGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenGroup *r);
-_PUBLIC_ void ndr_print_samr_QueryGroupInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryGroupInfo *r);
-_PUBLIC_ void ndr_print_samr_SetGroupInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetGroupInfo *r);
-_PUBLIC_ void ndr_print_samr_AddGroupMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_AddGroupMember *r);
-_PUBLIC_ void ndr_print_samr_DeleteDomainGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteDomainGroup *r);
-_PUBLIC_ void ndr_print_samr_DeleteGroupMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteGroupMember *r);
-_PUBLIC_ void ndr_print_samr_QueryGroupMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryGroupMember *r);
-_PUBLIC_ void ndr_print_samr_SetMemberAttributesOfGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetMemberAttributesOfGroup *r);
-_PUBLIC_ void ndr_print_samr_OpenAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenAlias *r);
-_PUBLIC_ void ndr_print_samr_QueryAliasInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryAliasInfo *r);
-_PUBLIC_ void ndr_print_samr_SetAliasInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetAliasInfo *r);
-_PUBLIC_ void ndr_print_samr_DeleteDomAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteDomAlias *r);
-_PUBLIC_ void ndr_print_samr_AddAliasMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_AddAliasMember *r);
-_PUBLIC_ void ndr_print_samr_DeleteAliasMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteAliasMember *r);
-_PUBLIC_ void ndr_print_samr_GetMembersInAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetMembersInAlias *r);
-_PUBLIC_ enum ndr_err_code ndr_push_samr_OpenUser(struct ndr_push *ndr, int flags, const struct samr_OpenUser *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_samr_OpenUser(struct ndr_pull *ndr, int flags, struct samr_OpenUser *r);
-_PUBLIC_ void ndr_print_samr_OpenUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenUser *r);
-_PUBLIC_ void ndr_print_samr_DeleteUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteUser *r);
-_PUBLIC_ enum ndr_err_code ndr_push_samr_QueryUserInfo(struct ndr_push *ndr, int flags, const struct samr_QueryUserInfo *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_samr_QueryUserInfo(struct ndr_pull *ndr, int flags, struct samr_QueryUserInfo *r);
-_PUBLIC_ void ndr_print_samr_QueryUserInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryUserInfo *r);
-_PUBLIC_ enum ndr_err_code ndr_push_samr_SetUserInfo(struct ndr_push *ndr, int flags, const struct samr_SetUserInfo *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_samr_SetUserInfo(struct ndr_pull *ndr, int flags, struct samr_SetUserInfo *r);
-_PUBLIC_ void ndr_print_samr_SetUserInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetUserInfo *r);
-_PUBLIC_ void ndr_print_samr_ChangePasswordUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_ChangePasswordUser *r);
-_PUBLIC_ void ndr_print_samr_GetGroupsForUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetGroupsForUser *r);
-_PUBLIC_ void ndr_print_samr_QueryDisplayInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDisplayInfo *r);
-_PUBLIC_ void ndr_print_samr_GetDisplayEnumerationIndex(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetDisplayEnumerationIndex *r);
-_PUBLIC_ void ndr_print_samr_TestPrivateFunctionsDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_TestPrivateFunctionsDomain *r);
-_PUBLIC_ void ndr_print_samr_TestPrivateFunctionsUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_TestPrivateFunctionsUser *r);
-_PUBLIC_ enum ndr_err_code ndr_push_samr_GetUserPwInfo(struct ndr_push *ndr, int flags, const struct samr_GetUserPwInfo *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_samr_GetUserPwInfo(struct ndr_pull *ndr, int flags, struct samr_GetUserPwInfo *r);
-_PUBLIC_ void ndr_print_samr_GetUserPwInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetUserPwInfo *r);
-_PUBLIC_ void ndr_print_samr_RemoveMemberFromForeignDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_RemoveMemberFromForeignDomain *r);
-_PUBLIC_ void ndr_print_samr_QueryDomainInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDomainInfo2 *r);
-_PUBLIC_ void ndr_print_samr_QueryUserInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryUserInfo2 *r);
-_PUBLIC_ void ndr_print_samr_QueryDisplayInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDisplayInfo2 *r);
-_PUBLIC_ void ndr_print_samr_GetDisplayEnumerationIndex2(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetDisplayEnumerationIndex2 *r);
-_PUBLIC_ void ndr_print_samr_CreateUser2(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateUser2 *r);
-_PUBLIC_ void ndr_print_samr_QueryDisplayInfo3(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDisplayInfo3 *r);
-_PUBLIC_ void ndr_print_samr_AddMultipleMembersToAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_AddMultipleMembersToAlias *r);
-_PUBLIC_ void ndr_print_samr_RemoveMultipleMembersFromAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_RemoveMultipleMembersFromAlias *r);
-_PUBLIC_ void ndr_print_samr_OemChangePasswordUser2(struct ndr_print *ndr, const char *name, int flags, const struct samr_OemChangePasswordUser2 *r);
-_PUBLIC_ void ndr_print_samr_ChangePasswordUser2(struct ndr_print *ndr, const char *name, int flags, const struct samr_ChangePasswordUser2 *r);
-_PUBLIC_ void ndr_print_samr_GetDomPwInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetDomPwInfo *r);
-_PUBLIC_ void ndr_print_samr_Connect2(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect2 *r);
-_PUBLIC_ enum ndr_err_code ndr_push_samr_SetUserInfo2(struct ndr_push *ndr, int flags, const struct samr_SetUserInfo2 *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_samr_SetUserInfo2(struct ndr_pull *ndr, int flags, struct samr_SetUserInfo2 *r);
-_PUBLIC_ void ndr_print_samr_SetUserInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetUserInfo2 *r);
-_PUBLIC_ void ndr_print_samr_SetBootKeyInformation(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetBootKeyInformation *r);
-_PUBLIC_ void ndr_print_samr_GetBootKeyInformation(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetBootKeyInformation *r);
-_PUBLIC_ void ndr_print_samr_Connect3(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect3 *r);
-_PUBLIC_ void ndr_print_samr_Connect4(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect4 *r);
-_PUBLIC_ void ndr_print_samr_ChangePasswordUser3(struct ndr_print *ndr, const char *name, int flags, const struct samr_ChangePasswordUser3 *r);
-_PUBLIC_ enum ndr_err_code ndr_push_samr_Connect5(struct ndr_push *ndr, int flags, const struct samr_Connect5 *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_samr_Connect5(struct ndr_pull *ndr, int flags, struct samr_Connect5 *r);
-_PUBLIC_ void ndr_print_samr_Connect5(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect5 *r);
-_PUBLIC_ void ndr_print_samr_RidToSid(struct ndr_print *ndr, const char *name, int flags, const struct samr_RidToSid *r);
-_PUBLIC_ void ndr_print_samr_SetDsrmPassword(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetDsrmPassword *r);
-_PUBLIC_ void ndr_print_samr_ValidatePassword(struct ndr_print *ndr, const char *name, int flags, const struct samr_ValidatePassword *r);
-
-/* The following definitions come from librpc/gen_ndr/ndr_security.c */
-
-_PUBLIC_ void ndr_print_security_ace_flags(struct ndr_print *ndr, const char *name, uint8_t r);
-_PUBLIC_ void ndr_print_security_ace_type(struct ndr_print *ndr, const char *name, enum security_ace_type r);
-_PUBLIC_ void ndr_print_security_ace_object_flags(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_security_ace_object_type(struct ndr_print *ndr, const char *name, const union security_ace_object_type *r);
-_PUBLIC_ void ndr_print_security_ace_object_inherited_type(struct ndr_print *ndr, const char *name, const union security_ace_object_inherited_type *r);
-_PUBLIC_ void ndr_print_security_ace_object(struct ndr_print *ndr, const char *name, const struct security_ace_object *r);
-_PUBLIC_ void ndr_print_security_ace_object_ctr(struct ndr_print *ndr, const char *name, const union security_ace_object_ctr *r);
-_PUBLIC_ enum ndr_err_code ndr_push_security_ace(struct ndr_push *ndr, int ndr_flags, const struct security_ace *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_security_ace(struct ndr_pull *ndr, int ndr_flags, struct security_ace *r);
-_PUBLIC_ void ndr_print_security_ace(struct ndr_print *ndr, const char *name, const struct security_ace *r);
-_PUBLIC_ void ndr_print_security_acl_revision(struct ndr_print *ndr, const char *name, enum security_acl_revision r);
-_PUBLIC_ enum ndr_err_code ndr_push_security_acl(struct ndr_push *ndr, int ndr_flags, const struct security_acl *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_security_acl(struct ndr_pull *ndr, int ndr_flags, struct security_acl *r);
-_PUBLIC_ void ndr_print_security_acl(struct ndr_print *ndr, const char *name, const struct security_acl *r);
-_PUBLIC_ void ndr_print_security_descriptor_revision(struct ndr_print *ndr, const char *name, enum security_descriptor_revision r);
-_PUBLIC_ void ndr_print_security_descriptor_type(struct ndr_print *ndr, const char *name, uint16_t r);
-_PUBLIC_ enum ndr_err_code ndr_push_security_descriptor(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_security_descriptor(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor *r);
-_PUBLIC_ void ndr_print_security_descriptor(struct ndr_print *ndr, const char *name, const struct security_descriptor *r);
-_PUBLIC_ enum ndr_err_code ndr_push_sec_desc_buf(struct ndr_push *ndr, int ndr_flags, const struct sec_desc_buf *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_sec_desc_buf(struct ndr_pull *ndr, int ndr_flags, struct sec_desc_buf *r);
-_PUBLIC_ void ndr_print_sec_desc_buf(struct ndr_print *ndr, const char *name, const struct sec_desc_buf *r);
-_PUBLIC_ enum ndr_err_code ndr_push_security_token(struct ndr_push *ndr, int ndr_flags, const struct security_token *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_security_token(struct ndr_pull *ndr, int ndr_flags, struct security_token *r);
-_PUBLIC_ void ndr_print_security_token(struct ndr_print *ndr, const char *name, const struct security_token *r);
-_PUBLIC_ enum ndr_err_code ndr_push_security_secinfo(struct ndr_push *ndr, int ndr_flags, uint32_t r);
-_PUBLIC_ enum ndr_err_code ndr_pull_security_secinfo(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
-_PUBLIC_ void ndr_print_security_secinfo(struct ndr_print *ndr, const char *name, uint32_t r);
-
-/* The following definitions come from librpc/gen_ndr/ndr_srvsvc.c */
-
-_PUBLIC_ void ndr_print_srvsvc_NetCharDevInfo0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevInfo0 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetCharDevCtr0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevCtr0 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetCharDevInfo1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevInfo1 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetCharDevCtr1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevCtr1 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetCharDevInfo(struct ndr_print *ndr, const char *name, const union srvsvc_NetCharDevInfo *r);
-_PUBLIC_ void ndr_print_srvsvc_NetCharDevCtr(struct ndr_print *ndr, const char *name, const union srvsvc_NetCharDevCtr *r);
-_PUBLIC_ void ndr_print_srvsvc_NetCharDevQInfo0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevQInfo0 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetCharDevQCtr0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevQCtr0 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetCharDevQInfo1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevQInfo1 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetCharDevQCtr1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetCharDevQCtr1 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetCharDevQInfo(struct ndr_print *ndr, const char *name, const union srvsvc_NetCharDevQInfo *r);
-_PUBLIC_ void ndr_print_srvsvc_NetCharDevQCtr(struct ndr_print *ndr, const char *name, const union srvsvc_NetCharDevQCtr *r);
-_PUBLIC_ void ndr_print_srvsvc_NetConnInfo0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetConnInfo0 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetConnCtr0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetConnCtr0 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetConnInfo1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetConnInfo1 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetConnCtr1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetConnCtr1 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetConnCtr(struct ndr_print *ndr, const char *name, const union srvsvc_NetConnCtr *r);
-_PUBLIC_ void ndr_print_srvsvc_NetConnInfoCtr(struct ndr_print *ndr, const char *name, const struct srvsvc_NetConnInfoCtr *r);
-_PUBLIC_ void ndr_print_srvsvc_NetFileInfo2(struct ndr_print *ndr, const char *name, const struct srvsvc_NetFileInfo2 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetFileCtr2(struct ndr_print *ndr, const char *name, const struct srvsvc_NetFileCtr2 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetFileInfo3(struct ndr_print *ndr, const char *name, const struct srvsvc_NetFileInfo3 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetFileCtr3(struct ndr_print *ndr, const char *name, const struct srvsvc_NetFileCtr3 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetFileInfo(struct ndr_print *ndr, const char *name, const union srvsvc_NetFileInfo *r);
-_PUBLIC_ void ndr_print_srvsvc_NetFileCtr(struct ndr_print *ndr, const char *name, const union srvsvc_NetFileCtr *r);
-_PUBLIC_ void ndr_print_srvsvc_NetFileInfoCtr(struct ndr_print *ndr, const char *name, const struct srvsvc_NetFileInfoCtr *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSessInfo0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessInfo0 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSessCtr0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessCtr0 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSessInfo1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessInfo1 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSessCtr1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessCtr1 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSessInfo2(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessInfo2 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSessCtr2(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessCtr2 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSessInfo10(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessInfo10 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSessCtr10(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessCtr10 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSessInfo502(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessInfo502 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSessCtr502(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessCtr502 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSessCtr(struct ndr_print *ndr, const char *name, const union srvsvc_NetSessCtr *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSessInfoCtr(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSessInfoCtr *r);
-_PUBLIC_ void ndr_print_srvsvc_ShareType(struct ndr_print *ndr, const char *name, enum srvsvc_ShareType r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareInfo0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareInfo0 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareCtr0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareCtr0 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareInfo1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareInfo1 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareCtr1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareCtr1 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareInfo2(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareInfo2 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareCtr2(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareCtr2 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareInfo501(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareInfo501 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareCtr501(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareCtr501 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareInfo502(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareInfo502 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareCtr502(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareCtr502 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareInfo1004(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareInfo1004 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareCtr1004(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareCtr1004 *r);
-_PUBLIC_ void ndr_print_NetShareInfo1005Flags(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareInfo1005(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareInfo1005 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareCtr1005(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareCtr1005 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareInfo1006(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareInfo1006 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareCtr1006(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareCtr1006 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareInfo1007(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareInfo1007 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareCtr1007(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareCtr1007 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareCtr1501(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareCtr1501 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareInfo(struct ndr_print *ndr, const char *name, const union srvsvc_NetShareInfo *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareCtr(struct ndr_print *ndr, const char *name, const union srvsvc_NetShareCtr *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareInfoCtr(struct ndr_print *ndr, const char *name, const struct srvsvc_NetShareInfoCtr *r);
-_PUBLIC_ enum ndr_err_code ndr_push_srvsvc_PlatformId(struct ndr_push *ndr, int ndr_flags, enum srvsvc_PlatformId r);
-_PUBLIC_ enum ndr_err_code ndr_pull_srvsvc_PlatformId(struct ndr_pull *ndr, int ndr_flags, enum srvsvc_PlatformId *r);
-_PUBLIC_ void ndr_print_srvsvc_PlatformId(struct ndr_print *ndr, const char *name, enum srvsvc_PlatformId r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo100(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo100 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo101(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo101 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo102(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo102 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo402(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo402 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo403(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo403 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo502(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo502 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo503(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo503 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo599(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo599 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1005(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1005 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1010(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1010 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1016(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1016 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1017(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1017 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1018(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1018 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1107(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1107 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1501(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1501 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1502(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1502 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1503(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1503 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1506(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1506 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1509(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1509 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1510(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1510 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1511(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1511 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1512(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1512 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1513(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1513 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1514(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1514 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1515(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1515 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1516(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1516 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1518(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1518 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1520(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1520 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1521(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1521 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1522(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1522 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1523(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1523 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1524(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1524 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1525(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1525 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1528(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1528 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1529(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1529 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1530(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1530 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1533(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1533 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1534(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1534 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1535(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1535 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1536(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1536 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1537(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1537 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1538(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1538 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1539(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1539 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1540(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1540 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1541(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1541 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1542(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1542 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1543(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1543 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1544(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1544 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1545(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1545 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1546(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1546 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1547(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1547 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1548(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1548 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1549(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1549 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1550(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1550 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1552(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1552 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1553(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1553 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1554(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1554 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1555(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1555 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo1556(struct ndr_print *ndr, const char *name, const struct srvsvc_NetSrvInfo1556 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvInfo(struct ndr_print *ndr, const char *name, const union srvsvc_NetSrvInfo *r);
-_PUBLIC_ void ndr_print_srvsvc_NetDiskInfo0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetDiskInfo0 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetDiskInfo(struct ndr_print *ndr, const char *name, const struct srvsvc_NetDiskInfo *r);
-_PUBLIC_ void ndr_print_srvsvc_Statistics(struct ndr_print *ndr, const char *name, const struct srvsvc_Statistics *r);
-_PUBLIC_ void ndr_print_srvsvc_NetTransportInfo0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetTransportInfo0 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetTransportCtr0(struct ndr_print *ndr, const char *name, const struct srvsvc_NetTransportCtr0 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetTransportInfo1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetTransportInfo1 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetTransportCtr1(struct ndr_print *ndr, const char *name, const struct srvsvc_NetTransportCtr1 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetTransportInfo2(struct ndr_print *ndr, const char *name, const struct srvsvc_NetTransportInfo2 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetTransportCtr2(struct ndr_print *ndr, const char *name, const struct srvsvc_NetTransportCtr2 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetTransportInfo3(struct ndr_print *ndr, const char *name, const struct srvsvc_NetTransportInfo3 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetTransportCtr3(struct ndr_print *ndr, const char *name, const struct srvsvc_NetTransportCtr3 *r);
-_PUBLIC_ void ndr_print_srvsvc_NetTransportCtr(struct ndr_print *ndr, const char *name, const union srvsvc_NetTransportCtr *r);
-_PUBLIC_ void ndr_print_srvsvc_NetRemoteTODInfo(struct ndr_print *ndr, const char *name, const struct srvsvc_NetRemoteTODInfo *r);
-_PUBLIC_ void ndr_print_srvsvc_NetTransportInfo(struct ndr_print *ndr, const char *name, const union srvsvc_NetTransportInfo *r);
-_PUBLIC_ void ndr_print_srvsvc_NetCharDevEnum(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetCharDevEnum *r);
-_PUBLIC_ void ndr_print_srvsvc_NetCharDevGetInfo(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetCharDevGetInfo *r);
-_PUBLIC_ void ndr_print_srvsvc_NetCharDevControl(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetCharDevControl *r);
-_PUBLIC_ void ndr_print_srvsvc_NetCharDevQEnum(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetCharDevQEnum *r);
-_PUBLIC_ void ndr_print_srvsvc_NetCharDevQGetInfo(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetCharDevQGetInfo *r);
-_PUBLIC_ void ndr_print_srvsvc_NetCharDevQSetInfo(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetCharDevQSetInfo *r);
-_PUBLIC_ void ndr_print_srvsvc_NetCharDevQPurge(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetCharDevQPurge *r);
-_PUBLIC_ void ndr_print_srvsvc_NetCharDevQPurgeSelf(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetCharDevQPurgeSelf *r);
-_PUBLIC_ void ndr_print_srvsvc_NetConnEnum(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetConnEnum *r);
-_PUBLIC_ void ndr_print_srvsvc_NetFileEnum(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetFileEnum *r);
-_PUBLIC_ void ndr_print_srvsvc_NetFileGetInfo(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetFileGetInfo *r);
-_PUBLIC_ void ndr_print_srvsvc_NetFileClose(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetFileClose *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSessEnum(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetSessEnum *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSessDel(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetSessDel *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareAdd(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetShareAdd *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareEnumAll(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetShareEnumAll *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareGetInfo(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetShareGetInfo *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareSetInfo(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetShareSetInfo *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareDel(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetShareDel *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareDelSticky(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetShareDelSticky *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareCheck(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetShareCheck *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvGetInfo(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetSrvGetInfo *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSrvSetInfo(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetSrvSetInfo *r);
-_PUBLIC_ void ndr_print_srvsvc_NetDiskEnum(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetDiskEnum *r);
-_PUBLIC_ void ndr_print_srvsvc_NetServerStatisticsGet(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetServerStatisticsGet *r);
-_PUBLIC_ void ndr_print_srvsvc_NetTransportAdd(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetTransportAdd *r);
-_PUBLIC_ void ndr_print_srvsvc_NetTransportEnum(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetTransportEnum *r);
-_PUBLIC_ void ndr_print_srvsvc_NetTransportDel(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetTransportDel *r);
-_PUBLIC_ void ndr_print_srvsvc_NetRemoteTOD(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetRemoteTOD *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSetServiceBits(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetSetServiceBits *r);
-_PUBLIC_ void ndr_print_srvsvc_NetPathType(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetPathType *r);
-_PUBLIC_ void ndr_print_srvsvc_NetPathCanonicalize(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetPathCanonicalize *r);
-_PUBLIC_ void ndr_print_srvsvc_NetPathCompare(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetPathCompare *r);
-_PUBLIC_ void ndr_print_srvsvc_NetNameValidate(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetNameValidate *r);
-_PUBLIC_ void ndr_print_srvsvc_NETRPRNAMECANONICALIZE(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRPRNAMECANONICALIZE *r);
-_PUBLIC_ void ndr_print_srvsvc_NetPRNameCompare(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetPRNameCompare *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareEnum(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetShareEnum *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareDelStart(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetShareDelStart *r);
-_PUBLIC_ void ndr_print_srvsvc_NetShareDelCommit(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetShareDelCommit *r);
-_PUBLIC_ void ndr_print_srvsvc_NetGetFileSecurity(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetGetFileSecurity *r);
-_PUBLIC_ void ndr_print_srvsvc_NetSetFileSecurity(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetSetFileSecurity *r);
-_PUBLIC_ void ndr_print_srvsvc_NetServerTransportAddEx(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetServerTransportAddEx *r);
-_PUBLIC_ void ndr_print_srvsvc_NetServerSetServiceBitsEx(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NetServerSetServiceBitsEx *r);
-_PUBLIC_ void ndr_print_srvsvc_NETRDFSGETVERSION(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRDFSGETVERSION *r);
-_PUBLIC_ void ndr_print_srvsvc_NETRDFSCREATELOCALPARTITION(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRDFSCREATELOCALPARTITION *r);
-_PUBLIC_ void ndr_print_srvsvc_NETRDFSDELETELOCALPARTITION(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRDFSDELETELOCALPARTITION *r);
-_PUBLIC_ void ndr_print_srvsvc_NETRDFSSETLOCALVOLUMESTATE(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRDFSSETLOCALVOLUMESTATE *r);
-_PUBLIC_ void ndr_print_srvsvc_NETRDFSSETSERVERINFO(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRDFSSETSERVERINFO *r);
-_PUBLIC_ void ndr_print_srvsvc_NETRDFSCREATEEXITPOINT(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRDFSCREATEEXITPOINT *r);
-_PUBLIC_ void ndr_print_srvsvc_NETRDFSDELETEEXITPOINT(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRDFSDELETEEXITPOINT *r);
-_PUBLIC_ void ndr_print_srvsvc_NETRDFSMODIFYPREFIX(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRDFSMODIFYPREFIX *r);
-_PUBLIC_ void ndr_print_srvsvc_NETRDFSFIXLOCALVOLUME(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRDFSFIXLOCALVOLUME *r);
-_PUBLIC_ void ndr_print_srvsvc_NETRDFSMANAGERREPORTSITEINFO(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRDFSMANAGERREPORTSITEINFO *r);
-_PUBLIC_ void ndr_print_srvsvc_NETRSERVERTRANSPORTDELEX(struct ndr_print *ndr, const char *name, int flags, const struct srvsvc_NETRSERVERTRANSPORTDELEX *r);
-
-/* The following definitions come from librpc/gen_ndr/ndr_svcctl.c */
-
-_PUBLIC_ void ndr_print_SERVICE_LOCK_STATUS(struct ndr_print *ndr, const char *name, const struct SERVICE_LOCK_STATUS *r);
-_PUBLIC_ void ndr_print_SERVICE_STATUS(struct ndr_print *ndr, const char *name, const struct SERVICE_STATUS *r);
-_PUBLIC_ void ndr_print_ENUM_SERVICE_STATUS(struct ndr_print *ndr, const char *name, const struct ENUM_SERVICE_STATUS *r);
-_PUBLIC_ enum ndr_err_code ndr_push_svcctl_ServerType(struct ndr_push *ndr, int ndr_flags, uint32_t r);
-_PUBLIC_ enum ndr_err_code ndr_pull_svcctl_ServerType(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
-_PUBLIC_ void ndr_print_svcctl_ServerType(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_svcctl_MgrAccessMask(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_svcctl_ServiceAccessMask(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_svcctl_CloseServiceHandle(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_CloseServiceHandle *r);
-_PUBLIC_ void ndr_print_svcctl_ControlService(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_ControlService *r);
-_PUBLIC_ void ndr_print_svcctl_DeleteService(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_DeleteService *r);
-_PUBLIC_ void ndr_print_svcctl_LockServiceDatabase(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_LockServiceDatabase *r);
-_PUBLIC_ void ndr_print_svcctl_QueryServiceObjectSecurity(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceObjectSecurity *r);
-_PUBLIC_ void ndr_print_svcctl_SetServiceObjectSecurity(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_SetServiceObjectSecurity *r);
-_PUBLIC_ void ndr_print_svcctl_QueryServiceStatus(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceStatus *r);
-_PUBLIC_ void ndr_print_svcctl_SetServiceStatus(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_SetServiceStatus *r);
-_PUBLIC_ void ndr_print_svcctl_UnlockServiceDatabase(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_UnlockServiceDatabase *r);
-_PUBLIC_ void ndr_print_svcctl_NotifyBootConfigStatus(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_NotifyBootConfigStatus *r);
-_PUBLIC_ void ndr_print_svcctl_SCSetServiceBitsW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_SCSetServiceBitsW *r);
-_PUBLIC_ void ndr_print_svcctl_ChangeServiceConfigW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_ChangeServiceConfigW *r);
-_PUBLIC_ void ndr_print_svcctl_CreateServiceW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_CreateServiceW *r);
-_PUBLIC_ void ndr_print_svcctl_EnumDependentServicesW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_EnumDependentServicesW *r);
-_PUBLIC_ void ndr_print_svcctl_EnumServicesStatusW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_EnumServicesStatusW *r);
-_PUBLIC_ void ndr_print_svcctl_OpenSCManagerW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_OpenSCManagerW *r);
-_PUBLIC_ void ndr_print_svcctl_OpenServiceW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_OpenServiceW *r);
-_PUBLIC_ void ndr_print_svcctl_QueryServiceConfigW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceConfigW *r);
-_PUBLIC_ void ndr_print_svcctl_QueryServiceLockStatusW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceLockStatusW *r);
-_PUBLIC_ void ndr_print_svcctl_StartServiceW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_StartServiceW *r);
-_PUBLIC_ void ndr_print_svcctl_GetServiceDisplayNameW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_GetServiceDisplayNameW *r);
-_PUBLIC_ void ndr_print_svcctl_GetServiceKeyNameW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_GetServiceKeyNameW *r);
-_PUBLIC_ void ndr_print_svcctl_SCSetServiceBitsA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_SCSetServiceBitsA *r);
-_PUBLIC_ void ndr_print_svcctl_ChangeServiceConfigA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_ChangeServiceConfigA *r);
-_PUBLIC_ void ndr_print_svcctl_CreateServiceA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_CreateServiceA *r);
-_PUBLIC_ void ndr_print_svcctl_EnumDependentServicesA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_EnumDependentServicesA *r);
-_PUBLIC_ void ndr_print_svcctl_EnumServicesStatusA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_EnumServicesStatusA *r);
-_PUBLIC_ void ndr_print_svcctl_OpenSCManagerA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_OpenSCManagerA *r);
-_PUBLIC_ void ndr_print_svcctl_OpenServiceA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_OpenServiceA *r);
-_PUBLIC_ void ndr_print_svcctl_QueryServiceConfigA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceConfigA *r);
-_PUBLIC_ void ndr_print_svcctl_QueryServiceLockStatusA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceLockStatusA *r);
-_PUBLIC_ void ndr_print_svcctl_StartServiceA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_StartServiceA *r);
-_PUBLIC_ void ndr_print_svcctl_GetServiceDisplayNameA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_GetServiceDisplayNameA *r);
-_PUBLIC_ void ndr_print_svcctl_GetServiceKeyNameA(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_GetServiceKeyNameA *r);
-_PUBLIC_ void ndr_print_svcctl_GetCurrentGroupeStateW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_GetCurrentGroupeStateW *r);
-_PUBLIC_ void ndr_print_svcctl_EnumServiceGroupW(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_EnumServiceGroupW *r);
-_PUBLIC_ void ndr_print_svcctl_ChangeServiceConfig2A(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_ChangeServiceConfig2A *r);
-_PUBLIC_ void ndr_print_svcctl_ChangeServiceConfig2W(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_ChangeServiceConfig2W *r);
-_PUBLIC_ void ndr_print_svcctl_QueryServiceConfig2A(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceConfig2A *r);
-_PUBLIC_ void ndr_print_svcctl_QueryServiceConfig2W(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceConfig2W *r);
-_PUBLIC_ void ndr_print_svcctl_QueryServiceStatusEx(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_QueryServiceStatusEx *r);
-_PUBLIC_ void ndr_print_EnumServicesStatusExA(struct ndr_print *ndr, const char *name, int flags, const struct EnumServicesStatusExA *r);
-_PUBLIC_ void ndr_print_EnumServicesStatusExW(struct ndr_print *ndr, const char *name, int flags, const struct EnumServicesStatusExW *r);
-_PUBLIC_ void ndr_print_svcctl_SCSendTSMessage(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_SCSendTSMessage *r);
-
-/* The following definitions come from librpc/gen_ndr/ndr_winreg.c */
-
-_PUBLIC_ void ndr_print_winreg_AccessMask(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_winreg_Type(struct ndr_print *ndr, const char *name, enum winreg_Type r);
-_PUBLIC_ enum ndr_err_code ndr_push_winreg_String(struct ndr_push *ndr, int ndr_flags, const struct winreg_String *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_winreg_String(struct ndr_pull *ndr, int ndr_flags, struct winreg_String *r);
-_PUBLIC_ void ndr_print_winreg_String(struct ndr_print *ndr, const char *name, const struct winreg_String *r);
-_PUBLIC_ void ndr_print_KeySecurityData(struct ndr_print *ndr, const char *name, const struct KeySecurityData *r);
-_PUBLIC_ void ndr_print_winreg_SecBuf(struct ndr_print *ndr, const char *name, const struct winreg_SecBuf *r);
-_PUBLIC_ void ndr_print_winreg_CreateAction(struct ndr_print *ndr, const char *name, enum winreg_CreateAction r);
-_PUBLIC_ void ndr_print_winreg_StringBuf(struct ndr_print *ndr, const char *name, const struct winreg_StringBuf *r);
-_PUBLIC_ void ndr_print_winreg_ValNameBuf(struct ndr_print *ndr, const char *name, const struct winreg_ValNameBuf *r);
-_PUBLIC_ void ndr_print_KeySecurityAttribute(struct ndr_print *ndr, const char *name, const struct KeySecurityAttribute *r);
-_PUBLIC_ void ndr_print_QueryMultipleValue(struct ndr_print *ndr, const char *name, const struct QueryMultipleValue *r);
-_PUBLIC_ void ndr_print_winreg_OpenHKCR(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCR *r);
-_PUBLIC_ void ndr_print_winreg_OpenHKCU(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCU *r);
-_PUBLIC_ void ndr_print_winreg_OpenHKLM(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKLM *r);
-_PUBLIC_ void ndr_print_winreg_OpenHKPD(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKPD *r);
-_PUBLIC_ void ndr_print_winreg_OpenHKU(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKU *r);
-_PUBLIC_ void ndr_print_winreg_CloseKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_CloseKey *r);
-_PUBLIC_ void ndr_print_winreg_CreateKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_CreateKey *r);
-_PUBLIC_ void ndr_print_winreg_DeleteKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_DeleteKey *r);
-_PUBLIC_ void ndr_print_winreg_DeleteValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_DeleteValue *r);
-_PUBLIC_ void ndr_print_winreg_EnumKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_EnumKey *r);
-_PUBLIC_ void ndr_print_winreg_EnumValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_EnumValue *r);
-_PUBLIC_ void ndr_print_winreg_FlushKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_FlushKey *r);
-_PUBLIC_ void ndr_print_winreg_GetKeySecurity(struct ndr_print *ndr, const char *name, int flags, const struct winreg_GetKeySecurity *r);
-_PUBLIC_ void ndr_print_winreg_LoadKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_LoadKey *r);
-_PUBLIC_ void ndr_print_winreg_NotifyChangeKeyValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_NotifyChangeKeyValue *r);
-_PUBLIC_ void ndr_print_winreg_OpenKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenKey *r);
-_PUBLIC_ void ndr_print_winreg_QueryInfoKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryInfoKey *r);
-_PUBLIC_ void ndr_print_winreg_QueryValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryValue *r);
-_PUBLIC_ void ndr_print_winreg_ReplaceKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_ReplaceKey *r);
-_PUBLIC_ void ndr_print_winreg_RestoreKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_RestoreKey *r);
-_PUBLIC_ void ndr_print_winreg_SaveKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SaveKey *r);
-_PUBLIC_ void ndr_print_winreg_SetKeySecurity(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SetKeySecurity *r);
-_PUBLIC_ void ndr_print_winreg_SetValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SetValue *r);
-_PUBLIC_ void ndr_print_winreg_UnLoadKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_UnLoadKey *r);
-_PUBLIC_ void ndr_print_winreg_InitiateSystemShutdown(struct ndr_print *ndr, const char *name, int flags, const struct winreg_InitiateSystemShutdown *r);
-_PUBLIC_ void ndr_print_winreg_AbortSystemShutdown(struct ndr_print *ndr, const char *name, int flags, const struct winreg_AbortSystemShutdown *r);
-_PUBLIC_ void ndr_print_winreg_GetVersion(struct ndr_print *ndr, const char *name, int flags, const struct winreg_GetVersion *r);
-_PUBLIC_ void ndr_print_winreg_OpenHKCC(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCC *r);
-_PUBLIC_ void ndr_print_winreg_OpenHKDD(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKDD *r);
-_PUBLIC_ void ndr_print_winreg_QueryMultipleValues(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryMultipleValues *r);
-_PUBLIC_ void ndr_print_winreg_InitiateSystemShutdownEx(struct ndr_print *ndr, const char *name, int flags, const struct winreg_InitiateSystemShutdownEx *r);
-_PUBLIC_ void ndr_print_winreg_SaveKeyEx(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SaveKeyEx *r);
-_PUBLIC_ void ndr_print_winreg_OpenHKPT(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKPT *r);
-_PUBLIC_ void ndr_print_winreg_OpenHKPN(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKPN *r);
-_PUBLIC_ void ndr_print_winreg_QueryMultipleValues2(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryMultipleValues2 *r);
-
-/* The following definitions come from librpc/gen_ndr/ndr_wkssvc.c */
-
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo100(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo100 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo101(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo101 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo102(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo102 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo502(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo502 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1010(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1010 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1011(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1011 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1012(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1012 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1013(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1013 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1018(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1018 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1023(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1023 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1027(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1027 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1028(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1028 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1032(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1032 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1033(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1033 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1041(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1041 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1042(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1042 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1043(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1043 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1044(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1044 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1045(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1045 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1046(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1046 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1047(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1047 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1048(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1048 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1049(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1049 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1050(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1050 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1051(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1051 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1052(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1052 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1053(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1053 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1054(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1054 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1055(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1055 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1056(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1056 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1057(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1057 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1058(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1058 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1059(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1059 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1060(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1060 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1061(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1061 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo1062(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaInfo1062 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaInfo(struct ndr_print *ndr, const char *name, const union wkssvc_NetWkstaInfo *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrWkstaUserInfo0(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrWkstaUserInfo0 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaEnumUsersCtr0(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaEnumUsersCtr0 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrWkstaUserInfo1(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrWkstaUserInfo1 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaEnumUsersCtr1(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaEnumUsersCtr1 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaEnumUsersCtr(struct ndr_print *ndr, const char *name, const union wkssvc_NetWkstaEnumUsersCtr *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaEnumUsersInfo(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaEnumUsersInfo *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrWkstaUserInfo1101(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrWkstaUserInfo1101 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrWkstaUserInfo(struct ndr_print *ndr, const char *name, const union wkssvc_NetrWkstaUserInfo *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaTransportInfo0(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaTransportInfo0 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaTransportCtr0(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaTransportCtr0 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaTransportCtr(struct ndr_print *ndr, const char *name, const union wkssvc_NetWkstaTransportCtr *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaTransportInfo(struct ndr_print *ndr, const char *name, const struct wkssvc_NetWkstaTransportInfo *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrUseInfo3(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrUseInfo3 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrUseInfo2(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrUseInfo2 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrUseInfo1(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrUseInfo1 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrUseInfo0(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrUseInfo0 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrUseGetInfoCtr(struct ndr_print *ndr, const char *name, const union wkssvc_NetrUseGetInfoCtr *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrUseEnumCtr2(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrUseEnumCtr2 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrUseEnumCtr1(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrUseEnumCtr1 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrUseEnumCtr0(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrUseEnumCtr0 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrUseEnumCtr(struct ndr_print *ndr, const char *name, const union wkssvc_NetrUseEnumCtr *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrUseEnumInfo(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrUseEnumInfo *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrWorkstationStatistics(struct ndr_print *ndr, const char *name, const struct wkssvc_NetrWorkstationStatistics *r);
-_PUBLIC_ void ndr_print_wkssvc_renameflags(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_wkssvc_NetValidateNameType(struct ndr_print *ndr, const char *name, enum wkssvc_NetValidateNameType r);
-_PUBLIC_ void ndr_print_wkssvc_NetJoinStatus(struct ndr_print *ndr, const char *name, enum wkssvc_NetJoinStatus r);
-_PUBLIC_ void ndr_print_wkssvc_PasswordBuffer(struct ndr_print *ndr, const char *name, const struct wkssvc_PasswordBuffer *r);
-_PUBLIC_ void ndr_print_wkssvc_joinflags(struct ndr_print *ndr, const char *name, uint32_t r);
-_PUBLIC_ void ndr_print_wkssvc_ComputerNameType(struct ndr_print *ndr, const char *name, enum wkssvc_ComputerNameType r);
-_PUBLIC_ void ndr_print_wkssvc_ComputerNamesCtr(struct ndr_print *ndr, const char *name, const struct wkssvc_ComputerNamesCtr *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaGetInfo(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetWkstaGetInfo *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaSetInfo(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetWkstaSetInfo *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaEnumUsers(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetWkstaEnumUsers *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrWkstaUserGetInfo(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrWkstaUserGetInfo *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrWkstaUserSetInfo(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrWkstaUserSetInfo *r);
-_PUBLIC_ void ndr_print_wkssvc_NetWkstaTransportEnum(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetWkstaTransportEnum *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrWkstaTransportAdd(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrWkstaTransportAdd *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrWkstaTransportDel(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrWkstaTransportDel *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrUseAdd(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrUseAdd *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrUseGetInfo(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrUseGetInfo *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrUseDel(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrUseDel *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrUseEnum(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrUseEnum *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrMessageBufferSend(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrMessageBufferSend *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrWorkstationStatisticsGet(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrWorkstationStatisticsGet *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrLogonDomainNameAdd(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrLogonDomainNameAdd *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrLogonDomainNameDel(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrLogonDomainNameDel *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrJoinDomain(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrJoinDomain *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrUnjoinDomain(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrUnjoinDomain *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrRenameMachineInDomain(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrRenameMachineInDomain *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrValidateName(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrValidateName *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrGetJoinInformation(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrGetJoinInformation *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrGetJoinableOus(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrGetJoinableOus *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrJoinDomain2(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrJoinDomain2 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrUnjoinDomain2(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrUnjoinDomain2 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrRenameMachineInDomain2(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrRenameMachineInDomain2 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrValidateName2(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrValidateName2 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrGetJoinableOus2(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrGetJoinableOus2 *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrAddAlternateComputerName(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrAddAlternateComputerName *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrRemoveAlternateComputerName(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrRemoveAlternateComputerName *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrSetPrimaryComputername(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrSetPrimaryComputername *r);
-_PUBLIC_ void ndr_print_wkssvc_NetrEnumerateComputerNames(struct ndr_print *ndr, const char *name, int flags, const struct wkssvc_NetrEnumerateComputerNames *r);
-
-/* The following definitions come from librpc/gen_ndr/ndr_xattr.c */
-
-_PUBLIC_ enum ndr_err_code ndr_push_tdb_xattr(struct ndr_push *ndr, int ndr_flags, const struct tdb_xattr *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_tdb_xattr(struct ndr_pull *ndr, int ndr_flags, struct tdb_xattr *r);
-_PUBLIC_ void ndr_print_tdb_xattr(struct ndr_print *ndr, const char *name, const struct tdb_xattr *r);
-_PUBLIC_ enum ndr_err_code ndr_push_tdb_xattrs(struct ndr_push *ndr, int ndr_flags, const struct tdb_xattrs *r);
-_PUBLIC_ enum ndr_err_code ndr_pull_tdb_xattrs(struct ndr_pull *ndr, int ndr_flags, struct tdb_xattrs *r);
-_PUBLIC_ void ndr_print_tdb_xattrs(struct ndr_print *ndr, const char *name, const struct tdb_xattrs *r);
-
-/* The following definitions come from librpc/gen_ndr/srv_dfs.c */
-
-void netdfs_get_pipe_fns(struct api_struct **fns, int *n_fns);
-NTSTATUS rpc_netdfs_init(void);
-
-/* The following definitions come from librpc/gen_ndr/srv_dssetup.c */
-
-void dssetup_get_pipe_fns(struct api_struct **fns, int *n_fns);
-NTSTATUS rpc_dssetup_init(void);
-
-/* The following definitions come from librpc/gen_ndr/srv_echo.c */
-
-void rpcecho_get_pipe_fns(struct api_struct **fns, int *n_fns);
-NTSTATUS rpc_rpcecho_init(void);
-
-/* The following definitions come from librpc/gen_ndr/srv_eventlog.c */
-
-void eventlog_get_pipe_fns(struct api_struct **fns, int *n_fns);
-NTSTATUS rpc_eventlog_init(void);
-
-/* The following definitions come from librpc/gen_ndr/srv_initshutdown.c */
-
-void initshutdown_get_pipe_fns(struct api_struct **fns, int *n_fns);
-NTSTATUS rpc_initshutdown_init(void);
-
-/* The following definitions come from librpc/gen_ndr/srv_lsa.c */
-
-void lsarpc_get_pipe_fns(struct api_struct **fns, int *n_fns);
-NTSTATUS rpc_lsarpc_init(void);
-
-/* The following definitions come from librpc/gen_ndr/srv_netlogon.c */
-
-void netlogon_get_pipe_fns(struct api_struct **fns, int *n_fns);
-NTSTATUS rpc_netlogon_init(void);
-
-/* The following definitions come from librpc/gen_ndr/srv_ntsvcs.c */
-
-void ntsvcs_get_pipe_fns(struct api_struct **fns, int *n_fns);
-NTSTATUS rpc_ntsvcs_init(void);
-
-/* The following definitions come from librpc/gen_ndr/srv_samr.c */
-
-void samr_get_pipe_fns(struct api_struct **fns, int *n_fns);
-NTSTATUS rpc_samr_init(void);
-
-/* The following definitions come from librpc/gen_ndr/srv_srvsvc.c */
-
-void srvsvc_get_pipe_fns(struct api_struct **fns, int *n_fns);
-NTSTATUS rpc_srvsvc_init(void);
-
-/* The following definitions come from librpc/gen_ndr/srv_svcctl.c */
-
-void svcctl_get_pipe_fns(struct api_struct **fns, int *n_fns);
-NTSTATUS rpc_svcctl_init(void);
-
-/* The following definitions come from librpc/gen_ndr/srv_winreg.c */
-
-void winreg_get_pipe_fns(struct api_struct **fns, int *n_fns);
-NTSTATUS rpc_winreg_init(void);
-
-/* The following definitions come from librpc/gen_ndr/srv_wkssvc.c */
-
-void wkssvc_get_pipe_fns(struct api_struct **fns, int *n_fns);
-NTSTATUS rpc_wkssvc_init(void);
+#include "librpc/gen_ndr/ndr_dfs.h"
+#include "librpc/gen_ndr/ndr_dssetup.h"
+#include "librpc/gen_ndr/ndr_echo.h"
+#include "librpc/gen_ndr/ndr_eventlog.h"
+#include "librpc/gen_ndr/ndr_krb5pac.h"
+#include "librpc/gen_ndr/ndr_lsa.h"
+#include "librpc/gen_ndr/ndr_misc.h"
+#include "librpc/gen_ndr/ndr_netlogon.h"
+#include "librpc/gen_ndr/ndr_notify.h"
+#include "librpc/gen_ndr/ndr_ntsvcs.h"
+#include "librpc/gen_ndr/ndr_samr.h"
+#include "librpc/gen_ndr/ndr_security.h"
+#include "librpc/gen_ndr/ndr_srvsvc.h"
+#include "librpc/gen_ndr/ndr_svcctl.h"
+#include "librpc/gen_ndr/ndr_winreg.h"
+#include "librpc/gen_ndr/ndr_wkssvc.h"
+
+#include "librpc/gen_ndr/srv_dfs.h"
+#include "librpc/gen_ndr/srv_dssetup.h"
+#include "librpc/gen_ndr/srv_echo.h"
+#include "librpc/gen_ndr/srv_eventlog.h"
+#include "librpc/gen_ndr/srv_initshutdown.h"
+#include "librpc/gen_ndr/srv_lsa.h"
+#include "librpc/gen_ndr/srv_netlogon.h"
+#include "librpc/gen_ndr/srv_ntsvcs.h"
+#include "librpc/gen_ndr/srv_samr.h"
+#include "librpc/gen_ndr/srv_srvsvc.h"
+#include "librpc/gen_ndr/srv_svcctl.h"
+#include "librpc/gen_ndr/srv_winreg.h"
+#include "librpc/gen_ndr/srv_wkssvc.h"
+
+#include "librpc/ndr/libndr.h"
+
+/* The following definitions come from librpc/ndr/util.c */
-/* The following definitions come from librpc/ndr/ndr.c */
-
-_PUBLIC_ size_t ndr_align_size(uint32_t offset, size_t n);
-_PUBLIC_ struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx);
-_PUBLIC_ enum ndr_err_code ndr_pull_advance(struct ndr_pull *ndr, uint32_t size);
-_PUBLIC_ void ndr_pull_save(struct ndr_pull *ndr, struct ndr_pull_save *save);
-_PUBLIC_ void ndr_pull_restore(struct ndr_pull *ndr, struct ndr_pull_save *save);
-_PUBLIC_ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx);
-_PUBLIC_ DATA_BLOB ndr_push_blob(struct ndr_push *ndr);
-_PUBLIC_ enum ndr_err_code ndr_push_expand(struct ndr_push *ndr, uint32_t extra_size);
-_PUBLIC_ void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) _PRINTF_ATTRIBUTE(2,3);
-_PUBLIC_ void ndr_print_string_helper(struct ndr_print *ndr, const char *format, ...) _PRINTF_ATTRIBUTE(2,3);
-_PUBLIC_ void ndr_print_debug(ndr_print_fn_t fn, const char *name, void *ptr);
-_PUBLIC_ void ndr_print_union_debug(ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr);
-_PUBLIC_ void ndr_print_function_debug(ndr_print_function_t fn, const char *name, int flags, void *ptr);
-_PUBLIC_ char *ndr_print_struct_string(TALLOC_CTX *mem_ctx, ndr_print_fn_t fn, const char *name, void *ptr);
-_PUBLIC_ char *ndr_print_union_string(TALLOC_CTX *mem_ctx, ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr);
-_PUBLIC_ char *ndr_print_function_string(TALLOC_CTX *mem_ctx,
- ndr_print_function_t fn, const char *name,
- int flags, void *ptr);
-_PUBLIC_ void ndr_set_flags(uint32_t *pflags, uint32_t new_flags);
NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err);
-const char *ndr_errstr(enum ndr_err_code err);
-_PUBLIC_ enum ndr_err_code ndr_pull_error(struct ndr_pull *ndr,
- enum ndr_err_code ndr_err,
- const char *format, ...) _PRINTF_ATTRIBUTE(3,4);
-_PUBLIC_ enum ndr_err_code ndr_push_error(struct ndr_push *ndr,
- enum ndr_err_code ndr_err,
- const char *format, ...) _PRINTF_ATTRIBUTE(3,4);
-_PUBLIC_ enum ndr_err_code ndr_pull_subcontext_start(struct ndr_pull *ndr,
- struct ndr_pull **_subndr,
- size_t header_size,
- ssize_t size_is);
-_PUBLIC_ enum ndr_err_code ndr_pull_subcontext_end(struct ndr_pull *ndr,
- struct ndr_pull *subndr,
- size_t header_size,
- ssize_t size_is);
-_PUBLIC_ enum ndr_err_code ndr_push_subcontext_start(struct ndr_push *ndr,
- struct ndr_push **_subndr,
- size_t header_size,
- ssize_t size_is);
-_PUBLIC_ enum ndr_err_code ndr_push_subcontext_end(struct ndr_push *ndr,
- struct ndr_push *subndr,
- size_t header_size,
- ssize_t size_is);
-_PUBLIC_ enum ndr_err_code ndr_token_store(TALLOC_CTX *mem_ctx,
- struct ndr_token_list **list,
- const void *key,
- uint32_t value);
-_PUBLIC_ enum ndr_err_code ndr_token_retrieve_cmp_fn(struct ndr_token_list **list, const void *key, uint32_t *v,
- comparison_fn_t _cmp_fn, bool _remove_tok);
-_PUBLIC_ enum ndr_err_code ndr_token_retrieve(struct ndr_token_list **list, const void *key, uint32_t *v);
-_PUBLIC_ uint32_t ndr_token_peek(struct ndr_token_list **list, const void *key);
-_PUBLIC_ enum ndr_err_code ndr_pull_array_size(struct ndr_pull *ndr, const void *p);
-_PUBLIC_ uint32_t ndr_get_array_size(struct ndr_pull *ndr, const void *p);
-_PUBLIC_ enum ndr_err_code ndr_check_array_size(struct ndr_pull *ndr, void *p, uint32_t size);
-_PUBLIC_ enum ndr_err_code ndr_pull_array_length(struct ndr_pull *ndr, const void *p);
-_PUBLIC_ uint32_t ndr_get_array_length(struct ndr_pull *ndr, const void *p);
-_PUBLIC_ enum ndr_err_code ndr_check_array_length(struct ndr_pull *ndr, void *p, uint32_t length);
-_PUBLIC_ enum ndr_err_code ndr_push_set_switch_value(struct ndr_push *ndr, const void *p, uint32_t val);
-_PUBLIC_ enum ndr_err_code ndr_pull_set_switch_value(struct ndr_pull *ndr, const void *p, uint32_t val);
-_PUBLIC_ enum ndr_err_code ndr_print_set_switch_value(struct ndr_print *ndr, const void *p, uint32_t val);
-_PUBLIC_ uint32_t ndr_push_get_switch_value(struct ndr_push *ndr, const void *p);
-_PUBLIC_ uint32_t ndr_pull_get_switch_value(struct ndr_pull *ndr, const void *p);
-_PUBLIC_ uint32_t ndr_print_get_switch_value(struct ndr_print *ndr, const void *p);
-_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
- ndr_pull_flags_fn_t fn);
-_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
- ndr_pull_flags_fn_t fn);
-_PUBLIC_ enum ndr_err_code ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
- uint32_t level, ndr_pull_flags_fn_t fn);
-_PUBLIC_ enum ndr_err_code ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
- uint32_t level, ndr_pull_flags_fn_t fn);
-_PUBLIC_ enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void *p,
- ndr_push_flags_fn_t fn);
-_PUBLIC_ enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
- uint32_t level, ndr_push_flags_fn_t fn);
-_PUBLIC_ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push);
-_PUBLIC_ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_fn_t push);
-_PUBLIC_ uint32_t ndr_push_get_relative_base_offset(struct ndr_push *ndr);
-_PUBLIC_ void ndr_push_restore_relative_base_offset(struct ndr_push *ndr, uint32_t offset);
-_PUBLIC_ enum ndr_err_code ndr_push_setup_relative_base_offset1(struct ndr_push *ndr, const void *p, uint32_t offset);
-_PUBLIC_ enum ndr_err_code ndr_push_setup_relative_base_offset2(struct ndr_push *ndr, const void *p);
-_PUBLIC_ enum ndr_err_code ndr_push_relative_ptr1(struct ndr_push *ndr, const void *p);
-_PUBLIC_ enum ndr_err_code ndr_push_relative_ptr2(struct ndr_push *ndr, const void *p);
-_PUBLIC_ uint32_t ndr_pull_get_relative_base_offset(struct ndr_pull *ndr);
-_PUBLIC_ void ndr_pull_restore_relative_base_offset(struct ndr_pull *ndr, uint32_t offset);
-_PUBLIC_ enum ndr_err_code ndr_pull_setup_relative_base_offset1(struct ndr_pull *ndr, const void *p, uint32_t offset);
-_PUBLIC_ enum ndr_err_code ndr_pull_setup_relative_base_offset2(struct ndr_pull *ndr, const void *p);
-_PUBLIC_ enum ndr_err_code ndr_pull_relative_ptr1(struct ndr_pull *ndr, const void *p, uint32_t rel_offset);
-_PUBLIC_ enum ndr_err_code ndr_pull_relative_ptr2(struct ndr_pull *ndr, const void *p);
-
-/* The following definitions come from librpc/ndr/ndr_basic.c */
-
-_PUBLIC_ void ndr_check_padding(struct ndr_pull *ndr, size_t n);
-_PUBLIC_ enum ndr_err_code ndr_pull_int8(struct ndr_pull *ndr, int ndr_flags, int8_t *v);
-_PUBLIC_ enum ndr_err_code ndr_pull_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *v);
-_PUBLIC_ enum ndr_err_code ndr_pull_int16(struct ndr_pull *ndr, int ndr_flags, int16_t *v);
-_PUBLIC_ enum ndr_err_code ndr_pull_uint16(struct ndr_pull *ndr, int ndr_flags, uint16_t *v);
-_PUBLIC_ enum ndr_err_code ndr_pull_int32(struct ndr_pull *ndr, int ndr_flags, int32_t *v);
-_PUBLIC_ enum ndr_err_code ndr_pull_uint32(struct ndr_pull *ndr, int ndr_flags, uint32_t *v);
-_PUBLIC_ enum ndr_err_code ndr_pull_generic_ptr(struct ndr_pull *ndr, uint32_t *v);
-_PUBLIC_ enum ndr_err_code ndr_pull_ref_ptr(struct ndr_pull *ndr, uint32_t *v);
-_PUBLIC_ enum ndr_err_code ndr_pull_udlong(struct ndr_pull *ndr, int ndr_flags, uint64_t *v);
-_PUBLIC_ enum ndr_err_code ndr_pull_udlongr(struct ndr_pull *ndr, int ndr_flags, uint64_t *v);
-_PUBLIC_ enum ndr_err_code ndr_pull_dlong(struct ndr_pull *ndr, int ndr_flags, int64_t *v);
-_PUBLIC_ enum ndr_err_code ndr_pull_hyper(struct ndr_pull *ndr, int ndr_flags, uint64_t *v);
-_PUBLIC_ enum ndr_err_code ndr_pull_pointer(struct ndr_pull *ndr, int ndr_flags, void* *v);
-_PUBLIC_ enum ndr_err_code ndr_pull_NTSTATUS(struct ndr_pull *ndr, int ndr_flags, NTSTATUS *status);
-_PUBLIC_ enum ndr_err_code ndr_push_NTSTATUS(struct ndr_push *ndr, int ndr_flags, NTSTATUS status);
-_PUBLIC_ void ndr_print_NTSTATUS(struct ndr_print *ndr, const char *name, NTSTATUS r);
-_PUBLIC_ enum ndr_err_code ndr_pull_WERROR(struct ndr_pull *ndr, int ndr_flags, WERROR *status);
-_PUBLIC_ enum ndr_err_code ndr_push_WERROR(struct ndr_push *ndr, int ndr_flags, WERROR status);
-_PUBLIC_ void ndr_print_WERROR(struct ndr_print *ndr, const char *name, WERROR r);
-_PUBLIC_ enum ndr_err_code ndr_pull_bytes(struct ndr_pull *ndr, uint8_t *data, uint32_t n);
-_PUBLIC_ enum ndr_err_code ndr_pull_array_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *data, uint32_t n);
-_PUBLIC_ enum ndr_err_code ndr_push_int8(struct ndr_push *ndr, int ndr_flags, int8_t v);
-_PUBLIC_ enum ndr_err_code ndr_push_uint8(struct ndr_push *ndr, int ndr_flags, uint8_t v);
-_PUBLIC_ enum ndr_err_code ndr_push_int16(struct ndr_push *ndr, int ndr_flags, int16_t v);
-_PUBLIC_ enum ndr_err_code ndr_push_uint16(struct ndr_push *ndr, int ndr_flags, uint16_t v);
-_PUBLIC_ enum ndr_err_code ndr_push_int32(struct ndr_push *ndr, int ndr_flags, int32_t v);
-_PUBLIC_ enum ndr_err_code ndr_push_uint32(struct ndr_push *ndr, int ndr_flags, uint32_t v);
-_PUBLIC_ enum ndr_err_code ndr_push_udlong(struct ndr_push *ndr, int ndr_flags, uint64_t v);
-_PUBLIC_ enum ndr_err_code ndr_push_udlongr(struct ndr_push *ndr, int ndr_flags, uint64_t v);
-_PUBLIC_ enum ndr_err_code ndr_push_dlong(struct ndr_push *ndr, int ndr_flags, int64_t v);
-_PUBLIC_ enum ndr_err_code ndr_push_hyper(struct ndr_push *ndr, int ndr_flags, uint64_t v);
-_PUBLIC_ enum ndr_err_code ndr_push_pointer(struct ndr_push *ndr, int ndr_flags, void* v);
-_PUBLIC_ enum ndr_err_code ndr_push_align(struct ndr_push *ndr, size_t size);
-_PUBLIC_ enum ndr_err_code ndr_pull_align(struct ndr_pull *ndr, size_t size);
-_PUBLIC_ enum ndr_err_code ndr_push_bytes(struct ndr_push *ndr, const uint8_t *data, uint32_t n);
-_PUBLIC_ enum ndr_err_code ndr_push_zero(struct ndr_push *ndr, uint32_t n);
-_PUBLIC_ enum ndr_err_code ndr_push_array_uint8(struct ndr_push *ndr, int ndr_flags, const uint8_t *data, uint32_t n);
-_PUBLIC_ void ndr_push_save(struct ndr_push *ndr, struct ndr_push_save *save);
-_PUBLIC_ void ndr_push_restore(struct ndr_push *ndr, struct ndr_push_save *save);
-_PUBLIC_ enum ndr_err_code ndr_push_unique_ptr(struct ndr_push *ndr, const void *p);
-_PUBLIC_ enum ndr_err_code ndr_push_full_ptr(struct ndr_push *ndr, const void *p);
-_PUBLIC_ enum ndr_err_code ndr_push_ref_ptr(struct ndr_push *ndr);
-_PUBLIC_ enum ndr_err_code ndr_push_NTTIME(struct ndr_push *ndr, int ndr_flags, NTTIME t);
-_PUBLIC_ enum ndr_err_code ndr_pull_NTTIME(struct ndr_pull *ndr, int ndr_flags, NTTIME *t);
-_PUBLIC_ enum ndr_err_code ndr_push_NTTIME_1sec(struct ndr_push *ndr, int ndr_flags, NTTIME t);
-_PUBLIC_ enum ndr_err_code ndr_pull_NTTIME_1sec(struct ndr_pull *ndr, int ndr_flags, NTTIME *t);
-_PUBLIC_ enum ndr_err_code ndr_pull_NTTIME_hyper(struct ndr_pull *ndr, int ndr_flags, NTTIME *t);
-_PUBLIC_ enum ndr_err_code ndr_push_NTTIME_hyper(struct ndr_push *ndr, int ndr_flags, NTTIME t);
-_PUBLIC_ enum ndr_err_code ndr_push_time_t(struct ndr_push *ndr, int ndr_flags, time_t t);
-_PUBLIC_ enum ndr_err_code ndr_pull_time_t(struct ndr_pull *ndr, int ndr_flags, time_t *t);
-_PUBLIC_ enum ndr_err_code ndr_pull_ipv4address(struct ndr_pull *ndr, int ndr_flags, const char **address);
-_PUBLIC_ enum ndr_err_code ndr_push_ipv4address(struct ndr_push *ndr, int ndr_flags, const char *address);
-_PUBLIC_ void ndr_print_ipv4address(struct ndr_print *ndr, const char *name,
- const char *address);
-_PUBLIC_ void ndr_print_struct(struct ndr_print *ndr, const char *name, const char *type);
-_PUBLIC_ void ndr_print_enum(struct ndr_print *ndr, const char *name, const char *type,
- const char *val, uint32_t value);
-_PUBLIC_ void ndr_print_bitmap_flag(struct ndr_print *ndr, size_t size, const char *flag_name, uint32_t flag, uint32_t value);
-_PUBLIC_ void ndr_print_int8(struct ndr_print *ndr, const char *name, int8_t v);
-_PUBLIC_ void ndr_print_uint8(struct ndr_print *ndr, const char *name, uint8_t v);
-_PUBLIC_ void ndr_print_int16(struct ndr_print *ndr, const char *name, int16_t v);
-_PUBLIC_ void ndr_print_uint16(struct ndr_print *ndr, const char *name, uint16_t v);
-_PUBLIC_ void ndr_print_int32(struct ndr_print *ndr, const char *name, int32_t v);
-_PUBLIC_ void ndr_print_uint32(struct ndr_print *ndr, const char *name, uint32_t v);
-_PUBLIC_ void ndr_print_udlong(struct ndr_print *ndr, const char *name, uint64_t v);
-_PUBLIC_ void ndr_print_udlongr(struct ndr_print *ndr, const char *name, uint64_t v);
-_PUBLIC_ void ndr_print_dlong(struct ndr_print *ndr, const char *name, int64_t v);
-_PUBLIC_ void ndr_print_hyper(struct ndr_print *ndr, const char *name, uint64_t v);
-_PUBLIC_ void ndr_print_pointer(struct ndr_print *ndr, const char *name, void *v);
-_PUBLIC_ void ndr_print_ptr(struct ndr_print *ndr, const char *name, const void *p);
-_PUBLIC_ void ndr_print_NTTIME(struct ndr_print *ndr, const char *name, NTTIME t);
-_PUBLIC_ void ndr_print_NTTIME_1sec(struct ndr_print *ndr, const char *name, NTTIME t);
-_PUBLIC_ void ndr_print_NTTIME_hyper(struct ndr_print *ndr, const char *name, NTTIME t);
-_PUBLIC_ void ndr_print_time_t(struct ndr_print *ndr, const char *name, time_t t);
-_PUBLIC_ void ndr_print_union(struct ndr_print *ndr, const char *name, int level, const char *type);
-_PUBLIC_ void ndr_print_bad_level(struct ndr_print *ndr, const char *name, uint16_t level);
-_PUBLIC_ void ndr_print_array_uint8(struct ndr_print *ndr, const char *name,
- const uint8_t *data, uint32_t count);
-_PUBLIC_ void ndr_print_DATA_BLOB(struct ndr_print *ndr, const char *name, DATA_BLOB r);
-_PUBLIC_ enum ndr_err_code ndr_push_DATA_BLOB(struct ndr_push *ndr, int ndr_flags, DATA_BLOB blob);
-_PUBLIC_ enum ndr_err_code ndr_pull_DATA_BLOB(struct ndr_pull *ndr, int ndr_flags, DATA_BLOB *blob);
-_PUBLIC_ uint32_t ndr_size_DATA_BLOB(int ret, const DATA_BLOB *data, int flags);
-_PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool b);
-_PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss);
-
-/* The following definitions come from librpc/ndr/ndr_krb5pac.c */
-
-enum ndr_err_code ndr_push_PAC_BUFFER(struct ndr_push *ndr, int ndr_flags, const struct PAC_BUFFER *r);
-enum ndr_err_code ndr_pull_PAC_BUFFER(struct ndr_pull *ndr, int ndr_flags, struct PAC_BUFFER *r);
-void ndr_print_PAC_BUFFER(struct ndr_print *ndr, const char *name, const struct PAC_BUFFER *r);
-
-/* The following definitions come from librpc/ndr/ndr_misc.c */
-
-bool all_zero(const uint8_t *ptr, size_t size);
-void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid);
-bool ndr_syntax_id_equal(const struct ndr_syntax_id *i1,
- const struct ndr_syntax_id *i2);
enum ndr_err_code ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r);
enum ndr_err_code ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_id *r);
void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct server_id *r);
+_PUBLIC_ void ndr_print_bool(struct ndr_print *ndr, const char *name, const bool b);
+_PUBLIC_ void ndr_print_sockaddr_storage(struct ndr_print *ndr, const char *name, const struct sockaddr_storage *ss);
+const char *ndr_errstr(enum ndr_err_code err);
/* The following definitions come from librpc/ndr/ndr_sec_helper.c */
@@ -4104,22 +2436,6 @@ void ndr_print_dom_sid2(struct ndr_print *ndr, const char *name, const struct do
void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
void ndr_print_dom_sid0(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
-/* The following definitions come from librpc/ndr/ndr_string.c */
-
-_PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const char **s);
-_PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, int ndr_flags, const char *s);
-_PUBLIC_ size_t ndr_string_array_size(struct ndr_push *ndr, const char *s);
-_PUBLIC_ void ndr_print_string(struct ndr_print *ndr, const char *name, const char *s);
-_PUBLIC_ uint32_t ndr_size_string(int ret, const char * const* string, int flags) ;
-_PUBLIC_ enum ndr_err_code ndr_pull_string_array(struct ndr_pull *ndr, int ndr_flags, const char ***_a);
-_PUBLIC_ enum ndr_err_code ndr_push_string_array(struct ndr_push *ndr, int ndr_flags, const char **a);
-_PUBLIC_ void ndr_print_string_array(struct ndr_print *ndr, const char *name, const char **a);
-_PUBLIC_ uint32_t ndr_string_length(const void *_var, uint32_t element_size);
-_PUBLIC_ enum ndr_err_code ndr_check_string_terminator(struct ndr_pull *ndr, uint32_t count, uint32_t element_size);
-_PUBLIC_ enum ndr_err_code ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags, const char **var, uint32_t length, uint8_t byte_mul, charset_t chset);
-_PUBLIC_ enum ndr_err_code ndr_push_charset(struct ndr_push *ndr, int ndr_flags, const char *var, uint32_t length, uint8_t byte_mul, charset_t chset);
-_PUBLIC_ uint32_t ndr_charset_length(const void *var, charset_t chset);
-
/* The following definitions come from librpc/ndr/sid.c */
enum ndr_err_code ndr_push_dom_sid(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *r);
@@ -4132,20 +2448,6 @@ enum ndr_err_code ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const
enum ndr_err_code ndr_pull_dom_sid0(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid);
enum ndr_err_code ndr_push_dom_sid0(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid);
-/* The following definitions come from librpc/ndr/uuid.c */
-
-_PUBLIC_ NTSTATUS GUID_from_string(const char *s, struct GUID *guid);
-_PUBLIC_ NTSTATUS NS_GUID_from_string(const char *s, struct GUID *guid);
-struct GUID GUID_random(void);
-_PUBLIC_ struct GUID GUID_zero(void);
-_PUBLIC_ bool GUID_all_zero(const struct GUID *u);
-_PUBLIC_ bool GUID_equal(const struct GUID *u1, const struct GUID *u2);
-_PUBLIC_ int GUID_compare(const struct GUID *u1, const struct GUID *u2);
-_PUBLIC_ char *GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid);
-_PUBLIC_ char *GUID_string2(TALLOC_CTX *mem_ctx, const struct GUID *guid);
-_PUBLIC_ char *NS_GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid);
-_PUBLIC_ bool policy_handle_empty(struct policy_handle *h) ;
-
/* The following definitions come from librpc/rpc/binding.c */
const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor);
@@ -4313,7 +2615,7 @@ bool receive_getdc_response(TALLOC_CTX *mem_ctx,
const char *domain_name,
uint32_t *nt_version,
const char **dc_name,
- union nbt_cldap_netlogon **reply);
+ struct netlogon_samlogon_response **reply);
/* The following definitions come from libsmb/clientgen.c */
@@ -4400,13 +2702,13 @@ bool cli_lock(struct cli_state *cli, int fnum,
uint32 offset, uint32 len, int timeout, enum brl_type lock_type);
bool cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len);
bool cli_lock64(struct cli_state *cli, int fnum,
- SMB_BIG_UINT offset, SMB_BIG_UINT len, int timeout, enum brl_type lock_type);
-bool cli_unlock64(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_UINT len);
+ uint64_t offset, uint64_t len, int timeout, enum brl_type lock_type);
+bool cli_unlock64(struct cli_state *cli, int fnum, uint64_t offset, uint64_t len);
bool cli_posix_lock(struct cli_state *cli, int fnum,
- SMB_BIG_UINT offset, SMB_BIG_UINT len,
+ uint64_t offset, uint64_t len,
bool wait_lock, enum brl_type lock_type);
-bool cli_posix_unlock(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_UINT len);
-bool cli_posix_getlock(struct cli_state *cli, int fnum, SMB_BIG_UINT *poffset, SMB_BIG_UINT *plen);
+bool cli_posix_unlock(struct cli_state *cli, int fnum, uint64_t offset, uint64_t len);
+bool cli_posix_getlock(struct cli_state *cli, int fnum, uint64_t *poffset, uint64_t *plen);
bool cli_getattrE(struct cli_state *cli, int fd,
uint16 *attr, SMB_OFF_T *size,
time_t *change_time,
@@ -4452,7 +2754,6 @@ NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
const char *pass,
const char *domain);
NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
-NTSTATUS cli_gss_smb_encryption_start(struct cli_state *cli);
NTSTATUS cli_force_encryption(struct cli_state *c,
const char *username,
const char *password,
@@ -5258,20 +3559,20 @@ const char *lock_type_name(enum brl_type lock_type);
const char *lock_flav_name(enum brl_flavour lock_flav);
bool is_locked(files_struct *fsp,
uint32 smbpid,
- SMB_BIG_UINT count,
- SMB_BIG_UINT offset,
+ uint64_t count,
+ uint64_t offset,
enum brl_type lock_type);
NTSTATUS query_lock(files_struct *fsp,
uint32 *psmbpid,
- SMB_BIG_UINT *pcount,
- SMB_BIG_UINT *poffset,
+ uint64_t *pcount,
+ uint64_t *poffset,
enum brl_type *plock_type,
enum brl_flavour lock_flav);
struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
files_struct *fsp,
uint32 lock_pid,
- SMB_BIG_UINT count,
- SMB_BIG_UINT offset,
+ uint64_t count,
+ uint64_t offset,
enum brl_type lock_type,
enum brl_flavour lock_flav,
bool blocking_lock,
@@ -5280,13 +3581,13 @@ struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
NTSTATUS do_unlock(struct messaging_context *msg_ctx,
files_struct *fsp,
uint32 lock_pid,
- SMB_BIG_UINT count,
- SMB_BIG_UINT offset,
+ uint64_t count,
+ uint64_t offset,
enum brl_flavour lock_flav);
NTSTATUS do_lock_cancel(files_struct *fsp,
uint32 lock_pid,
- SMB_BIG_UINT count,
- SMB_BIG_UINT offset,
+ uint64_t count,
+ uint64_t offset,
enum brl_flavour lock_flav);
void locking_close_file(struct messaging_context *msg_ctx,
files_struct *fsp);
@@ -5338,8 +3639,8 @@ int share_mode_forall(void (*fn)(const struct share_mode_entry *, const char *,
/* The following definitions come from locking/posix.c */
bool is_posix_locked(files_struct *fsp,
- SMB_BIG_UINT *pu_offset,
- SMB_BIG_UINT *pu_count,
+ uint64_t *pu_offset,
+ uint64_t *pu_count,
enum brl_type *plock_type,
enum brl_flavour lock_flav);
bool posix_locking_init(bool read_only);
@@ -5347,28 +3648,28 @@ bool posix_locking_end(void);
void reduce_windows_lock_ref_count(files_struct *fsp, unsigned int dcount);
int fd_close_posix(struct files_struct *fsp);
bool set_posix_lock_windows_flavour(files_struct *fsp,
- SMB_BIG_UINT u_offset,
- SMB_BIG_UINT u_count,
+ uint64_t u_offset,
+ uint64_t u_count,
enum brl_type lock_type,
const struct lock_context *lock_ctx,
const struct lock_struct *plocks,
int num_locks,
int *errno_ret);
bool release_posix_lock_windows_flavour(files_struct *fsp,
- SMB_BIG_UINT u_offset,
- SMB_BIG_UINT u_count,
+ uint64_t u_offset,
+ uint64_t u_count,
enum brl_type deleted_lock_type,
const struct lock_context *lock_ctx,
const struct lock_struct *plocks,
int num_locks);
bool set_posix_lock_posix_flavour(files_struct *fsp,
- SMB_BIG_UINT u_offset,
- SMB_BIG_UINT u_count,
+ uint64_t u_offset,
+ uint64_t u_count,
enum brl_type lock_type,
int *errno_ret);
bool release_posix_lock_posix_flavour(files_struct *fsp,
- SMB_BIG_UINT u_offset,
- SMB_BIG_UINT u_count,
+ uint64_t u_offset,
+ uint64_t u_count,
const struct lock_context *lock_ctx,
const struct lock_struct *plocks,
int num_locks);
@@ -5954,6 +4255,7 @@ const char **lp_svcctl_list(void);
char *lp_cups_options(int );
char *lp_cups_server(void);
char *lp_iprint_server(void);
+int lp_cups_connection_timeout(void);
const char *lp_ctdbd_socket(void);
const char **lp_cluster_addresses(void);
bool lp_clustering(void);
@@ -6119,7 +4421,7 @@ bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal);
struct parm_struct *lp_get_parameter(const char *param_name);
struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters);
bool lp_snum_ok(int iService);
-void lp_add_one_printer(char *name, char *comment);
+void lp_add_one_printer(const char *name, const char *comment, void *pdata);
bool lp_loaded(void);
void lp_killunused(bool (*snumused) (int));
void lp_kill_all_services(void);
@@ -6548,6 +4850,8 @@ bool secrets_restore_schannel_session_info(TALLOC_CTX *mem_ctx,
struct dcinfo **ppdc);
bool secrets_store_generic(const char *owner, const char *key, const char *secret);
char *secrets_fetch_generic(const char *owner, const char *key);
+bool secrets_store_local_schannel_key(uint8_t schannel_key[16]);
+bool secrets_fetch_local_schannel_key(uint8_t schannel_key[16]);
/* The following definitions come from passdb/util_builtin.c */
@@ -6690,11 +4994,15 @@ char* get_server_name( Printer_entry *printer );
/* The following definitions come from printing/pcap.c */
+bool pcap_cache_add_specific(struct pcap_cache **ppcache, const char *name, const char *comment);
+void pcap_cache_destroy_specific(struct pcap_cache **ppcache);
bool pcap_cache_add(const char *name, const char *comment);
bool pcap_cache_loaded(void);
+void pcap_cache_replace(const struct pcap_cache *cache);
void pcap_cache_reload(void);
bool pcap_printername_ok(const char *printername);
-void pcap_printer_fn(void (*fn)(char *, char *));
+void pcap_printer_fn_specific(const struct pcap_cache *, void (*fn)(const char *, const char *, void *), void *);
+void pcap_printer_fn(void (*fn)(const char *, const char *, void *), void *);
/* The following definitions come from printing/print_aix.c */
@@ -6718,7 +5026,8 @@ bool sysv_cache_reload(void);
/* The following definitions come from printing/printfsp.c */
-NTSTATUS print_fsp_open(connection_struct *conn, const char *fname,
+NTSTATUS print_fsp_open(struct smb_request *req, connection_struct *conn,
+ const char *fname,
uint16_t current_vuid, files_struct **result);
void print_fsp_end(files_struct *fsp, enum file_close_type close_type);
@@ -7049,6 +5358,12 @@ NTSTATUS rpccli_netlogon_sam_network_logon_ex(struct rpc_pipe_client *cli,
DATA_BLOB lm_response,
DATA_BLOB nt_response,
struct netr_SamInfo3 **info3);
+NTSTATUS rpccli_netlogon_set_trust_password(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ const unsigned char orig_trust_passwd_hash[16],
+ const char *new_trust_pwd_cleartext,
+ const unsigned char new_trust_passwd_hash[16],
+ uint32_t sec_channel_type);
/* The following definitions come from rpc_client/cli_pipe.c */
@@ -7313,8 +5628,6 @@ WERROR rpccli_spoolss_rffpcnex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
WERROR rpccli_svcctl_enumerate_services( struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
POLICY_HND *hSCM, uint32 type, uint32 state,
uint32 *returned, ENUM_SERVICES_STATUS **service_array );
-WERROR rpccli_svcctl_query_config(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- POLICY_HND *hService, SERVICE_CONFIG *config );
/* The following definitions come from rpc_client/init_lsa.c */
@@ -7427,6 +5740,9 @@ void init_netr_PasswordInfo(struct netr_PasswordInfo *r,
const char *workstation,
struct samr_Password lmpassword,
struct samr_Password ntpassword);
+void init_netr_CryptPassword(const char *pwd,
+ unsigned char session_key[16],
+ struct netr_CryptPassword *pwd_buf);
/* The following definitions come from rpc_client/init_samr.c */
@@ -7436,22 +5752,22 @@ void init_samr_DomInfo1(struct samr_DomInfo1 *r,
uint32_t password_properties,
int64_t max_password_age,
int64_t min_password_age);
-void init_samr_DomInfo2(struct samr_DomInfo2 *r,
- NTTIME force_logoff_time,
- const char *comment,
- const char *domain_name,
- const char *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);
+void init_samr_DomGeneralInformation(struct samr_DomGeneralInformation *r,
+ NTTIME force_logoff_time,
+ const char *oem_information,
+ const char *domain_name,
+ const char *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);
void init_samr_DomInfo3(struct samr_DomInfo3 *r,
NTTIME force_logoff_time);
-void init_samr_DomInfo4(struct samr_DomInfo4 *r,
- const char *comment);
+void init_samr_DomOEMInformation(struct samr_DomOEMInformation *r,
+ const char *oem_information);
void init_samr_DomInfo5(struct samr_DomInfo5 *r,
const char *domain_name);
void init_samr_DomInfo6(struct samr_DomInfo6 *r,
@@ -8304,11 +6620,8 @@ bool convert_port_data_1( NT_PORT_DATA_1 *port1, RPC_BUFFER *buf ) ;
bool svcctl_io_enum_services_status( const char *desc, ENUM_SERVICES_STATUS *enum_status, RPC_BUFFER *buffer, int depth );
bool svcctl_io_service_status_process( const char *desc, SERVICE_STATUS_PROCESS *status, RPC_BUFFER *buffer, int depth );
uint32 svcctl_sizeof_enum_services_status( ENUM_SERVICES_STATUS *status );
-uint32 svcctl_sizeof_service_config( SERVICE_CONFIG *config );
bool svcctl_io_q_enum_services_status(const char *desc, SVCCTL_Q_ENUM_SERVICES_STATUS *q_u, prs_struct *ps, int depth);
bool svcctl_io_r_enum_services_status(const char *desc, SVCCTL_R_ENUM_SERVICES_STATUS *r_u, prs_struct *ps, int depth);
-bool svcctl_io_q_query_service_config(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG *q_u, prs_struct *ps, int depth);
-bool svcctl_io_r_query_service_config(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG *r_u, prs_struct *ps, int depth);
bool svcctl_io_q_query_service_config2(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG2 *q_u, prs_struct *ps, int depth);
void init_service_description_buffer(SERVICE_DESCRIPTION *desc, const char *service_desc );
bool svcctl_io_service_description( const char *desc, SERVICE_DESCRIPTION *description, RPC_BUFFER *buffer, int depth );
@@ -8827,26 +7140,16 @@ bool api_pipe_request(pipes_struct *p);
pipes_struct *get_first_internal_pipe(void);
pipes_struct *get_next_internal_pipe(pipes_struct *p);
void set_pipe_handle_offset(int max_open_files);
-void reset_chain_p(void);
void init_rpc_pipe_hnd(void);
-smb_np_struct *open_rpc_pipe_p(const char *pipe_name,
- connection_struct *conn, uint16 vuid);
-ssize_t write_to_pipe(smb_np_struct *p, char *data, size_t n);
-ssize_t read_from_pipe(smb_np_struct *p, char *data, size_t n,
- bool *is_data_outstanding);
-bool wait_rpc_pipe_hnd_state(smb_np_struct *p, uint16 priority);
-bool set_rpc_pipe_hnd_state(smb_np_struct *p, uint16 device_state);
-bool close_rpc_pipe_hnd(smb_np_struct *p);
-void pipe_close_conn(connection_struct *conn);
-smb_np_struct *get_rpc_pipe_p(uint16 pnum);
-smb_np_struct *get_rpc_pipe(int pnum);
-struct pipes_struct *make_internal_rpc_pipe_p(const char *pipe_name,
- const char *client_address,
- struct auth_serversupplied_info *server_info,
- uint16_t vuid);
-ssize_t read_from_internal_pipe(struct pipes_struct *p, char *data, size_t n,
- bool *is_data_outstanding);
-ssize_t write_to_internal_pipe(struct pipes_struct *p, char *data, size_t n);
+
+bool fsp_is_np(struct files_struct *fsp);
+NTSTATUS np_open(struct smb_request *smb_req, struct connection_struct *conn,
+ const char *name, struct files_struct **pfsp);
+NTSTATUS np_write(struct files_struct *fsp, uint8_t *data, size_t len,
+ ssize_t *nwritten);
+NTSTATUS np_read(struct files_struct *fsp, uint8_t *data, size_t len,
+ ssize_t *nread, bool *is_data_outstanding);
+
/* The following definitions come from rpc_server/srv_samr_nt.c */
@@ -9244,7 +7547,6 @@ WERROR _svcctl_ControlService(pipes_struct *p,
WERROR _svcctl_EnumDependentServicesW(pipes_struct *p,
struct svcctl_EnumDependentServicesW *r);
WERROR _svcctl_query_service_status_ex( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_STATUSEX *q_u, SVCCTL_R_QUERY_SERVICE_STATUSEX *r_u );
-WERROR _svcctl_query_service_config( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CONFIG *q_u, SVCCTL_R_QUERY_SERVICE_CONFIG *r_u );
WERROR _svcctl_query_service_config2( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CONFIG2 *q_u, SVCCTL_R_QUERY_SERVICE_CONFIG2 *r_u );
WERROR _svcctl_LockServiceDatabase(pipes_struct *p,
struct svcctl_LockServiceDatabase *r);
@@ -9467,16 +7769,16 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck,
uint32 lock_pid,
enum brl_type lock_type,
enum brl_flavour lock_flav,
- SMB_BIG_UINT offset,
- SMB_BIG_UINT count,
+ uint64_t offset,
+ uint64_t count,
uint32 blocking_pid);
void cancel_pending_lock_requests_by_fid(files_struct *fsp, struct byte_range_lock *br_lck);
void remove_pending_lock_requests_by_mid(int mid);
bool blocking_lock_was_deferred(int mid);
bool blocking_lock_cancel(files_struct *fsp,
uint32 lock_pid,
- SMB_BIG_UINT offset,
- SMB_BIG_UINT count,
+ uint64_t offset,
+ uint64_t count,
enum brl_flavour lock_flav,
unsigned char locktype,
NTSTATUS err);
@@ -9505,7 +7807,8 @@ NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passw
/* The following definitions come from smbd/close.c */
void set_close_write_time(struct files_struct *fsp, struct timespec ts);
-NTSTATUS close_file(files_struct *fsp, enum file_close_type close_type);
+NTSTATUS close_file(struct smb_request *req, files_struct *fsp,
+ enum file_close_type close_type);
void msg_close_file(struct messaging_context *msg_ctx,
void *private_data,
uint32_t msg_type,
@@ -9538,19 +7841,17 @@ int count_all_current_connections(void);
bool claim_connection(connection_struct *conn, const char *name,
uint32 msg_flags);
bool register_message_flags(bool doreg, uint32 msg_flags);
-bool store_pipe_opendb( smb_np_struct *p );
-bool delete_pipe_opendb( smb_np_struct *p );
/* The following definitions come from smbd/dfree.c */
-SMB_BIG_UINT sys_disk_free(connection_struct *conn, const char *path, bool small_query,
- SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT *dsize);
-SMB_BIG_UINT get_dfree_info(connection_struct *conn,
+uint64_t sys_disk_free(connection_struct *conn, const char *path, bool small_query,
+ uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
+uint64_t get_dfree_info(connection_struct *conn,
const char *path,
bool small_query,
- SMB_BIG_UINT *bsize,
- SMB_BIG_UINT *dfree,
- SMB_BIG_UINT *dsize);
+ uint64_t *bsize,
+ uint64_t *dfree,
+ uint64_t *dsize);
/* The following definitions come from smbd/dir.c */
@@ -9664,14 +7965,13 @@ void reply_unix_error(struct smb_request *req, uint8 defclass, uint32 defcode,
/* The following definitions come from smbd/fake_file.c */
enum FAKE_FILE_TYPE is_fake_file(const char *fname);
-NTSTATUS open_fake_file(connection_struct *conn,
+NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
uint16_t current_vuid,
enum FAKE_FILE_TYPE fake_file_type,
const char *fname,
uint32 access_mask,
files_struct **result);
-void destroy_fake_file_handle(struct fake_file_handle **fh);
-NTSTATUS close_fake_file(files_struct *fsp);
+NTSTATUS close_fake_file(struct smb_request *req, files_struct *fsp);
/* The following definitions come from smbd/file_access.c */
@@ -9712,7 +8012,8 @@ NTSTATUS check_name(connection_struct *conn, const char *name);
/* The following definitions come from smbd/files.c */
-NTSTATUS file_new(connection_struct *conn, files_struct **result);
+NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
+ files_struct **result);
void file_close_conn(connection_struct *conn);
void file_close_pid(uint16 smbpid, int vuid);
void file_init(void);
@@ -9725,15 +8026,12 @@ files_struct *file_find_di_first(struct file_id id);
files_struct *file_find_di_next(files_struct *start_fsp);
files_struct *file_find_print(void);
void file_sync_all(connection_struct *conn);
-void file_free(files_struct *fsp);
+void file_free(struct smb_request *req, files_struct *fsp);
files_struct *file_fnum(uint16 fnum);
-files_struct *file_fsp(uint16 fid);
-void file_chain_reset(void);
-NTSTATUS dup_file_fsp(files_struct *fsp,
- uint32 access_mask,
- uint32 share_access,
- uint32 create_options,
- files_struct **result);
+files_struct *file_fsp(struct smb_request *req, uint16 fid);
+NTSTATUS dup_file_fsp(struct smb_request *req, files_struct *fsp,
+ uint32 access_mask, uint32 share_access,
+ uint32 create_options, files_struct **result);
/* The following definitions come from smbd/ipc.c */
@@ -9925,9 +8223,10 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
/* Information (FILE_EXISTS etc.) */
int *pinfo,
files_struct **result);
-NTSTATUS open_file_fchmod(connection_struct *conn, const char *fname,
+NTSTATUS open_file_fchmod(struct smb_request *req, connection_struct *conn,
+ const char *fname,
SMB_STRUCT_STAT *psbuf, files_struct **result);
-NTSTATUS close_file_fchmod(files_struct *fsp);
+NTSTATUS close_file_fchmod(struct smb_request *req, files_struct *fsp);
NTSTATUS open_directory(connection_struct *conn,
struct smb_request *req,
const char *fname,
@@ -9954,7 +8253,7 @@ NTSTATUS create_file_unixpath(connection_struct *conn,
uint32_t create_options,
uint32_t file_attributes,
uint32_t oplock_request,
- SMB_BIG_UINT allocation_size,
+ uint64_t allocation_size,
struct security_descriptor *sd,
struct ea_list *ea_list,
@@ -9971,7 +8270,7 @@ NTSTATUS create_file(connection_struct *conn,
uint32_t create_options,
uint32_t file_attributes,
uint32_t oplock_request,
- SMB_BIG_UINT allocation_size,
+ uint64_t allocation_size,
struct security_descriptor *sd,
struct ea_list *ea_list,
@@ -10036,14 +8335,17 @@ void reply_pipe_close(connection_struct *conn, struct smb_request *req);
/* The following definitions come from smbd/posix_acls.c */
-NTSTATUS unpack_nt_owners(int snum, uid_t *puser, gid_t *pgrp, uint32 security_info_sent, SEC_DESC *psd);
+NTSTATUS unpack_nt_owners(int snum, uid_t *puser, gid_t *pgrp, uint32 security_info_sent, const SEC_DESC *psd);
SMB_ACL_T free_empty_sys_acl(connection_struct *conn, SMB_ACL_T the_acl);
NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
SEC_DESC **ppdesc);
NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name,
uint32_t security_info, SEC_DESC **ppdesc);
int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid);
-NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd);
+NTSTATUS append_parent_acl(files_struct *fsp,
+ const SEC_DESC *pcsd,
+ SEC_DESC **pp_new_sd);
+NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd);
int get_acl_group_bits( connection_struct *conn, const char *fname, mode_t *mode );
int chmod_acl(connection_struct *conn, const char *name, mode_t mode);
int inherit_access_posix_acl(connection_struct *conn, const char *inherit_from_dir,
@@ -10095,18 +8397,18 @@ void smbd_process(void);
/* The following definitions come from smbd/quotas.c */
-bool disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
-bool disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
+bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
+bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
bool disk_quotas(const char *path,
- SMB_BIG_UINT *bsize,
- SMB_BIG_UINT *dfree,
- SMB_BIG_UINT *dsize);
-bool disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
-bool disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
-bool disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
-bool disk_quotas_vxfs(const char *name, char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
-bool disk_quotas(const char *path,SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT *dsize);
-bool disk_quotas(const char *path,SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT *dsize);
+ uint64_t *bsize,
+ uint64_t *dfree,
+ uint64_t *dsize);
+bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
+bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
+bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
+bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
+bool disk_quotas(const char *path,uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
+bool disk_quotas(const char *path,uint64_t *bsize,uint64_t *dfree,uint64_t *dsize);
/* The following definitions come from smbd/reply.c */
@@ -10216,8 +8518,8 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
bool target_is_directory);
void reply_copy(struct smb_request *req);
uint32 get_lock_pid( char *data, int data_offset, bool large_file_format);
-SMB_BIG_UINT get_lock_count( char *data, int data_offset, bool large_file_format);
-SMB_BIG_UINT get_lock_offset( char *data, int data_offset, bool large_file_format, bool *err);
+uint64_t get_lock_count( char *data, int data_offset, bool large_file_format);
+uint64_t get_lock_offset( char *data, int data_offset, bool large_file_format, bool *err);
void reply_lockingX(struct smb_request *req);
void reply_readbmpx(struct smb_request *req);
void reply_readbs(struct smb_request *req);
@@ -10335,8 +8637,8 @@ int sys_statvfs(const char *path, vfs_statvfs_struct *statbuf);
/* The following definitions come from smbd/trans2.c */
-SMB_BIG_UINT smb_roundup(connection_struct *conn, SMB_BIG_UINT val);
-SMB_BIG_UINT get_allocation_size(connection_struct *conn, files_struct *fsp, const SMB_STRUCT_STAT *sbuf);
+uint64_t smb_roundup(connection_struct *conn, uint64_t val);
+uint64_t get_allocation_size(connection_struct *conn, files_struct *fsp, const SMB_STRUCT_STAT *sbuf);
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);
@@ -10420,7 +8722,7 @@ ssize_t vfs_pwrite_data(struct smb_request *req,
const char *buffer,
size_t N,
SMB_OFF_T offset);
-int vfs_allocate_file_space(files_struct *fsp, SMB_BIG_UINT len);
+int vfs_allocate_file_space(files_struct *fsp, uint64_t len);
int vfs_set_filelen(files_struct *fsp, SMB_OFF_T len);
int vfs_fill_sparse(files_struct *fsp, SMB_OFF_T len);
SMB_OFF_T vfs_transfer_file(files_struct *in, files_struct *out, SMB_OFF_T n);
diff --git a/source3/include/rbtree.h b/source3/include/rbtree.h
deleted file mode 100644
index 1cfd3463a0..0000000000
--- a/source3/include/rbtree.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- Red Black Trees
- (C) 1999 Andrea Arcangeli <andrea@suse.de>
-
- 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- linux/include/linux/rbtree.h
-
- To use rbtrees you'll have to implement your own insert and search cores.
- This will avoid us to use callbacks and to drop drammatically performances.
- I know it's not the cleaner way, but in C (not in C++) to get
- performances and genericity...
-
- Some example of insert and search follows here. The search is a plain
- normal search over an ordered tree. The insert instead must be implemented
- int two steps: as first thing the code must insert the element in
- order as a red leaf in the tree, then the support library function
- rb_insert_color() must be called. Such function will do the
- not trivial work to rebalance the rbtree if necessary.
-
------------------------------------------------------------------------
-static inline struct page * rb_search_page_cache(struct inode * inode,
- unsigned long offset)
-{
- struct rb_node * n = inode->i_rb_page_cache.rb_node;
- struct page * page;
-
- while (n)
- {
- page = rb_entry(n, struct page, rb_page_cache);
-
- if (offset < page->offset)
- n = n->rb_left;
- else if (offset > page->offset)
- n = n->rb_right;
- else
- return page;
- }
- return NULL;
-}
-
-static inline struct page * __rb_insert_page_cache(struct inode * inode,
- unsigned long offset,
- struct rb_node * node)
-{
- struct rb_node ** p = &inode->i_rb_page_cache.rb_node;
- struct rb_node * parent = NULL;
- struct page * page;
-
- while (*p)
- {
- parent = *p;
- page = rb_entry(parent, struct page, rb_page_cache);
-
- if (offset < page->offset)
- p = &(*p)->rb_left;
- else if (offset > page->offset)
- p = &(*p)->rb_right;
- else
- return page;
- }
-
- rb_link_node(node, parent, p);
-
- return NULL;
-}
-
-static inline struct page * rb_insert_page_cache(struct inode * inode,
- unsigned long offset,
- struct rb_node * node)
-{
- struct page * ret;
- if ((ret = __rb_insert_page_cache(inode, offset, node)))
- goto out;
- rb_insert_color(node, &inode->i_rb_page_cache);
- out:
- return ret;
-}
------------------------------------------------------------------------
-*/
-
-#ifndef _LINUX_RBTREE_H
-#define _LINUX_RBTREE_H
-
-struct rb_node
-{
- unsigned long rb_parent_color;
- struct rb_node *rb_right;
- struct rb_node *rb_left;
-};
-
-struct rb_root
-{
- struct rb_node *rb_node;
-};
-
-
-#define RB_ROOT (struct rb_root) { NULL, }
-
-#if 0
-#define rb_entry(ptr, type, member) container_of(ptr, type, member)
-#endif
-
-void rb_insert_color(struct rb_node *, struct rb_root *);
-void rb_erase(struct rb_node *, struct rb_root *);
-
-/* Find logical next and previous nodes in a tree */
-struct rb_node *rb_next(struct rb_node *);
-struct rb_node *rb_prev(struct rb_node *);
-struct rb_node *rb_first(struct rb_root *);
-struct rb_node *rb_last(struct rb_root *);
-
-/* Fast replacement of a single node without remove/rebalance/add/rebalance */
-extern void rb_replace_node(struct rb_node *victim, struct rb_node *new_node,
- struct rb_root *root);
-
-void rb_link_node(struct rb_node * node, struct rb_node * parent,
- struct rb_node ** rb_link);
-
-#endif /* _LINUX_RBTREE_H */
diff --git a/source3/include/rpc_lsa.h b/source3/include/rpc_lsa.h
index b4021afd0a..1dc5ba4a7b 100644
--- a/source3/include/rpc_lsa.h
+++ b/source3/include/rpc_lsa.h
@@ -39,6 +39,7 @@
#define LSA_POLICY_READ ( STANDARD_RIGHTS_READ_ACCESS |\
+ LSA_POLICY_VIEW_LOCAL_INFORMATION |\
LSA_POLICY_VIEW_AUDIT_INFORMATION |\
LSA_POLICY_GET_PRIVATE_INFORMATION)
diff --git a/source3/include/rpc_secdes.h b/source3/include/rpc_secdes.h
index 83103b7386..71fba41fe9 100644
--- a/source3/include/rpc_secdes.h
+++ b/source3/include/rpc_secdes.h
@@ -70,9 +70,6 @@
PROTECTED_SACL_SECURITY_INFORMATION|\
PROTECTED_DACL_SECURITY_INFORMATION)
-/* SEC_ACCESS */
-typedef uint32 SEC_ACCESS;
-
/* SEC_ACE */
typedef struct security_ace SEC_ACE;
#define SEC_ACE_HEADER_SIZE (2 * sizeof(uint8) + sizeof(uint16) + sizeof(uint32))
diff --git a/source3/include/rpc_svcctl.h b/source3/include/rpc_svcctl.h
index aa1d1662c8..0e31a53e32 100644
--- a/source3/include/rpc_svcctl.h
+++ b/source3/include/rpc_svcctl.h
@@ -142,18 +142,6 @@ typedef struct {
} ENUM_SERVICES_STATUS;
typedef struct {
- uint32 service_type;
- uint32 start_type;
- uint32 error_control;
- UNISTR2 *executablepath;
- UNISTR2 *loadordergroup;
- uint32 tag_id;
- UNISTR2 *dependencies;
- UNISTR2 *startname;
- UNISTR2 *displayname;
-} SERVICE_CONFIG;
-
-typedef struct {
uint32 unknown;
UNISTR description;
} SERVICE_DESCRIPTION;
@@ -216,20 +204,6 @@ typedef struct {
typedef struct {
POLICY_HND handle;
- uint32 buffer_size;
-} SVCCTL_Q_QUERY_SERVICE_CONFIG;
-
-typedef struct {
- SERVICE_CONFIG config;
- uint32 needed;
- WERROR status;
-} SVCCTL_R_QUERY_SERVICE_CONFIG;
-
-
-/**************************/
-
-typedef struct {
- POLICY_HND handle;
uint32 level;
uint32 buffer_size;
} SVCCTL_Q_QUERY_SERVICE_CONFIG2;
diff --git a/source3/include/secrets.h b/source3/include/secrets.h
index d9f457558b..3c8e2ccf81 100644
--- a/source3/include/secrets.h
+++ b/source3/include/secrets.h
@@ -45,6 +45,8 @@
#define SECRETS_LDAP_BIND_PW "SECRETS/LDAP_BIND_PW"
+#define SECRETS_LOCAL_SCHANNEL_KEY "SECRETS/LOCAL_SCHANNEL_KEY"
+
/* Authenticated user info is stored in secrets.tdb under these keys */
#define SECRETS_AUTH_USER "SECRETS/AUTH_USER"
diff --git a/source3/include/smb.h b/source3/include/smb.h
index c8c4f8c3cc..732bef1212 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -174,9 +174,6 @@ typedef uint32 codepoint_t;
/* pipe string names */
#define PIPE_LANMAN "\\PIPE\\LANMAN"
-/* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */
-typedef uint64_t NTTIME;
-
#define MAX_HOURS_LEN 32
#ifndef MAXSUBAUTHS
@@ -249,15 +246,6 @@ struct id_map {
enum id_mapping status;
};
-/* 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"
@@ -372,7 +360,7 @@ typedef struct {
struct fd_handle {
size_t ref_count;
int fd;
- SMB_BIG_UINT position_information;
+ uint64_t position_information;
SMB_OFF_T pos;
uint32 private_options; /* NT Create options, but we only look at
* NTCREATEX_OPTIONS_PRIVATE_DENY_DOS and
@@ -391,6 +379,7 @@ struct idle_event;
struct share_mode_entry;
struct uuid;
struct named_mutex;
+struct pcap_cache;
struct vfs_fsp_data {
struct vfs_fsp_data *next;
@@ -447,7 +436,7 @@ typedef struct files_struct {
unsigned int num_smb_operations;
uint16 rap_print_jobid;
struct file_id file_id;
- SMB_BIG_UINT initial_allocation_size; /* Faked up initial allocation on disk. */
+ uint64_t initial_allocation_size; /* Faked up initial allocation on disk. */
mode_t mode;
uint16 file_pid;
uint16 vuid;
@@ -558,10 +547,10 @@ struct stream_struct {
struct dfree_cached_info {
time_t last_dfree_time;
- SMB_BIG_UINT dfree_ret;
- SMB_BIG_UINT bsize;
- SMB_BIG_UINT dfree;
- SMB_BIG_UINT dsize;
+ uint64_t dfree_ret;
+ uint64_t bsize;
+ uint64_t dfree;
+ uint64_t dsize;
};
struct dptr_struct;
@@ -647,6 +636,7 @@ struct smb_request {
size_t unread_bytes;
bool encrypted;
connection_struct *conn;
+ struct files_struct *chain_fsp;
};
/* Defines for the sent_oplock_break field above. */
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index 20e2a9a443..d2e0aa95ac 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -75,22 +75,6 @@
return ERROR_NT(NT_STATUS_INVALID_HANDLE); \
} while(0)
-/* you must add the following extern declaration to files using this macro
- * (do not add it to the macro as that causes nested extern declaration warnings)
- * extern struct current_user current_user;
- */
-#define CHECK_FSP(fsp,conn) do {\
- if (!(fsp) || !(conn)) \
- return ERROR_NT(NT_STATUS_INVALID_HANDLE); \
- else if (((conn) != (fsp)->conn) || current_user.vuid != (fsp)->vuid) \
- return ERROR_NT(NT_STATUS_INVALID_HANDLE); \
- else if ((fsp)->is_directory) \
- return ERROR_NT(NT_STATUS_INVALID_DEVICE_REQUEST); \
- else if ((fsp)->fh->fd == -1) \
- return ERROR_NT(NT_STATUS_ACCESS_DENIED); \
- (fsp)->num_smb_operations++;\
- } while(0)
-
#define CHECK_READ(fsp,inbuf) (((fsp)->fh->fd != -1) && ((fsp)->can_read || \
((SVAL((inbuf),smb_flg2) & FLAGS2_READ_PERMIT_EXECUTE) && \
(fsp->access_mask & FILE_EXECUTE))))
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index f58a6452bf..8945708ca3 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -782,7 +782,7 @@ extern bool do_profile_times;
extern clockid_t __profile_clock;
-static inline SMB_BIG_UINT profile_timestamp(void)
+static inline uint64_t profile_timestamp(void)
{
struct timespec ts;
@@ -797,7 +797,7 @@ static inline SMB_BIG_UINT profile_timestamp(void)
#else
-static inline SMB_BIG_UINT profile_timestamp(void)
+static inline uint64_t profile_timestamp(void)
{
struct timeval tv;
GetTimeOfDay(&tv);
@@ -830,14 +830,14 @@ static inline SMB_BIG_UINT profile_timestamp(void)
}
#define START_PROFILE(x) \
- SMB_BIG_UINT __profstamp_##x = 0; \
+ uint64_t __profstamp_##x = 0; \
if (do_profile_flag) { \
__profstamp_##x = do_profile_times ? profile_timestamp() : 0;\
INC_PROFILE_COUNT(x##_count); \
}
#define START_PROFILE_BYTES(x,n) \
- SMB_BIG_UINT __profstamp_##x = 0; \
+ uint64_t __profstamp_##x = 0; \
if (do_profile_flag) { \
__profstamp_##x = do_profile_times ? profile_timestamp() : 0;\
INC_PROFILE_COUNT(x##_count); \
diff --git a/source3/include/sysquotas.h b/source3/include/sysquotas.h
index a0754a3737..71d5e9b264 100644
--- a/source3/include/sysquotas.h
+++ b/source3/include/sysquotas.h
@@ -37,8 +37,8 @@
Some stuff for the sys_quota api.
**************************************************/
-#define SMB_QUOTAS_NO_LIMIT ((SMB_BIG_UINT)(0))
-#define SMB_QUOTAS_NO_SPACE ((SMB_BIG_UINT)(1))
+#define SMB_QUOTAS_NO_LIMIT ((uint64_t)(0))
+#define SMB_QUOTAS_NO_SPACE ((uint64_t)(1))
#define SMB_QUOTAS_SET_NO_LIMIT(dp) \
{\
@@ -58,14 +58,14 @@
typedef struct _SMB_DISK_QUOTA {
enum SMB_QUOTA_TYPE qtype;
- SMB_BIG_UINT bsize;
- SMB_BIG_UINT hardlimit; /* In bsize units. */
- SMB_BIG_UINT softlimit; /* In bsize units. */
- SMB_BIG_UINT curblocks; /* In bsize units. */
- SMB_BIG_UINT ihardlimit; /* inode hard limit. */
- SMB_BIG_UINT isoftlimit; /* inode soft limit. */
- SMB_BIG_UINT curinodes; /* Current used inodes. */
- uint32 qflags;
+ uint64_t bsize;
+ uint64_t hardlimit; /* In bsize units. */
+ uint64_t softlimit; /* In bsize units. */
+ uint64_t curblocks; /* In bsize units. */
+ uint64_t ihardlimit; /* inode hard limit. */
+ uint64_t isoftlimit; /* inode soft limit. */
+ uint64_t curinodes; /* Current used inodes. */
+ uint32_t qflags;
} SMB_DISK_QUOTA;
#ifndef QUOTABLOCK_SIZE
diff --git a/source3/include/talloc_stack.h b/source3/include/talloc_stack.h
index a2a12f8a63..bb22b8a029 100644
--- a/source3/include/talloc_stack.h
+++ b/source3/include/talloc_stack.h
@@ -35,7 +35,7 @@
#ifndef _TALLOC_STACK_H
#define _TALLOC_STACK_H
-#include "lib/talloc/talloc.h"
+#include "../talloc/talloc.h"
/*
* Create a new talloc stack frame.
diff --git a/source3/include/util_tdb.h b/source3/include/util_tdb.h
index fcc723c511..107d0b1bd5 100644
--- a/source3/include/util_tdb.h
+++ b/source3/include/util_tdb.h
@@ -48,34 +48,34 @@ struct tdb_validation_status {
typedef int (*tdb_validate_data_func)(TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_DATA dbuf, void *state);
-TDB_DATA make_tdb_data(const uint8 *dptr, size_t dsize);
+TDB_DATA make_tdb_data(const uint8_t *dptr, size_t dsize);
TDB_DATA string_tdb_data(const char *string);
TDB_DATA string_term_tdb_data(const char *string);
TDB_LIST_NODE *tdb_search_keys(struct tdb_context*, const char*);
void tdb_search_list_free(TDB_LIST_NODE*);
-int tdb_chainlock_with_timeout( TDB_CONTEXT *tdb, TDB_DATA key,
+int tdb_chainlock_with_timeout( struct tdb_context *tdb, TDB_DATA key,
unsigned int timeout);
int tdb_lock_bystring(struct tdb_context *tdb, const char *keyval);
-int tdb_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval,
+int tdb_lock_bystring_with_timeout(struct tdb_context *tdb, const char *keyval,
int timeout);
void tdb_unlock_bystring(struct tdb_context *tdb, const char *keyval);
int tdb_read_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval,
unsigned int timeout);
-void tdb_read_unlock_bystring(TDB_CONTEXT *tdb, const char *keyval);
-
-int32 tdb_fetch_int32_byblob(TDB_CONTEXT *tdb, TDB_DATA key);
-int32 tdb_fetch_int32(struct tdb_context *tdb, const char *keystr);
-bool tdb_store_uint32_byblob(TDB_CONTEXT *tdb, TDB_DATA key, uint32 value);
-bool tdb_store_uint32(struct tdb_context *tdb, const char *keystr, uint32 value);
-int tdb_store_int32_byblob(TDB_CONTEXT *tdb, TDB_DATA key, int32 v);
-int tdb_store_int32(struct tdb_context *tdb, const char *keystr, int32 v);
-bool tdb_fetch_uint32_byblob(TDB_CONTEXT *tdb, TDB_DATA key, uint32 *value);
-bool tdb_fetch_uint32(struct tdb_context *tdb, const char *keystr, uint32 *value);
-int32 tdb_change_int32_atomic(struct tdb_context *tdb, const char *keystr, int32 *oldval, int32 change_val);
-bool tdb_change_uint32_atomic(TDB_CONTEXT *tdb, const char *keystr,
- uint32 *oldval, uint32 change_val);
+void tdb_read_unlock_bystring(struct tdb_context *tdb, const char *keyval);
+
+int32_t tdb_fetch_int32_byblob(struct tdb_context *tdb, TDB_DATA key);
+int32_t tdb_fetch_int32(struct tdb_context *tdb, const char *keystr);
+bool tdb_store_uint32_byblob(struct tdb_context *tdb, TDB_DATA key, uint32_t value);
+bool tdb_store_uint32(struct tdb_context *tdb, const char *keystr, uint32_t value);
+int tdb_store_int32_byblob(struct tdb_context *tdb, TDB_DATA key, int32_t v);
+int tdb_store_int32(struct tdb_context *tdb, const char *keystr, int32_t v);
+bool tdb_fetch_uint32_byblob(struct tdb_context *tdb, TDB_DATA key, uint32_t *value);
+bool tdb_fetch_uint32(struct tdb_context *tdb, const char *keystr, uint32_t *value);
+int32_t tdb_change_int32_atomic(struct tdb_context *tdb, const char *keystr, int32_t *oldval, int32_t change_val);
+bool tdb_change_uint32_atomic(struct tdb_context *tdb, const char *keystr,
+ uint32_t *oldval, uint32_t change_val);
int tdb_store_bystring(struct tdb_context *tdb, const char *keystr, TDB_DATA data, int flags);
int tdb_trans_store_bystring(TDB_CONTEXT *tdb, const char *keystr,
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 9b72f69328..4cedb4a9c6 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -108,8 +108,10 @@
/* Leave at 22 - not yet released. Remove parameter fd from close_fn. - obnox */
/* Changed to version 23 - remove set_nt_acl call. This can only be done via an
open handle. JRA. */
+/* Changed to version 24 - make security descriptor const in fset_nt_acl. JRA. */
+/* Changed to version 25 - Jelmer's change from SMB_BIG_UINT to uint64_t. */
-#define SMB_VFS_INTERFACE_VERSION 23
+#define SMB_VFS_INTERFACE_VERSION 25
/* to bug old modules which are trying to compile with the old functions */
@@ -281,8 +283,8 @@ struct vfs_ops {
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,
- SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
+ uint64_t (*disk_free)(struct vfs_handle_struct *handle, const char *path, bool small_query, uint64_t *bsize,
+ uint64_t *dfree, uint64_t *dsize);
int (*get_quota)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
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);
@@ -365,7 +367,7 @@ struct vfs_ops {
NTSTATUS (*fset_nt_acl)(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32 security_info_sent,
- struct security_descriptor *psd);
+ const struct security_descriptor *psd);
/* POSIX ACL operations. */
@@ -624,14 +626,14 @@ typedef struct vfs_statvfs_struct {
if no distinction is made return the same value in each.
*/
- SMB_BIG_UINT TotalBlocks;
- SMB_BIG_UINT BlocksAvail; /* bfree */
- SMB_BIG_UINT UserBlocksAvail; /* bavail */
+ uint64_t TotalBlocks;
+ uint64_t BlocksAvail; /* bfree */
+ uint64_t UserBlocksAvail; /* bavail */
/* For undefined Node fields or FSID return -1 */
- SMB_BIG_UINT TotalFileNodes;
- SMB_BIG_UINT FreeFileNodes;
- SMB_BIG_UINT FsIdentifier; /* fsid */
+ uint64_t TotalFileNodes;
+ uint64_t FreeFileNodes;
+ uint64_t FsIdentifier; /* fsid */
/* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */
/* NB flags can come from FILE_SYSTEM_DEVICE_INFO call */
diff --git a/source3/include/xfile.h b/source3/include/xfile.h
deleted file mode 100644
index ffe4481a64..0000000000
--- a/source3/include/xfile.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- stdio replacement
- Copyright (C) Andrew Tridgell 2001
-
- 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 _XFILE_H_
-#define _XFILE_H_
-/*
- see xfile.c for explanations
-*/
-
-typedef struct {
- int fd;
- char *buf;
- char *next;
- int bufsize;
- int bufused;
- int open_flags;
- int buftype;
- int flags;
-} XFILE;
-
-extern XFILE *x_stdin, *x_stdout, *x_stderr;
-
-/* buffering type */
-#define X_IOFBF 0
-#define X_IOLBF 1
-#define X_IONBF 2
-
-#define x_getc(f) x_fgetc(f)
-
-int x_vfprintf(XFILE *f, const char *format, va_list ap) PRINTF_ATTRIBUTE(2, 0);
-int x_fprintf(XFILE *f, const char *format, ...) PRINTF_ATTRIBUTE(2, 3);
-#endif /* _XFILE_H_ */
diff --git a/source3/iniparser_build/dictionary.c b/source3/iniparser_build/dictionary.c
index de98a4523f..3147361746 100644
--- a/source3/iniparser_build/dictionary.c
+++ b/source3/iniparser_build/dictionary.c
@@ -3,5 +3,5 @@
the iniparser source code
--metze
*/
-#include "lib/replace/replace.h"
+#include "../replace/replace.h"
#include "iniparser/src/dictionary.c"
diff --git a/source3/iniparser_build/iniparser.c b/source3/iniparser_build/iniparser.c
index 4974f373ee..3f4a1aaf1a 100644
--- a/source3/iniparser_build/iniparser.c
+++ b/source3/iniparser_build/iniparser.c
@@ -3,5 +3,5 @@
the iniparser source code
--metze
*/
-#include "lib/replace/replace.h"
+#include "../replace/replace.h"
#include "iniparser/src/iniparser.c"
diff --git a/source3/iniparser_build/strlib.c b/source3/iniparser_build/strlib.c
index 685ec8e04d..4ea95b73ae 100644
--- a/source3/iniparser_build/strlib.c
+++ b/source3/iniparser_build/strlib.c
@@ -3,5 +3,5 @@
the iniparser source code
--metze
*/
-#include "lib/replace/replace.h"
+#include "../replace/replace.h"
#include "iniparser/src/strlib.c"
diff --git a/source3/intl/lang_tdb.c b/source3/intl/lang_tdb.c
index 499b9eb87d..ac7e9dda40 100644
--- a/source3/intl/lang_tdb.c
+++ b/source3/intl/lang_tdb.c
@@ -33,14 +33,14 @@ static bool load_msg(const char *msg_file)
char *msgid, *msgstr;
TDB_DATA data;
- lines = file_lines_load(msg_file, &num_lines,0);
+ lines = file_lines_load(msg_file, &num_lines, 0, NULL);
if (!lines) {
return False;
}
if (tdb_lockall(tdb) != 0) {
- file_lines_free(lines);
+ TALLOC_FREE(lines);
return False;
}
@@ -68,7 +68,7 @@ static bool load_msg(const char *msg_file)
}
}
- file_lines_free(lines);
+ TALLOC_FREE(lines);
tdb_unlockall(tdb);
return True;
diff --git a/source3/lib/access.c b/source3/lib/access.c
index 6a445f8139..966d8ce87c 100644
--- a/source3/lib/access.c
+++ b/source3/lib/access.c
@@ -104,7 +104,7 @@ static bool string_match(const char *tok,const char *s)
if (memcache_lookup(
NULL, SINGLETON_CACHE,
- data_blob_string_const("yp_default_domain"),
+ data_blob_string_const_null("yp_default_domain"),
&tmp)) {
SMB_ASSERT(tmp.length > 0);
@@ -116,8 +116,8 @@ static bool string_match(const char *tok,const char *s)
memcache_add(
NULL, SINGLETON_CACHE,
- data_blob_string_const("yp_default_domain"),
- data_blob_string_const(mydomain?mydomain:""));
+ data_blob_string_const_null("yp_default_domain"),
+ data_blob_string_const_null(mydomain?mydomain:""));
}
if (!mydomain) {
diff --git a/source3/lib/arc4.c b/source3/lib/arc4.c
deleted file mode 100644
index af2564b6c0..0000000000
--- a/source3/lib/arc4.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- An implementation of arc4.
-
- 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"
-
-/*****************************************************************
- Initialize state for an arc4 crypt/decrpyt.
- arc4 state is 258 bytes - last 2 bytes are the index bytes.
-*****************************************************************/
-
-void smb_arc4_init(unsigned char arc4_state_out[258], const unsigned char *key, size_t keylen)
-{
- size_t ind;
- unsigned char j = 0;
-
- for (ind = 0; ind < 256; ind++) {
- arc4_state_out[ind] = (unsigned char)ind;
- }
-
- for( ind = 0; ind < 256; ind++) {
- unsigned char tc;
-
- j += (arc4_state_out[ind] + key[ind%keylen]);
-
- tc = arc4_state_out[ind];
- arc4_state_out[ind] = arc4_state_out[j];
- arc4_state_out[j] = tc;
- }
- arc4_state_out[256] = 0;
- arc4_state_out[257] = 0;
-}
-
-/*****************************************************************
- Do the arc4 crypt/decrpyt.
- arc4 state is 258 bytes - last 2 bytes are the index bytes.
-*****************************************************************/
-
-void smb_arc4_crypt(unsigned char arc4_state_inout[258], unsigned char *data, size_t len)
-{
- unsigned char index_i = arc4_state_inout[256];
- unsigned char index_j = arc4_state_inout[257];
- size_t ind;
-
- for( ind = 0; ind < len; ind++) {
- unsigned char tc;
- unsigned char t;
-
- index_i++;
- index_j += arc4_state_inout[index_i];
-
- tc = arc4_state_inout[index_i];
- arc4_state_inout[index_i] = arc4_state_inout[index_j];
- arc4_state_inout[index_j] = tc;
-
- t = arc4_state_inout[index_i] + arc4_state_inout[index_j];
- data[ind] = data[ind] ^ arc4_state_inout[t];
- }
-
- arc4_state_inout[256] = index_i;
- arc4_state_inout[257] = index_j;
-}
diff --git a/source3/lib/async_sock.c b/source3/lib/async_sock.c
index 1a4c27ba20..ffba6de832 100644
--- a/source3/lib/async_sock.c
+++ b/source3/lib/async_sock.c
@@ -658,12 +658,13 @@ struct async_req *async_connect(TALLOC_CTX *mem_ctx, struct event_context *ev,
state->fde = event_add_fd(ev, state, fd,
EVENT_FD_READ | EVENT_FD_WRITE,
- async_connect_callback, state);
+ async_connect_callback, result);
if (state->fde == NULL) {
sys_fcntl_long(fd, F_SETFL, p->old_sockflags);
TALLOC_FREE(result);
return NULL;
}
+ result->private_data = state;
state->param.param_connect.fd = fd;
state->param.param_connect.address = address;
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index 485212b100..3ec3220900 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -1166,7 +1166,7 @@ static size_t pull_ascii_base_talloc(TALLOC_CTX *ctx,
int flags)
{
char *dest = NULL;
- size_t converted_size;
+ size_t dest_len;
#ifdef DEVELOPER
/* Ensure we never use the braindead "malloc" varient. */
@@ -1177,6 +1177,10 @@ static size_t pull_ascii_base_talloc(TALLOC_CTX *ctx,
*ppdest = NULL;
+ if (!src_len) {
+ return 0;
+ }
+
if (flags & STR_TERMINATE) {
if (src_len == (size_t)-1) {
src_len = strlen((const char *)src) + 1;
@@ -1194,18 +1198,41 @@ static size_t pull_ascii_base_talloc(TALLOC_CTX *ctx,
(unsigned int)src_len);
smb_panic(msg);
}
+ } else {
+ /* Can't have an unlimited length
+ * non STR_TERMINATE'd.
+ */
+ if (src_len == (size_t)-1) {
+ errno = EINVAL;
+ return 0;
+ }
}
+ /* src_len != -1 here. */
+
if (!convert_string_allocate(ctx, CH_DOS, CH_UNIX, src, src_len, &dest,
- &converted_size, True))
- {
- converted_size = 0;
+ &dest_len, True)) {
+ dest_len = 0;
}
- if (converted_size && dest) {
+ if (dest_len && dest) {
/* Did we already process the terminating zero ? */
- if (dest[converted_size - 1] != 0) {
- dest[converted_size - 1] = 0;
+ if (dest[dest_len-1] != 0) {
+ size_t size = talloc_get_size(dest);
+ /* Have we got space to append the '\0' ? */
+ if (size <= dest_len) {
+ /* No, realloc. */
+ dest = TALLOC_REALLOC_ARRAY(ctx, dest, char,
+ dest_len+1);
+ if (!dest) {
+ /* talloc fail. */
+ dest_len = (size_t)-1;
+ return 0;
+ }
+ }
+ /* Yay - space ! */
+ dest[dest_len] = '\0';
+ dest_len++;
}
} else if (dest) {
dest[0] = 0;
@@ -1562,21 +1589,26 @@ size_t pull_ucs2_base_talloc(TALLOC_CTX *ctx,
if (src_len >= 1024*1024) {
smb_panic("Bad src length in pull_ucs2_base_talloc\n");
}
+ } else {
+ /* Can't have an unlimited length
+ * non STR_TERMINATE'd.
+ */
+ if (src_len == (size_t)-1) {
+ errno = EINVAL;
+ return 0;
+ }
}
+ /* src_len != -1 here. */
+
/* ucs2 is always a multiple of 2 bytes */
- if (src_len != (size_t)-1) {
- src_len &= ~1;
- }
+ src_len &= ~1;
if (!convert_string_talloc(ctx, CH_UTF16LE, CH_UNIX, src, src_len,
(void *)&dest, &dest_len, True)) {
dest_len = 0;
}
- if (src_len == (size_t)-1)
- src_len = dest_len*2;
-
if (dest_len) {
/* Did we already process the terminating zero ? */
if (dest[dest_len-1] != 0) {
diff --git a/source3/lib/compression/mszip.c b/source3/lib/compression/mszip.c
deleted file mode 100644
index aeeb2d8afd..0000000000
--- a/source3/lib/compression/mszip.c
+++ /dev/null
@@ -1,676 +0,0 @@
-/* mszip decompression - based on cabextract.c code from
- * Stuart Caie
- *
- * adapted for Samba by Andrew Tridgell and Stefan Metzmacher 2005
- *
- * (C) 2000-2001 Stuart Caie <kyzer@4u.net>
- * reaktivate-specifics by Malte Starostik <malte@kde.org>
- *
- * 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/compression/mszip.h"
-
-/*--------------------------------------------------------------------------*/
-/* our archiver information / state */
-
-/* MSZIP stuff */
-#define ZIPWSIZE 0x8000 /* window size */
-#define ZIPLBITS 9 /* bits in base literal/length lookup table */
-#define ZIPDBITS 6 /* bits in base distance lookup table */
-#define ZIPBMAX 16 /* maximum bit length of any code */
-#define ZIPN_MAX 288 /* maximum number of codes in any set */
-
-struct Ziphuft {
- uint8_t e; /* number of extra bits or operation */
- uint8_t b; /* number of bits in this code or subcode */
- union {
- uint16_t n; /* literal, length base, or distance base */
- struct Ziphuft *t; /* pointer to next level of table */
- } v;
-};
-
-struct ZIPstate {
- uint32_t window_posn; /* current offset within the window */
- uint32_t bb; /* bit buffer */
- uint32_t bk; /* bits in bit buffer */
- uint32_t ll[288+32]; /* literal/length and distance code lengths */
- uint32_t c[ZIPBMAX+1]; /* bit length count table */
- int32_t lx[ZIPBMAX+1]; /* memory for l[-1..ZIPBMAX-1] */
- struct Ziphuft *u[ZIPBMAX]; /* table stack */
- uint32_t v[ZIPN_MAX]; /* values in order of bit length */
- uint32_t x[ZIPBMAX+1]; /* bit offsets, then code stack */
- uint8_t *inpos;
-};
-
-/* generic stuff */
-#define CAB(x) (decomp_state->x)
-#define ZIP(x) (decomp_state->methods.zip.x)
-
-/* CAB data blocks are <= 32768 bytes in uncompressed form. Uncompressed
- * blocks have zero growth. MSZIP guarantees that it won't grow above
- * uncompressed size by more than 12 bytes. LZX guarantees it won't grow
- * more than 6144 bytes.
- */
-#define CAB_BLOCKMAX (32768)
-#define CAB_INPUTMAX (CAB_BLOCKMAX+6144)
-
-struct decomp_state {
- struct folder *current; /* current folder we're extracting from */
- uint32_t offset; /* uncompressed offset within folder */
- uint8_t *outpos; /* (high level) start of data to use up */
- uint16_t outlen; /* (high level) amount of data to use up */
- uint16_t split; /* at which split in current folder? */
- int (*decompress)(int, int); /* the chosen compression func */
- uint8_t inbuf[CAB_INPUTMAX+2]; /* +2 for lzx bitbuffer overflows! */
- uint8_t outbuf[CAB_BLOCKMAX];
- union {
- struct ZIPstate zip;
- } methods;
-};
-
-
-/* MSZIP decruncher */
-
-/* Dirk Stoecker wrote the ZIP decoder, based on the InfoZip deflate code */
-
-/* Tables for deflate from PKZIP's appnote.txt. */
-static const uint8_t Zipborder[] = /* Order of the bit length code lengths */
-{ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
-static const uint16_t Zipcplens[] = /* Copy lengths for literal codes 257..285 */
-{ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51,
- 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
-static const uint16_t Zipcplext[] = /* Extra bits for literal codes 257..285 */
-{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4,
- 4, 5, 5, 5, 5, 0, 99, 99}; /* 99==invalid */
-static const uint16_t Zipcpdist[] = /* Copy offsets for distance codes 0..29 */
-{ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385,
-513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577};
-static const uint16_t Zipcpdext[] = /* Extra bits for distance codes */
-{ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10,
-10, 11, 11, 12, 12, 13, 13};
-
-/* And'ing with Zipmask[n] masks the lower n bits */
-static const uint16_t Zipmask[17] = {
- 0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
- 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
-};
-
-#define ZIPNEEDBITS(n) {while(k<(n)){int32_t c=*(ZIP(inpos)++);\
- b|=((uint32_t)c)<<k;k+=8;}}
-#define ZIPDUMPBITS(n) {b>>=(n);k-=(n);}
-
-static void Ziphuft_free(struct Ziphuft *t)
-{
- register struct Ziphuft *p, *q;
-
- /* Go through linked list, freeing from the allocated (t[-1]) address. */
- p = t;
- while (p != (struct Ziphuft *)NULL)
- {
- q = (--p)->v.t;
- free(p);
- p = q;
- }
-}
-
-static int32_t Ziphuft_build(struct decomp_state *decomp_state,
- uint32_t *b, uint32_t n, uint32_t s, const uint16_t *d, const uint16_t *e,
- struct Ziphuft **t, int32_t *m)
-{
- uint32_t a; /* counter for codes of length k */
- uint32_t el; /* length of EOB code (value 256) */
- uint32_t f; /* i repeats in table every f entries */
- int32_t g; /* maximum code length */
- int32_t h; /* table level */
- register uint32_t i; /* counter, current code */
- register uint32_t j; /* counter */
- register int32_t k; /* number of bits in current code */
- int32_t *l; /* stack of bits per table */
- register uint32_t *p; /* pointer into ZIP(c)[],ZIP(b)[],ZIP(v)[] */
- register struct Ziphuft *q; /* points to current table */
- struct Ziphuft r; /* table entry for structure assignment */
- register int32_t w; /* bits before this table == (l * h) */
- uint32_t *xp; /* pointer into x */
- int32_t y; /* number of dummy codes added */
- uint32_t z; /* number of entries in current table */
-
- l = ZIP(lx)+1;
-
- /* Generate counts for each bit length */
- el = n > 256 ? b[256] : ZIPBMAX; /* set length of EOB code, if any */
-
- for(i = 0; i < ZIPBMAX+1; ++i)
- ZIP(c)[i] = 0;
- p = b; i = n;
- do
- {
- ZIP(c)[*p]++; p++; /* assume all entries <= ZIPBMAX */
- } while (--i);
- if (ZIP(c)[0] == n) /* null input--all zero length codes */
- {
- *t = (struct Ziphuft *)NULL;
- *m = 0;
- return 0;
- }
-
- /* Find minimum and maximum length, bound *m by those */
- for (j = 1; j <= ZIPBMAX; j++)
- if (ZIP(c)[j])
- break;
- k = j; /* minimum code length */
- if ((uint32_t)*m < j)
- *m = j;
- for (i = ZIPBMAX; i; i--)
- if (ZIP(c)[i])
- break;
- g = i; /* maximum code length */
- if ((uint32_t)*m > i)
- *m = i;
-
- /* Adjust last length count to fill out codes, if needed */
- for (y = 1 << j; j < i; j++, y <<= 1)
- if ((y -= ZIP(c)[j]) < 0)
- return 2; /* bad input: more codes than bits */
- if ((y -= ZIP(c)[i]) < 0)
- return 2;
- ZIP(c)[i] += y;
-
- /* Generate starting offsets int32_to the value table for each length */
- ZIP(x)[1] = j = 0;
- p = ZIP(c) + 1; xp = ZIP(x) + 2;
- while (--i)
- { /* note that i == g from above */
- *xp++ = (j += *p++);
- }
-
- /* Make a table of values in order of bit lengths */
- p = b; i = 0;
- do{
- if ((j = *p++) != 0)
- ZIP(v)[ZIP(x)[j]++] = i;
- } while (++i < n);
-
-
- /* Generate the Huffman codes and for each, make the table entries */
- ZIP(x)[0] = i = 0; /* first Huffman code is zero */
- p = ZIP(v); /* grab values in bit order */
- h = -1; /* no tables yet--level -1 */
- w = l[-1] = 0; /* no bits decoded yet */
- ZIP(u)[0] = (struct Ziphuft *)NULL; /* just to keep compilers happy */
- q = (struct Ziphuft *)NULL; /* ditto */
- z = 0; /* ditto */
-
- /* go through the bit lengths (k already is bits in shortest code) */
- for (; k <= g; k++)
- {
- a = ZIP(c)[k];
- while (a--)
- {
- /* here i is the Huffman code of length k bits for value *p */
- /* make tables up to required level */
- while (k > w + l[h])
- {
- w += l[h++]; /* add bits already decoded */
-
- /* compute minimum size table less than or equal to *m bits */
- z = (z = g - w) > (uint32_t)*m ? *m : z; /* upper limit */
- if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */
- { /* too few codes for k-w bit table */
- f -= a + 1; /* deduct codes from patterns left */
- xp = ZIP(c) + k;
- while (++j < z) /* try smaller tables up to z bits */
- {
- if ((f <<= 1) <= *++xp)
- break; /* enough codes to use up j bits */
- f -= *xp; /* else deduct codes from patterns */
- }
- }
- if ((uint32_t)w + j > el && (uint32_t)w < el)
- j = el - w; /* make EOB code end at table */
- z = 1 << j; /* table entries for j-bit table */
- l[h] = j; /* set table size in stack */
-
- /* allocate and link in new table */
- if (!(q = (struct Ziphuft *)SMB_MALLOC((z + 1)*sizeof(struct Ziphuft))))
- {
- if(h)
- Ziphuft_free(ZIP(u)[0]);
- return 3; /* not enough memory */
- }
- *t = q + 1; /* link to list for Ziphuft_free() */
- *(t = &(q->v.t)) = (struct Ziphuft *)NULL;
- ZIP(u)[h] = ++q; /* table starts after link */
-
- /* connect to last table, if there is one */
- if (h)
- {
- ZIP(x)[h] = i; /* save pattern for backing up */
- r.b = (uint8_t)l[h-1]; /* bits to dump before this table */
- r.e = (uint8_t)(16 + j); /* bits in this table */
- r.v.t = q; /* pointer to this table */
- j = (i & ((1 << w) - 1)) >> (w - l[h-1]);
- ZIP(u)[h-1][j] = r; /* connect to last table */
- }
- }
-
- /* set up table entry in r */
- r.b = (uint8_t)(k - w);
- if (p >= ZIP(v) + n)
- r.e = 99; /* out of values--invalid code */
- else if (*p < s)
- {
- r.e = (uint8_t)(*p < 256 ? 16 : 15); /* 256 is end-of-block code */
- r.v.n = *p++; /* simple code is just the value */
- }
- else
- {
- r.e = (uint8_t)e[*p - s]; /* non-simple--look up in lists */
- r.v.n = d[*p++ - s];
- }
-
- /* fill code-like entries with r */
- f = 1 << (k - w);
- for (j = i >> w; j < z; j += f)
- q[j] = r;
-
- /* backwards increment the k-bit code i */
- for (j = 1 << (k - 1); i & j; j >>= 1)
- i ^= j;
- i ^= j;
-
- /* backup over finished tables */
- while ((i & ((1 << w) - 1)) != ZIP(x)[h])
- w -= l[--h]; /* don't need to update q */
- }
- }
-
- /* return actual size of base table */
- *m = l[0];
-
- /* Return true (1) if we were given an incomplete table */
- return y != 0 && g != 1;
-}
-
-static int32_t Zipinflate_codes(struct decomp_state *decomp_state,
- struct Ziphuft *tl, struct Ziphuft *td,
- int32_t bl, int32_t bd)
-{
- register uint32_t e; /* table entry flag/number of extra bits */
- uint32_t n, d; /* length and index for copy */
- uint32_t w; /* current window position */
- struct Ziphuft *t; /* pointer to table entry */
- uint32_t ml, md; /* masks for bl and bd bits */
- register uint32_t b; /* bit buffer */
- register uint32_t k; /* number of bits in bit buffer */
-
- DEBUG(10,("Zipinflate_codes\n"));
-
- /* make local copies of globals */
- b = ZIP(bb); /* initialize bit buffer */
- k = ZIP(bk);
- w = ZIP(window_posn); /* initialize window position */
-
- /* inflate the coded data */
- ml = Zipmask[bl]; /* precompute masks for speed */
- md = Zipmask[bd];
-
- for(;;)
- {
- ZIPNEEDBITS((uint32_t)bl)
- if((e = (t = tl + ((uint32_t)b & ml))->e) > 16)
- do
- {
- if (e == 99)
- return 1;
- ZIPDUMPBITS(t->b)
- e -= 16;
- ZIPNEEDBITS(e)
- } while ((e = (t = t->v.t + ((uint32_t)b & Zipmask[e]))->e) > 16);
- ZIPDUMPBITS(t->b)
- if (w >= CAB_BLOCKMAX) break;
- if (e == 16) /* then it's a literal */
- CAB(outbuf)[w++] = (uint8_t)t->v.n;
- else /* it's an EOB or a length */
- {
- /* exit if end of block */
- if(e == 15)
- break;
-
- /* get length of block to copy */
- ZIPNEEDBITS(e)
- n = t->v.n + ((uint32_t)b & Zipmask[e]);
- ZIPDUMPBITS(e);
-
- /* decode distance of block to copy */
- ZIPNEEDBITS((uint32_t)bd)
- if ((e = (t = td + ((uint32_t)b & md))->e) > 16)
- do {
- if (e == 99)
- return 1;
- ZIPDUMPBITS(t->b)
- e -= 16;
- ZIPNEEDBITS(e)
- } while ((e = (t = t->v.t + ((uint32_t)b & Zipmask[e]))->e) > 16);
- ZIPDUMPBITS(t->b)
- ZIPNEEDBITS(e)
- d = w - t->v.n - ((uint32_t)b & Zipmask[e]);
- ZIPDUMPBITS(e)
- do
- {
- n -= (e = (e = ZIPWSIZE - ((d &= ZIPWSIZE-1) > w ? d : w)) > n ?n:e);
- do
- {
- CAB(outbuf)[w++] = CAB(outbuf)[d++];
- } while (--e);
- } while (n);
- }
- }
-
- /* restore the globals from the locals */
- ZIP(window_posn) = w; /* restore global window pointer */
- ZIP(bb) = b; /* restore global bit buffer */
- ZIP(bk) = k;
-
- /* done */
- return 0;
-}
-
-/* "decompress" an inflated type 0 (stored) block. */
-static int32_t Zipinflate_stored(struct decomp_state *decomp_state)
-{
- uint32_t n; /* number of bytes in block */
- uint32_t w; /* current window position */
- register uint32_t b; /* bit buffer */
- register uint32_t k; /* number of bits in bit buffer */
-
- /* make local copies of globals */
- b = ZIP(bb); /* initialize bit buffer */
- k = ZIP(bk);
- w = ZIP(window_posn); /* initialize window position */
-
- /* go to byte boundary */
- n = k & 7;
- ZIPDUMPBITS(n);
-
- /* get the length and its complement */
- ZIPNEEDBITS(16)
- n = ((uint32_t)b & 0xffff);
- ZIPDUMPBITS(16)
- ZIPNEEDBITS(16)
- if (n != (uint32_t)((~b) & 0xffff))
- return 1; /* error in compressed data */
- ZIPDUMPBITS(16)
-
- /* read and output the compressed data */
- while(n--)
- {
- ZIPNEEDBITS(8)
- CAB(outbuf)[w++] = (uint8_t)b;
- ZIPDUMPBITS(8)
- }
-
- /* restore the globals from the locals */
- ZIP(window_posn) = w; /* restore global window pointer */
- ZIP(bb) = b; /* restore global bit buffer */
- ZIP(bk) = k;
- return 0;
-}
-
-static int32_t Zipinflate_fixed(struct decomp_state *decomp_state)
-{
- struct Ziphuft *fixed_tl;
- struct Ziphuft *fixed_td;
- int32_t fixed_bl, fixed_bd;
- int32_t i; /* temporary variable */
- uint32_t *l;
-
- l = ZIP(ll);
-
- /* literal table */
- for(i = 0; i < 144; i++)
- l[i] = 8;
- for(; i < 256; i++)
- l[i] = 9;
- for(; i < 280; i++)
- l[i] = 7;
- for(; i < 288; i++) /* make a complete, but wrong code set */
- l[i] = 8;
- fixed_bl = 7;
- if((i = Ziphuft_build(decomp_state, l, 288, 257, Zipcplens, Zipcplext, &fixed_tl, &fixed_bl)))
- return i;
-
- /* distance table */
- for(i = 0; i < 30; i++) /* make an incomplete code set */
- l[i] = 5;
- fixed_bd = 5;
- if((i = Ziphuft_build(decomp_state, l, 30, 0, Zipcpdist, Zipcpdext, &fixed_td, &fixed_bd)) > 1)
- {
- Ziphuft_free(fixed_tl);
- return i;
- }
-
- /* decompress until an end-of-block code */
- i = Zipinflate_codes(decomp_state, fixed_tl, fixed_td, fixed_bl, fixed_bd);
-
- Ziphuft_free(fixed_td);
- Ziphuft_free(fixed_tl);
- return i;
-}
-
-/* decompress an inflated type 2 (dynamic Huffman codes) block. */
-static int32_t Zipinflate_dynamic(struct decomp_state *decomp_state)
-{
- int32_t i; /* temporary variables */
- uint32_t j;
- uint32_t *ll;
- uint32_t l; /* last length */
- uint32_t m; /* mask for bit lengths table */
- uint32_t n; /* number of lengths to get */
- struct Ziphuft *tl; /* literal/length code table */
- struct Ziphuft *td; /* distance code table */
- int32_t bl; /* lookup bits for tl */
- int32_t bd; /* lookup bits for td */
- uint32_t nb; /* number of bit length codes */
- uint32_t nl; /* number of literal/length codes */
- uint32_t nd; /* number of distance codes */
- register uint32_t b; /* bit buffer */
- register uint32_t k; /* number of bits in bit buffer */
-
- /* make local bit buffer */
- b = ZIP(bb);
- k = ZIP(bk);
- ll = ZIP(ll);
-
- /* read in table lengths */
- ZIPNEEDBITS(5)
- nl = 257 + ((uint32_t)b & 0x1f); /* number of literal/length codes */
- ZIPDUMPBITS(5)
- ZIPNEEDBITS(5)
- nd = 1 + ((uint32_t)b & 0x1f); /* number of distance codes */
- ZIPDUMPBITS(5)
- ZIPNEEDBITS(4)
- nb = 4 + ((uint32_t)b & 0xf); /* number of bit length codes */
- ZIPDUMPBITS(4)
- if(nl > 288 || nd > 32)
- return 1; /* bad lengths */
-
- /* read in bit-length-code lengths */
- for(j = 0; j < nb; j++)
- {
- ZIPNEEDBITS(3)
- ll[Zipborder[j]] = (uint32_t)b & 7;
- ZIPDUMPBITS(3)
- }
- for(; j < 19; j++)
- ll[Zipborder[j]] = 0;
-
- /* build decoding table for trees--single level, 7 bit lookup */
- bl = 7;
- if((i = Ziphuft_build(decomp_state, ll, 19, 19, NULL, NULL, &tl, &bl)) != 0)
- {
- if(i == 1)
- Ziphuft_free(tl);
- return i; /* incomplete code set */
- }
-
- /* read in literal and distance code lengths */
- n = nl + nd;
- m = Zipmask[bl];
- i = l = 0;
- while((uint32_t)i < n)
- {
- ZIPNEEDBITS((uint32_t)bl)
- j = (td = tl + ((uint32_t)b & m))->b;
- ZIPDUMPBITS(j)
- j = td->v.n;
- if (j < 16) /* length of code in bits (0..15) */
- ll[i++] = l = j; /* save last length in l */
- else if (j == 16) /* repeat last length 3 to 6 times */
- {
- ZIPNEEDBITS(2)
- j = 3 + ((uint32_t)b & 3);
- ZIPDUMPBITS(2)
- if((uint32_t)i + j > n)
- return 1;
- while (j--)
- ll[i++] = l;
- }
- else if (j == 17) /* 3 to 10 zero length codes */
- {
- ZIPNEEDBITS(3)
- j = 3 + ((uint32_t)b & 7);
- ZIPDUMPBITS(3)
- if ((uint32_t)i + j > n)
- return 1;
- while (j--)
- ll[i++] = 0;
- l = 0;
- }
- else /* j == 18: 11 to 138 zero length codes */
- {
- ZIPNEEDBITS(7)
- j = 11 + ((uint32_t)b & 0x7f);
- ZIPDUMPBITS(7)
- if ((uint32_t)i + j > n)
- return 1;
- while (j--)
- ll[i++] = 0;
- l = 0;
- }
- }
-
- /* free decoding table for trees */
- Ziphuft_free(tl);
-
- /* restore the global bit buffer */
- ZIP(bb) = b;
- ZIP(bk) = k;
-
- /* build the decoding tables for literal/length and distance codes */
- bl = ZIPLBITS;
- if((i = Ziphuft_build(decomp_state, ll, nl, 257, Zipcplens, Zipcplext, &tl, &bl)) != 0)
- {
- if(i == 1)
- Ziphuft_free(tl);
- return i; /* incomplete code set */
- }
- bd = ZIPDBITS;
- Ziphuft_build(decomp_state, ll + nl, nd, 0, Zipcpdist, Zipcpdext, &td, &bd);
-
- /* decompress until an end-of-block code */
- if(Zipinflate_codes(decomp_state, tl, td, bl, bd))
- return 1;
-
- /* free the decoding tables, return */
- Ziphuft_free(tl);
- Ziphuft_free(td);
- return 0;
-}
-
-/* e == last block flag */
-static int32_t Zipinflate_block(struct decomp_state *decomp_state, int32_t *e)
-{ /* decompress an inflated block */
- uint32_t t; /* block type */
- register uint32_t b; /* bit buffer */
- register uint32_t k; /* number of bits in bit buffer */
-
- DEBUG(10,("Zipinflate_block\n"));
-
- /* make local bit buffer */
- b = ZIP(bb);
- k = ZIP(bk);
-
- /* read in last block bit */
- ZIPNEEDBITS(1)
- *e = (int32_t)b & 1;
- ZIPDUMPBITS(1)
-
- /* read in block type */
- ZIPNEEDBITS(2)
- t = (uint32_t)b & 3;
- ZIPDUMPBITS(2)
-
- /* restore the global bit buffer */
- ZIP(bb) = b;
- ZIP(bk) = k;
-
- DEBUG(10,("inflate type %d\n", t));
-
- /* inflate that block type */
- if(t == 2)
- return Zipinflate_dynamic(decomp_state);
- if(t == 0)
- return Zipinflate_stored(decomp_state);
- if(t == 1)
- return Zipinflate_fixed(decomp_state);
- /* bad block type */
- return 2;
-}
-
-_PUBLIC_ struct decomp_state *ZIPdecomp_state(TALLOC_CTX *mem_ctx)
-{
- return talloc_zero(mem_ctx, struct decomp_state);
-}
-
-int ZIPdecompress(struct decomp_state *decomp_state, DATA_BLOB *inbuf, DATA_BLOB *outbuf)
-{
- int32_t e = 0;/* last block flag */
-
- ZIP(inpos) = CAB(inbuf);
- ZIP(bb) = ZIP(bk) = ZIP(window_posn) = 0;
-
- if (inbuf->length > sizeof(decomp_state->inbuf)) return DECR_INPUT;
-
- if (outbuf->length > sizeof(decomp_state->outbuf)) return DECR_OUTPUT;
-
- if (outbuf->length > ZIPWSIZE) return DECR_DATAFORMAT;
-
- memcpy(decomp_state->inbuf, inbuf->data, inbuf->length);
-
- /* CK = Chris Kirmse, official Microsoft purloiner */
- if (ZIP(inpos)[0] != 'C' || ZIP(inpos)[1] != 'K') return DECR_ILLEGALDATA;
- ZIP(inpos) += 2;
-
- while (!e) {
- if (Zipinflate_block(decomp_state, &e)) {
- return DECR_ILLEGALDATA;
- }
- }
-
- memcpy(outbuf->data, decomp_state->outbuf, outbuf->length);
-
- return DECR_OK;
-}
diff --git a/source3/lib/compression/mszip.h b/source3/lib/compression/mszip.h
deleted file mode 100644
index bb835f2595..0000000000
--- a/source3/lib/compression/mszip.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* mszip decompression - based on cabextract.c code from
- * Stuart Caie
- *
- * adapted for Samba by Andrew Tridgell and Stefan Metzmacher 2005
- *
- * (C) 2000-2001 Stuart Caie <kyzer@4u.net>
- * reaktivate-specifics by Malte Starostik <malte@kde.org>
- *
- * 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/>.
- */
-
-struct decomp_state;
-struct decomp_state *ZIPdecomp_state(TALLOC_CTX *mem_ctx);
-
-#define DECR_OK (0)
-#define DECR_DATAFORMAT (1)
-#define DECR_ILLEGALDATA (2)
-#define DECR_NOMEMORY (3)
-#define DECR_CHECKSUM (4)
-#define DECR_INPUT (5)
-#define DECR_OUTPUT (6)
-int ZIPdecompress(struct decomp_state *decomp_state, DATA_BLOB *inbuf, DATA_BLOB *outbuf);
diff --git a/source3/lib/crc32.c b/source3/lib/crc32.c
deleted file mode 100644
index a4ae90c469..0000000000
--- a/source3/lib/crc32.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*-
- * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or
- * code or tables extracted from it, as desired without restriction.
- *
- * First, the polynomial itself and its table of feedback terms. The
- * polynomial is
- * X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0
- *
- * Note that we take it "backwards" and put the highest-order term in
- * the lowest-order bit. The X^32 term is "implied"; the LSB is the
- * X^31 term, etc. The X^0 term (usually shown as "+1") results in
- * the MSB being 1
- *
- * Note that the usual hardware shift register implementation, which
- * is what we're using (we're merely optimizing it by doing eight-bit
- * chunks at a time) shifts bits into the lowest-order term. In our
- * implementation, that means shifting towards the right. Why do we
- * do it this way? Because the calculated CRC must be transmitted in
- * order from highest-order term to lowest-order term. UARTs transmit
- * characters in order from LSB to MSB. By storing the CRC this way
- * we hand it to the UART in the order low-byte to high-byte; the UART
- * sends each low-bit to hight-bit; and the result is transmission bit
- * by bit from highest- to lowest-order term without requiring any bit
- * shuffling on our part. Reception works similarly
- *
- * The feedback terms table consists of 256, 32-bit entries. Notes
- *
- * The table can be generated at runtime if desired; code to do so
- * is shown later. It might not be obvious, but the feedback
- * terms simply represent the results of eight shift/xor opera
- * tions for all combinations of data and CRC register values
- *
- * The values must be right-shifted by eight bits by the "updcrc
- * logic; the shift must be unsigned (bring in zeroes). On some
- * hardware you could probably optimize the shift in assembler by
- * using byte-swap instructions
- * polynomial $edb88320
- *
- *
- * CRC32 code derived from work by Gary S. Brown.
- */
-
-#include "includes.h"
-
-static const uint32 crc32_tab[] = {
- 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
- 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
- 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
- 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
- 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
- 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
- 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
- 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
- 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
- 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
- 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
- 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
- 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
- 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
- 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
- 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
- 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
- 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
- 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
- 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
- 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
- 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
- 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
- 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
- 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
- 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
- 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
- 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
- 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
- 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
- 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
- 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
- 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
- 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
- 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
- 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
- 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
- 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
- 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
- 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
- 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
- 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
- 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
-};
-
-uint32 crc32_calc_buffer(const char *buf, size_t size)
-{
- const unsigned char *p;
- uint32 crc;
-
- p = (const unsigned char *)buf;
- crc = ~0U;
-
- while (size--)
- crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8);
-
- return crc ^ ~0U;
-}
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 1ae23bcf82..10a65c5bcc 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -155,7 +155,7 @@ static NTSTATUS ctdbd_connect(TALLOC_CTX *mem_ctx,
* Do we have a complete ctdb packet in the queue?
*/
-static bool ctdb_req_complete(const struct data_blob *data,
+static bool ctdb_req_complete(const DATA_BLOB *data,
size_t *length,
void *private_data)
{
@@ -220,7 +220,7 @@ struct req_pull_state {
* Pull a ctdb request out of the incoming packet queue
*/
-static NTSTATUS ctdb_req_pull(const struct data_blob *data,
+static NTSTATUS ctdb_req_pull(const DATA_BLOB *data,
void *private_data)
{
struct req_pull_state *state = (struct req_pull_state *)private_data;
@@ -260,7 +260,7 @@ static struct messaging_rec *ctdb_pull_messaging_rec(TALLOC_CTX *mem_ctx,
blob = data_blob_const(msg->data, msg->datalen);
ndr_err = ndr_pull_struct_blob(
- &blob, result, result,
+ &blob, result, NULL, result,
(ndr_pull_flags_fn_t)ndr_pull_messaging_rec);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -497,7 +497,7 @@ NTSTATUS ctdbd_messaging_connection(TALLOC_CTX *mem_ctx,
/*
* Packet handler to receive and handle a ctdb message
*/
-static NTSTATUS ctdb_handle_message(const struct data_blob *data,
+static NTSTATUS ctdb_handle_message(const DATA_BLOB *data,
void *private_data)
{
struct ctdbd_connection *conn = talloc_get_type_abort(
@@ -636,7 +636,7 @@ NTSTATUS ctdbd_messaging_send(struct ctdbd_connection *conn,
}
ndr_err = ndr_push_struct_blob(
- &blob, mem_ctx, msg,
+ &blob, mem_ctx, NULL, msg,
(ndr_push_flags_fn_t)ndr_push_messaging_rec);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -1025,7 +1025,7 @@ struct ctdbd_traverse_state {
* Handle a traverse record coming in on the ctdbd connection
*/
-static NTSTATUS ctdb_traverse_handler(const struct data_blob *blob,
+static NTSTATUS ctdb_traverse_handler(const DATA_BLOB *blob,
void *private_data)
{
struct ctdbd_traverse_state *state =
diff --git a/source3/lib/data_blob.c b/source3/lib/data_blob.c
deleted file mode 100644
index 66c5daf363..0000000000
--- a/source3/lib/data_blob.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Easy management of byte-length data
- Copyright (C) Andrew Tridgell 2001
- Copyright (C) Andrew Bartlett 2001
-
- 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"
-
-const DATA_BLOB data_blob_null = { NULL, 0, NULL };
-
-/*******************************************************************
- Free() a data blob.
-*******************************************************************/
-
-static void free_data_blob(DATA_BLOB *d)
-{
- if ((d) && (d->free)) {
- SAFE_FREE(d->data);
- }
-}
-
-/*******************************************************************
- Construct a data blob, must be freed with data_blob_free().
- You can pass NULL for p and get a blank data blob
-*******************************************************************/
-
-DATA_BLOB data_blob(const void *p, size_t length)
-{
- DATA_BLOB ret;
-
- if (!length) {
- ZERO_STRUCT(ret);
- return ret;
- }
-
- if (p) {
- ret.data = (uint8 *)smb_xmemdup(p, length);
- } else {
- ret.data = SMB_XMALLOC_ARRAY(uint8, length);
- }
- ret.length = length;
- ret.free = free_data_blob;
- return ret;
-}
-
-/*******************************************************************
- Construct a data blob, using supplied TALLOC_CTX.
-*******************************************************************/
-
-DATA_BLOB data_blob_talloc(TALLOC_CTX *mem_ctx, const void *p, size_t length)
-{
- DATA_BLOB ret;
-
- if (!length) {
- ZERO_STRUCT(ret);
- return ret;
- }
-
- if (p) {
- ret.data = (uint8 *)TALLOC_MEMDUP(mem_ctx, p, length);
- if (ret.data == NULL)
- smb_panic("data_blob_talloc: TALLOC_MEMDUP failed");
- } else {
- ret.data = (uint8 *)TALLOC(mem_ctx, length);
- if (ret.data == NULL)
- smb_panic("data_blob_talloc: TALLOC failed");
- }
-
- ret.length = length;
- ret.free = NULL;
- return ret;
-}
-
-/*******************************************************************
- Free a data blob.
-*******************************************************************/
-
-void data_blob_free(DATA_BLOB *d)
-{
- if (d) {
- if (d->free) {
- (d->free)(d);
- }
- d->length = 0;
- }
-}
-
-/*******************************************************************
- Clear a DATA_BLOB's contents
-*******************************************************************/
-
-void data_blob_clear(DATA_BLOB *d)
-{
- if (d->data) {
- memset(d->data, 0, d->length);
- }
-}
-
-/*******************************************************************
- Free a data blob and clear its contents
-*******************************************************************/
-
-void data_blob_clear_free(DATA_BLOB *d)
-{
- data_blob_clear(d);
- data_blob_free(d);
-}
-
-/**
- useful for constructing data blobs in test suites, while
- avoiding const warnings
-**/
-DATA_BLOB data_blob_string_const(const char *str)
-{
- DATA_BLOB blob;
- blob.data = CONST_DISCARD(uint8 *, str);
- blob.length = strlen(str) + 1;
- blob.free = NULL;
- return blob;
-}
-
-/**
- * Create a new data blob from const data
- */
-DATA_BLOB data_blob_const(const void *p, size_t length)
-{
- DATA_BLOB blob;
- blob.data = CONST_DISCARD(uint8 *, p);
- blob.length = length;
- blob.free = NULL;
- return blob;
-}
-
-/**
- construct a zero data blob, using supplied TALLOC_CTX.
- use this sparingly as it initialises data - better to initialise
- yourself if you want specific data in the blob
-**/
-DATA_BLOB data_blob_talloc_zero(TALLOC_CTX *mem_ctx, size_t length)
-{
- DATA_BLOB blob = data_blob_talloc(mem_ctx, NULL, length);
- data_blob_clear(&blob);
- return blob;
-}
-
-/**
-print the data_blob as hex string
-**/
-_PUBLIC_ char *data_blob_hex_string(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob)
-{
- int i;
- char *hex_string;
-
- hex_string = talloc_array(mem_ctx, char, (blob->length*2)+1);
- if (!hex_string) {
- return NULL;
- }
-
- for (i = 0; i < blob->length; i++)
- slprintf(&hex_string[i*2], 3, "%02X", blob->data[i]);
-
- hex_string[(blob->length*2)] = '\0';
- return hex_string;
-}
-
-
diff --git a/source3/lib/dbwrap_ctdb.c b/source3/lib/dbwrap_ctdb.c
index 63a5ce4de6..38daa61b33 100644
--- a/source3/lib/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap_ctdb.c
@@ -405,8 +405,9 @@ static struct db_record *db_ctdb_fetch_locked_transaction(struct db_ctdb_ctx *ct
return result;
}
-static int db_ctdb_record_destructor(struct db_record *rec)
+static int db_ctdb_record_destructor(struct db_record **recp)
{
+ struct db_record *rec = talloc_get_type_abort(*recp, struct db_record);
struct db_ctdb_transaction_handle *h = talloc_get_type_abort(
rec->private_data, struct db_ctdb_transaction_handle);
int ret = h->ctx->db->transaction_commit(h->ctx->db);
@@ -424,7 +425,7 @@ static struct db_record *db_ctdb_fetch_locked_persistent(struct db_ctdb_ctx *ctx
TDB_DATA key)
{
int res;
- struct db_record *rec;
+ struct db_record *rec, **recp;
res = db_ctdb_transaction_start(ctx->db);
if (res == -1) {
@@ -438,7 +439,14 @@ static struct db_record *db_ctdb_fetch_locked_persistent(struct db_ctdb_ctx *ctx
}
/* destroy this transaction when we release the lock */
- talloc_set_destructor((struct db_record *)talloc_new(rec), db_ctdb_record_destructor);
+ recp = talloc(rec, struct db_record *);
+ if (recp == NULL) {
+ ctx->db->transaction_cancel(ctx->db);
+ talloc_free(rec);
+ return NULL;
+ }
+ *recp = rec;
+ talloc_set_destructor(recp, db_ctdb_record_destructor);
return rec;
}
@@ -813,7 +821,7 @@ static int db_ctdb_record_destr(struct db_record* data)
? "Unlocking db %u key %s\n"
: "Unlocking db %u key %.20s\n",
(int)crec->ctdb_ctx->db_id,
- hex_encode(data, (unsigned char *)data->key.dptr,
+ hex_encode_talloc(data, (unsigned char *)data->key.dptr,
data->key.dsize)));
if (tdb_chainunlock(crec->ctdb_ctx->wtdb->tdb, data->key) != 0) {
@@ -863,7 +871,7 @@ static struct db_record *fetch_locked_internal(struct db_ctdb_ctx *ctx,
again:
if (DEBUGLEVEL >= 10) {
- char *keystr = hex_encode(result, key.dptr, key.dsize);
+ char *keystr = hex_encode_talloc(result, key.dptr, key.dsize);
DEBUG(10, (DEBUGLEVEL > 10
? "Locking db %u key %s\n"
: "Locking db %u key %.20s\n",
diff --git a/source3/lib/dbwrap_file.c b/source3/lib/dbwrap_file.c
index e3779de1e4..69ad8e4b20 100644
--- a/source3/lib/dbwrap_file.c
+++ b/source3/lib/dbwrap_file.c
@@ -105,7 +105,7 @@ static struct db_record *db_file_fetch_locked(struct db_context *db,
/* Cut to 8 bits */
file->hash = fsh(key.dptr, key.dsize);
- file->name = hex_encode(file, (unsigned char *)key.dptr, key.dsize);
+ file->name = hex_encode_talloc(file, (unsigned char *)key.dptr, key.dsize);
if (file->name == NULL) {
DEBUG(0, ("hex_encode failed\n"));
TALLOC_FREE(result);
diff --git a/source3/lib/dbwrap_rbt.c b/source3/lib/dbwrap_rbt.c
index b70ce3dfa0..6e09627223 100644
--- a/source3/lib/dbwrap_rbt.c
+++ b/source3/lib/dbwrap_rbt.c
@@ -18,7 +18,7 @@
*/
#include "includes.h"
-#include "rbtree.h"
+#include "../lib/util/rbtree.h"
#define DBWRAP_RBT_ALIGN(_size_) (((_size_)+15)&~15)
diff --git a/source3/lib/dbwrap_tdb.c b/source3/lib/dbwrap_tdb.c
index 7bdadd3770..4860c61ab0 100644
--- a/source3/lib/dbwrap_tdb.c
+++ b/source3/lib/dbwrap_tdb.c
@@ -31,14 +31,14 @@ 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
+ /* This hex_encode_talloc() 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,
+ hex_encode_talloc(data, (unsigned char *)data->key.dptr,
data->key.dsize)));
if (tdb_chainunlock(ctx->wtdb->tdb, data->key) != 0) {
@@ -94,7 +94,7 @@ static struct db_record *db_tdb_fetch_locked(struct db_context *db,
/* 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);
+ char *keystr = hex_encode_talloc(NULL, (unsigned char*)key.dptr, key.dsize);
DEBUG(10, (DEBUGLEVEL > 10
? "Locking key %s\n" : "Locking key %.20s\n",
keystr));
diff --git a/source3/lib/debug.c b/source3/lib/debug.c
index d835ea7c17..be2707b595 100644
--- a/source3/lib/debug.c
+++ b/source3/lib/debug.c
@@ -578,7 +578,9 @@ void setup_logging(const char *pname, bool interactive)
stdout_logging = False;
if (dbf) {
x_fflush(dbf);
- (void) x_fclose(dbf);
+ if (dbf != x_stdout) {
+ (void) x_fclose(dbf);
+ }
}
dbf = NULL;
@@ -982,7 +984,7 @@ void dbgflush( void )
****************************************************************************/
-bool dbghdr(int level, int cls, const char *file, const char *func, int line)
+bool dbghdrclass(int level, int cls, const char *location, const char *func)
{
/* Ensure we don't lose any real errno value. */
int old_errno = errno;
@@ -1044,10 +1046,10 @@ bool dbghdr(int level, int cls, const char *file, const char *func, int line)
lp_debug_hires_timestamp()),
level, header_str);
} else {
- (void)Debug1( "[%s, %2d%s] %s:%s(%d)\n",
+ (void)Debug1( "[%s, %2d%s] %s(%s)\n",
current_timestring(debug_ctx(),
lp_debug_hires_timestamp()),
- level, header_str, file, func, line );
+ level, header_str, location, func );
}
}
@@ -1055,6 +1057,12 @@ bool dbghdr(int level, int cls, const char *file, const char *func, int line)
return( True );
}
+bool dbghdr(int level, const char *location, const char *func)
+{
+ /* For compatibility with Samba 4, which doesn't have debug classes */
+ return dbghdrclass(level, 0, location, func);
+}
+
/***************************************************************************
Add text to the body of the "current" debug message via the format buffer.
diff --git a/source3/lib/display_sec.c b/source3/lib/display_sec.c
index 67392e4568..a0d93d6fe7 100644
--- a/source3/lib/display_sec.c
+++ b/source3/lib/display_sec.c
@@ -118,7 +118,7 @@ char *get_sec_mask_str(TALLOC_CTX *ctx, uint32 type)
/****************************************************************************
display sec_access structure
****************************************************************************/
-void display_sec_access(SEC_ACCESS *info)
+void display_sec_access(uint32_t *info)
{
char *mask_str = get_sec_mask_str(NULL, *info);
printf("\t\tPermissions: 0x%x: %s\n", *info, mask_str ? mask_str : "");
@@ -157,13 +157,13 @@ static void disp_sec_ace_object(struct security_ace_object *object)
{
if (object->flags & SEC_ACE_OBJECT_PRESENT) {
printf("Object type: SEC_ACE_OBJECT_PRESENT\n");
- printf("Object GUID: %s\n", smb_uuid_string(talloc_tos(),
- object->type.type));
+ printf("Object GUID: %s\n", GUID_string(talloc_tos(),
+ &object->type.type));
}
if (object->flags & SEC_ACE_OBJECT_INHERITED_PRESENT) {
printf("Object type: SEC_ACE_OBJECT_INHERITED_PRESENT\n");
- printf("Object GUID: %s\n", smb_uuid_string(talloc_tos(),
- object->inherited_type.inherited_type));
+ printf("Object GUID: %s\n", GUID_string(talloc_tos(),
+ &object->inherited_type.inherited_type));
}
}
diff --git a/source3/lib/dprintf.c b/source3/lib/dprintf.c
index a3bb5be43a..b3c830dd5b 100644
--- a/source3/lib/dprintf.c
+++ b/source3/lib/dprintf.c
@@ -41,7 +41,7 @@
msgstr = lang_msg(format);
if (!msgstr) return -1;
- VA_COPY(ap2, ap);
+ va_copy(ap2, ap);
ret = vasprintf(&p, msgstr, ap2);
diff --git a/source3/lib/dummysmbd.c b/source3/lib/dummysmbd.c
index dbe886e3d1..5c624bdebf 100644
--- a/source3/lib/dummysmbd.c
+++ b/source3/lib/dummysmbd.c
@@ -51,3 +51,18 @@ NTSTATUS can_delete_directory(struct connection_struct *conn,
{
return NT_STATUS_OK;
}
+
+bool change_to_root_user(void)
+{
+ return false;
+}
+
+struct event_context *smbd_event_context(void)
+{
+ return NULL;
+}
+
+struct messaging_context *smbd_messaging_context(void)
+{
+ return NULL;
+}
diff --git a/source3/lib/errmap_unix.c b/source3/lib/errmap_unix.c
index 2cd2386c5c..9adb237096 100644
--- a/source3/lib/errmap_unix.c
+++ b/source3/lib/errmap_unix.c
@@ -128,3 +128,139 @@ NTSTATUS map_nt_error_from_unix(int unix_error)
/* Default return */
return NT_STATUS_ACCESS_DENIED;
}
+
+/* Return a UNIX errno from a NT status code */
+static const struct {
+ NTSTATUS status;
+ int error;
+} nt_errno_map[] = {
+ {NT_STATUS_ACCESS_VIOLATION, EACCES},
+ {NT_STATUS_INVALID_HANDLE, EBADF},
+ {NT_STATUS_ACCESS_DENIED, EACCES},
+ {NT_STATUS_OBJECT_NAME_NOT_FOUND, ENOENT},
+ {NT_STATUS_OBJECT_PATH_NOT_FOUND, ENOENT},
+ {NT_STATUS_SHARING_VIOLATION, EBUSY},
+ {NT_STATUS_OBJECT_PATH_INVALID, ENOTDIR},
+ {NT_STATUS_OBJECT_NAME_COLLISION, EEXIST},
+ {NT_STATUS_PATH_NOT_COVERED, ENOENT},
+ {NT_STATUS_UNSUCCESSFUL, EINVAL},
+ {NT_STATUS_NOT_IMPLEMENTED, ENOSYS},
+ {NT_STATUS_IN_PAGE_ERROR, EFAULT},
+ {NT_STATUS_BAD_NETWORK_NAME, ENOENT},
+#ifdef EDQUOT
+ {NT_STATUS_PAGEFILE_QUOTA, EDQUOT},
+ {NT_STATUS_QUOTA_EXCEEDED, EDQUOT},
+ {NT_STATUS_REGISTRY_QUOTA_LIMIT, EDQUOT},
+ {NT_STATUS_LICENSE_QUOTA_EXCEEDED, EDQUOT},
+#endif
+#ifdef ETIME
+ {NT_STATUS_TIMER_NOT_CANCELED, ETIME},
+#endif
+ {NT_STATUS_INVALID_PARAMETER, EINVAL},
+ {NT_STATUS_NO_SUCH_DEVICE, ENODEV},
+ {NT_STATUS_NO_SUCH_FILE, ENOENT},
+#ifdef ENODATA
+ {NT_STATUS_END_OF_FILE, ENODATA},
+#endif
+#ifdef ENOMEDIUM
+ {NT_STATUS_NO_MEDIA_IN_DEVICE, ENOMEDIUM},
+ {NT_STATUS_NO_MEDIA, ENOMEDIUM},
+#endif
+ {NT_STATUS_NONEXISTENT_SECTOR, ESPIPE},
+ {NT_STATUS_NO_MEMORY, ENOMEM},
+ {NT_STATUS_CONFLICTING_ADDRESSES, EADDRINUSE},
+ {NT_STATUS_NOT_MAPPED_VIEW, EINVAL},
+ {NT_STATUS_UNABLE_TO_FREE_VM, EADDRINUSE},
+ {NT_STATUS_ACCESS_DENIED, EACCES},
+ {NT_STATUS_BUFFER_TOO_SMALL, ENOBUFS},
+ {NT_STATUS_WRONG_PASSWORD, EACCES},
+ {NT_STATUS_LOGON_FAILURE, EACCES},
+ {NT_STATUS_INVALID_WORKSTATION, EACCES},
+ {NT_STATUS_INVALID_LOGON_HOURS, EACCES},
+ {NT_STATUS_PASSWORD_EXPIRED, EACCES},
+ {NT_STATUS_ACCOUNT_DISABLED, EACCES},
+ {NT_STATUS_DISK_FULL, ENOSPC},
+ {NT_STATUS_INVALID_PIPE_STATE, EPIPE},
+ {NT_STATUS_PIPE_BUSY, EPIPE},
+ {NT_STATUS_PIPE_DISCONNECTED, EPIPE},
+ {NT_STATUS_PIPE_NOT_AVAILABLE, ENOSYS},
+ {NT_STATUS_FILE_IS_A_DIRECTORY, EISDIR},
+ {NT_STATUS_NOT_SUPPORTED, ENOSYS},
+ {NT_STATUS_NOT_A_DIRECTORY, ENOTDIR},
+ {NT_STATUS_DIRECTORY_NOT_EMPTY, ENOTEMPTY},
+ {NT_STATUS_NETWORK_UNREACHABLE, ENETUNREACH},
+ {NT_STATUS_HOST_UNREACHABLE, EHOSTUNREACH},
+ {NT_STATUS_CONNECTION_ABORTED, ECONNABORTED},
+ {NT_STATUS_CONNECTION_REFUSED, ECONNREFUSED},
+ {NT_STATUS_TOO_MANY_LINKS, EMLINK},
+ {NT_STATUS_NETWORK_BUSY, EBUSY},
+ {NT_STATUS_DEVICE_DOES_NOT_EXIST, ENODEV},
+#ifdef ELIBACC
+ {NT_STATUS_DLL_NOT_FOUND, ELIBACC},
+#endif
+ {NT_STATUS_PIPE_BROKEN, EPIPE},
+ {NT_STATUS_REMOTE_NOT_LISTENING, ECONNREFUSED},
+ {NT_STATUS_NETWORK_ACCESS_DENIED, EACCES},
+ {NT_STATUS_TOO_MANY_OPENED_FILES, EMFILE},
+#ifdef EPROTO
+ {NT_STATUS_DEVICE_PROTOCOL_ERROR, EPROTO},
+#endif
+ {NT_STATUS_FLOAT_OVERFLOW, ERANGE},
+ {NT_STATUS_FLOAT_UNDERFLOW, ERANGE},
+ {NT_STATUS_INTEGER_OVERFLOW, ERANGE},
+ {NT_STATUS_MEDIA_WRITE_PROTECTED, EROFS},
+ {NT_STATUS_PIPE_CONNECTED, EISCONN},
+ {NT_STATUS_MEMORY_NOT_ALLOCATED, EFAULT},
+ {NT_STATUS_FLOAT_INEXACT_RESULT, ERANGE},
+ {NT_STATUS_ILL_FORMED_PASSWORD, EACCES},
+ {NT_STATUS_PASSWORD_RESTRICTION, EACCES},
+ {NT_STATUS_ACCOUNT_RESTRICTION, EACCES},
+ {NT_STATUS_PORT_CONNECTION_REFUSED, ECONNREFUSED},
+ {NT_STATUS_NAME_TOO_LONG, ENAMETOOLONG},
+ {NT_STATUS_REMOTE_DISCONNECT, ESHUTDOWN},
+ {NT_STATUS_CONNECTION_DISCONNECTED, ECONNABORTED},
+ {NT_STATUS_CONNECTION_RESET, ENETRESET},
+#ifdef ENOTUNIQ
+ {NT_STATUS_IP_ADDRESS_CONFLICT1, ENOTUNIQ},
+ {NT_STATUS_IP_ADDRESS_CONFLICT2, ENOTUNIQ},
+#endif
+ {NT_STATUS_PORT_MESSAGE_TOO_LONG, EMSGSIZE},
+ {NT_STATUS_PROTOCOL_UNREACHABLE, ENOPROTOOPT},
+ {NT_STATUS_ADDRESS_ALREADY_EXISTS, EADDRINUSE},
+ {NT_STATUS_PORT_UNREACHABLE, EHOSTUNREACH},
+ {NT_STATUS_IO_TIMEOUT, ETIMEDOUT},
+ {NT_STATUS_RETRY, EAGAIN},
+#ifdef ENOTUNIQ
+ {NT_STATUS_DUPLICATE_NAME, ENOTUNIQ},
+#endif
+#ifdef ECOMM
+ {NT_STATUS_NET_WRITE_FAULT, ECOMM},
+#endif
+#ifdef EXDEV
+ {NT_STATUS_NOT_SAME_DEVICE, EXDEV},
+#endif
+ {NT_STATUS(0), 0}
+};
+
+int map_errno_from_nt_status(NTSTATUS status)
+{
+ int i;
+ DEBUG(10,("map_errno_from_nt_status: 32 bit codes: code=%08x\n",
+ NT_STATUS_V(status)));
+
+ /* Status codes without this bit set are not errors */
+
+ if (!(NT_STATUS_V(status) & 0xc0000000)) {
+ return 0;
+ }
+
+ for (i=0;nt_errno_map[i].error;i++) {
+ if (NT_STATUS_V(nt_errno_map[i].status) ==
+ NT_STATUS_V(status)) {
+ return nt_errno_map[i].error;
+ }
+ }
+
+ /* for all other cases - a default code */
+ return EINVAL;
+}
diff --git a/source3/lib/events.c b/source3/lib/events.c
index f03138708b..8bbc9497ac 100644
--- a/source3/lib/events.c
+++ b/source3/lib/events.c
@@ -436,7 +436,7 @@ void dump_event_list(struct event_context *event_ctx)
te->event_name,
(unsigned long)te,
(int)evt.tv_sec,
- http_timestring(te->when.tv_sec)));
+ http_timestring(talloc_tos(), te->when.tv_sec)));
}
for (fe = event_ctx->fd_events; fe; fe = fe->next) {
diff --git a/source3/lib/fsusage.c b/source3/lib/fsusage.c
deleted file mode 100644
index 66ffb9f442..0000000000
--- a/source3/lib/fsusage.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- functions to calculate the free disk space
- Copyright (C) Andrew Tridgell 1998-2000
-
- 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"
-
-
-/* Return the number of TOSIZE-byte blocks used by
- BLOCKS FROMSIZE-byte blocks, rounding away from zero.
-*/
-static SMB_BIG_UINT adjust_blocks(SMB_BIG_UINT blocks, SMB_BIG_UINT fromsize, SMB_BIG_UINT tosize)
-{
- if (fromsize == tosize) { /* e.g., from 512 to 512 */
- return blocks;
- } else if (fromsize > tosize) { /* e.g., from 2048 to 512 */
- return blocks * (fromsize / tosize);
- } else { /* e.g., from 256 to 512 */
- /* Protect against broken filesystems... */
- if (fromsize == 0) {
- fromsize = tosize;
- }
- return (blocks + 1) / (tosize / fromsize);
- }
-}
-
-/* this does all of the system specific guff to get the free disk space.
- It is derived from code in the GNU fileutils package, but has been
- considerably mangled for use here
-
- results are returned in *dfree and *dsize, in 512 byte units
-*/
-int sys_fsusage(const char *path, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
-{
-#ifdef STAT_STATFS3_OSF1
-#define CONVERT_BLOCKS(B) adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)fsd.f_fsize, (SMB_BIG_UINT)512)
- struct statfs fsd;
-
- if (statfs (path, &fsd, sizeof (struct statfs)) != 0)
- return -1;
-#endif /* STAT_STATFS3_OSF1 */
-
-#ifdef STAT_STATFS2_FS_DATA /* Ultrix */
-#define CONVERT_BLOCKS(B) adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)1024, (SMB_BIG_UINT)512)
- struct fs_data fsd;
-
- if (statfs (path, &fsd) != 1)
- return -1;
-
- (*dsize) = CONVERT_BLOCKS (fsd.fd_req.btot);
- (*dfree) = CONVERT_BLOCKS (fsd.fd_req.bfreen);
-#endif /* STAT_STATFS2_FS_DATA */
-
-#ifdef STAT_STATFS2_BSIZE /* 4.3BSD, SunOS 4, HP-UX, AIX */
-#define CONVERT_BLOCKS(B) adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)fsd.f_bsize, (SMB_BIG_UINT)512)
- struct statfs fsd;
-
- if (statfs (path, &fsd) < 0)
- return -1;
-
-#ifdef STATFS_TRUNCATES_BLOCK_COUNTS
- /* In SunOS 4.1.2, 4.1.3, and 4.1.3_U1, the block counts in the
- struct statfs are truncated to 2GB. These conditions detect that
- truncation, presumably without botching the 4.1.1 case, in which
- the values are not truncated. The correct counts are stored in
- undocumented spare fields. */
- if (fsd.f_blocks == 0x1fffff && fsd.f_spare[0] > 0) {
- fsd.f_blocks = fsd.f_spare[0];
- fsd.f_bfree = fsd.f_spare[1];
- fsd.f_bavail = fsd.f_spare[2];
- }
-#endif /* STATFS_TRUNCATES_BLOCK_COUNTS */
-#endif /* STAT_STATFS2_BSIZE */
-
-
-#ifdef STAT_STATFS2_FSIZE /* 4.4BSD */
-#define CONVERT_BLOCKS(B) adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)fsd.f_fsize, (SMB_BIG_UINT)512)
-
- struct statfs fsd;
-
- if (statfs (path, &fsd) < 0)
- return -1;
-#endif /* STAT_STATFS2_FSIZE */
-
-#ifdef STAT_STATFS4 /* SVR3, Dynix, Irix, AIX */
-# if _AIX || defined(_CRAY)
-# define CONVERT_BLOCKS(B) adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)fsd.f_bsize, (SMB_BIG_UINT)512)
-# ifdef _CRAY
-# define f_bavail f_bfree
-# endif
-# else
-# define CONVERT_BLOCKS(B) ((SMB_BIG_UINT)B)
-# ifndef _SEQUENT_ /* _SEQUENT_ is DYNIX/ptx */
-# ifndef DOLPHIN /* DOLPHIN 3.8.alfa/7.18 has f_bavail */
-# define f_bavail f_bfree
-# endif
-# endif
-# endif
-
- struct statfs fsd;
-
- if (statfs (path, &fsd, sizeof fsd, 0) < 0)
- return -1;
- /* Empirically, the block counts on most SVR3 and SVR3-derived
- systems seem to always be in terms of 512-byte blocks,
- no matter what value f_bsize has. */
-
-#endif /* STAT_STATFS4 */
-
-#if defined(STAT_STATVFS) || defined(STAT_STATVFS64) /* SVR4 */
-#if defined HAVE_FRSIZE
-# define CONVERT_BLOCKS(B) \
- adjust_blocks ((SMB_BIG_UINT)(B), fsd.f_frsize ? (SMB_BIG_UINT)fsd.f_frsize : (SMB_BIG_UINT)fsd.f_bsize, (SMB_BIG_UINT)512)
-#else
-# define CONVERT_BLOCKS(B) \
- adjust_blocks ((SMB_BIG_UINT)(B), (SMB_BIG_UINT)fsd.f_bsize, (SMB_BIG_UINT)512)
-#endif
-
-#ifdef STAT_STATVFS64
- struct statvfs64 fsd;
- if (statvfs64(path, &fsd) < 0) return -1;
-#else
- struct statvfs fsd;
- if (statvfs(path, &fsd) < 0) return -1;
-#endif
-
- /* f_frsize isn't guaranteed to be supported. */
-
-#endif /* STAT_STATVFS */
-
-#ifndef CONVERT_BLOCKS
- /* we don't have any dfree code! */
- return -1;
-#else
-#if !defined(STAT_STATFS2_FS_DATA)
- /* !Ultrix */
- (*dsize) = CONVERT_BLOCKS (fsd.f_blocks);
- (*dfree) = CONVERT_BLOCKS (fsd.f_bavail);
-#endif /* not STAT_STATFS2_FS_DATA */
-#endif
-
- return 0;
-}
diff --git a/source3/lib/genrand.c b/source3/lib/genrand.c
index 4590b812c5..076a2fd518 100644
--- a/source3/lib/genrand.c
+++ b/source3/lib/genrand.c
@@ -21,7 +21,7 @@
#include "includes.h"
-static unsigned char smb_arc4_state[258];
+static struct arcfour_state smb_arc4_state;
static uint32 counter;
static bool done_reseed = False;
@@ -89,6 +89,7 @@ static void do_filehash(const char *fname, unsigned char *the_hash)
static int do_reseed(bool use_fd, int fd)
{
unsigned char seed_inbuf[40];
+ DATA_BLOB seed_blob = { seed_inbuf, 40 };
uint32 v1, v2; struct timeval tval; pid_t mypid;
struct passwd *pw;
int reseed_data = 0;
@@ -146,7 +147,7 @@ static int do_reseed(bool use_fd, int fd)
seed_inbuf[i] ^= ((char *)(&reseed_data))[i % sizeof(reseed_data)];
}
- smb_arc4_init(smb_arc4_state, seed_inbuf, sizeof(seed_inbuf));
+ arcfour_init(&smb_arc4_state, &seed_blob);
return -1;
}
@@ -155,7 +156,7 @@ static int do_reseed(bool use_fd, int fd)
Interface to the (hopefully) good crypto random number generator.
********************************************************************/
-void generate_random_buffer( unsigned char *out, int len)
+void generate_random_buffer(uint8_t *out, int len)
{
static int urand_fd = -1;
unsigned char md4_buf[64];
@@ -190,7 +191,7 @@ void generate_random_buffer( unsigned char *out, int len)
while(len > 0) {
int copy_len = len > 16 ? 16 : len;
- smb_arc4_crypt(smb_arc4_state, md4_buf, sizeof(md4_buf));
+ arcfour_crypt_sbox(&smb_arc4_state, md4_buf, sizeof(md4_buf));
mdfour(tmp_buf, md4_buf, sizeof(md4_buf));
memcpy(p, tmp_buf, copy_len);
p += copy_len;
@@ -204,15 +205,11 @@ void generate_random_buffer( unsigned char *out, int len)
static char c_list[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+_-#.,";
-char *generate_random_str(size_t len)
+char *generate_random_str(TALLOC_CTX *mem_ctx, size_t len)
{
- static unsigned char retstr[256];
+ unsigned char *retstr = talloc_zero_array(mem_ctx, unsigned char, len);
size_t i;
- memset(retstr, '\0', sizeof(retstr));
-
- if (len > sizeof(retstr)-1)
- len = sizeof(retstr) -1;
generate_random_buffer( retstr, len);
for (i = 0; i < len; i++)
retstr[i] = c_list[ retstr[i] % (sizeof(c_list)-1) ];
diff --git a/source3/lib/hmacmd5.c b/source3/lib/hmacmd5.c
deleted file mode 100644
index 86db3aa236..0000000000
--- a/source3/lib/hmacmd5.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- HMAC MD5 code for use in NTLMv2
- Copyright (C) Luke Kenneth Casson Leighton 1996-2000
- Copyright (C) Andrew Tridgell 1992-2000
-
- 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/>.
-*/
-
-/* taken direct from rfc2104 implementation and modified for suitable use
- * for ntlmv2.
- */
-
-#include "includes.h"
-
-/***********************************************************************
- the rfc 2104 version of hmac_md5 initialisation.
-***********************************************************************/
-
-void hmac_md5_init_rfc2104(const unsigned char *key, int key_len, HMACMD5Context *ctx)
-{
- int i;
- unsigned char tk[16];
-
- /* if key is longer than 64 bytes reset it to key=MD5(key) */
- if (key_len > 64) {
- struct MD5Context tctx;
-
- MD5Init(&tctx);
- MD5Update(&tctx, key, key_len);
- MD5Final(tk, &tctx);
-
- key = tk;
- key_len = 16;
- }
-
- /* start out by storing key in pads */
- ZERO_STRUCT(ctx->k_ipad);
- ZERO_STRUCT(ctx->k_opad);
- memcpy( ctx->k_ipad, key, key_len);
- memcpy( ctx->k_opad, key, key_len);
-
- /* XOR key with ipad and opad values */
- for (i=0; i<64; i++) {
- ctx->k_ipad[i] ^= 0x36;
- ctx->k_opad[i] ^= 0x5c;
- }
-
- MD5Init(&ctx->ctx);
- MD5Update(&ctx->ctx, ctx->k_ipad, 64);
-}
-
-/***********************************************************************
- the microsoft version of hmac_md5 initialisation.
-***********************************************************************/
-
-void hmac_md5_init_limK_to_64(const unsigned char* key, int key_len,
- HMACMD5Context *ctx)
-{
- int i;
-
- /* if key is longer than 64 bytes truncate it */
- if (key_len > 64) {
- key_len = 64;
- }
-
- /* start out by storing key in pads */
- ZERO_STRUCT(ctx->k_ipad);
- ZERO_STRUCT(ctx->k_opad);
- memcpy( ctx->k_ipad, key, key_len);
- memcpy( ctx->k_opad, key, key_len);
-
- /* XOR key with ipad and opad values */
- for (i=0; i<64; i++) {
- ctx->k_ipad[i] ^= 0x36;
- ctx->k_opad[i] ^= 0x5c;
- }
-
- MD5Init(&ctx->ctx);
- MD5Update(&ctx->ctx, ctx->k_ipad, 64);
-}
-
-/***********************************************************************
- update hmac_md5 "inner" buffer
-***********************************************************************/
-
-void hmac_md5_update(const unsigned char *text, int text_len, HMACMD5Context *ctx)
-{
- MD5Update(&ctx->ctx, text, text_len); /* then text of datagram */
-}
-
-/***********************************************************************
- finish off hmac_md5 "inner" buffer and generate outer one.
-***********************************************************************/
-void hmac_md5_final(unsigned char *digest, HMACMD5Context *ctx)
-
-{
- struct MD5Context ctx_o;
-
- MD5Final(digest, &ctx->ctx);
-
- MD5Init(&ctx_o);
- MD5Update(&ctx_o, ctx->k_opad, 64);
- MD5Update(&ctx_o, digest, 16);
- MD5Final(digest, &ctx_o);
-}
-
-/***********************************************************
- single function to calculate an HMAC MD5 digest from data.
- use the microsoft hmacmd5 init method because the key is 16 bytes.
-************************************************************/
-
-void hmac_md5( unsigned char key[16], const unsigned char *data, int data_len,
- unsigned char *digest)
-{
- HMACMD5Context ctx;
- hmac_md5_init_limK_to_64(key, 16, &ctx);
- if (data_len != 0)
- {
- hmac_md5_update(data, data_len, &ctx);
- }
- hmac_md5_final(digest, &ctx);
-}
-
diff --git a/source3/lib/interfaces.c b/source3/lib/interfaces.c
index dd857ae672..4567fe457b 100644
--- a/source3/lib/interfaces.c
+++ b/source3/lib/interfaces.c
@@ -86,7 +86,7 @@
#define SOCKET_WRAPPER_NOT_REPLACE
#include "interfaces.h"
-#include "lib/replace/replace.h"
+#include "../replace/replace.h"
/****************************************************************************
Utility functions.
diff --git a/source3/lib/ldb/common/ldb.c b/source3/lib/ldb/common/ldb.c
index 743711b967..c8aa6afdfc 100644
--- a/source3/lib/ldb/common/ldb.c
+++ b/source3/lib/ldb/common/ldb.c
@@ -787,6 +787,7 @@ int ldb_search(struct ldb_context *ldb,
done:
if (ret != LDB_SUCCESS) {
talloc_free(res);
+ res = NULL;
}
*_res = res;
diff --git a/source3/lib/ldb/ldb_tdb/ldb_tdb.h b/source3/lib/ldb/ldb_tdb/ldb_tdb.h
index 42f3dc2421..486d948fa0 100644
--- a/source3/lib/ldb/ldb_tdb/ldb_tdb.h
+++ b/source3/lib/ldb/ldb_tdb/ldb_tdb.h
@@ -6,7 +6,7 @@
#if (_SAMBA_BUILD_ >= 4)
#include "lib/tdb/include/tdb.h"
#elif defined(_SAMBA_BUILD_)
-#include "tdb/include/tdb.h"
+#include "../tdb/include/tdb.h"
#else
#include "tdb.h"
#endif
diff --git a/source3/lib/ldb/libldb.m4 b/source3/lib/ldb/libldb.m4
index 845563b4a1..df2075d4e3 100644
--- a/source3/lib/ldb/libldb.m4
+++ b/source3/lib/ldb/libldb.m4
@@ -1,33 +1 @@
SMB_ENABLE(ldb_sqlite3,$with_sqlite3_support)
-
-AC_MSG_CHECKING([for Python])
-
-PYTHON=
-
-AC_ARG_WITH(python,
-[ --with-python=PYTHONNAME build Python libraries],
-[ case "${withval-python}" in
- yes)
- PYTHON=python
- ;;
- no)
- PYTHON=
- ;;
- *)
- PYTHON=${withval-python}
- ;;
- esac ])
-
-if test x"$PYTHON" != "x"; then
- incdir=`python -c 'import sys; print "%s/include/python%d.%d" % (sys.prefix, sys.version_info[[0]], sys.version_info[[1]])'`
- CPPFLAGS="$CPPFLAGS -I $incdir"
-fi
-
-if test x"$PYTHON" != "x"; then
- AC_MSG_RESULT([${withval-python}])
-else
- AC_MSG_RESULT(no)
- SMB_ENABLE(swig_ldb, NO)
-fi
-
-AC_SUBST(PYTHON)
diff --git a/source3/lib/md4.c b/source3/lib/md4.c
deleted file mode 100644
index bae0091e36..0000000000
--- a/source3/lib/md4.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- a implementation of MD4 designed for use in the SMB authentication protocol
- Copyright (C) Andrew Tridgell 1997-1998.
-
- 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"
-
-/* NOTE: This code makes no attempt to be fast!
-
- 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)
-{
- return (X&Y) | ((~X)&Z);
-}
-
-static uint32 G(uint32 X, uint32 Y, uint32 Z)
-{
- return (X&Y) | (X&Z) | (Y&Z);
-}
-
-static uint32 H(uint32 X, uint32 Y, uint32 Z)
-{
- return X^Y^Z;
-}
-
-static uint32 lshift(uint32 x, int s)
-{
- x &= 0xFFFFFFFF;
- return ((x<<s)&0xFFFFFFFF) | (x>>(32-s));
-}
-
-#define ROUND1(a,b,c,d,k,s) a = lshift(a + F(b,c,d) + X[k], s)
-#define ROUND2(a,b,c,d,k,s) a = lshift(a + G(b,c,d) + X[k] + (uint32)0x5A827999,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_t *state, uint32 *M)
-{
- int j;
- uint32 AA, BB, CC, DD;
- uint32 X[16];
-
- for (j=0;j<16;j++)
- X[j] = M[j];
-
- AA = A; BB = B; CC = C; DD = D;
-
- ROUND1(A,B,C,D, 0, 3); ROUND1(D,A,B,C, 1, 7);
- ROUND1(C,D,A,B, 2, 11); ROUND1(B,C,D,A, 3, 19);
- ROUND1(A,B,C,D, 4, 3); ROUND1(D,A,B,C, 5, 7);
- ROUND1(C,D,A,B, 6, 11); ROUND1(B,C,D,A, 7, 19);
- ROUND1(A,B,C,D, 8, 3); ROUND1(D,A,B,C, 9, 7);
- ROUND1(C,D,A,B, 10, 11); ROUND1(B,C,D,A, 11, 19);
- ROUND1(A,B,C,D, 12, 3); ROUND1(D,A,B,C, 13, 7);
- ROUND1(C,D,A,B, 14, 11); ROUND1(B,C,D,A, 15, 19);
-
- ROUND2(A,B,C,D, 0, 3); ROUND2(D,A,B,C, 4, 5);
- ROUND2(C,D,A,B, 8, 9); ROUND2(B,C,D,A, 12, 13);
- ROUND2(A,B,C,D, 1, 3); ROUND2(D,A,B,C, 5, 5);
- ROUND2(C,D,A,B, 9, 9); ROUND2(B,C,D,A, 13, 13);
- ROUND2(A,B,C,D, 2, 3); ROUND2(D,A,B,C, 6, 5);
- ROUND2(C,D,A,B, 10, 9); ROUND2(B,C,D,A, 14, 13);
- ROUND2(A,B,C,D, 3, 3); ROUND2(D,A,B,C, 7, 5);
- ROUND2(C,D,A,B, 11, 9); ROUND2(B,C,D,A, 15, 13);
-
- ROUND3(A,B,C,D, 0, 3); ROUND3(D,A,B,C, 8, 9);
- ROUND3(C,D,A,B, 4, 11); ROUND3(B,C,D,A, 12, 15);
- ROUND3(A,B,C,D, 2, 3); ROUND3(D,A,B,C, 10, 9);
- ROUND3(C,D,A,B, 6, 11); ROUND3(B,C,D,A, 14, 15);
- ROUND3(A,B,C,D, 1, 3); ROUND3(D,A,B,C, 9, 9);
- ROUND3(C,D,A,B, 5, 11); ROUND3(B,C,D,A, 13, 15);
- ROUND3(A,B,C,D, 3, 3); ROUND3(D,A,B,C, 11, 9);
- ROUND3(C,D,A,B, 7, 11); ROUND3(B,C,D,A, 15, 15);
-
- A += AA; B += BB; C += CC; D += DD;
-
- A &= 0xFFFFFFFF; B &= 0xFFFFFFFF;
- C &= 0xFFFFFFFF; D &= 0xFFFFFFFF;
-
- for (j=0;j<16;j++)
- X[j] = 0;
-}
-
-static void copy64(uint32 *M, const unsigned char *in)
-{
- int i;
-
- for (i=0;i<16;i++)
- M[i] = (in[i*4+3]<<24) | (in[i*4+2]<<16) |
- (in[i*4+1]<<8) | (in[i*4+0]<<0);
-}
-
-static void copy4(unsigned char *out, uint32 x)
-{
- out[0] = x&0xFF;
- out[1] = (x>>8)&0xFF;
- out[2] = (x>>16)&0xFF;
- out[3] = (x>>24)&0xFF;
-}
-
-/* produce a md4 message digest from data of length n bytes */
-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;
-
- A = 0x67452301;
- B = 0xefcdab89;
- C = 0x98badcfe;
- D = 0x10325476;
-
- while (n > 64) {
- copy64(M, in);
- mdfour64(state, M);
- in += 64;
- n -= 64;
- }
-
- for (i=0;i<128;i++)
- buf[i] = 0;
- memcpy(buf, in, n);
- buf[n] = 0x80;
-
- if (n <= 55) {
- copy4(buf+56, b);
- copy64(M, buf);
- mdfour64(state, M);
- } else {
- copy4(buf+120, b);
- copy64(M, buf);
- mdfour64(state, M);
- copy64(M, buf+64);
- mdfour64(state, M);
- }
-
- for (i=0;i<128;i++)
- buf[i] = 0;
- copy64(M, buf);
-
- copy4(out, A);
- copy4(out+4, B);
- copy4(out+8, C);
- copy4(out+12, D);
-}
-
-
diff --git a/source3/lib/md5.c b/source3/lib/md5.c
deleted file mode 100644
index 2121b17047..0000000000
--- a/source3/lib/md5.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * This code implements the MD5 message-digest algorithm.
- * The algorithm is due to Ron Rivest. This code was
- * written by Colin Plumb in 1993, no copyright is claimed.
- * This code is in the public domain; do with it what you wish.
- *
- * Equivalent code is available from RSA Data Security, Inc.
- * This code has been tested against that, and is equivalent,
- * except that you don't need to include two pages of legalese
- * with every copy.
- *
- * To compute the message digest of a chunk of bytes, declare an
- * MD5Context structure, pass it to MD5Init, call MD5Update as
- * needed on buffers full of bytes, and then call MD5Final, which
- * will fill a supplied 16-byte array with the digest.
- */
-
-/* This code slightly modified to fit into Samba by
- abartlet@samba.org Jun 2001 */
-
-#include "includes.h"
-
-#include "md5.h"
-
-static void MD5Transform(uint32 buf[4], uint32 const in[16]);
-
-/*
- * Note: this code is harmless on little-endian machines.
- */
-static void byteReverse(unsigned char *buf, unsigned longs)
-{
- uint32 t;
- do {
- t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
- ((unsigned) buf[1] << 8 | buf[0]);
- *(uint32 *) buf = t;
- buf += 4;
- } while (--longs);
-}
-
-/*
- * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
- * initialization constants.
- */
-void MD5Init(struct MD5Context *ctx)
-{
- ctx->buf[0] = 0x67452301;
- ctx->buf[1] = 0xefcdab89;
- ctx->buf[2] = 0x98badcfe;
- ctx->buf[3] = 0x10325476;
-
- ctx->bits[0] = 0;
- ctx->bits[1] = 0;
-}
-
-/*
- * Update context to reflect the concatenation of another buffer full
- * of bytes.
- */
-void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
-{
- register uint32 t;
-
- /* Update bitcount */
-
- t = ctx->bits[0];
- if ((ctx->bits[0] = t + ((uint32) len << 3)) < t)
- ctx->bits[1]++; /* Carry from low to high */
- ctx->bits[1] += len >> 29;
-
- t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
-
- /* Handle any leading odd-sized chunks */
-
- if (t) {
- unsigned char *p = (unsigned char *) ctx->in + t;
-
- t = 64 - t;
- if (len < t) {
- memmove(p, buf, len);
- return;
- }
- memmove(p, buf, t);
- byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (uint32 *) ctx->in);
- buf += t;
- len -= t;
- }
- /* Process data in 64-byte chunks */
-
- while (len >= 64) {
- memmove(ctx->in, buf, 64);
- byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (uint32 *) ctx->in);
- buf += 64;
- len -= 64;
- }
-
- /* Handle any remaining bytes of data. */
-
- memmove(ctx->in, buf, len);
-}
-
-/*
- * Final wrapup - pad to 64-byte boundary with the bit pattern
- * 1 0* (64-bit count of bits processed, MSB-first)
- */
-void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
-{
- unsigned int count;
- unsigned char *p;
-
- /* Compute number of bytes mod 64 */
- count = (ctx->bits[0] >> 3) & 0x3F;
-
- /* Set the first char of padding to 0x80. This is safe since there is
- always at least one byte free */
- p = ctx->in + count;
- *p++ = 0x80;
-
- /* Bytes of padding needed to make 64 bytes */
- count = 64 - 1 - count;
-
- /* Pad out to 56 mod 64 */
- if (count < 8) {
- /* Two lots of padding: Pad the first block to 64 bytes */
- memset(p, 0, count);
- byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (uint32 *) ctx->in);
-
- /* Now fill the next block with 56 bytes */
- memset(ctx->in, 0, 56);
- } else {
- /* Pad block to 56 bytes */
- memset(p, 0, count - 8);
- }
- byteReverse(ctx->in, 14);
-
- /* Append length in bits and transform */
- ((uint32 *) ctx->in)[14] = ctx->bits[0];
- ((uint32 *) ctx->in)[15] = ctx->bits[1];
-
- MD5Transform(ctx->buf, (uint32 *) ctx->in);
- byteReverse((unsigned char *) ctx->buf, 4);
- memmove(digest, ctx->buf, 16);
- memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
-}
-
-/* The four core functions - F1 is optimized somewhat */
-
-/* #define F1(x, y, z) (x & y | ~x & z) */
-#define F1(x, y, z) (z ^ (x & (y ^ z)))
-#define F2(x, y, z) F1(z, x, y)
-#define F3(x, y, z) (x ^ y ^ z)
-#define F4(x, y, z) (y ^ (x | ~z))
-
-/* This is the central step in the MD5 algorithm. */
-#define MD5STEP(f, w, x, y, z, data, s) \
- ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
-
-/*
- * The core of the MD5 algorithm, this alters an existing MD5 hash to
- * reflect the addition of 16 longwords of new data. MD5Update blocks
- * the data and converts bytes into longwords for this routine.
- */
-static void MD5Transform(uint32 buf[4], uint32 const in[16])
-{
- register uint32 a, b, c, d;
-
- a = buf[0];
- b = buf[1];
- c = buf[2];
- d = buf[3];
-
- MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
- MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
- MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
- MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
- MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
- MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
- MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
- MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
- MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
- MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
- MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
- MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
- MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
- MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
- MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
- MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
-
- MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
- MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
- MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
- MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
- MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
- MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
- MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
- MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
- MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
- MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
- MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
- MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
- MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
- MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
- MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
- MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
-
- MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
- MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
- MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
- MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
- MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
- MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
- MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
- MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
- MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
- MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
- MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
- MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
- MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
- MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
- MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
- MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
-
- MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
- MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
- MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
- MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
- MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
- MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
- MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
- MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
- MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
- MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
- MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
- MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
- MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
- MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
- MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
- MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
-
- buf[0] += a;
- buf[1] += b;
- buf[2] += c;
- buf[3] += d;
-}
diff --git a/source3/lib/memcache.c b/source3/lib/memcache.c
index e1426bc811..9c892fedfa 100644
--- a/source3/lib/memcache.c
+++ b/source3/lib/memcache.c
@@ -18,7 +18,7 @@
*/
#include "memcache.h"
-#include "rbtree.h"
+#include "../lib/util/rbtree.h"
static struct memcache *global_cache;
diff --git a/source3/lib/messages_local.c b/source3/lib/messages_local.c
index f436afc2ff..9f7f88f783 100644
--- a/source3/lib/messages_local.c
+++ b/source3/lib/messages_local.c
@@ -160,7 +160,7 @@ static NTSTATUS messaging_tdb_fetch(TDB_CONTEXT *msg_tdb,
blob = data_blob_const(data.dptr, data.dsize);
ndr_err = ndr_pull_struct_blob(
- &blob, result, result,
+ &blob, result, NULL, result,
(ndr_pull_flags_fn_t)ndr_pull_messaging_array);
SAFE_FREE(data.dptr);
@@ -203,7 +203,7 @@ static NTSTATUS messaging_tdb_store(TDB_CONTEXT *msg_tdb,
}
ndr_err = ndr_push_struct_blob(
- &blob, mem_ctx, array,
+ &blob, mem_ctx, NULL, array,
(ndr_push_flags_fn_t)ndr_push_messaging_array);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
diff --git a/source3/lib/netapi/examples/Makefile.in b/source3/lib/netapi/examples/Makefile.in
index b1c1e59be7..090bc50dee 100644
--- a/source3/lib/netapi/examples/Makefile.in
+++ b/source3/lib/netapi/examples/Makefile.in
@@ -5,7 +5,7 @@ KRB5LIBS=@KRB5_LIBS@
LDAP_LIBS=@LDAP_LIBS@
LIBS=@LIBS@ -lnetapi -ltdb -ltalloc
DEVELOPER_CFLAGS=@DEVELOPER_CFLAGS@
-FLAGS=-I../ -L../../../bin @CFLAGS@ $(GTK_FLAGS)
+CCFLAGS=-I../ -L../../../bin @CFLAGS@ $(GTK_FLAGS)
CC=@CC@
PICFLAG=@PICFLAG@
LDFLAGS=@PIE_LDFLAGS@ @LDFLAGS@
@@ -14,7 +14,7 @@ NETAPI_LIBS=$(LIBS) $(KRB5LIBS) $(LDAP_LIBS)
CMDLINE_LIBS=$(NETAPI_LIBS) @POPTLIBS@
# Compile a source file.
-COMPILE_CC = $(CC) -I. $(FLAGS) $(PICFLAG) -c $< -o $@
+COMPILE_CC = $(CC) -I. $(CCFLAGS) $(PICFLAG) -c $< -o $@
COMPILE = $(COMPILE_CC)
PROGS = bin/getdc@EXEEXT@ \
@@ -140,187 +140,187 @@ FILEENUM_OBJ = file/file_enum.o $(CMDLINE_OBJ)
bin/getdc@EXEEXT@: $(BINARY_PREREQS) $(GETDC_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(GETDC_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(GETDC_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/dsgetdc@EXEEXT@: $(BINARY_PREREQS) $(DSGETDC_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(DSGETDC_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(DSGETDC_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/getjoinableous@EXEEXT@: $(BINARY_PREREQS) $(GETJOINABLEOUS_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(GETJOINABLEOUS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(GETJOINABLEOUS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/rename_machine@EXEEXT@: $(BINARY_PREREQS) $(RENAMEMACHINE_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(RENAMEMACHINE_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(RENAMEMACHINE_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/netdomjoin@EXEEXT@: $(BINARY_PREREQS) $(NETDOMJOIN_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(NETDOMJOIN_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(NETDOMJOIN_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/netdomjoin-gui@EXEEXT@: $(BINARY_PREREQS) $(NETDOMJOIN_GUI_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) $(GTK_FLAGS) -o $@ $(NETDOMJOIN_GUI_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(GTK_LIBS)
+ @$(CC) $(CCFLAGS) $(GTK_FLAGS) -o $@ $(NETDOMJOIN_GUI_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(GTK_LIBS)
bin/user_add@EXEEXT@: $(BINARY_PREREQS) $(USERADD_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(USERADD_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(USERADD_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/user_del@EXEEXT@: $(BINARY_PREREQS) $(USERDEL_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(USERDEL_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(USERDEL_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/user_enum@EXEEXT@: $(BINARY_PREREQS) $(USERENUM_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(USERENUM_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(USERENUM_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/user_dispinfo@EXEEXT@: $(BINARY_PREREQS) $(USERDISPINFO_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(USERDISPINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(USERDISPINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/user_chgpwd@EXEEXT@: $(BINARY_PREREQS) $(USERCHGPWD_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(USERCHGPWD_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(USERCHGPWD_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/user_getinfo@EXEEXT@: $(BINARY_PREREQS) $(USERGETINFO_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(USERGETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(USERGETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/user_setinfo@EXEEXT@: $(BINARY_PREREQS) $(USERSETINFO_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(USERSETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(USERSETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/user_modalsget@EXEEXT@: $(BINARY_PREREQS) $(USERMODALSGET_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(USERMODALSGET_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(USERMODALSGET_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/user_modalsset@EXEEXT@: $(BINARY_PREREQS) $(USERMODALSSET_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(USERMODALSSET_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(USERMODALSSET_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/user_getgroups@EXEEXT@: $(BINARY_PREREQS) $(USERGETGROUPS_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(USERGETGROUPS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(USERGETGROUPS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/user_setgroups@EXEEXT@: $(BINARY_PREREQS) $(USERSETGROUPS_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(USERSETGROUPS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(USERSETGROUPS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/user_getlocalgroups@EXEEXT@: $(BINARY_PREREQS) $(USERGETLOCALGROUPS_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(USERGETLOCALGROUPS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(USERGETLOCALGROUPS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/group_add@EXEEXT@: $(BINARY_PREREQS) $(GROUPADD_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(GROUPADD_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(GROUPADD_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/group_del@EXEEXT@: $(BINARY_PREREQS) $(GROUPDEL_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(GROUPDEL_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(GROUPDEL_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/group_enum@EXEEXT@: $(BINARY_PREREQS) $(GROUPENUM_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(GROUPENUM_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(GROUPENUM_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/group_setinfo@EXEEXT@: $(BINARY_PREREQS) $(GROUPSETINFO_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(GROUPSETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(GROUPSETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/group_getinfo@EXEEXT@: $(BINARY_PREREQS) $(GROUPGETINFO_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(GROUPGETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(GROUPGETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/group_adduser@EXEEXT@: $(BINARY_PREREQS) $(GROUPADDUSER_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(GROUPADDUSER_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(GROUPADDUSER_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/group_deluser@EXEEXT@: $(BINARY_PREREQS) $(GROUPDELUSER_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(GROUPDELUSER_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(GROUPDELUSER_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/group_getusers@EXEEXT@: $(BINARY_PREREQS) $(GROUPGETUSERS_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(GROUPGETUSERS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(GROUPGETUSERS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/group_setusers@EXEEXT@: $(BINARY_PREREQS) $(GROUPSETUSERS_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(GROUPSETUSERS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(GROUPSETUSERS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/localgroup_add@EXEEXT@: $(BINARY_PREREQS) $(LOCALGROUPADD_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(LOCALGROUPADD_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(LOCALGROUPADD_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/localgroup_del@EXEEXT@: $(BINARY_PREREQS) $(LOCALGROUPDEL_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(LOCALGROUPDEL_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(LOCALGROUPDEL_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/localgroup_getinfo@EXEEXT@: $(BINARY_PREREQS) $(LOCALGROUPGETINFO_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(LOCALGROUPGETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(LOCALGROUPGETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/localgroup_setinfo@EXEEXT@: $(BINARY_PREREQS) $(LOCALGROUPSETINFO_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(LOCALGROUPSETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(LOCALGROUPSETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/localgroup_enum@EXEEXT@: $(BINARY_PREREQS) $(LOCALGROUPENUM_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(LOCALGROUPENUM_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(LOCALGROUPENUM_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/localgroup_addmembers@EXEEXT@: $(BINARY_PREREQS) $(LOCALGROUPADDMEMBERS_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(LOCALGROUPADDMEMBERS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(LOCALGROUPADDMEMBERS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/localgroup_delmembers@EXEEXT@: $(BINARY_PREREQS) $(LOCALGROUPDELMEMBERS_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(LOCALGROUPDELMEMBERS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(LOCALGROUPDELMEMBERS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/localgroup_setmembers@EXEEXT@: $(BINARY_PREREQS) $(LOCALGROUPSETMEMBERS_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(LOCALGROUPSETMEMBERS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(LOCALGROUPSETMEMBERS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/localgroup_getmembers@EXEEXT@: $(BINARY_PREREQS) $(LOCALGROUPGETMEMBERS_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(LOCALGROUPGETMEMBERS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(LOCALGROUPGETMEMBERS_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/remote_tod@EXEEXT@: $(BINARY_PREREQS) $(REMOTETOD_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(REMOTETOD_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(REMOTETOD_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/server_getinfo@EXEEXT@: $(BINARY_PREREQS) $(SERVERGETINFO_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(SERVERGETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(SERVERGETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/share_add@EXEEXT@: $(BINARY_PREREQS) $(SHAREADD_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(SHAREADD_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(SHAREADD_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/share_del@EXEEXT@: $(BINARY_PREREQS) $(SHAREDEL_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(SHAREDEL_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(SHAREDEL_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/share_enum@EXEEXT@: $(BINARY_PREREQS) $(SHAREENUM_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(SHAREENUM_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(SHAREENUM_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/share_getinfo@EXEEXT@: $(BINARY_PREREQS) $(SHAREGETINFO_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(SHAREGETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(SHAREGETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/share_setinfo@EXEEXT@: $(BINARY_PREREQS) $(SHARESETINFO_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(SHARESETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(SHARESETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/file_close@EXEEXT@: $(BINARY_PREREQS) $(FILECLOSE_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(FILECLOSE_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(FILECLOSE_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/file_getinfo@EXEEXT@: $(BINARY_PREREQS) $(FILEGETINFO_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(FILEGETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(FILEGETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
bin/file_enum@EXEEXT@: $(BINARY_PREREQS) $(FILEENUM_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(FILEENUM_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(FILEENUM_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
clean:
-rm -f $(PROGS)
diff --git a/source3/lib/netapi/examples/user/user_modalsset.c b/source3/lib/netapi/examples/user/user_modalsset.c
index 57e1ef70ea..c6958a9012 100644
--- a/source3/lib/netapi/examples/user/user_modalsset.c
+++ b/source3/lib/netapi/examples/user/user_modalsset.c
@@ -95,6 +95,7 @@ int main(int argc, const char **argv)
case 1:
case 2:
case 3:
+ break;
case 1001:
u1001.usrmod1001_min_passwd_len = 0;
buffer = (uint8_t *)&u1001;
diff --git a/source3/lib/netapi/file.c b/source3/lib/netapi/file.c
index 036af32f38..0d66be0eb1 100644
--- a/source3/lib/netapi/file.c
+++ b/source3/lib/netapi/file.c
@@ -47,7 +47,8 @@ WERROR NetFileClose_r(struct libnetapi_ctx *ctx,
r->in.server_name,
r->in.fileid,
&werr);
- if (!W_ERROR_IS_OK(werr)) {
+ if (!NT_STATUS_IS_OK(status)) {
+ werr = ntstatus_to_werror(status);
goto done;
}
diff --git a/source3/lib/netapi/getdc.c b/source3/lib/netapi/getdc.c
index 07a6544af1..76c0d0be2a 100644
--- a/source3/lib/netapi/getdc.c
+++ b/source3/lib/netapi/getdc.c
@@ -58,6 +58,10 @@ WERROR NetGetDCName_r(struct libnetapi_ctx *ctx,
r->in.domain_name,
(const char **)r->out.buffer,
&werr);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ werr = ntstatus_to_werror(status);
+ }
done:
return werr;
diff --git a/source3/lib/netapi/group.c b/source3/lib/netapi/group.c
index c3fccb4840..8dba4b8838 100644
--- a/source3/lib/netapi/group.c
+++ b/source3/lib/netapi/group.c
@@ -1224,7 +1224,7 @@ WERROR NetGroupEnum_r(struct libnetapi_ctx *ctx,
}
if (r->out.total_entries) {
- *r->out.total_entries = domain_info->info2.num_groups;
+ *r->out.total_entries = domain_info->general.num_groups;
}
status = rpccli_samr_QueryDisplayInfo2(pipe_cli,
diff --git a/source3/lib/netapi/localgroup.c b/source3/lib/netapi/localgroup.c
index 25a3427bc1..5e738e1262 100644
--- a/source3/lib/netapi/localgroup.c
+++ b/source3/lib/netapi/localgroup.c
@@ -822,7 +822,7 @@ WERROR NetLocalGroupEnum_r(struct libnetapi_ctx *ctx,
}
if (r->out.total_entries) {
- *r->out.total_entries += builtin_info->info2.num_aliases;
+ *r->out.total_entries += builtin_info->general.num_aliases;
}
status = rpccli_samr_QueryDomainInfo(pipe_cli, ctx,
@@ -835,7 +835,7 @@ WERROR NetLocalGroupEnum_r(struct libnetapi_ctx *ctx,
}
if (r->out.total_entries) {
- *r->out.total_entries += domain_info->info2.num_aliases;
+ *r->out.total_entries += domain_info->general.num_aliases;
}
status = rpccli_samr_EnumDomainAliases(pipe_cli, ctx,
diff --git a/source3/lib/netapi/share.c b/source3/lib/netapi/share.c
index 1d0e1810f1..e6aed36064 100644
--- a/source3/lib/netapi/share.c
+++ b/source3/lib/netapi/share.c
@@ -271,7 +271,8 @@ WERROR NetShareDel_r(struct libnetapi_ctx *ctx,
r->in.net_name,
r->in.reserved,
&werr);
- if (!W_ERROR_IS_OK(werr)) {
+ if (!NT_STATUS_IS_OK(status)) {
+ werr = ntstatus_to_werror(status);
goto done;
}
diff --git a/source3/lib/netapi/tests/Makefile.in b/source3/lib/netapi/tests/Makefile.in
index d3f0663908..659f82c9d8 100644
--- a/source3/lib/netapi/tests/Makefile.in
+++ b/source3/lib/netapi/tests/Makefile.in
@@ -2,7 +2,7 @@ KRB5LIBS=@KRB5_LIBS@
LDAP_LIBS=@LDAP_LIBS@
LIBS=@LIBS@ -lnetapi -ltdb -ltalloc
DEVELOPER_CFLAGS=@DEVELOPER_CFLAGS@
-FLAGS=-I../ -L../../../bin @CFLAGS@ $(GTK_FLAGS)
+CCFLAGS=-I../ -L../../../bin @CFLAGS@ $(GTK_FLAGS)
CC=@CC@
PICFLAG=@PICFLAG@
LDFLAGS=@PIE_LDFLAGS@ @LDFLAGS@
@@ -11,7 +11,7 @@ NETAPI_LIBS=$(LIBS) $(KRB5LIBS) $(LDAP_LIBS)
CMDLINE_LIBS=$(NETAPI_LIBS) @POPTLIBS@
# Compile a source file.
-COMPILE_CC = $(CC) -I. $(FLAGS) $(PICFLAG) -c $< -o $@
+COMPILE_CC = $(CC) -I. $(CCFLAGS) $(PICFLAG) -c $< -o $@
COMPILE = $(COMPILE_CC)
PROGS = bin/netapitest@EXEEXT@
@@ -44,11 +44,11 @@ bin/.dummy:
CMDLINE_OBJ = common.o
NETAPIBUFFER_OBJ = netapibuffer.o
-NETAPITEST_OBJ = netapitest.o netlocalgroup.o netuser.o netgroup.o netdisplay.o netshare.o $(CMDLINE_OBJ)
+NETAPITEST_OBJ = netapitest.o netlocalgroup.o netuser.o netgroup.o netdisplay.o netshare.o netfile.o $(CMDLINE_OBJ)
bin/netapitest@EXEEXT@: $(BINARY_PREREQS) $(NETAPITEST_OBJ)
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(NETAPITEST_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+ @$(CC) $(CCFLAGS) -o $@ $(NETAPITEST_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
clean:
-rm -f $(PROGS)
diff --git a/source3/lib/netapi/tests/common.h b/source3/lib/netapi/tests/common.h
index 5a320321ba..9320840909 100644
--- a/source3/lib/netapi/tests/common.h
+++ b/source3/lib/netapi/tests/common.h
@@ -41,6 +41,8 @@ NET_API_STATUS netapitest_display(struct libnetapi_ctx *ctx,
const char *hostname);
NET_API_STATUS netapitest_share(struct libnetapi_ctx *ctx,
const char *hostname);
+NET_API_STATUS netapitest_file(struct libnetapi_ctx *ctx,
+ const char *hostname);
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
diff --git a/source3/lib/netapi/tests/netapitest.c b/source3/lib/netapi/tests/netapitest.c
index 87144020f5..4a38f721d8 100644
--- a/source3/lib/netapi/tests/netapitest.c
+++ b/source3/lib/netapi/tests/netapitest.c
@@ -84,6 +84,11 @@ int main(int argc, const char **argv)
goto out;
}
+ status = netapitest_file(ctx, hostname);
+ if (status) {
+ goto out;
+ }
+
out:
if (status != 0) {
printf("testsuite failed with: %s\n",
diff --git a/source3/lib/netapi/tests/netfile.c b/source3/lib/netapi/tests/netfile.c
new file mode 100644
index 0000000000..bee3c2ed5e
--- /dev/null
+++ b/source3/lib/netapi/tests/netfile.c
@@ -0,0 +1,145 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * NetFile testsuite
+ * 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 <sys/types.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <netapi.h>
+
+#include "common.h"
+
+static NET_API_STATUS test_netfileenum(const char *hostname,
+ uint32_t level)
+{
+ NET_API_STATUS status;
+ uint32_t entries_read = 0;
+ uint32_t total_entries = 0;
+ uint32_t resume_handle = 0;
+ uint8_t *buffer = NULL;
+ int i;
+
+ struct FILE_INFO_2 *i2 = NULL;
+ struct FILE_INFO_3 *i3 = NULL;
+
+ printf("testing NetFileEnum level %d\n", level);
+
+ do {
+ status = NetFileEnum(hostname,
+ NULL,
+ NULL,
+ level,
+ &buffer,
+ (uint32_t)-1,
+ &entries_read,
+ &total_entries,
+ &resume_handle);
+ if (status == 0 || status == ERROR_MORE_DATA) {
+ switch (level) {
+ case 2:
+ i2 = (struct FILE_INFO_2 *)buffer;
+ break;
+ case 3:
+ i3 = (struct FILE_INFO_3 *)buffer;
+ break;
+ default:
+ return -1;
+ }
+
+ for (i=0; i<entries_read; i++) {
+
+ switch (level) {
+ case 2:
+ case 3:
+ break;
+ default:
+ break;
+ }
+
+ switch (level) {
+ case 2:
+ i2++;
+ break;
+ case 3:
+ i3++;
+ break;
+ }
+ }
+ NetApiBufferFree(buffer);
+ }
+ } while (status == ERROR_MORE_DATA);
+
+ if (status) {
+ return status;
+ }
+
+ return 0;
+}
+
+NET_API_STATUS netapitest_file(struct libnetapi_ctx *ctx,
+ const char *hostname)
+{
+ NET_API_STATUS status = 0;
+ uint32_t enum_levels[] = { 2, 3 };
+ int i;
+
+ printf("NetFile tests\n");
+
+ /* test enum */
+
+ for (i=0; i<ARRAY_SIZE(enum_levels); i++) {
+
+ status = test_netfileenum(hostname, enum_levels[i]);
+ if (status) {
+ NETAPI_STATUS(ctx, status, "NetFileEnum");
+ goto out;
+ }
+ }
+
+ /* basic queries */
+#if 0
+ {
+ uint32_t levels[] = { 2, 3 };
+ for (i=0; i<ARRAY_SIZE(levels); i++) {
+ uint8_t *buffer = NULL;
+
+ printf("testing NetFileGetInfo level %d\n", levels[i]);
+
+ status = NetFileGetInfo(hostname, fid, levels[i], &buffer);
+ if (status && status != 124) {
+ NETAPI_STATUS(ctx, status, "NetFileGetInfo");
+ goto out;
+ }
+ }
+ }
+#endif
+
+ status = 0;
+
+ printf("NetFile tests succeeded\n");
+ out:
+ if (status != 0) {
+ printf("NetFile testsuite failed with: %s\n",
+ libnetapi_get_error_string(ctx, status));
+ }
+
+ return status;
+}
diff --git a/source3/lib/netapi/tests/netgroup.c b/source3/lib/netapi/tests/netgroup.c
index a89a772ce4..51a21b3bf5 100644
--- a/source3/lib/netapi/tests/netgroup.c
+++ b/source3/lib/netapi/tests/netgroup.c
@@ -36,14 +36,14 @@ static NET_API_STATUS test_netgroupenum(const char *hostname,
uint32_t total_entries = 0;
uint32_t resume_handle = 0;
int found_group = 0;
- const char *current_name;
+ const char *current_name = NULL;
uint8_t *buffer = NULL;
int i;
- struct GROUP_INFO_0 *info0;
- struct GROUP_INFO_1 *info1;
- struct GROUP_INFO_2 *info2;
- struct GROUP_INFO_3 *info3;
+ struct GROUP_INFO_0 *info0 = NULL;
+ struct GROUP_INFO_1 *info1 = NULL;
+ struct GROUP_INFO_2 *info2 = NULL;
+ struct GROUP_INFO_3 *info3 = NULL;
printf("testing NetGroupEnum level %d\n", level);
diff --git a/source3/lib/netapi/tests/netlocalgroup.c b/source3/lib/netapi/tests/netlocalgroup.c
index 0d82059356..76c59c814b 100644
--- a/source3/lib/netapi/tests/netlocalgroup.c
+++ b/source3/lib/netapi/tests/netlocalgroup.c
@@ -36,12 +36,12 @@ static NET_API_STATUS test_netlocalgroupenum(const char *hostname,
uint32_t total_entries = 0;
uint32_t resume_handle = 0;
int found_group = 0;
- const char *current_name;
+ const char *current_name = NULL;
uint8_t *buffer = NULL;
int i;
- struct LOCALGROUP_INFO_0 *info0;
- struct LOCALGROUP_INFO_1 *info1;
+ struct LOCALGROUP_INFO_0 *info0 = NULL;
+ struct LOCALGROUP_INFO_1 *info1 = NULL;
printf("testing NetLocalGroupEnum level %d\n", level);
diff --git a/source3/lib/netapi/tests/netshare.c b/source3/lib/netapi/tests/netshare.c
index 9446c307b3..84af9e0827 100644
--- a/source3/lib/netapi/tests/netshare.c
+++ b/source3/lib/netapi/tests/netshare.c
@@ -36,13 +36,13 @@ static NET_API_STATUS test_netshareenum(const char *hostname,
uint32_t total_entries = 0;
uint32_t resume_handle = 0;
int found_share = 0;
- const char *current_name;
+ const char *current_name = NULL;
uint8_t *buffer = NULL;
int i;
- struct SHARE_INFO_0 *i0;
- struct SHARE_INFO_1 *i1;
- struct SHARE_INFO_2 *i2;
+ struct SHARE_INFO_0 *i0 = NULL;
+ struct SHARE_INFO_1 *i1 = NULL;
+ struct SHARE_INFO_2 *i2 = NULL;
printf("testing NetShareEnum level %d\n", level);
diff --git a/source3/lib/netapi/tests/netuser.c b/source3/lib/netapi/tests/netuser.c
index f1622e45c4..7bbc5ca347 100644
--- a/source3/lib/netapi/tests/netuser.c
+++ b/source3/lib/netapi/tests/netuser.c
@@ -35,20 +35,20 @@ static NET_API_STATUS test_netuserenum(const char *hostname,
uint32_t entries_read = 0;
uint32_t total_entries = 0;
uint32_t resume_handle = 0;
- const char *current_name;
+ const char *current_name = NULL;
int found_user = 0;
uint8_t *buffer = NULL;
int i;
- struct USER_INFO_0 *info0;
- struct USER_INFO_1 *info1;
- struct USER_INFO_2 *info2;
- struct USER_INFO_3 *info3;
- struct USER_INFO_4 *info4;
- struct USER_INFO_10 *info10;
- struct USER_INFO_11 *info11;
- struct USER_INFO_20 *info20;
- struct USER_INFO_23 *info23;
+ struct USER_INFO_0 *info0 = NULL;
+ struct USER_INFO_1 *info1 = NULL;
+ struct USER_INFO_2 *info2 = NULL;
+ struct USER_INFO_3 *info3 = NULL;
+ struct USER_INFO_4 *info4 = NULL;
+ struct USER_INFO_10 *info10 = NULL;
+ struct USER_INFO_11 *info11 = NULL;
+ struct USER_INFO_20 *info20 = NULL;
+ struct USER_INFO_23 *info23 = NULL;
printf("testing NetUserEnum level %d\n", level);
diff --git a/source3/lib/netapi/user.c b/source3/lib/netapi/user.c
index 7d0c47f331..fcb87b77be 100644
--- a/source3/lib/netapi/user.c
+++ b/source3/lib/netapi/user.c
@@ -108,18 +108,18 @@ static void convert_USER_INFO_X_to_samr_user_info21(struct USER_INFO_X *infoX,
infoX->usriX_workstations,
infoX->usriX_usr_comment,
&zero_parameters,
- 0,
+ infoX->usriX_user_id,
infoX->usriX_primary_group_id,
infoX->usriX_flags,
fields_present,
zero_logon_hours,
- 0,
- 0,
+ infoX->usriX_bad_pw_count,
+ infoX->usriX_num_logons,
infoX->usriX_country_code,
+ infoX->usriX_code_page,
0,
0,
- 0,
- 0);
+ infoX->usriX_password_expired);
}
/****************************************************************
@@ -132,6 +132,7 @@ static NTSTATUS construct_USER_INFO_X(uint32_t level,
struct USER_INFO_0 *u0 = NULL;
struct USER_INFO_1 *u1 = NULL;
struct USER_INFO_2 *u2 = NULL;
+ struct USER_INFO_3 *u3 = NULL;
struct USER_INFO_1003 *u1003 = NULL;
struct USER_INFO_1006 *u1006 = NULL;
struct USER_INFO_1007 *u1007 = NULL;
@@ -193,6 +194,37 @@ static NTSTATUS construct_USER_INFO_X(uint32_t level,
uX->usriX_country_code = u2->usri2_country_code;
uX->usriX_code_page = u2->usri2_code_page;
break;
+ case 3:
+ u3 = (struct USER_INFO_3 *)buffer;
+ uX->usriX_name = u3->usri3_name;
+ uX->usriX_password_age = u3->usri3_password_age;
+ uX->usriX_priv = u3->usri3_priv;
+ uX->usriX_home_dir = u3->usri3_home_dir;
+ uX->usriX_comment = u3->usri3_comment;
+ uX->usriX_flags = u3->usri3_flags;
+ uX->usriX_script_path = u3->usri3_script_path;
+ uX->usriX_auth_flags = u3->usri3_auth_flags;
+ uX->usriX_full_name = u3->usri3_full_name;
+ uX->usriX_usr_comment = u3->usri3_usr_comment;
+ uX->usriX_parms = u3->usri3_parms;
+ uX->usriX_workstations = u3->usri3_workstations;
+ uX->usriX_last_logon = u3->usri3_last_logon;
+ uX->usriX_last_logoff = u3->usri3_last_logoff;
+ uX->usriX_acct_expires = u3->usri3_acct_expires;
+ uX->usriX_max_storage = u3->usri3_max_storage;
+ uX->usriX_units_per_week= u3->usri3_units_per_week;
+ uX->usriX_logon_hours = u3->usri3_logon_hours;
+ uX->usriX_bad_pw_count = u3->usri3_bad_pw_count;
+ uX->usriX_num_logons = u3->usri3_num_logons;
+ uX->usriX_logon_server = u3->usri3_logon_server;
+ uX->usriX_country_code = u3->usri3_country_code;
+ uX->usriX_code_page = u3->usri3_code_page;
+ uX->usriX_user_id = u3->usri3_user_id;
+ uX->usriX_primary_group_id = u3->usri3_primary_group_id;
+ uX->usriX_profile = u3->usri3_profile;
+ uX->usriX_home_dir_drive = u3->usri3_home_dir_drive;
+ uX->usriX_password_expired = u3->usri3_password_expired;
+ break;
case 1003:
u1003 = (struct USER_INFO_1003 *)buffer;
uX->usriX_password = u1003->usri1003_password;
@@ -237,7 +269,6 @@ static NTSTATUS construct_USER_INFO_X(uint32_t level,
u1053 = (struct USER_INFO_1053 *)buffer;
uX->usriX_home_dir_drive = u1053->usri1053_home_dir_drive;
break;
- case 3:
case 4:
default:
return NT_STATUS_INVALID_INFO_CLASS;
@@ -1753,9 +1784,17 @@ WERROR NetUserSetInfo_r(struct libnetapi_ctx *ctx,
user_mask = SAMR_USER_ACCESS_SET_ATTRIBUTES |
SAMR_USER_ACCESS_GET_GROUPS;
break;
+ case 3:
+ user_mask = STD_RIGHT_READ_CONTROL_ACCESS |
+ STD_RIGHT_WRITE_DAC_ACCESS |
+ SAMR_USER_ACCESS_GET_GROUPS |
+ SAMR_USER_ACCESS_SET_PASSWORD |
+ SAMR_USER_ACCESS_SET_ATTRIBUTES |
+ SAMR_USER_ACCESS_GET_ATTRIBUTES |
+ SAMR_USER_ACCESS_SET_LOC_COM;
+ break;
case 1:
case 2:
- case 3:
case 4:
case 21:
case 22:
diff --git a/source3/lib/nss_wrapper/config.m4 b/source3/lib/nss_wrapper/config.m4
deleted file mode 100644
index 58e94f9830..0000000000
--- a/source3/lib/nss_wrapper/config.m4
+++ /dev/null
@@ -1,19 +0,0 @@
-AC_ARG_ENABLE(nss-wrapper,
-[ --enable-nss-wrapper Turn on nss wrapper library (default=no)])
-
-HAVE_NSS_WRAPPER=no
-
-if eval "test x$developer = xyes"; then
- enable_nss_wrapper=yes
-fi
-
-if eval "test x$enable_nss_wrapper = xyes"; then
- AC_DEFINE(NSS_WRAPPER,1,[Use nss wrapper library])
- HAVE_NSS_WRAPPER=yes
-
- # this is only used for samba3
- NSS_WRAPPER_OBJS="lib/nss_wrapper/nss_wrapper.o"
-fi
-
-AC_SUBST(HAVE_NSS_WRAPPER)
-AC_SUBST(NSS_WRAPPER_OBJS)
diff --git a/source3/lib/nss_wrapper/config.mk b/source3/lib/nss_wrapper/config.mk
deleted file mode 100644
index 9751d2bf73..0000000000
--- a/source3/lib/nss_wrapper/config.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-##############################
-# Start SUBSYSTEM NSS_WRAPPER
-[LIBRARY::NSS_WRAPPER]
-VERSION = 0.0.1
-SO_VERSION = 0
-DESCRIPTION = Wrapper library for testing nss calls without being root
-PUBLIC_HEADERS = nss_wrapper.h
-OBJ_FILES = nss_wrapper.o
-# End SUBSYSTEM NSS_WRAPPER
-##############################
diff --git a/source3/lib/nss_wrapper/nss_wrapper.c b/source3/lib/nss_wrapper/nss_wrapper.c
deleted file mode 100644
index 5d443facd3..0000000000
--- a/source3/lib/nss_wrapper/nss_wrapper.c
+++ /dev/null
@@ -1,1130 +0,0 @@
-/*
- * Copyright (C) Stefan Metzmacher 2007 <metze@samba.org>
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifdef _SAMBA_BUILD_
-
-#define NSS_WRAPPER_NOT_REPLACE
-#include "lib/replace/replace.h"
-#include "system/passwd.h"
-#include "system/filesys.h"
-
-#else /* _SAMBA_BUILD_ */
-
-#error nss_wrapper_only_supported_in_samba_yet
-
-#endif
-
-#ifndef _PUBLIC_
-#define _PUBLIC_
-#endif
-
-/* not all systems have _r functions... */
-#ifndef HAVE_GETPWNAM_R
-#define getpwnam_r(name, pwdst, buf, buflen, pwdstp) ENOSYS
-#endif
-#ifndef HAVE_GETPWUID_R
-#define getpwuid_r(uid, pwdst, buf, buflen, pwdstp) ENOSYS
-#endif
-#ifndef HAVE_GETPWENT_R
-#define getpwent_r(pwdst, buf, buflen, pwdstp) ENOSYS
-#endif
-#ifndef HAVE_GETGRNAM_R
-#define getgrnam_r(name, grdst, buf, buflen, grdstp) ENOSYS
-#endif
-#ifndef HAVE_GETGRUID_R
-#define getgrgid_r(uid, grdst, buf, buflen, grdstp) ENOSYS
-#endif
-#ifndef HAVE_GETGRENT_R
-#define getgrent_r(grdst, buf, buflen, grdstp) ENOSYS
-#endif
-
-/* LD_PRELOAD doesn't work yet, so REWRITE_CALLS is all we support
- * for now */
-#define REWRITE_CALLS
-
-#ifdef REWRITE_CALLS
-
-#define real_getpwnam getpwnam
-#define real_getpwnam_r getpwnam_r
-#define real_getpwuid getpwuid
-#define real_getpwuid_r getpwuid_r
-
-#define real_setpwent setpwent
-#define real_getpwent getpwent
-#define real_getpwent_r getpwent_r
-#define real_endpwent endpwent
-
-/*
-#define real_getgrlst getgrlst
-#define real_getgrlst_r getgrlst_r
-#define real_initgroups_dyn initgroups_dyn
-*/
-#define real_initgroups initgroups
-
-#define real_getgrnam getgrnam
-#define real_getgrnam_r getgrnam_r
-#define real_getgrgid getgrgid
-#define real_getgrgid_r getgrgid_r
-
-#define real_setgrent setgrent
-#define real_getgrent getgrent
-#define real_getgrent_r getgrent_r
-#define real_endgrent endgrent
-
-#endif
-
-#if 0
-# ifdef DEBUG
-# define NWRAP_ERROR(args) DEBUG(0, args)
-# else
-# define NWRAP_ERROR(args) printf args
-# endif
-#else
-#define NWRAP_ERROR(args)
-#endif
-
-#if 0
-# ifdef DEBUG
-# define NWRAP_DEBUG(args) DEBUG(0, args)
-# else
-# define NWRAP_DEBUG(args) printf args
-# endif
-#else
-#define NWRAP_DEBUG(args)
-#endif
-
-#if 0
-# ifdef DEBUG
-# define NWRAP_VERBOSE(args) DEBUG(0, args)
-# else
-# define NWRAP_VERBOSE(args) printf args
-# endif
-#else
-#define NWRAP_VERBOSE(args)
-#endif
-
-struct nwrap_cache {
- const char *path;
- int fd;
- struct stat st;
- uint8_t *buf;
- void *private_data;
- bool (*parse_line)(struct nwrap_cache *, char *line);
- void (*unload)(struct nwrap_cache *);
-};
-
-struct nwrap_pw {
- struct nwrap_cache *cache;
-
- struct passwd *list;
- int num;
- int idx;
-};
-
-struct nwrap_cache __nwrap_cache_pw;
-struct nwrap_pw nwrap_pw_global;
-
-static bool nwrap_pw_parse_line(struct nwrap_cache *nwrap, char *line);
-static void nwrap_pw_unload(struct nwrap_cache *nwrap);
-
-struct nwrap_gr {
- struct nwrap_cache *cache;
-
- struct group *list;
- int num;
- int idx;
-};
-
-struct nwrap_cache __nwrap_cache_gr;
-struct nwrap_gr nwrap_gr_global;
-
-static bool nwrap_gr_parse_line(struct nwrap_cache *nwrap, char *line);
-static void nwrap_gr_unload(struct nwrap_cache *nwrap);
-
-static void nwrap_init(void)
-{
- static bool initialized;
-
- if (initialized) return;
- initialized = true;
-
- nwrap_pw_global.cache = &__nwrap_cache_pw;
-
- nwrap_pw_global.cache->path = getenv("NSS_WRAPPER_PASSWD");
- nwrap_pw_global.cache->fd = -1;
- nwrap_pw_global.cache->private_data = &nwrap_pw_global;
- nwrap_pw_global.cache->parse_line = nwrap_pw_parse_line;
- nwrap_pw_global.cache->unload = nwrap_pw_unload;
-
- nwrap_gr_global.cache = &__nwrap_cache_gr;
-
- nwrap_gr_global.cache->path = getenv("NSS_WRAPPER_GROUP");
- nwrap_gr_global.cache->fd = -1;
- nwrap_gr_global.cache->private_data = &nwrap_gr_global;
- nwrap_gr_global.cache->parse_line = nwrap_gr_parse_line;
- nwrap_gr_global.cache->unload = nwrap_gr_unload;
-}
-
-static bool nwrap_enabled(void)
-{
- nwrap_init();
-
- if (!nwrap_pw_global.cache->path) {
- return false;
- }
- if (nwrap_pw_global.cache->path[0] == '\0') {
- return false;
- }
- if (!nwrap_gr_global.cache->path) {
- return false;
- }
- if (nwrap_gr_global.cache->path[0] == '\0') {
- return false;
- }
-
- return true;
-}
-
-static bool nwrap_parse_file(struct nwrap_cache *nwrap)
-{
- int ret;
- uint8_t *buf = NULL;
- char *nline;
-
- if (nwrap->st.st_size == 0) {
- NWRAP_DEBUG(("%s: size == 0\n",
- __location__));
- goto done;
- }
-
- if (nwrap->st.st_size > INT32_MAX) {
- NWRAP_ERROR(("%s: size[%u] larger than INT32_MAX\n",
- __location__, (unsigned)nwrap->st.st_size));
- goto failed;
- }
-
- ret = lseek(nwrap->fd, 0, SEEK_SET);
- if (ret != 0) {
- NWRAP_ERROR(("%s: lseek - %d\n",__location__,ret));
- goto failed;
- }
-
- buf = (uint8_t *)malloc(nwrap->st.st_size + 1);
- if (!buf) {
- NWRAP_ERROR(("%s: malloc failed\n",__location__));
- goto failed;
- }
-
- ret = read(nwrap->fd, buf, nwrap->st.st_size);
- if (ret != nwrap->st.st_size) {
- NWRAP_ERROR(("%s: read(%u) gave %d\n",
- __location__, (unsigned)nwrap->st.st_size, ret));
- goto failed;
- }
-
- buf[nwrap->st.st_size] = '\0';
-
- nline = (char *)buf;
- while (nline && nline[0]) {
- char *line;
- char *e;
- bool ok;
-
- line = nline;
- nline = NULL;
-
- e = strchr(line, '\n');
- if (e) {
- e[0] = '\0';
- e++;
- if (e[0] == '\r') {
- e[0] = '\0';
- e++;
- }
- nline = e;
- }
-
- NWRAP_VERBOSE(("%s:'%s'\n",__location__, line));
-
- if (strlen(line) == 0) {
- continue;
- }
-
- ok = nwrap->parse_line(nwrap, line);
- if (!ok) {
- goto failed;
- }
- }
-
-done:
- nwrap->buf = buf;
- return true;
-
-failed:
- if (buf) free(buf);
- return false;
-}
-
-static void nwrap_cache_unload(struct nwrap_cache *nwrap)
-{
- nwrap->unload(nwrap);
-
- if (nwrap->buf) free(nwrap->buf);
-
- nwrap->buf = NULL;
-}
-
-static void nwrap_cache_reload(struct nwrap_cache *nwrap)
-{
- struct stat st;
- int ret;
- bool ok;
- bool retried = false;
-
-reopen:
- if (nwrap->fd < 0) {
- nwrap->fd = open(nwrap->path, O_RDONLY);
- if (nwrap->fd < 0) {
- NWRAP_ERROR(("%s: unable to open '%s' readonly %d:%s\n",
- __location__,
- nwrap->path, nwrap->fd,
- strerror(errno)));
- return;
- }
- NWRAP_VERBOSE(("%s: open '%s'\n", __location__, nwrap->path));
- }
-
- ret = fstat(nwrap->fd, &st);
- if (ret != 0) {
- NWRAP_ERROR(("%s: fstat(%s) - %d:%s\n",
- __location__,
- nwrap->path,
- ret, strerror(errno)));
- return;
- }
-
- if (retried == false && st.st_nlink == 0) {
- /* maybe someone has replaced the file... */
- NWRAP_DEBUG(("%s: st_nlink == 0, reopen %s\n",
- __location__, nwrap->path));
- retried = true;
- memset(&nwrap->st, 0, sizeof(nwrap->st));
- close(nwrap->fd);
- nwrap->fd = -1;
- goto reopen;
- }
-
- if (st.st_mtime == nwrap->st.st_mtime) {
- NWRAP_VERBOSE(("%s: st_mtime[%u] hasn't changed, skip reload\n",
- __location__, (unsigned)st.st_mtime));
- return;
- }
- NWRAP_DEBUG(("%s: st_mtime has changed [%u] => [%u], start reload\n",
- __location__, (unsigned)st.st_mtime,
- (unsigned)nwrap->st.st_mtime));
-
- nwrap->st = st;
-
- nwrap_cache_unload(nwrap);
-
- ok = nwrap_parse_file(nwrap);
- if (!ok) {
- NWRAP_ERROR(("%s: failed to reload %s\n",
- __location__, nwrap->path));
- nwrap_cache_unload(nwrap);
- }
- NWRAP_DEBUG(("%s: reloaded %s\n",
- __location__, nwrap->path));
-}
-
-/*
- * the caller has to call nwrap_unload() on failure
- */
-static bool nwrap_pw_parse_line(struct nwrap_cache *nwrap, char *line)
-{
- struct nwrap_pw *nwrap_pw;
- char *c;
- char *p;
- char *e;
- struct passwd *pw;
- size_t list_size;
-
- nwrap_pw = (struct nwrap_pw *)nwrap->private_data;
-
- list_size = sizeof(*nwrap_pw->list) * (nwrap_pw->num+1);
- pw = (struct passwd *)realloc(nwrap_pw->list, list_size);
- if (!pw) {
- NWRAP_ERROR(("%s:realloc(%u) failed\n",
- __location__, list_size));
- return false;
- }
- nwrap_pw->list = pw;
-
- pw = &nwrap_pw->list[nwrap_pw->num];
-
- c = line;
-
- /* name */
- p = strchr(c, ':');
- if (!p) {
- NWRAP_ERROR(("%s:invalid line[%s]: '%s'\n",
- __location__, line, c));
- return false;
- }
- *p = '\0';
- p++;
- pw->pw_name = c;
- c = p;
-
- NWRAP_VERBOSE(("name[%s]\n", pw->pw_name));
-
- /* password */
- p = strchr(c, ':');
- if (!p) {
- NWRAP_ERROR(("%s:invalid line[%s]: '%s'\n",
- __location__, line, c));
- return false;
- }
- *p = '\0';
- p++;
- pw->pw_passwd = c;
- c = p;
-
- NWRAP_VERBOSE(("password[%s]\n", pw->pw_passwd));
-
- /* uid */
- p = strchr(c, ':');
- if (!p) {
- NWRAP_ERROR(("%s:invalid line[%s]: '%s'\n",
- __location__, line, c));
- return false;
- }
- *p = '\0';
- p++;
- e = NULL;
- pw->pw_uid = (uid_t)strtoul(c, &e, 10);
- if (c == e) {
- NWRAP_ERROR(("%s:invalid line[%s]: '%s' - %s\n",
- __location__, line, c, strerror(errno)));
- return false;
- }
- if (e == NULL) {
- NWRAP_ERROR(("%s:invalid line[%s]: '%s' - %s\n",
- __location__, line, c, strerror(errno)));
- return false;
- }
- if (e[0] != '\0') {
- NWRAP_ERROR(("%s:invalid line[%s]: '%s' - %s\n",
- __location__, line, c, strerror(errno)));
- return false;
- }
- c = p;
-
- NWRAP_VERBOSE(("uid[%u]\n", pw->pw_uid));
-
- /* gid */
- p = strchr(c, ':');
- if (!p) {
- NWRAP_ERROR(("%s:invalid line[%s]: '%s'\n",
- __location__, line, c));
- return false;
- }
- *p = '\0';
- p++;
- e = NULL;
- pw->pw_gid = (gid_t)strtoul(c, &e, 10);
- if (c == e) {
- NWRAP_ERROR(("%s:invalid line[%s]: '%s' - %s\n",
- __location__, line, c, strerror(errno)));
- return false;
- }
- if (e == NULL) {
- NWRAP_ERROR(("%s:invalid line[%s]: '%s' - %s\n",
- __location__, line, c, strerror(errno)));
- return false;
- }
- if (e[0] != '\0') {
- NWRAP_ERROR(("%s:invalid line[%s]: '%s' - %s\n",
- __location__, line, c, strerror(errno)));
- return false;
- }
- c = p;
-
- NWRAP_VERBOSE(("gid[%u]\n", pw->pw_gid));
-
- /* gecos */
- p = strchr(c, ':');
- if (!p) {
- NWRAP_ERROR(("%s:invalid line[%s]: '%s'\n",
- __location__, line, c));
- return false;
- }
- *p = '\0';
- p++;
- pw->pw_gecos = c;
- c = p;
-
- NWRAP_VERBOSE(("gecos[%s]\n", pw->pw_gecos));
-
- /* dir */
- p = strchr(c, ':');
- if (!p) {
- NWRAP_ERROR(("%s:'%s'\n",__location__,c));
- return false;
- }
- *p = '\0';
- p++;
- pw->pw_dir = c;
- c = p;
-
- NWRAP_VERBOSE(("dir[%s]\n", pw->pw_dir));
-
- /* shell */
- pw->pw_shell = c;
- NWRAP_VERBOSE(("shell[%s]\n", pw->pw_shell));
-
- NWRAP_DEBUG(("add user[%s:%s:%u:%u:%s:%s:%s]\n",
- pw->pw_name, pw->pw_passwd,
- pw->pw_uid, pw->pw_gid,
- pw->pw_gecos, pw->pw_dir, pw->pw_shell));
-
- nwrap_pw->num++;
- return true;
-}
-
-static void nwrap_pw_unload(struct nwrap_cache *nwrap)
-{
- struct nwrap_pw *nwrap_pw;
- nwrap_pw = (struct nwrap_pw *)nwrap->private_data;
-
- if (nwrap_pw->list) free(nwrap_pw->list);
-
- nwrap_pw->list = NULL;
- nwrap_pw->num = 0;
- nwrap_pw->idx = 0;
-}
-
-static int nwrap_pw_copy_r(const struct passwd *src, struct passwd *dst,
- char *buf, size_t buflen, struct passwd **dstp)
-{
- char *first;
- char *last;
- off_t ofs;
-
- first = src->pw_name;
-
- last = src->pw_shell;
- while (*last) last++;
-
- ofs = PTR_DIFF(last + 1, first);
-
- if (ofs > buflen) {
- return ERANGE;
- }
-
- memcpy(buf, first, ofs);
-
- ofs = PTR_DIFF(src->pw_name, first);
- dst->pw_name = buf + ofs;
- ofs = PTR_DIFF(src->pw_passwd, first);
- dst->pw_passwd = buf + ofs;
- dst->pw_uid = src->pw_uid;
- dst->pw_gid = src->pw_gid;
- ofs = PTR_DIFF(src->pw_gecos, first);
- dst->pw_gecos = buf + ofs;
- ofs = PTR_DIFF(src->pw_dir, first);
- dst->pw_dir = buf + ofs;
- ofs = PTR_DIFF(src->pw_shell, first);
- dst->pw_shell = buf + ofs;
-
- if (dstp) {
- *dstp = dst;
- }
-
- return 0;
-}
-
-/*
- * the caller has to call nwrap_unload() on failure
- */
-static bool nwrap_gr_parse_line(struct nwrap_cache *nwrap, char *line)
-{
- struct nwrap_gr *nwrap_gr;
- char *c;
- char *p;
- char *e;
- struct group *gr;
- size_t list_size;
- unsigned nummem;
-
- nwrap_gr = (struct nwrap_gr *)nwrap->private_data;
-
- list_size = sizeof(*nwrap_gr->list) * (nwrap_gr->num+1);
- gr = (struct group *)realloc(nwrap_gr->list, list_size);
- if (!gr) {
- NWRAP_ERROR(("%s:realloc failed\n",__location__));
- return false;
- }
- nwrap_gr->list = gr;
-
- gr = &nwrap_gr->list[nwrap_gr->num];
-
- c = line;
-
- /* name */
- p = strchr(c, ':');
- if (!p) {
- NWRAP_ERROR(("%s:invalid line[%s]: '%s'\n",
- __location__, line, c));
- return false;
- }
- *p = '\0';
- p++;
- gr->gr_name = c;
- c = p;
-
- NWRAP_VERBOSE(("name[%s]\n", gr->gr_name));
-
- /* password */
- p = strchr(c, ':');
- if (!p) {
- NWRAP_ERROR(("%s:invalid line[%s]: '%s'\n",
- __location__, line, c));
- return false;
- }
- *p = '\0';
- p++;
- gr->gr_passwd = c;
- c = p;
-
- NWRAP_VERBOSE(("password[%s]\n", gr->gr_passwd));
-
- /* gid */
- p = strchr(c, ':');
- if (!p) {
- NWRAP_ERROR(("%s:invalid line[%s]: '%s'\n",
- __location__, line, c));
- return false;
- }
- *p = '\0';
- p++;
- e = NULL;
- gr->gr_gid = (gid_t)strtoul(c, &e, 10);
- if (c == e) {
- NWRAP_ERROR(("%s:invalid line[%s]: '%s' - %s\n",
- __location__, line, c, strerror(errno)));
- return false;
- }
- if (e == NULL) {
- NWRAP_ERROR(("%s:invalid line[%s]: '%s' - %s\n",
- __location__, line, c, strerror(errno)));
- return false;
- }
- if (e[0] != '\0') {
- NWRAP_ERROR(("%s:invalid line[%s]: '%s' - %s\n",
- __location__, line, c, strerror(errno)));
- return false;
- }
- c = p;
-
- NWRAP_VERBOSE(("gid[%u]\n", gr->gr_gid));
-
- /* members */
- gr->gr_mem = (char **)malloc(sizeof(char *));
- if (!gr->gr_mem) {
- NWRAP_ERROR(("%s:calloc failed\n",__location__));
- return false;
- }
- gr->gr_mem[0] = NULL;
-
- for(nummem=0; p; nummem++) {
- char **m;
- size_t m_size;
- c = p;
- p = strchr(c, ',');
- if (p) {
- *p = '\0';
- p++;
- }
-
- if (strlen(c) == 0) {
- break;
- }
-
- m_size = sizeof(char *) * (nummem+2);
- m = (char **)realloc(gr->gr_mem, m_size);
- if (!m) {
- NWRAP_ERROR(("%s:realloc(%u) failed\n",
- __location__, m_size));
- return false;
- }
- gr->gr_mem = m;
- gr->gr_mem[nummem] = c;
- gr->gr_mem[nummem+1] = NULL;
-
- NWRAP_VERBOSE(("member[%u]: '%s'\n", nummem, gr->gr_mem[nummem]));
- }
-
- NWRAP_DEBUG(("add group[%s:%s:%u:] with %u members\n",
- gr->gr_name, gr->gr_passwd, gr->gr_gid, nummem));
-
- nwrap_gr->num++;
- return true;
-}
-
-static void nwrap_gr_unload(struct nwrap_cache *nwrap)
-{
- int i;
- struct nwrap_gr *nwrap_gr;
- nwrap_gr = (struct nwrap_gr *)nwrap->private_data;
-
- if (nwrap_gr->list) {
- for (i=0; i < nwrap_gr->num; i++) {
- if (nwrap_gr->list[i].gr_mem) {
- free(nwrap_gr->list[i].gr_mem);
- }
- }
- free(nwrap_gr->list);
- }
-
- nwrap_gr->list = NULL;
- nwrap_gr->num = 0;
- nwrap_gr->idx = 0;
-}
-
-static int nwrap_gr_copy_r(const struct group *src, struct group *dst,
- char *buf, size_t buflen, struct group **dstp)
-{
- char *first;
- char **lastm;
- char *last;
- off_t ofsb;
- off_t ofsm;
- off_t ofs;
- unsigned i;
-
- first = src->gr_name;
-
- lastm = src->gr_mem;
- while (*lastm) lastm++;
-
- last = *lastm;
- while (*last) last++;
-
- ofsb = PTR_DIFF(last + 1, first);
- ofsm = PTR_DIFF(lastm + 1, src->gr_mem);
-
- if ((ofsb + ofsm) > buflen) {
- return ERANGE;
- }
-
- memcpy(buf, first, ofsb);
- memcpy(buf + ofsb, src->gr_mem, ofsm);
-
- ofs = PTR_DIFF(src->gr_name, first);
- dst->gr_name = buf + ofs;
- ofs = PTR_DIFF(src->gr_passwd, first);
- dst->gr_passwd = buf + ofs;
- dst->gr_gid = src->gr_gid;
-
- dst->gr_mem = (char **)(buf + ofsb);
- for (i=0; src->gr_mem[i]; i++) {
- ofs = PTR_DIFF(src->gr_mem[i], first);
- dst->gr_mem[i] = buf + ofs;
- }
-
- if (dstp) {
- *dstp = dst;
- }
-
- return 0;
-}
-
-/* user functions */
-_PUBLIC_ struct passwd *nwrap_getpwnam(const char *name)
-{
- int i;
-
- if (!nwrap_enabled()) {
- return real_getpwnam(name);
- }
-
- nwrap_cache_reload(nwrap_pw_global.cache);
-
- for (i=0; i<nwrap_pw_global.num; i++) {
- if (strcmp(nwrap_pw_global.list[i].pw_name, name) == 0) {
- NWRAP_DEBUG(("%s: user[%s] found\n",
- __location__, name));
- return &nwrap_pw_global.list[i];
- }
- NWRAP_VERBOSE(("%s: user[%s] does not match [%s]\n",
- __location__, name,
- nwrap_pw_global.list[i].pw_name));
- }
-
- NWRAP_DEBUG(("%s: user[%s] not found\n", __location__, name));
-
- errno = ENOENT;
- return NULL;
-}
-
-_PUBLIC_ int nwrap_getpwnam_r(const char *name, struct passwd *pwdst,
- char *buf, size_t buflen, struct passwd **pwdstp)
-{
- struct passwd *pw;
-
- if (!nwrap_enabled()) {
- return real_getpwnam_r(name, pwdst, buf, buflen, pwdstp);
- }
-
- pw = nwrap_getpwnam(name);
- if (!pw) {
- if (errno == 0) {
- return ENOENT;
- }
- return errno;
- }
-
- return nwrap_pw_copy_r(pw, pwdst, buf, buflen, pwdstp);
-}
-
-_PUBLIC_ struct passwd *nwrap_getpwuid(uid_t uid)
-{
- int i;
-
- if (!nwrap_enabled()) {
- return real_getpwuid(uid);
- }
-
- nwrap_cache_reload(nwrap_pw_global.cache);
-
- for (i=0; i<nwrap_pw_global.num; i++) {
- if (nwrap_pw_global.list[i].pw_uid == uid) {
- NWRAP_DEBUG(("%s: uid[%u] found\n",
- __location__, uid));
- return &nwrap_pw_global.list[i];
- }
- NWRAP_VERBOSE(("%s: uid[%u] does not match [%u]\n",
- __location__, uid,
- nwrap_pw_global.list[i].pw_uid));
- }
-
- NWRAP_DEBUG(("%s: uid[%u] not found\n", __location__, uid));
-
- errno = ENOENT;
- return NULL;
-}
-
-_PUBLIC_ int nwrap_getpwuid_r(uid_t uid, struct passwd *pwdst,
- char *buf, size_t buflen, struct passwd **pwdstp)
-{
- struct passwd *pw;
-
- if (!nwrap_enabled()) {
- return real_getpwuid_r(uid, pwdst, buf, buflen, pwdstp);
- }
-
- pw = nwrap_getpwuid(uid);
- if (!pw) {
- if (errno == 0) {
- return ENOENT;
- }
- return errno;
- }
-
- return nwrap_pw_copy_r(pw, pwdst, buf, buflen, pwdstp);
-}
-
-/* user enum functions */
-_PUBLIC_ void nwrap_setpwent(void)
-{
- if (!nwrap_enabled()) {
- real_setpwent();
- }
-
- nwrap_pw_global.idx = 0;
-}
-
-_PUBLIC_ struct passwd *nwrap_getpwent(void)
-{
- struct passwd *pw;
-
- if (!nwrap_enabled()) {
- return real_getpwent();
- }
-
- if (nwrap_pw_global.idx == 0) {
- nwrap_cache_reload(nwrap_pw_global.cache);
- }
-
- if (nwrap_pw_global.idx >= nwrap_pw_global.num) {
- errno = ENOENT;
- return NULL;
- }
-
- pw = &nwrap_pw_global.list[nwrap_pw_global.idx++];
-
- NWRAP_VERBOSE(("%s: return user[%s] uid[%u]\n",
- __location__, pw->pw_name, pw->pw_uid));
-
- return pw;
-}
-
-_PUBLIC_ int nwrap_getpwent_r(struct passwd *pwdst, char *buf,
- size_t buflen, struct passwd **pwdstp)
-{
- struct passwd *pw;
-
- if (!nwrap_enabled()) {
-#ifdef SOLARIS_GETPWENT_R
- pw = real_getpwent_r(pwdst, buf, buflen);
- if (!pw) {
- if (errno == 0) {
- return ENOENT;
- }
- return errno;
- }
- if (pwdstp) {
- *pwdstp = pw;
- }
- return 0;
-#else
- return real_getpwent_r(pwdst, buf, buflen, pwdstp);
-#endif
- }
-
- pw = nwrap_getpwent();
- if (!pw) {
- if (errno == 0) {
- return ENOENT;
- }
- return errno;
- }
-
- return nwrap_pw_copy_r(pw, pwdst, buf, buflen, pwdstp);
-}
-
-_PUBLIC_ void nwrap_endpwent(void)
-{
- if (!nwrap_enabled()) {
- real_endpwent();
- }
-
- nwrap_pw_global.idx = 0;
-}
-
-/* misc functions */
-_PUBLIC_ int nwrap_initgroups(const char *user, gid_t group)
-{
- if (!nwrap_enabled()) {
- return real_initgroups(user, group);
- }
-
- /* TODO: maybe we should also fake this... */
- return EPERM;
-}
-
-/* group functions */
-_PUBLIC_ struct group *nwrap_getgrnam(const char *name)
-{
- int i;
-
- if (!nwrap_enabled()) {
- return real_getgrnam(name);
- }
-
- nwrap_cache_reload(nwrap_gr_global.cache);
-
- for (i=0; i<nwrap_gr_global.num; i++) {
- if (strcmp(nwrap_gr_global.list[i].gr_name, name) == 0) {
- NWRAP_DEBUG(("%s: group[%s] found\n",
- __location__, name));
- return &nwrap_gr_global.list[i];
- }
- NWRAP_VERBOSE(("%s: group[%s] does not match [%s]\n",
- __location__, name,
- nwrap_gr_global.list[i].gr_name));
- }
-
- NWRAP_DEBUG(("%s: group[%s] not found\n", __location__, name));
-
- errno = ENOENT;
- return NULL;
-}
-
-_PUBLIC_ int nwrap_getgrnam_r(const char *name, struct group *grdst,
- char *buf, size_t buflen, struct group **grdstp)
-{
- struct group *gr;
-
- if (!nwrap_enabled()) {
- return real_getgrnam_r(name, grdst, buf, buflen, grdstp);
- }
-
- gr = nwrap_getgrnam(name);
- if (!gr) {
- if (errno == 0) {
- return ENOENT;
- }
- return errno;
- }
-
- return nwrap_gr_copy_r(gr, grdst, buf, buflen, grdstp);
-}
-
-_PUBLIC_ struct group *nwrap_getgrgid(gid_t gid)
-{
- int i;
-
- if (!nwrap_enabled()) {
- return real_getgrgid(gid);
- }
-
- nwrap_cache_reload(nwrap_gr_global.cache);
-
- for (i=0; i<nwrap_gr_global.num; i++) {
- if (nwrap_gr_global.list[i].gr_gid == gid) {
- NWRAP_DEBUG(("%s: gid[%u] found\n",
- __location__, gid));
- return &nwrap_gr_global.list[i];
- }
- NWRAP_VERBOSE(("%s: gid[%u] does not match [%u]\n",
- __location__, gid,
- nwrap_gr_global.list[i].gr_gid));
- }
-
- NWRAP_DEBUG(("%s: gid[%u] not found\n", __location__, gid));
-
- errno = ENOENT;
- return NULL;
-}
-
-_PUBLIC_ int nwrap_getgrgid_r(gid_t gid, struct group *grdst,
- char *buf, size_t buflen, struct group **grdstp)
-{
- struct group *gr;
-
- if (!nwrap_enabled()) {
- return real_getgrgid_r(gid, grdst, buf, buflen, grdstp);
- }
-
- gr = nwrap_getgrgid(gid);
- if (!gr) {
- if (errno == 0) {
- return ENOENT;
- }
- return errno;
- }
-
- return nwrap_gr_copy_r(gr, grdst, buf, buflen, grdstp);
-
- return ENOENT;
-}
-
-/* group enum functions */
-_PUBLIC_ void nwrap_setgrent(void)
-{
- if (!nwrap_enabled()) {
- real_setgrent();
- }
-
- nwrap_gr_global.idx = 0;
-}
-
-_PUBLIC_ struct group *nwrap_getgrent(void)
-{
- struct group *gr;
-
- if (!nwrap_enabled()) {
- return real_getgrent();
- }
-
- if (nwrap_gr_global.idx == 0) {
- nwrap_cache_reload(nwrap_gr_global.cache);
- }
-
- if (nwrap_gr_global.idx >= nwrap_gr_global.num) {
- errno = ENOENT;
- return NULL;
- }
-
- gr = &nwrap_gr_global.list[nwrap_gr_global.idx++];
-
- NWRAP_VERBOSE(("%s: return group[%s] gid[%u]\n",
- __location__, gr->gr_name, gr->gr_gid));
-
- return gr;
-}
-
-_PUBLIC_ int nwrap_getgrent_r(struct group *grdst, char *buf,
- size_t buflen, struct group **grdstp)
-{
- struct group *gr;
-
- if (!nwrap_enabled()) {
-#ifdef SOLARIS_GETGRENT_R
- gr = real_getgrent_r(grdst, buf, buflen);
- if (!gr) {
- if (errno == 0) {
- return ENOENT;
- }
- return errno;
- }
- if (grdstp) {
- *grdstp = gr;
- }
- return 0;
-#else
- return real_getgrent_r(grdst, buf, buflen, grdstp);
-#endif
- }
-
- gr = nwrap_getgrent();
- if (!gr) {
- if (errno == 0) {
- return ENOENT;
- }
- return errno;
- }
-
- return nwrap_gr_copy_r(gr, grdst, buf, buflen, grdstp);
-}
-
-_PUBLIC_ void nwrap_endgrent(void)
-{
- if (!nwrap_enabled()) {
- real_endgrent();
- }
-
- nwrap_gr_global.idx = 0;
-}
diff --git a/source3/lib/nss_wrapper/nss_wrapper.h b/source3/lib/nss_wrapper/nss_wrapper.h
deleted file mode 100644
index 35a47348a8..0000000000
--- a/source3/lib/nss_wrapper/nss_wrapper.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (C) Stefan Metzmacher 2007 <metze@samba.org>
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef __NSS_WRAPPER_H__
-#define __NSS_WRAPPER_H__
-
-struct passwd *nwrap_getpwnam(const char *name);
-int nwrap_getpwnam_r(const char *name, struct passwd *pwbuf,
- char *buf, size_t buflen, struct passwd **pwbufp);
-struct passwd *nwrap_getpwuid(uid_t uid);
-int nwrap_getpwuid_r(uid_t uid, struct passwd *pwbuf,
- char *buf, size_t buflen, struct passwd **pwbufp);
-void nwrap_setpwent(void);
-struct passwd *nwrap_getpwent(void);
-int nwrap_getpwent_r(struct passwd *pwbuf, char *buf,
- size_t buflen, struct passwd **pwbufp);
-void nwrap_endpwent(void);
-int nwrap_initgroups(const char *user, gid_t group);
-struct group *nwrap_getgrnam(const char *name);
-int nwrap_getgrnam_r(const char *name, struct group *gbuf,
- char *buf, size_t buflen, struct group **gbufp);
-struct group *nwrap_getgrgid(gid_t gid);
-int nwrap_getgrgid_r(gid_t gid, struct group *gbuf,
- char *buf, size_t buflen, struct group **gbufp);
-void nwrap_setgrent(void);
-struct group *nwrap_getgrent(void);
-int nwrap_getgrent_r(struct group *gbuf, char *buf,
- size_t buflen, struct group **gbufp);
-void nwrap_endgrent(void);
-
-#ifdef NSS_WRAPPER_REPLACE
-
-#ifdef getpwnam
-#undef getpwnam
-#endif
-#define getpwnam nwrap_getpwnam
-
-#ifdef getpwnam_r
-#undef getpwnam_r
-#endif
-#define getpwnam_r nwrap_getpwnam_r
-
-#ifdef getpwuid
-#undef getpwuid
-#endif
-#define getpwuid nwrap_getpwuid
-
-#ifdef getpwuid_r
-#undef getpwuid_r
-#endif
-#define getpwuid_r nwrap_getpwuid_r
-
-#ifdef setpwent
-#undef setpwent
-#endif
-#define setpwent nwrap_setpwent
-
-#ifdef getpwent
-#undef getpwent
-#endif
-#define getpwent nwrap_getpwent
-
-#ifdef getpwent_r
-#undef getpwent_r
-#endif
-#define getpwent_r nwrap_getpwent_r
-
-#ifdef endpwent
-#undef endpwent
-#endif
-#define endpwent nwrap_endpwent
-
-#ifdef getgrlst
-#undef getgrlst
-#endif
-#define getgrlst __none_nwrap_getgrlst
-
-#ifdef getgrlst_r
-#undef getgrlst_r
-#endif
-#define getgrlst_r __none_nwrap_getgrlst_r
-
-#ifdef initgroups_dyn
-#undef initgroups_dyn
-#endif
-#define initgroups_dyn __none_nwrap_initgroups_dyn
-
-#ifdef initgroups
-#undef initgroups
-#endif
-#define initgroups nwrap_initgroups
-
-#ifdef getgrnam
-#undef getgrnam
-#endif
-#define getgrnam nwrap_getgrnam
-
-#ifdef getgrnam_r
-#undef getgrnam_r
-#endif
-#define getgrnam_r nwrap_getgrnam_r
-
-#ifdef getgrgid
-#undef getgrgid
-#endif
-#define getgrgid nwrap_getgrgid
-
-#ifdef getgrgid_r
-#undef getgrgid_r
-#endif
-#define getgrgid_r nwrap_getgrgid_r
-
-#ifdef setgrent
-#undef setgrent
-#endif
-#define setgrent nwrap_setgrent
-
-#ifdef getgrent
-#undef getgrent
-#endif
-#define getgrent nwrap_getgrent
-
-#ifdef getgrent_r
-#undef getgrent_r
-#endif
-#define getgrent_r nwrap_getgrent_r
-
-#ifdef endgrent
-#undef endgrent
-#endif
-#define endgrent nwrap_endgrent
-
-#endif /* NSS_WRAPPER_REPLACE */
-
-#endif /* __NSS_WRAPPER_H__ */
diff --git a/source3/lib/nss_wrapper/nss_wrapper.pl b/source3/lib/nss_wrapper/nss_wrapper.pl
deleted file mode 100644
index b1c9be5365..0000000000
--- a/source3/lib/nss_wrapper/nss_wrapper.pl
+++ /dev/null
@@ -1,265 +0,0 @@
-#!/usr/bin/perl
-#
-
-use strict;
-
-use Getopt::Long;
-use Cwd qw(abs_path);
-
-my $opt_help = 0;
-my $opt_path = undef;
-my $opt_action = undef;
-my $opt_type = undef;
-my $opt_name = undef;
-
-my $passwdfn = undef;
-my $groupfn = undef;
-my $actionfn = undef;
-
-sub passwd_add($$);
-sub passwd_delete($$);
-sub group_add($$);
-sub group_delete($$);
-
-my $result = GetOptions(
- 'help|h|?' => \$opt_help,
- 'path=s' => \$opt_path,
- 'action=s' => \$opt_action,
- 'type=s' => \$opt_type,
- 'name=s' => \$opt_name
-);
-
-sub usage($;$)
-{
- my ($ret, $msg) = @_;
-
- print $msg."\n\n" if defined($msg);
-
- print "usage:
-
- --help|-h|-? Show this help.
-
- --path <path> Path of the 'passwd' or 'group' file.
-
- --type <type> Only 'passwd' is supported yet,
- but 'group' and maybe 'member' will be added
- in future.
-
- --action <action> 'add' or 'delete'.
-
- --name <name> The name of the object.
-";
- exit($ret);
-}
-
-usage(1) if (not $result);
-
-usage(0) if ($opt_help);
-
-if (not defined($opt_path)) {
- usage(1, "missing: --path <path>");
-}
-if ($opt_path eq "" or $opt_path eq "/") {
- usage(1, "invalid: --path <path>: '$opt_path'");
-}
-my $opt_fullpath = abs_path($opt_path);
-if (not defined($opt_fullpath)) {
- usage(1, "invalid: --path <path>: '$opt_path'");
-}
-
-
-if (not defined($opt_action)) {
- usage(1, "missing: --action [add|delete]");
-}
-if ($opt_action eq "add") {
- $passwdfn = \&passwd_add;
- $groupfn = \&group_add;
-} elsif ($opt_action eq "delete") {
- $passwdfn = \&passwd_delete;
- $groupfn = \&group_delete;
-} else {
- usage(1, "invalid: --action [add|delete]: '$opt_action'");
-}
-
-if (not defined($opt_type)) {
- usage(1, "missing: --type [passwd|group]");
-}
-if ($opt_type eq "passwd") {
- $actionfn = $passwdfn;
-} elsif ($opt_type eq "group") {
- $actionfn = $groupfn;
-} else {
- usage(1, "invalid: --type [passwd|group]: '$opt_type'")
-}
-
-if (not defined($opt_name)) {
- usage(1, "missing: --name <name>");
-}
-if ($opt_name eq "") {
- usage(1, "invalid: --name <name>");
-}
-
-exit $actionfn->($opt_fullpath, $opt_name);
-
-sub passwd_add_entry($$);
-
-sub passwd_load($)
-{
- my ($path) = @_;
- my @lines;
- my $passwd = undef;
-
- open(PWD, "<$path") or die("Unable to open '$path' for read");
- @lines = <PWD>;
- close(PWD);
-
- $passwd->{array} = ();
- $passwd->{name} = {};
- $passwd->{uid} = {};
- $passwd->{path} = $path;
-
- foreach my $line (@lines) {
- passwd_add_entry($passwd, $line);
- }
-
- return $passwd;
-}
-
-sub passwd_lookup_name($$)
-{
- my ($passwd, $name) = @_;
-
- return undef unless defined($passwd->{name}{$name});
-
- return $passwd->{name}{$name};
-}
-
-sub passwd_lookup_uid($$)
-{
- my ($passwd, $uid) = @_;
-
- return undef unless defined($passwd->{uid}{$uid});
-
- return $passwd->{uid}{$uid};
-}
-
-sub passwd_get_free_uid($)
-{
- my ($passwd) = @_;
- my $uid = 1000;
-
- while (passwd_lookup_uid($passwd, $uid)) {
- $uid++;
- }
-
- return $uid;
-}
-
-sub passwd_add_entry($$)
-{
- my ($passwd, $str) = @_;
-
- chomp $str;
- my @e = split(':', $str);
-
- push(@{$passwd->{array}}, \@e);
- $passwd->{name}{$e[0]} = \@e;
- $passwd->{uid}{$e[2]} = \@e;
-}
-
-sub passwd_remove_entry($$)
-{
- my ($passwd, $eref) = @_;
-
- for(my $i; defined($passwd->{array}[$i]); $i++) {
- if ($eref == $passwd->{array}[$i]) {
- $passwd->{array}[$i] = undef;
- }
- }
-
- delete $passwd->{name}{${$eref}[0]};
- delete $passwd->{uid}{${$eref}[2]};
-}
-
-sub passwd_save($)
-{
- my ($passwd) = @_;
- my @lines = ();
- my $path = $passwd->{path};
- my $tmppath = $path.$$;
-
- foreach my $eref (@{$passwd->{array}}) {
- next unless defined($eref);
-
- my $line = join(':', @{$eref});
- push(@lines, $line);
- }
-
- open(PWD, ">$tmppath") or die("Unable to open '$tmppath' for write");
- print PWD join("\n", @lines)."\n";
- close(PWD);
- rename($tmppath, $path) or die("Unable to rename $tmppath => $path");
-}
-
-sub passwd_add($$)
-{
- my ($path, $name) = @_;
-
- #print "passwd_add: '$name' in '$path'\n";
-
- my $passwd = passwd_load($path);
-
- my $e = passwd_lookup_name($passwd, $name);
- die("account[$name] already exists in '$path'") if defined($e);
-
- my $uid = passwd_get_free_uid($passwd);
- my $gid = 65534;# nogroup gid
-
- my $pwent = $name.":x:".$uid.":".$gid.":".$name." gecos:/nodir:/bin/false";
-
- passwd_add_entry($passwd, $pwent);
-
- passwd_save($passwd);
-
- return 0;
-}
-
-sub passwd_delete($$)
-{
- my ($path, $name) = @_;
-
- #print "passwd_delete: '$name' in '$path'\n";
-
- my $passwd = passwd_load($path);
-
- my $e = passwd_lookup_name($passwd, $name);
- die("account[$name] does not exists in '$path'") unless defined($e);
-
- passwd_remove_entry($passwd, $e);
-
- passwd_save($passwd);
-
- return 0;
-}
-
-sub group_add($$)
-{
- my ($path, $name) = @_;
-
- #print "group_add: '$name' in '$path'\n";
-
- die("group_add: not implemented yet!");
-
- return 0;
-}
-
-sub group_delete($$)
-{
- my ($path, $name) = @_;
-
- #print "group_delete: '$name' in '$path'\n";
-
- die("group_delete: not implemented yet!");
-
- return 0;
-}
diff --git a/source3/lib/packet.c b/source3/lib/packet.c
index e0486165f3..e4cab6ba87 100644
--- a/source3/lib/packet.c
+++ b/source3/lib/packet.c
@@ -21,7 +21,7 @@
struct packet_context {
int fd;
- struct data_blob in, out;
+ DATA_BLOB in, out;
};
/*
@@ -120,16 +120,16 @@ NTSTATUS packet_fd_read_sync(struct packet_context *ctx)
}
bool packet_handler(struct packet_context *ctx,
- bool (*full_req)(const struct data_blob *data,
+ bool (*full_req)(const DATA_BLOB *data,
size_t *length,
void *private_data),
- NTSTATUS (*callback)(const struct data_blob *data,
+ NTSTATUS (*callback)(const DATA_BLOB *data,
void *private_data),
void *private_data,
NTSTATUS *status)
{
size_t length;
- struct data_blob data;
+ DATA_BLOB data;
if (!full_req(&ctx->in, &length, private_data)) {
return False;
@@ -211,7 +211,7 @@ NTSTATUS packet_send(struct packet_context *ctx, int num_blobs, ...)
va_start(ap, num_blobs);
for (i=0; i<num_blobs; i++) {
size_t tmp;
- struct data_blob blob = va_arg(ap, struct data_blob);
+ DATA_BLOB blob = va_arg(ap, DATA_BLOB);
tmp = len + blob.length;
if (tmp < len) {
@@ -236,7 +236,7 @@ NTSTATUS packet_send(struct packet_context *ctx, int num_blobs, ...)
va_start(ap, num_blobs);
for (i=0; i<num_blobs; i++) {
- struct data_blob blob = va_arg(ap, struct data_blob);
+ DATA_BLOB blob = va_arg(ap, DATA_BLOB);
memcpy(ctx->out.data+ctx->out.length, blob.data, blob.length);
ctx->out.length += blob.length;
diff --git a/source3/lib/rbtree.c b/source3/lib/rbtree.c
deleted file mode 100644
index f6868cab5d..0000000000
--- a/source3/lib/rbtree.c
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- Red Black Trees
- (C) 1999 Andrea Arcangeli <andrea@suse.de>
- (C) 2002 David Woodhouse <dwmw2@infradead.org>
-
- 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- linux/lib/rbtree.c
-*/
-
-#include "includes.h"
-#include "rbtree.h"
-
-#define RB_RED 0
-#define RB_BLACK 1
-
-#define rb_parent(r) ((struct rb_node *)((r)->rb_parent_color & ~3))
-#define rb_color(r) ((r)->rb_parent_color & 1)
-#define rb_is_red(r) (!rb_color(r))
-#define rb_is_black(r) rb_color(r)
-#define rb_set_red(r) do { (r)->rb_parent_color &= ~1; } while (0)
-#define rb_set_black(r) do { (r)->rb_parent_color |= 1; } while (0)
-
-static void rb_set_parent(struct rb_node *rb, struct rb_node *p)
-{
- rb->rb_parent_color = (rb->rb_parent_color & 3) | (unsigned long)p;
-}
-static void rb_set_color(struct rb_node *rb, int color)
-{
- rb->rb_parent_color = (rb->rb_parent_color & ~1) | color;
-}
-
-#define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL)
-#define RB_EMPTY_NODE(node) (rb_parent(node) == node)
-#define RB_CLEAR_NODE(node) (rb_set_parent(node, node))
-
-static void __rb_rotate_left(struct rb_node *node, struct rb_root *root)
-{
- struct rb_node *right = node->rb_right;
- struct rb_node *parent = rb_parent(node);
-
- if ((node->rb_right = right->rb_left))
- rb_set_parent(right->rb_left, node);
- right->rb_left = node;
-
- rb_set_parent(right, parent);
-
- if (parent)
- {
- if (node == parent->rb_left)
- parent->rb_left = right;
- else
- parent->rb_right = right;
- }
- else
- root->rb_node = right;
- rb_set_parent(node, right);
-}
-
-static void __rb_rotate_right(struct rb_node *node, struct rb_root *root)
-{
- struct rb_node *left = node->rb_left;
- struct rb_node *parent = rb_parent(node);
-
- if ((node->rb_left = left->rb_right))
- rb_set_parent(left->rb_right, node);
- left->rb_right = node;
-
- rb_set_parent(left, parent);
-
- if (parent)
- {
- if (node == parent->rb_right)
- parent->rb_right = left;
- else
- parent->rb_left = left;
- }
- else
- root->rb_node = left;
- rb_set_parent(node, left);
-}
-
-void rb_insert_color(struct rb_node *node, struct rb_root *root)
-{
- struct rb_node *parent, *gparent;
-
- while ((parent = rb_parent(node)) && rb_is_red(parent))
- {
- gparent = rb_parent(parent);
-
- if (parent == gparent->rb_left)
- {
- {
- register struct rb_node *uncle = gparent->rb_right;
- if (uncle && rb_is_red(uncle))
- {
- rb_set_black(uncle);
- rb_set_black(parent);
- rb_set_red(gparent);
- node = gparent;
- continue;
- }
- }
-
- if (parent->rb_right == node)
- {
- register struct rb_node *tmp;
- __rb_rotate_left(parent, root);
- tmp = parent;
- parent = node;
- node = tmp;
- }
-
- rb_set_black(parent);
- rb_set_red(gparent);
- __rb_rotate_right(gparent, root);
- } else {
- {
- register struct rb_node *uncle = gparent->rb_left;
- if (uncle && rb_is_red(uncle))
- {
- rb_set_black(uncle);
- rb_set_black(parent);
- rb_set_red(gparent);
- node = gparent;
- continue;
- }
- }
-
- if (parent->rb_left == node)
- {
- register struct rb_node *tmp;
- __rb_rotate_right(parent, root);
- tmp = parent;
- parent = node;
- node = tmp;
- }
-
- rb_set_black(parent);
- rb_set_red(gparent);
- __rb_rotate_left(gparent, root);
- }
- }
-
- rb_set_black(root->rb_node);
-}
-
-static void __rb_erase_color(struct rb_node *node, struct rb_node *parent,
- struct rb_root *root)
-{
- struct rb_node *other;
-
- while ((!node || rb_is_black(node)) && node != root->rb_node)
- {
- if (parent->rb_left == node)
- {
- other = parent->rb_right;
- if (rb_is_red(other))
- {
- rb_set_black(other);
- rb_set_red(parent);
- __rb_rotate_left(parent, root);
- other = parent->rb_right;
- }
- if ((!other->rb_left || rb_is_black(other->rb_left)) &&
- (!other->rb_right || rb_is_black(other->rb_right)))
- {
- rb_set_red(other);
- node = parent;
- parent = rb_parent(node);
- }
- else
- {
- if (!other->rb_right || rb_is_black(other->rb_right))
- {
- struct rb_node *o_left;
- if ((o_left = other->rb_left))
- rb_set_black(o_left);
- rb_set_red(other);
- __rb_rotate_right(other, root);
- other = parent->rb_right;
- }
- rb_set_color(other, rb_color(parent));
- rb_set_black(parent);
- if (other->rb_right)
- rb_set_black(other->rb_right);
- __rb_rotate_left(parent, root);
- node = root->rb_node;
- break;
- }
- }
- else
- {
- other = parent->rb_left;
- if (rb_is_red(other))
- {
- rb_set_black(other);
- rb_set_red(parent);
- __rb_rotate_right(parent, root);
- other = parent->rb_left;
- }
- if ((!other->rb_left || rb_is_black(other->rb_left)) &&
- (!other->rb_right || rb_is_black(other->rb_right)))
- {
- rb_set_red(other);
- node = parent;
- parent = rb_parent(node);
- }
- else
- {
- if (!other->rb_left || rb_is_black(other->rb_left))
- {
- register struct rb_node *o_right;
- if ((o_right = other->rb_right))
- rb_set_black(o_right);
- rb_set_red(other);
- __rb_rotate_left(other, root);
- other = parent->rb_left;
- }
- rb_set_color(other, rb_color(parent));
- rb_set_black(parent);
- if (other->rb_left)
- rb_set_black(other->rb_left);
- __rb_rotate_right(parent, root);
- node = root->rb_node;
- break;
- }
- }
- }
- if (node)
- rb_set_black(node);
-}
-
-void rb_erase(struct rb_node *node, struct rb_root *root)
-{
- struct rb_node *child, *parent;
- int color;
-
- if (!node->rb_left)
- child = node->rb_right;
- else if (!node->rb_right)
- child = node->rb_left;
- else
- {
- struct rb_node *old = node, *left;
-
- node = node->rb_right;
- while ((left = node->rb_left) != NULL)
- node = left;
- child = node->rb_right;
- parent = rb_parent(node);
- color = rb_color(node);
-
- if (child)
- rb_set_parent(child, parent);
- if (parent == old) {
- parent->rb_right = child;
- parent = node;
- } else
- parent->rb_left = child;
-
- node->rb_parent_color = old->rb_parent_color;
- node->rb_right = old->rb_right;
- node->rb_left = old->rb_left;
-
- if (rb_parent(old))
- {
- if (rb_parent(old)->rb_left == old)
- rb_parent(old)->rb_left = node;
- else
- rb_parent(old)->rb_right = node;
- } else
- root->rb_node = node;
-
- rb_set_parent(old->rb_left, node);
- if (old->rb_right)
- rb_set_parent(old->rb_right, node);
- goto color;
- }
-
- parent = rb_parent(node);
- color = rb_color(node);
-
- if (child)
- rb_set_parent(child, parent);
- if (parent)
- {
- if (parent->rb_left == node)
- parent->rb_left = child;
- else
- parent->rb_right = child;
- }
- else
- root->rb_node = child;
-
- color:
- if (color == RB_BLACK)
- __rb_erase_color(child, parent, root);
-}
-
-/*
- * This function returns the first node (in sort order) of the tree.
- */
-struct rb_node *rb_first(struct rb_root *root)
-{
- struct rb_node *n;
-
- n = root->rb_node;
- if (!n)
- return NULL;
- while (n->rb_left)
- n = n->rb_left;
- return n;
-}
-
-struct rb_node *rb_last(struct rb_root *root)
-{
- struct rb_node *n;
-
- n = root->rb_node;
- if (!n)
- return NULL;
- while (n->rb_right)
- n = n->rb_right;
- return n;
-}
-
-struct rb_node *rb_next(struct rb_node *node)
-{
- struct rb_node *parent;
-
- if (rb_parent(node) == node)
- return NULL;
-
- /* If we have a right-hand child, go down and then left as far
- as we can. */
- if (node->rb_right) {
- node = node->rb_right;
- while (node->rb_left)
- node=node->rb_left;
- return node;
- }
-
- /* No right-hand children. Everything down and left is
- smaller than us, so any 'next' node must be in the general
- direction of our parent. Go up the tree; any time the
- ancestor is a right-hand child of its parent, keep going
- up. First time it's a left-hand child of its parent, said
- parent is our 'next' node. */
- while ((parent = rb_parent(node)) && node == parent->rb_right)
- node = parent;
-
- return parent;
-}
-
-struct rb_node *rb_prev(struct rb_node *node)
-{
- struct rb_node *parent;
-
- if (rb_parent(node) == node)
- return NULL;
-
- /* If we have a left-hand child, go down and then right as far
- as we can. */
- if (node->rb_left) {
- node = node->rb_left;
- while (node->rb_right)
- node=node->rb_right;
- return node;
- }
-
- /* No left-hand children. Go up till we find an ancestor which
- is a right-hand child of its parent */
- while ((parent = rb_parent(node)) && node == parent->rb_left)
- node = parent;
-
- return parent;
-}
-
-void rb_replace_node(struct rb_node *victim, struct rb_node *new_node,
- struct rb_root *root)
-{
- struct rb_node *parent = rb_parent(victim);
-
- /* Set the surrounding nodes to point to the replacement */
- if (parent) {
- if (victim == parent->rb_left)
- parent->rb_left = new_node;
- else
- parent->rb_right = new_node;
- } else {
- root->rb_node = new_node;
- }
- if (victim->rb_left)
- rb_set_parent(victim->rb_left, new_node);
- if (victim->rb_right)
- rb_set_parent(victim->rb_right, new_node);
-
- /* Copy the pointers/colour from the victim to the replacement */
- *new_node = *victim;
-}
-
-void rb_link_node(struct rb_node * node, struct rb_node * parent,
- struct rb_node ** rb_link)
-{
- node->rb_parent_color = (unsigned long )parent;
- node->rb_left = node->rb_right = NULL;
-
- *rb_link = node;
-}
diff --git a/source3/lib/readline.c b/source3/lib/readline.c
index 254f55c86a..cafb5a9f62 100644
--- a/source3/lib/readline.c
+++ b/source3/lib/readline.c
@@ -45,6 +45,24 @@
# define RL_COMPLETION_CAST
#endif /* HAVE_NEW_LIBREADLINE */
+static bool smb_rl_done;
+
+#if HAVE_LIBREADLINE
+/*
+ * MacOS/X does not have rl_done in readline.h, but
+ * readline.so has it
+ */
+extern int rl_done;
+#endif
+
+void smb_readline_done(void)
+{
+ smb_rl_done = true;
+#if HAVE_LIBREADLINE
+ rl_done = 1;
+#endif
+}
+
/****************************************************************************
Display the prompt and wait for input. Call callback() regularly
****************************************************************************/
@@ -69,7 +87,7 @@ static char *smb_readline_replacement(const char *prompt, void (*callback)(void)
return NULL;
}
- while (1) {
+ while (!smb_rl_done) {
timeout.tv_sec = 5;
timeout.tv_usec = 0;
@@ -87,6 +105,7 @@ static char *smb_readline_replacement(const char *prompt, void (*callback)(void)
callback();
}
}
+ return NULL;
}
/****************************************************************************
diff --git a/source3/lib/replace/.checker_innocent b/source3/lib/replace/.checker_innocent
deleted file mode 100644
index e619176540..0000000000
--- a/source3/lib/replace/.checker_innocent
+++ /dev/null
@@ -1,4 +0,0 @@
->>>MISTAKE21_create_files_6a9e68ada99a97cb
->>>MISTAKE21_os2_delete_9b2bfa7f38711d09
->>>MISTAKE21_os2_delete_2fcc29aaa99a97cb
->>>SECURITY2_os2_delete_9b2bfa7f1c9396ca
diff --git a/source3/lib/replace/Makefile.in b/source3/lib/replace/Makefile.in
deleted file mode 100644
index c989835a8d..0000000000
--- a/source3/lib/replace/Makefile.in
+++ /dev/null
@@ -1,63 +0,0 @@
-#!gmake
-#
-CC = @CC@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-bindir = @bindir@
-includedir = @includedir@
-libdir = @libdir@
-VPATH = @libreplacedir@
-srcdir = @srcdir@
-builddir = @builddir@
-INSTALL = @INSTALL@
-LIBS = @LIBS@
-
-.PHONY: test all showflags install installcheck clean distclean realdistclean
-
-CFLAGS=-I. @CFLAGS@
-LDFLAGS=@LDFLAGS@
-
-OBJS = @LIBREPLACEOBJ@
-
-all: showflags libreplace.a testsuite
-
-showflags:
- @echo 'libreplace will be compiled with flags:'
- @echo ' CC = $(CC)'
- @echo ' CFLAGS = $(CFLAGS)'
- @echo ' LDFLAGS= $(LDFLAGS)'
- @echo ' LIBS = $(LIBS)'
-
-install: all
- mkdir -p $(libdir)
- $(INSTALL) libreplace.a $(libdir)
-
-libreplace.a: $(OBJS)
- ar -rcsv $@ $(OBJS)
-
-test: all
- ./testsuite
-
-installcheck: install test
-
-TEST_OBJS = test/testsuite.o test/os2_delete.o test/strptime.o test/getifaddrs.o
-
-testsuite: libreplace.a $(TEST_OBJS)
- $(CC) -o testsuite $(TEST_OBJS) -L. -lreplace $(LDFLAGS) $(LIBS)
-
-.c.o:
- @echo Compiling $*.c
- @mkdir -p `dirname $@`
- @$(CC) $(CFLAGS) -c $< -o $@
-
-clean:
- rm -f *.o test/*.o *.a testsuite
- rm -f testfile.dat
-
-distclean: clean
- rm -f *~ */*~
- rm -f config.log config.status config.h config.cache
- rm -f Makefile
-
-realdistclean: distclean
- rm -f configure config.h.in
diff --git a/source3/lib/replace/README b/source3/lib/replace/README
deleted file mode 100644
index 4d94317c4b..0000000000
--- a/source3/lib/replace/README
+++ /dev/null
@@ -1,113 +0,0 @@
-This subsystem ensures that we can always use a certain core set of
-functions and types, that are either provided by the OS or by replacement
-functions / definitions in this subsystem. The aim is to try to stick
-to POSIX functions in here as much as possible. Convenience functions
-that are available on no platform at all belong in other subsystems
-(such as LIBUTIL).
-
-The following functions are guaranteed:
-
-ftruncate
-strlcpy
-strlcat
-mktime
-rename
-initgroups
-memmove
-strdup
-setlinebuf
-vsyslog
-timegm
-setenv
-unsetenv
-strndup
-strnlen
-waitpid
-seteuid
-setegid
-asprintf
-snprintf
-vasprintf
-vsnprintf
-opendir
-readdir
-telldir
-seekdir
-closedir
-dlopen
-dlclose
-dlsym
-dlerror
-chroot
-bzero
-strerror
-errno
-mkdtemp
-mkstemp (a secure one!)
-pread
-pwrite
-getpass
-readline (the library)
-inet_ntoa
-inet_ntop
-inet_pton
-inet_aton
-strtoll
-strtoull
-socketpair
-strptime
-getaddrinfo
-freeaddrinfo
-getnameinfo
-gai_strerror
-getifaddrs
-freeifaddrs
-utime
-utimes
-
-Types:
-bool
-socklen_t
-uint_t
-uint{8,16,32,64}_t
-int{8,16,32,64}_t
-intptr_t
-
-Constants:
-PATH_NAME_MAX
-UINT{16,32,64}_MAX
-INT32_MAX
-RTLD_LAZY
-HOST_NAME_MAX
-UINT16_MAX
-UINT32_MAX
-UINT64_MAX
-CHAR_BIT
-
-Macros:
-va_copy
-__FUNCTION__
-__FILE__
-__LINE__
-__LINESTR__
-__location__
-__STRING
-__STRINGSTRING
-MIN
-MAX
-QSORT_CAST
-ZERO_STRUCT
-ZERO_STRUCTP
-ZERO_STRUCTPN
-ZERO_ARRAY
-ARRAY_SIZE
-PTR_DIFF
-
-Headers:
-stdint.h
-stdbool.h
-
-Prerequisites:
-memset (for bzero)
-syslog (for vsyslog)
-mktemp (for mkstemp and mkdtemp)
diff --git a/source3/lib/replace/aclocal.m4 b/source3/lib/replace/aclocal.m4
deleted file mode 100644
index 5605e476ba..0000000000
--- a/source3/lib/replace/aclocal.m4
+++ /dev/null
@@ -1 +0,0 @@
-m4_include(libreplace.m4)
diff --git a/source3/lib/replace/autoconf-2.60.m4 b/source3/lib/replace/autoconf-2.60.m4
deleted file mode 100644
index acdcd38efe..0000000000
--- a/source3/lib/replace/autoconf-2.60.m4
+++ /dev/null
@@ -1,210 +0,0 @@
-# AC_GNU_SOURCE
-# --------------
-AC_DEFUN([AC_GNU_SOURCE],
-[AH_VERBATIM([_GNU_SOURCE],
-[/* Enable GNU extensions on systems that have them. */
-#ifndef _GNU_SOURCE
-# undef _GNU_SOURCE
-#endif])dnl
-AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
-AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
-AC_DEFINE([_GNU_SOURCE])
-])
-
-# _AC_C_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST,
-# ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE)
-# --------------------------------------------------------------
-# Check whether the C compiler accepts features of STANDARD (e.g `c89', `c99')
-# by trying to compile a program of TEST-PROLOGUE and TEST-BODY. If this fails,
-# try again with each compiler option in the space-separated OPTION-LIST; if one
-# helps, append it to CC. If eventually successful, run ACTION-IF-AVAILABLE,
-# else ACTION-IF-UNAVAILABLE.
-AC_DEFUN([_AC_C_STD_TRY],
-[AC_MSG_CHECKING([for $CC option to accept ISO ]m4_translit($1, [c], [C]))
-AC_CACHE_VAL(ac_cv_prog_cc_$1,
-[ac_cv_prog_cc_$1=no
-ac_save_CC=$CC
-AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])])
-for ac_arg in '' $4
-do
- CC="$ac_save_CC $ac_arg"
- _AC_COMPILE_IFELSE([], [ac_cv_prog_cc_$1=$ac_arg])
- test "x$ac_cv_prog_cc_$1" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
-])# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_$1" in
- x)
- AC_MSG_RESULT([none needed]) ;;
- xno)
- AC_MSG_RESULT([unsupported]) ;;
- *)
- CC="$CC $ac_cv_prog_cc_$1"
- AC_MSG_RESULT([$ac_cv_prog_cc_$1]) ;;
-esac
-AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$5], [$6])
-])# _AC_C_STD_TRY
-
-# _AC_PROG_CC_C99 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
-# ----------------------------------------------------------------
-# If the C compiler is not in ISO C99 mode by default, try to add an
-# option to output variable CC to make it so. This macro tries
-# various options that select ISO C99 on some system or another. It
-# considers the compiler to be in ISO C99 mode if it handles mixed
-# code and declarations, _Bool, inline and restrict.
-AC_DEFUN([_AC_PROG_CC_C99],
-[_AC_C_STD_TRY([c99],
-[[#include <stdarg.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <stdio.h>
-
-struct incomplete_array
-{
- int datasize;
- double data[];
-};
-
-struct named_init {
- int number;
- const wchar_t *name;
- double average;
-};
-
-typedef const char *ccp;
-
-static inline int
-test_restrict(ccp restrict text)
-{
- // See if C++-style comments work.
- // Iterate through items via the restricted pointer.
- // Also check for declarations in for loops.
- for (unsigned int i = 0; *(text+i) != '\0'; ++i)
- continue;
- return 0;
-}
-
-// Check varargs and va_copy work.
-static void
-test_varargs(const char *format, ...)
-{
- va_list args;
- va_start(args, format);
- va_list args_copy;
- va_copy(args_copy, args);
-
- const char *str;
- int number;
- float fnumber;
-
- while (*format)
- {
- switch (*format++)
- {
- case 's': // string
- str = va_arg(args_copy, const char *);
- break;
- case 'd': // int
- number = va_arg(args_copy, int);
- break;
- case 'f': // float
- fnumber = (float) va_arg(args_copy, double);
- break;
- default:
- break;
- }
- }
- va_end(args_copy);
- va_end(args);
-}
-]],
-[[
- // Check bool and long long datatypes.
- _Bool success = false;
- long long int bignum = -1234567890LL;
- unsigned long long int ubignum = 1234567890uLL;
-
- // Check restrict.
- if (test_restrict("String literal") != 0)
- success = true;
- char *restrict newvar = "Another string";
-
- // Check varargs.
- test_varargs("s, d' f .", "string", 65, 34.234);
-
- // Check incomplete arrays work.
- struct incomplete_array *ia =
- malloc(sizeof(struct incomplete_array) + (sizeof(double) * 10));
- ia->datasize = 10;
- for (int i = 0; i < ia->datasize; ++i)
- ia->data[i] = (double) i * 1.234;
-
- // Check named initialisers.
- struct named_init ni = {
- .number = 34,
- .name = L"Test wide string",
- .average = 543.34343,
- };
-
- ni.number = 58;
-
- int dynamic_array[ni.number];
- dynamic_array[43] = 543;
-
- // work around unused variable warnings
- return bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x';
-]],
-dnl Try
-dnl GCC -std=gnu99 (unused restrictive modes: -std=c99 -std=iso9899:1999)
-dnl AIX -qlanglvl=extc99 (unused restrictive mode: -qlanglvl=stdc99)
-dnl Intel ICC -c99
-dnl IRIX -c99
-dnl Solaris (unused because it causes the compiler to assume C99 semantics for
-dnl library functions, and this is invalid before Solaris 10: -xc99)
-dnl Tru64 -c99
-dnl with extended modes being tried first.
-[[-std=gnu99 -c99 -qlanglvl=extc99]], [$1], [$2])[]dnl
-])# _AC_PROG_CC_C99
-
-# AC_PROG_CC_C99
-# --------------
-AC_DEFUN([AC_PROG_CC_C99],
-[ AC_REQUIRE([AC_PROG_CC])dnl
- _AC_PROG_CC_C99
-])
-
-# AC_USE_SYSTEM_EXTENSIONS
-# ------------------------
-# Enable extensions on systems that normally disable them,
-# typically due to standards-conformance issues.
-AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
-[
- AC_BEFORE([$0], [AC_COMPILE_IFELSE])
- AC_BEFORE([$0], [AC_RUN_IFELSE])
-
- AC_REQUIRE([AC_GNU_SOURCE])
- AC_REQUIRE([AC_AIX])
- AC_REQUIRE([AC_MINIX])
-
- AH_VERBATIM([__EXTENSIONS__],
-[/* Enable extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# undef _POSIX_PTHREAD_SEMANTICS
-#endif])
- AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
- [ac_cv_safe_to_define___extensions__],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([
-# define __EXTENSIONS__ 1
- AC_INCLUDES_DEFAULT])],
- [ac_cv_safe_to_define___extensions__=yes],
- [ac_cv_safe_to_define___extensions__=no])])
- test $ac_cv_safe_to_define___extensions__ = yes &&
- AC_DEFINE([__EXTENSIONS__])
- AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
-])
diff --git a/source3/lib/replace/autogen.sh b/source3/lib/replace/autogen.sh
deleted file mode 100755
index d46a4279f3..0000000000
--- a/source3/lib/replace/autogen.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-rm -rf autom4te.cache
-rm -f configure config.h.in
-
-autoheader || exit 1
-autoconf || exit 1
-
-rm -rf autom4te.cache
-
-echo "Now run ./configure and then make."
-exit 0
-
diff --git a/source3/lib/replace/config.guess b/source3/lib/replace/config.guess
deleted file mode 100755
index 354dbe175a..0000000000
--- a/source3/lib/replace/config.guess
+++ /dev/null
@@ -1,1464 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-timestamp='2005-08-03'
-
-# This file 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/>.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner <per@bothner.com>.
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# This script attempts to guess a canonical system name similar to
-# config.sub. If it succeeds, it prints the system name on stdout, and
-# exits with 0. Otherwise, it exits with 1.
-#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help" >&2
- exit 1 ;;
- * )
- break ;;
- esac
-done
-
-if test $# != 0; then
- echo "$me: too many arguments$help" >&2
- exit 1
-fi
-
-trap 'exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
-# compiler to aid in system detection is discouraged as it requires
-# temporary files to be created and, as you can see below, it is a
-# headache to deal with in a portable fashion.
-
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-# Portable tmp directory creation inspired by the Autoconf team.
-
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,) echo "int x;" > $dummy.c ;
- for c in cc gcc c89 c99 ; do
- if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
- CC_FOR_BUILD="$c"; break ;
- fi ;
- done ;
- if test x"$CC_FOR_BUILD" = x ; then
- CC_FOR_BUILD=no_compiler_found ;
- fi
- ;;
- ,,*) CC_FOR_BUILD=$CC ;;
- ,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
- PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
- *:NetBSD:*:*)
- # NetBSD (nbsd) targets should (where applicable) match one or
- # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
- # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
- # switched to ELF, *-*-netbsd* would select the old
- # object file format. This provides both forward
- # compatibility and a consistent mechanism for selecting the
- # object file format.
- #
- # Note: NetBSD doesn't particularly care about the vendor
- # portion of the name. We always set it to "unknown".
- sysctl="sysctl -n hw.machine_arch"
- UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
- /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
- case "${UNAME_MACHINE_ARCH}" in
- armeb) machine=armeb-unknown ;;
- arm*) machine=arm-unknown ;;
- sh3el) machine=shl-unknown ;;
- sh3eb) machine=sh-unknown ;;
- *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
- esac
- # The Operating System including object format, if it has switched
- # to ELF recently, or will in the future.
- case "${UNAME_MACHINE_ARCH}" in
- arm*|i386|m68k|ns32k|sh3*|sparc|vax)
- eval $set_cc_for_build
- if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep __ELF__ >/dev/null
- then
- # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
- # Return netbsd for either. FIX?
- os=netbsd
- else
- os=netbsdelf
- fi
- ;;
- *)
- os=netbsd
- ;;
- esac
- # The OS release
- # Debian GNU/NetBSD machines have a different userland, and
- # thus, need a distinct triplet. However, they do not need
- # kernel version information, so it can be replaced with a
- # suitable tag, in the style of linux-gnu.
- case "${UNAME_VERSION}" in
- Debian*)
- release='-gnu'
- ;;
- *)
- release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- ;;
- esac
- # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
- # contains redundant information, the shorter form:
- # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "${machine}-${os}${release}"
- exit ;;
- *:OpenBSD:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
- exit ;;
- *:ekkoBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
- exit ;;
- macppc:MirBSD:*:*)
- echo powerppc-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- *:MirBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- alpha:OSF1:*:*)
- case $UNAME_RELEASE in
- *4.0)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- ;;
- *5.*)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
- ;;
- esac
- # According to Compaq, /usr/sbin/psrinfo has been available on
- # OSF/1 and Tru64 systems produced since 1995. I hope that
- # covers most systems running today. This code pipes the CPU
- # types through head -n 1, so we only detect the type of CPU 0.
- ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
- case "$ALPHA_CPU_TYPE" in
- "EV4 (21064)")
- UNAME_MACHINE="alpha" ;;
- "EV4.5 (21064)")
- UNAME_MACHINE="alpha" ;;
- "LCA4 (21066/21068)")
- UNAME_MACHINE="alpha" ;;
- "EV5 (21164)")
- UNAME_MACHINE="alphaev5" ;;
- "EV5.6 (21164A)")
- UNAME_MACHINE="alphaev56" ;;
- "EV5.6 (21164PC)")
- UNAME_MACHINE="alphapca56" ;;
- "EV5.7 (21164PC)")
- UNAME_MACHINE="alphapca57" ;;
- "EV6 (21264)")
- UNAME_MACHINE="alphaev6" ;;
- "EV6.7 (21264A)")
- UNAME_MACHINE="alphaev67" ;;
- "EV6.8CB (21264C)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8AL (21264B)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8CX (21264D)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.9A (21264/EV69A)")
- UNAME_MACHINE="alphaev69" ;;
- "EV7 (21364)")
- UNAME_MACHINE="alphaev7" ;;
- "EV7.9 (21364A)")
- UNAME_MACHINE="alphaev79" ;;
- esac
- # A Pn.n version is a patched version.
- # A Vn.n version is a released version.
- # A Tn.n version is a released field test version.
- # A Xn.n version is an unreleased experimental baselevel.
- # 1.2 uses "1.2" for uname -r.
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- exit ;;
- Alpha\ *:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # Should we change UNAME_MACHINE based on the output of uname instead
- # of the specific Alpha model?
- echo alpha-pc-interix
- exit ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit ;;
- Amiga*:UNIX_System_V:4.0:*)
- echo m68k-unknown-sysv4
- exit ;;
- *:[Aa]miga[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-amigaos
- exit ;;
- *:[Mm]orph[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-morphos
- exit ;;
- *:OS/390:*:*)
- echo i370-ibm-openedition
- exit ;;
- *:z/VM:*:*)
- echo s390-ibm-zvmoe
- exit ;;
- *:OS400:*:*)
- echo powerpc-ibm-os400
- exit ;;
- arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix${UNAME_RELEASE}
- exit ;;
- arm:riscos:*:*|arm:RISCOS:*:*)
- echo arm-unknown-riscos
- exit ;;
- SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit ;;
- Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
- # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit ;;
- NILE*:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit ;;
- DRS?6000:unix:4.0:6*)
- echo sparc-icl-nx6
- exit ;;
- DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
- case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7; exit ;;
- esac ;;
- sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- i86pc:SunOS:5.*:*)
- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:6*:*)
- # According to config.sub, this is the proper way to canonicalize
- # SunOS6. Hard to guess exactly what SunOS6 will be like, but
- # it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
- Series*|S4*)
- UNAME_RELEASE=`uname -v`
- ;;
- esac
- # Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit ;;
- sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit ;;
- sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
- case "`/bin/arch`" in
- sun3)
- echo m68k-sun-sunos${UNAME_RELEASE}
- ;;
- sun4)
- echo sparc-sun-sunos${UNAME_RELEASE}
- ;;
- esac
- exit ;;
- aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
- exit ;;
- # The situation for MiNT is a little confusing. The machine name
- # can be virtually everything (everything which is not
- # "atarist" or "atariste" at least should have a processor
- # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
- # to the lowercase version "mint" (or "freemint"). Finally
- # the system name "TOS" denotes a system which is actually not
- # MiNT. But MiNT is downward compatible to TOS, so this should
- # be no problem.
- atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit ;;
- hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit ;;
- *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit ;;
- m68k:machten:*:*)
- echo m68k-apple-machten${UNAME_RELEASE}
- exit ;;
- powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
- exit ;;
- RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit ;;
- RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit ;;
- VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit ;;
- 2020:CLIX:*:* | 2430:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit ;;
- mips:*:*:UMIPS | mips:*:*:RISCos)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h> /* for printf() prototype */
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
- #if defined (host_mips) && defined (MIPSEB)
- #if defined (SYSTYPE_SYSV)
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_SVR4)
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
- #endif
- #endif
- exit (-1);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c &&
- dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
- SYSTEM_NAME=`$dummy $dummyarg` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo mips-mips-riscos${UNAME_RELEASE}
- exit ;;
- Motorola:PowerMAX_OS:*:*)
- echo powerpc-motorola-powermax
- exit ;;
- Motorola:*:4.3:PL8-*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit ;;
- m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit ;;
- m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit ;;
- m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit ;;
- AViiON:dgux:*:*)
- # DG/UX returns AViiON for all architectures
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
- then
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
- [ ${TARGET_BINARY_INTERFACE}x = x ]
- then
- echo m88k-dg-dgux${UNAME_RELEASE}
- else
- echo m88k-dg-dguxbcs${UNAME_RELEASE}
- fi
- else
- echo i586-dg-dgux${UNAME_RELEASE}
- fi
- exit ;;
- M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit ;;
- M88*:*:R3*:*)
- # Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit ;;
- XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit ;;
- Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit ;;
- *:IRIX*:*:*)
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit ;;
- ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i*86:AIX:*:*)
- echo i386-ibm-aix
- exit ;;
- ia64:AIX:*:*)
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:2:3)
- if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <sys/systemcfg.h>
-
- main()
- {
- if (!__power_pc())
- exit(1);
- puts("powerpc-ibm-aix3.2.5");
- exit(0);
- }
-EOF
- if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
- then
- echo "$SYSTEM_NAME"
- else
- echo rs6000-ibm-aix3.2.5
- fi
- elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- echo rs6000-ibm-aix3.2.4
- else
- echo rs6000-ibm-aix3.2
- fi
- exit ;;
- *:AIX:*:[45])
- IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
- if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
- IBM_ARCH=rs6000
- else
- IBM_ARCH=powerpc
- fi
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:*:*)
- echo rs6000-ibm-aix
- exit ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- echo romp-ibm-bsd4.4
- exit ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit ;; # report: romp-ibm BSD 4.3
- *:BOSX:*:*)
- echo rs6000-bull-bosx
- exit ;;
- DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit ;;
- 9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit ;;
- hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit ;;
- 9000/[34678]??:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/[678][0-9][0-9])
- if [ -x /usr/bin/getconf ]; then
- sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "${sc_cpu_version}" in
- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
- 532) # CPU_PA_RISC2_0
- case "${sc_kernel_bits}" in
- 32) HP_ARCH="hppa2.0n" ;;
- 64) HP_ARCH="hppa2.0w" ;;
- '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
- esac ;;
- esac
- fi
- if [ "${HP_ARCH}" = "" ]; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-
- #define _HPUX_SOURCE
- #include <stdlib.h>
- #include <unistd.h>
-
- int main ()
- {
- #if defined(_SC_KERNEL_BITS)
- long bits = sysconf(_SC_KERNEL_BITS);
- #endif
- long cpu = sysconf (_SC_CPU_VERSION);
-
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
- case CPU_PA_RISC2_0:
- #if defined(_SC_KERNEL_BITS)
- switch (bits)
- {
- case 64: puts ("hppa2.0w"); break;
- case 32: puts ("hppa2.0n"); break;
- default: puts ("hppa2.0"); break;
- } break;
- #else /* !defined(_SC_KERNEL_BITS) */
- puts ("hppa2.0"); break;
- #endif
- default: puts ("hppa1.0"); break;
- }
- exit (0);
- }
-EOF
- (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
- test -z "$HP_ARCH" && HP_ARCH=hppa
- fi ;;
- esac
- if [ ${HP_ARCH} = "hppa2.0w" ]
- then
- eval $set_cc_for_build
-
- # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
- # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
- # generating 64-bit code. GNU and HP use different nomenclature:
- #
- # $ CC_FOR_BUILD=cc ./config.guess
- # => hppa2.0w-hp-hpux11.23
- # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
- # => hppa64-hp-hpux11.23
-
- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
- grep __LP64__ >/dev/null
- then
- HP_ARCH="hppa2.0w"
- else
- HP_ARCH="hppa64"
- fi
- fi
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit ;;
- ia64:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- echo ia64-hp-hpux${HPUX_REV}
- exit ;;
- 3050*:HI-UX:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <unistd.h>
- int
- main ()
- {
- long cpu = sysconf (_SC_CPU_VERSION);
- /* The order matters, because CPU_IS_HP_MC68K erroneously returns
- true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
- results, however. */
- if (CPU_IS_PA_RISC (cpu))
- {
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
- default: puts ("hppa-hitachi-hiuxwe2"); break;
- }
- }
- else if (CPU_IS_HP_MC68K (cpu))
- puts ("m68k-hitachi-hiuxwe2");
- else puts ("unknown-hitachi-hiuxwe2");
- exit (0);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo unknown-hitachi-hiuxwe2
- exit ;;
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
- echo hppa1.1-hp-bsd
- exit ;;
- 9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit ;;
- *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
- echo hppa1.0-hp-mpeix
- exit ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- echo hppa1.1-hp-osf
- exit ;;
- hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit ;;
- i*86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
- else
- echo ${UNAME_MACHINE}-unknown-osf1
- fi
- exit ;;
- parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit ;;
- C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit ;;
- C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit ;;
- C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit ;;
- C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit ;;
- CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
- | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
- -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*T3E:*:*:*)
- echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*SV1:*:*:*)
- echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- *:UNICOS/mp:*:*)
- echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
- FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- 5000:UNIX_System_V:4.*:*)
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit ;;
- sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:FreeBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit ;;
- i*:CYGWIN*:*)
- echo ${UNAME_MACHINE}-pc-cygwin
- exit ;;
- i*:MINGW*:*)
- echo ${UNAME_MACHINE}-pc-mingw32
- exit ;;
- i*:windows32*:*)
- # uname -m includes "-pc" on this system.
- echo ${UNAME_MACHINE}-mingw32
- exit ;;
- i*:PW*:*)
- echo ${UNAME_MACHINE}-pc-pw32
- exit ;;
- x86:Interix*:[34]*)
- echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
- exit ;;
- [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
- echo i${UNAME_MACHINE}-pc-mks
- exit ;;
- i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
- # UNAME_MACHINE based on the output of uname instead of i386?
- echo i586-pc-interix
- exit ;;
- i*:UWIN*:*)
- echo ${UNAME_MACHINE}-pc-uwin
- exit ;;
- amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
- echo x86_64-unknown-cygwin
- exit ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin
- exit ;;
- prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- *:GNU:*:*)
- # the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit ;;
- *:GNU/*:*:*)
- # other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
- exit ;;
- i*86:Minix:*:*)
- echo ${UNAME_MACHINE}-pc-minix
- exit ;;
- arm*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- cris:Linux:*:*)
- echo cris-axis-linux-gnu
- exit ;;
- crisv32:Linux:*:*)
- echo crisv32-axis-linux-gnu
- exit ;;
- frv:Linux:*:*)
- echo frv-unknown-linux-gnu
- exit ;;
- ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- mips:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef mips
- #undef mipsel
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=mipsel
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=mips
- #else
- CPU=
- #endif
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
- ;;
- mips64:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef mips64
- #undef mips64el
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=mips64el
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=mips64
- #else
- CPU=
- #endif
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
- ;;
- or32:Linux:*:*)
- echo or32-unknown-linux-gnu
- exit ;;
- ppc:Linux:*:*)
- echo powerpc-unknown-linux-gnu
- exit ;;
- ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-gnu
- exit ;;
- alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
- EV5) UNAME_MACHINE=alphaev5 ;;
- EV56) UNAME_MACHINE=alphaev56 ;;
- PCA56) UNAME_MACHINE=alphapca56 ;;
- PCA57) UNAME_MACHINE=alphapca56 ;;
- EV6) UNAME_MACHINE=alphaev6 ;;
- EV67) UNAME_MACHINE=alphaev67 ;;
- EV68*) UNAME_MACHINE=alphaev68 ;;
- esac
- objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
- exit ;;
- parisc:Linux:*:* | hppa:Linux:*:*)
- # Look for CPU level
- case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-gnu ;;
- PA8*) echo hppa2.0-unknown-linux-gnu ;;
- *) echo hppa-unknown-linux-gnu ;;
- esac
- exit ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-gnu
- exit ;;
- s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux
- exit ;;
- sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- x86_64:Linux:*:*)
- echo x86_64-unknown-linux-gnu
- exit ;;
- i*86:Linux:*:*)
- # The BFD linker knows what the default object file format is, so
- # first see if it will tell us. cd to the root directory to prevent
- # problems with other programs or directories called `ld' in the path.
- # Set LC_ALL=C to ensure ld outputs messages in English.
- ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
- | sed -ne '/supported targets:/!d
- s/[ ][ ]*/ /g
- s/.*supported targets: *//
- s/ .*//
- p'`
- case "$ld_supported_targets" in
- elf32-i386)
- TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
- ;;
- a.out-i386-linux)
- echo "${UNAME_MACHINE}-pc-linux-gnuaout"
- exit ;;
- coff-i386)
- echo "${UNAME_MACHINE}-pc-linux-gnucoff"
- exit ;;
- "")
- # Either a pre-BFD a.out linker (linux-gnuoldld) or
- # one that does not give us useful --help.
- echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
- exit ;;
- esac
- # Determine whether the default compiler is a.out or elf
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <features.h>
- #ifdef __ELF__
- # ifdef __GLIBC__
- # if __GLIBC__ >= 2
- LIBC=gnu
- # else
- LIBC=gnulibc1
- # endif
- # else
- LIBC=gnulibc1
- # endif
- #else
- #ifdef __INTEL_COMPILER
- LIBC=gnu
- #else
- LIBC=gnuaout
- #endif
- #endif
- #ifdef __dietlibc__
- LIBC=dietlibc
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
- test x"${LIBC}" != x && {
- echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
- exit
- }
- test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
- ;;
- i*86:DYNIX/ptx:4*:*)
- # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
- # earlier versions are messed up and put the nodename in both
- # sysname and nodename.
- echo i386-sequent-sysv4
- exit ;;
- i*86:UNIX_SV:4.2MP:2.*)
- # Unixware is an offshoot of SVR4, but it has its own version
- # number series starting with 2...
- # I am not positive that other SVR4 systems won't match this,
- # I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit ;;
- i*86:OS/2:*:*)
- # If we were able to find `uname', then EMX Unix compatibility
- # is probably installed.
- echo ${UNAME_MACHINE}-pc-os2-emx
- exit ;;
- i*86:XTS-300:*:STOP)
- echo ${UNAME_MACHINE}-unknown-stop
- exit ;;
- i*86:atheos:*:*)
- echo ${UNAME_MACHINE}-unknown-atheos
- exit ;;
- i*86:syllable:*:*)
- echo ${UNAME_MACHINE}-pc-syllable
- exit ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- i*86:*DOS:*:*)
- echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit ;;
- i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
- UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
- if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
- fi
- exit ;;
- i*86:*:5:[678]*)
- # UnixWare 7.x, OpenUNIX and OpenServer 6.
- case `/bin/uname -X | grep "^Machine"` in
- *486*) UNAME_MACHINE=i486 ;;
- *Pentium) UNAME_MACHINE=i586 ;;
- *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
- esac
- echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
- exit ;;
- i*86:*:3.2:*)
- if test -f /usr/options/cb.name; then
- UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
- elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
- (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
- (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
- && UNAME_MACHINE=i586
- (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
- && UNAME_MACHINE=i686
- (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
- && UNAME_MACHINE=i686
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
- else
- echo ${UNAME_MACHINE}-pc-sysv32
- fi
- exit ;;
- pc:*:*:*)
- # Left here for compatibility:
- # uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i386.
- echo i386-pc-msdosdjgpp
- exit ;;
- Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit ;;
- paragon:*:*:*)
- echo i860-intel-osf1
- exit ;;
- i860:*:4.*:*) # i860-SVR4
- if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
- else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
- fi
- exit ;;
- mini*:CTIX:SYS*5:*)
- # "miniframe"
- echo m68010-convergent-sysv
- exit ;;
- mc68k:UNIX:SYSTEM5:3.51m)
- echo m68k-convergent-sysv
- exit ;;
- M680?0:D-NIX:5.3:*)
- echo m68k-diab-dnix
- exit ;;
- M68*:*:R3V[5678]*:*)
- test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
- 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
- OS_REL=''
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
- 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4; exit; } ;;
- m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit ;;
- TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- rs6000:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
- echo powerpc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
- exit ;;
- RM*:ReliantUNIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- *:SINIX-*:*:*)
- if uname -p 2>/dev/null >/dev/null ; then
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo ${UNAME_MACHINE}-sni-sysv4
- else
- echo ns32k-sni-sysv
- fi
- exit ;;
- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit ;;
- *:UNIX_System_V:4*:FTX*)
- # From Gerald Hewes <hewes@openmarket.com>.
- # How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit ;;
- *:*:*:FTX*)
- # From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit ;;
- i*86:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo ${UNAME_MACHINE}-stratus-vos
- exit ;;
- *:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo hppa1.1-stratus-vos
- exit ;;
- mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit ;;
- news*:NEWS-OS:6*:*)
- echo mips-sony-newsos6
- exit ;;
- R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
- else
- echo mips-unknown-sysv${UNAME_RELEASE}
- fi
- exit ;;
- BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
- echo powerpc-be-beos
- exit ;;
- BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
- echo powerpc-apple-beos
- exit ;;
- BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
- echo i586-pc-beos
- exit ;;
- SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-6:SUPER-UX:*:*)
- echo sx6-nec-superux${UNAME_RELEASE}
- exit ;;
- Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Rhapsody:*:*)
- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Darwin:*:*)
- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- case $UNAME_PROCESSOR in
- *86) UNAME_PROCESSOR=i686 ;;
- unknown) UNAME_PROCESSOR=powerpc ;;
- esac
- echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
- exit ;;
- *:procnto*:*:* | *:QNX:[0123456789]*:*)
- UNAME_PROCESSOR=`uname -p`
- if test "$UNAME_PROCESSOR" = "x86"; then
- UNAME_PROCESSOR=i386
- UNAME_MACHINE=pc
- fi
- echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
- exit ;;
- *:QNX:*:4*)
- echo i386-pc-qnx
- exit ;;
- NSE-?:NONSTOP_KERNEL:*:*)
- echo nse-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSR-?:NONSTOP_KERNEL:*:*)
- echo nsr-tandem-nsk${UNAME_RELEASE}
- exit ;;
- *:NonStop-UX:*:*)
- echo mips-compaq-nonstopux
- exit ;;
- BS2000:POSIX*:*:*)
- echo bs2000-siemens-sysv
- exit ;;
- DS/*:UNIX_System_V:*:*)
- echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit ;;
- *:Plan9:*:*)
- # "uname -m" is not consistent, so use $cputype instead. 386
- # is converted to i386 for consistency with other x86
- # operating systems.
- if test "$cputype" = "386"; then
- UNAME_MACHINE=i386
- else
- UNAME_MACHINE="$cputype"
- fi
- echo ${UNAME_MACHINE}-unknown-plan9
- exit ;;
- *:TOPS-10:*:*)
- echo pdp10-unknown-tops10
- exit ;;
- *:TENEX:*:*)
- echo pdp10-unknown-tenex
- exit ;;
- KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
- echo pdp10-dec-tops20
- exit ;;
- XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
- echo pdp10-xkl-tops20
- exit ;;
- *:TOPS-20:*:*)
- echo pdp10-unknown-tops20
- exit ;;
- *:ITS:*:*)
- echo pdp10-unknown-its
- exit ;;
- SEI:*:*:SEIUX)
- echo mips-sei-seiux${UNAME_RELEASE}
- exit ;;
- *:DragonFly:*:*)
- echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit ;;
- *:*VMS:*:*)
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- case "${UNAME_MACHINE}" in
- A*) echo alpha-dec-vms ; exit ;;
- I*) echo ia64-dec-vms ; exit ;;
- V*) echo vax-dec-vms ; exit ;;
- esac ;;
- *:XENIX:*:SysV)
- echo i386-pc-xenix
- exit ;;
- i*86:skyos:*:*)
- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
- exit ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
- /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
- I don't know.... */
- printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
- printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
- "4"
-#else
- ""
-#endif
- ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
- printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
- printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
- int version;
- version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
- if (version < 4)
- printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
- else
- printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
- exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
- printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
- printf ("ns32k-encore-mach\n"); exit (0);
-#else
- printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
- printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
- printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
- printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
- struct utsname un;
-
- uname(&un);
-
- if (strncmp(un.version, "V2", 2) == 0) {
- printf ("i386-sequent-ptx2\n"); exit (0);
- }
- if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
- printf ("i386-sequent-ptx1\n"); exit (0);
- }
- printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-# include <sys/param.h>
-# if defined (BSD)
-# if BSD == 43
- printf ("vax-dec-bsd4.3\n"); exit (0);
-# else
-# if BSD == 199006
- printf ("vax-dec-bsd4.3reno\n"); exit (0);
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# endif
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# else
- printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
- printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
- exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
- case `getsysinfo -f cpu_type` in
- c1*)
- echo c1-convex-bsd
- exit ;;
- c2*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- c34*)
- echo c34-convex-bsd
- exit ;;
- c38*)
- echo c38-convex-bsd
- exit ;;
- c4*)
- echo c4-convex-bsd
- exit ;;
- esac
-fi
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
- http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
-and
- http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo = `(hostinfo) 2>/dev/null`
-/bin/universe = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/source3/lib/replace/config.sub b/source3/lib/replace/config.sub
deleted file mode 100755
index 23cd6fd75c..0000000000
--- a/source3/lib/replace/config.sub
+++ /dev/null
@@ -1,1577 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-timestamp='2005-07-08'
-
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine. It does not imply ALL GNU software can.
-#
-# This file 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/>.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support. The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
- $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help"
- exit 1 ;;
-
- *local*)
- # First pass through any local machine types.
- echo $1
- exit ;;
-
- * )
- break ;;
- esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
- exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
- exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
- nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
- kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
- os=-$maybe_os
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
- ;;
- *)
- basic_machine=`echo $1 | sed 's/-[^-]*$//'`
- if [ $basic_machine != $1 ]
- then os=`echo $1 | sed 's/.*-/-/'`
- else os=; fi
- ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work. We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
- -sun*os*)
- # Prevent following clause from handling this invalid input.
- ;;
- -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
- -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
- -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
- -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
- -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
- -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray)
- os=
- basic_machine=$1
- ;;
- -sim | -cisco | -oki | -wec | -winbond)
- os=
- basic_machine=$1
- ;;
- -scout)
- ;;
- -wrs)
- os=-vxworks
- basic_machine=$1
- ;;
- -chorusos*)
- os=-chorusos
- basic_machine=$1
- ;;
- -chorusrdb)
- os=-chorusrdb
- basic_machine=$1
- ;;
- -hiux*)
- os=-hiuxwe2
- ;;
- -sco5)
- os=-sco3.2v5
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco4)
- os=-sco3.2v4
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2v[4-9]*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco*)
- os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -udk*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -isc)
- os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -clix*)
- basic_machine=clipper-intergraph
- ;;
- -isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -lynx*)
- os=-lynxos
- ;;
- -ptx*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
- ;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
- ;;
- -psos*)
- os=-psos
- ;;
- -mint | -mint[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
- # Recognize the basic CPU types without company name.
- # Some are omitted here because they have special meanings below.
- 1750a | 580 \
- | a29k \
- | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
- | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
- | am33_2.0 \
- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
- | bfin \
- | c4x | clipper \
- | d10v | d30v | dlx | dsp16xx \
- | fr30 | frv \
- | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
- | i370 | i860 | i960 | ia64 \
- | ip2k | iq2000 \
- | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
- | mips | mipsbe | mipseb | mipsel | mipsle \
- | mips16 \
- | mips64 | mips64el \
- | mips64vr | mips64vrel \
- | mips64orion | mips64orionel \
- | mips64vr4100 | mips64vr4100el \
- | mips64vr4300 | mips64vr4300el \
- | mips64vr5000 | mips64vr5000el \
- | mips64vr5900 | mips64vr5900el \
- | mipsisa32 | mipsisa32el \
- | mipsisa32r2 | mipsisa32r2el \
- | mipsisa64 | mipsisa64el \
- | mipsisa64r2 | mipsisa64r2el \
- | mipsisa64sb1 | mipsisa64sb1el \
- | mipsisa64sr71k | mipsisa64sr71kel \
- | mipstx39 | mipstx39el \
- | mn10200 | mn10300 \
- | ms1 \
- | msp430 \
- | ns16k | ns32k \
- | or32 \
- | pdp10 | pdp11 | pj | pjl \
- | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
- | pyramid \
- | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
- | sh64 | sh64le \
- | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
- | sparcv8 | sparcv9 | sparcv9b \
- | strongarm \
- | tahoe | thumb | tic4x | tic80 | tron \
- | v850 | v850e \
- | we32k \
- | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
- | z8k)
- basic_machine=$basic_machine-unknown
- ;;
- m32c)
- basic_machine=$basic_machine-unknown
- ;;
- m6811 | m68hc11 | m6812 | m68hc12)
- # Motorola 68HC11/12.
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
- ;;
-
- # We use `pc' rather than `unknown'
- # because (1) that's what they normally are, and
- # (2) the word "unknown" tends to confuse beginning users.
- i*86 | x86_64)
- basic_machine=$basic_machine-pc
- ;;
- # Object if more than one company name word.
- *-*-*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
- # Recognize the basic CPU types with company name.
- 580-* \
- | a29k-* \
- | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
- | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
- | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
- | avr-* \
- | bfin-* | bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
- | clipper-* | craynv-* | cydra-* \
- | d10v-* | d30v-* | dlx-* \
- | elxsi-* \
- | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
- | h8300-* | h8500-* \
- | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
- | i*86-* | i860-* | i960-* | ia64-* \
- | ip2k-* | iq2000-* \
- | m32r-* | m32rle-* \
- | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* \
- | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
- | mips16-* \
- | mips64-* | mips64el-* \
- | mips64vr-* | mips64vrel-* \
- | mips64orion-* | mips64orionel-* \
- | mips64vr4100-* | mips64vr4100el-* \
- | mips64vr4300-* | mips64vr4300el-* \
- | mips64vr5000-* | mips64vr5000el-* \
- | mips64vr5900-* | mips64vr5900el-* \
- | mipsisa32-* | mipsisa32el-* \
- | mipsisa32r2-* | mipsisa32r2el-* \
- | mipsisa64-* | mipsisa64el-* \
- | mipsisa64r2-* | mipsisa64r2el-* \
- | mipsisa64sb1-* | mipsisa64sb1el-* \
- | mipsisa64sr71k-* | mipsisa64sr71kel-* \
- | mipstx39-* | mipstx39el-* \
- | mmix-* \
- | ms1-* \
- | msp430-* \
- | none-* | np1-* | ns16k-* | ns32k-* \
- | orion-* \
- | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
- | pyramid-* \
- | romp-* | rs6000-* \
- | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
- | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
- | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
- | sparclite-* \
- | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
- | tahoe-* | thumb-* \
- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
- | tron-* \
- | v850-* | v850e-* | vax-* \
- | we32k-* \
- | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
- | xstormy16-* | xtensa-* \
- | ymp-* \
- | z8k-*)
- ;;
- m32c-*)
- ;;
- # Recognize the various machine names and aliases which stand
- # for a CPU type and a company and sometimes even an OS.
- 386bsd)
- basic_machine=i386-unknown
- os=-bsd
- ;;
- 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- basic_machine=m68000-att
- ;;
- 3b*)
- basic_machine=we32k-att
- ;;
- a29khif)
- basic_machine=a29k-amd
- os=-udi
- ;;
- abacus)
- basic_machine=abacus-unknown
- ;;
- adobe68k)
- basic_machine=m68010-adobe
- os=-scout
- ;;
- alliant | fx80)
- basic_machine=fx80-alliant
- ;;
- altos | altos3068)
- basic_machine=m68k-altos
- ;;
- am29k)
- basic_machine=a29k-none
- os=-bsd
- ;;
- amd64)
- basic_machine=x86_64-pc
- ;;
- amd64-*)
- basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- amdahl)
- basic_machine=580-amdahl
- os=-sysv
- ;;
- amiga | amiga-*)
- basic_machine=m68k-unknown
- ;;
- amigaos | amigados)
- basic_machine=m68k-unknown
- os=-amigaos
- ;;
- amigaunix | amix)
- basic_machine=m68k-unknown
- os=-sysv4
- ;;
- apollo68)
- basic_machine=m68k-apollo
- os=-sysv
- ;;
- apollo68bsd)
- basic_machine=m68k-apollo
- os=-bsd
- ;;
- aux)
- basic_machine=m68k-apple
- os=-aux
- ;;
- balance)
- basic_machine=ns32k-sequent
- os=-dynix
- ;;
- c90)
- basic_machine=c90-cray
- os=-unicos
- ;;
- convex-c1)
- basic_machine=c1-convex
- os=-bsd
- ;;
- convex-c2)
- basic_machine=c2-convex
- os=-bsd
- ;;
- convex-c32)
- basic_machine=c32-convex
- os=-bsd
- ;;
- convex-c34)
- basic_machine=c34-convex
- os=-bsd
- ;;
- convex-c38)
- basic_machine=c38-convex
- os=-bsd
- ;;
- cray | j90)
- basic_machine=j90-cray
- os=-unicos
- ;;
- craynv)
- basic_machine=craynv-cray
- os=-unicosmp
- ;;
- cr16c)
- basic_machine=cr16c-unknown
- os=-elf
- ;;
- crds | unos)
- basic_machine=m68k-crds
- ;;
- crisv32 | crisv32-* | etraxfs*)
- basic_machine=crisv32-axis
- ;;
- cris | cris-* | etrax*)
- basic_machine=cris-axis
- ;;
- crx)
- basic_machine=crx-unknown
- os=-elf
- ;;
- da30 | da30-*)
- basic_machine=m68k-da30
- ;;
- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
- basic_machine=mips-dec
- ;;
- decsystem10* | dec10*)
- basic_machine=pdp10-dec
- os=-tops10
- ;;
- decsystem20* | dec20*)
- basic_machine=pdp10-dec
- os=-tops20
- ;;
- delta | 3300 | motorola-3300 | motorola-delta \
- | 3300-motorola | delta-motorola)
- basic_machine=m68k-motorola
- ;;
- delta88)
- basic_machine=m88k-motorola
- os=-sysv3
- ;;
- djgpp)
- basic_machine=i586-pc
- os=-msdosdjgpp
- ;;
- dpx20 | dpx20-*)
- basic_machine=rs6000-bull
- os=-bosx
- ;;
- dpx2* | dpx2*-bull)
- basic_machine=m68k-bull
- os=-sysv3
- ;;
- ebmon29k)
- basic_machine=a29k-amd
- os=-ebmon
- ;;
- elxsi)
- basic_machine=elxsi-elxsi
- os=-bsd
- ;;
- encore | umax | mmax)
- basic_machine=ns32k-encore
- ;;
- es1800 | OSE68k | ose68k | ose | OSE)
- basic_machine=m68k-ericsson
- os=-ose
- ;;
- fx2800)
- basic_machine=i860-alliant
- ;;
- genix)
- basic_machine=ns32k-ns
- ;;
- gmicro)
- basic_machine=tron-gmicro
- os=-sysv
- ;;
- go32)
- basic_machine=i386-pc
- os=-go32
- ;;
- h3050r* | hiux*)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- h8300hms)
- basic_machine=h8300-hitachi
- os=-hms
- ;;
- h8300xray)
- basic_machine=h8300-hitachi
- os=-xray
- ;;
- h8500hms)
- basic_machine=h8500-hitachi
- os=-hms
- ;;
- harris)
- basic_machine=m88k-harris
- os=-sysv3
- ;;
- hp300-*)
- basic_machine=m68k-hp
- ;;
- hp300bsd)
- basic_machine=m68k-hp
- os=-bsd
- ;;
- hp300hpux)
- basic_machine=m68k-hp
- os=-hpux
- ;;
- hp3k9[0-9][0-9] | hp9[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k2[0-9][0-9] | hp9k31[0-9])
- basic_machine=m68000-hp
- ;;
- hp9k3[2-9][0-9])
- basic_machine=m68k-hp
- ;;
- hp9k6[0-9][0-9] | hp6[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k7[0-79][0-9] | hp7[0-79][0-9])
- basic_machine=hppa1.1-hp
- ;;
- hp9k78[0-9] | hp78[0-9])
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][13679] | hp8[0-9][13679])
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][0-9] | hp8[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hppa-next)
- os=-nextstep3
- ;;
- hppaosf)
- basic_machine=hppa1.1-hp
- os=-osf
- ;;
- hppro)
- basic_machine=hppa1.1-hp
- os=-proelf
- ;;
- i370-ibm* | ibm*)
- basic_machine=i370-ibm
- ;;
-# I'm not sure what "Sysv32" means. Should this be sysv3.2?
- i*86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv32
- ;;
- i*86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
- ;;
- i*86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
- ;;
- i*86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-solaris2
- ;;
- i386mach)
- basic_machine=i386-mach
- os=-mach
- ;;
- i386-vsta | vsta)
- basic_machine=i386-unknown
- os=-vsta
- ;;
- iris | iris4d)
- basic_machine=mips-sgi
- case $os in
- -irix*)
- ;;
- *)
- os=-irix4
- ;;
- esac
- ;;
- isi68 | isi)
- basic_machine=m68k-isi
- os=-sysv
- ;;
- m88k-omron*)
- basic_machine=m88k-omron
- ;;
- magnum | m3230)
- basic_machine=mips-mips
- os=-sysv
- ;;
- merlin)
- basic_machine=ns32k-utek
- os=-sysv
- ;;
- mingw32)
- basic_machine=i386-pc
- os=-mingw32
- ;;
- miniframe)
- basic_machine=m68000-convergent
- ;;
- *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- monitor)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- morphos)
- basic_machine=powerpc-unknown
- os=-morphos
- ;;
- msdos)
- basic_machine=i386-pc
- os=-msdos
- ;;
- mvs)
- basic_machine=i370-ibm
- os=-mvs
- ;;
- ncr3000)
- basic_machine=i486-ncr
- os=-sysv4
- ;;
- netbsd386)
- basic_machine=i386-unknown
- os=-netbsd
- ;;
- netwinder)
- basic_machine=armv4l-rebel
- os=-linux
- ;;
- news | news700 | news800 | news900)
- basic_machine=m68k-sony
- os=-newsos
- ;;
- news1000)
- basic_machine=m68030-sony
- os=-newsos
- ;;
- news-3600 | risc-news)
- basic_machine=mips-sony
- os=-newsos
- ;;
- necv70)
- basic_machine=v70-nec
- os=-sysv
- ;;
- next | m*-next )
- basic_machine=m68k-next
- case $os in
- -nextstep* )
- ;;
- -ns2*)
- os=-nextstep2
- ;;
- *)
- os=-nextstep3
- ;;
- esac
- ;;
- nh3000)
- basic_machine=m68k-harris
- os=-cxux
- ;;
- nh[45]000)
- basic_machine=m88k-harris
- os=-cxux
- ;;
- nindy960)
- basic_machine=i960-intel
- os=-nindy
- ;;
- mon960)
- basic_machine=i960-intel
- os=-mon960
- ;;
- nonstopux)
- basic_machine=mips-compaq
- os=-nonstopux
- ;;
- np1)
- basic_machine=np1-gould
- ;;
- nsr-tandem)
- basic_machine=nsr-tandem
- ;;
- op50n-* | op60c-*)
- basic_machine=hppa1.1-oki
- os=-proelf
- ;;
- openrisc | openrisc-*)
- basic_machine=or32-unknown
- ;;
- os400)
- basic_machine=powerpc-ibm
- os=-os400
- ;;
- OSE68000 | ose68000)
- basic_machine=m68000-ericsson
- os=-ose
- ;;
- os68k)
- basic_machine=m68k-none
- os=-os68k
- ;;
- pa-hitachi)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- paragon)
- basic_machine=i860-intel
- os=-osf
- ;;
- pbd)
- basic_machine=sparc-tti
- ;;
- pbb)
- basic_machine=m68k-tti
- ;;
- pc532 | pc532-*)
- basic_machine=ns32k-pc532
- ;;
- pentium | p5 | k5 | k6 | nexgen | viac3)
- basic_machine=i586-pc
- ;;
- pentiumpro | p6 | 6x86 | athlon | athlon_*)
- basic_machine=i686-pc
- ;;
- pentiumii | pentium2 | pentiumiii | pentium3)
- basic_machine=i686-pc
- ;;
- pentium4)
- basic_machine=i786-pc
- ;;
- pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-* | 6x86-* | athlon-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium4-*)
- basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pn)
- basic_machine=pn-gould
- ;;
- power) basic_machine=power-ibm
- ;;
- ppc) basic_machine=powerpc-unknown
- ;;
- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppcle | powerpclittle | ppc-le | powerpc-little)
- basic_machine=powerpcle-unknown
- ;;
- ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64) basic_machine=powerpc64-unknown
- ;;
- ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64le | powerpc64little | ppc64-le | powerpc64-little)
- basic_machine=powerpc64le-unknown
- ;;
- ppc64le-* | powerpc64little-*)
- basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ps2)
- basic_machine=i386-ibm
- ;;
- pw32)
- basic_machine=i586-unknown
- os=-pw32
- ;;
- rom68k)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- rm[46]00)
- basic_machine=mips-siemens
- ;;
- rtpc | rtpc-*)
- basic_machine=romp-ibm
- ;;
- s390 | s390-*)
- basic_machine=s390-ibm
- ;;
- s390x | s390x-*)
- basic_machine=s390x-ibm
- ;;
- sa29200)
- basic_machine=a29k-amd
- os=-udi
- ;;
- sb1)
- basic_machine=mipsisa64sb1-unknown
- ;;
- sb1el)
- basic_machine=mipsisa64sb1el-unknown
- ;;
- sei)
- basic_machine=mips-sei
- os=-seiux
- ;;
- sequent)
- basic_machine=i386-sequent
- ;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
- ;;
- sh64)
- basic_machine=sh64-unknown
- ;;
- sparclite-wrs | simso-wrs)
- basic_machine=sparclite-wrs
- os=-vxworks
- ;;
- sps7)
- basic_machine=m68k-bull
- os=-sysv2
- ;;
- spur)
- basic_machine=spur-unknown
- ;;
- st2000)
- basic_machine=m68k-tandem
- ;;
- stratus)
- basic_machine=i860-stratus
- os=-sysv4
- ;;
- sun2)
- basic_machine=m68000-sun
- ;;
- sun2os3)
- basic_machine=m68000-sun
- os=-sunos3
- ;;
- sun2os4)
- basic_machine=m68000-sun
- os=-sunos4
- ;;
- sun3os3)
- basic_machine=m68k-sun
- os=-sunos3
- ;;
- sun3os4)
- basic_machine=m68k-sun
- os=-sunos4
- ;;
- sun4os3)
- basic_machine=sparc-sun
- os=-sunos3
- ;;
- sun4os4)
- basic_machine=sparc-sun
- os=-sunos4
- ;;
- sun4sol2)
- basic_machine=sparc-sun
- os=-solaris2
- ;;
- sun3 | sun3-*)
- basic_machine=m68k-sun
- ;;
- sun4)
- basic_machine=sparc-sun
- ;;
- sun386 | sun386i | roadrunner)
- basic_machine=i386-sun
- ;;
- sv1)
- basic_machine=sv1-cray
- os=-unicos
- ;;
- symmetry)
- basic_machine=i386-sequent
- os=-dynix
- ;;
- t3e)
- basic_machine=alphaev5-cray
- os=-unicos
- ;;
- t90)
- basic_machine=t90-cray
- os=-unicos
- ;;
- tic54x | c54x*)
- basic_machine=tic54x-unknown
- os=-coff
- ;;
- tic55x | c55x*)
- basic_machine=tic55x-unknown
- os=-coff
- ;;
- tic6x | c6x*)
- basic_machine=tic6x-unknown
- os=-coff
- ;;
- tx39)
- basic_machine=mipstx39-unknown
- ;;
- tx39el)
- basic_machine=mipstx39el-unknown
- ;;
- toad1)
- basic_machine=pdp10-xkl
- os=-tops20
- ;;
- tower | tower-32)
- basic_machine=m68k-ncr
- ;;
- tpf)
- basic_machine=s390x-ibm
- os=-tpf
- ;;
- udi29k)
- basic_machine=a29k-amd
- os=-udi
- ;;
- ultra3)
- basic_machine=a29k-nyu
- os=-sym1
- ;;
- v810 | necv810)
- basic_machine=v810-nec
- os=-none
- ;;
- vaxv)
- basic_machine=vax-dec
- os=-sysv
- ;;
- vms)
- basic_machine=vax-dec
- os=-vms
- ;;
- vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
- ;;
- vxworks960)
- basic_machine=i960-wrs
- os=-vxworks
- ;;
- vxworks68)
- basic_machine=m68k-wrs
- os=-vxworks
- ;;
- vxworks29k)
- basic_machine=a29k-wrs
- os=-vxworks
- ;;
- w65*)
- basic_machine=w65-wdc
- os=-none
- ;;
- w89k-*)
- basic_machine=hppa1.1-winbond
- os=-proelf
- ;;
- xbox)
- basic_machine=i686-pc
- os=-mingw32
- ;;
- xps | xps100)
- basic_machine=xps100-honeywell
- ;;
- ymp)
- basic_machine=ymp-cray
- os=-unicos
- ;;
- z8k-*-coff)
- basic_machine=z8k-unknown
- os=-sim
- ;;
- none)
- basic_machine=none-none
- os=-none
- ;;
-
-# Here we handle the default manufacturer of certain CPU types. It is in
-# some cases the only manufacturer, in others, it is the most popular.
- w89k)
- basic_machine=hppa1.1-winbond
- ;;
- op50n)
- basic_machine=hppa1.1-oki
- ;;
- op60c)
- basic_machine=hppa1.1-oki
- ;;
- romp)
- basic_machine=romp-ibm
- ;;
- mmix)
- basic_machine=mmix-knuth
- ;;
- rs6000)
- basic_machine=rs6000-ibm
- ;;
- vax)
- basic_machine=vax-dec
- ;;
- pdp10)
- # there are many clones, so DEC is not a safe bet
- basic_machine=pdp10-unknown
- ;;
- pdp11)
- basic_machine=pdp11-dec
- ;;
- we32k)
- basic_machine=we32k-att
- ;;
- sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
- basic_machine=sh-unknown
- ;;
- sparc | sparcv8 | sparcv9 | sparcv9b)
- basic_machine=sparc-sun
- ;;
- cydra)
- basic_machine=cydra-cydrome
- ;;
- orion)
- basic_machine=orion-highlevel
- ;;
- orion105)
- basic_machine=clipper-highlevel
- ;;
- mac | mpw | mac-mpw)
- basic_machine=m68k-apple
- ;;
- pmac | pmac-mpw)
- basic_machine=powerpc-apple
- ;;
- *-unknown)
- # Make sure to match an already-canonicalized machine name.
- ;;
- *)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
- *-digital*)
- basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
- ;;
- *-commodore*)
- basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
- ;;
- *)
- ;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
- # -solaris* is a basic system type, with this one exception.
- -solaris1 | -solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
- ;;
- -solaris)
- os=-solaris2
- ;;
- -svr4*)
- os=-sysv4
- ;;
- -unixware*)
- os=-sysv4.2uw
- ;;
- -gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
- # First accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST END IN A *, to match a version number.
- # -sysv* is not here because it comes later, after sysvr4.
- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* \
- | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
- | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
- | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -chorusos* | -chorusrdb* \
- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
- | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
- | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
- | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -qnx*)
- case $basic_machine in
- x86-* | i*86-*)
- ;;
- *)
- os=-nto$os
- ;;
- esac
- ;;
- -nto-qnx*)
- ;;
- -nto*)
- os=`echo $os | sed -e 's|nto|nto-qnx|'`
- ;;
- -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
- | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
- ;;
- -mac*)
- os=`echo $os | sed -e 's|mac|macos|'`
- ;;
- -linux-dietlibc)
- os=-linux-dietlibc
- ;;
- -linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
- ;;
- -sunos5*)
- os=`echo $os | sed -e 's|sunos5|solaris2|'`
- ;;
- -sunos6*)
- os=`echo $os | sed -e 's|sunos6|solaris3|'`
- ;;
- -opened*)
- os=-openedition
- ;;
- -os400*)
- os=-os400
- ;;
- -wince*)
- os=-wince
- ;;
- -osfrose*)
- os=-osfrose
- ;;
- -osf*)
- os=-osf
- ;;
- -utek*)
- os=-bsd
- ;;
- -dynix*)
- os=-bsd
- ;;
- -acis*)
- os=-aos
- ;;
- -atheos*)
- os=-atheos
- ;;
- -syllable*)
- os=-syllable
- ;;
- -386bsd)
- os=-bsd
- ;;
- -ctix* | -uts*)
- os=-sysv
- ;;
- -nova*)
- os=-rtmk-nova
- ;;
- -ns2 )
- os=-nextstep2
- ;;
- -nsk*)
- os=-nsk
- ;;
- # Preserve the version number of sinix5.
- -sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
- ;;
- -sinix*)
- os=-sysv4
- ;;
- -tpf*)
- os=-tpf
- ;;
- -triton*)
- os=-sysv3
- ;;
- -oss*)
- os=-sysv3
- ;;
- -svr4)
- os=-sysv4
- ;;
- -svr3)
- os=-sysv3
- ;;
- -sysvr4)
- os=-sysv4
- ;;
- # This must come after -sysvr4.
- -sysv*)
- ;;
- -ose*)
- os=-ose
- ;;
- -es1800*)
- os=-ose
- ;;
- -xenix)
- os=-xenix
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- os=-mint
- ;;
- -aros*)
- os=-aros
- ;;
- -kaos*)
- os=-kaos
- ;;
- -zvmoe)
- os=-zvmoe
- ;;
- -none)
- ;;
- *)
- # Get rid of the `-' at the beginning of $os.
- os=`echo $os | sed 's/[^-]*-//'`
- echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
- exit 1
- ;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system. Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
- *-acorn)
- os=-riscix1.2
- ;;
- arm*-rebel)
- os=-linux
- ;;
- arm*-semi)
- os=-aout
- ;;
- c4x-* | tic4x-*)
- os=-coff
- ;;
- # This must come before the *-dec entry.
- pdp10-*)
- os=-tops20
- ;;
- pdp11-*)
- os=-none
- ;;
- *-dec | vax-*)
- os=-ultrix4.2
- ;;
- m68*-apollo)
- os=-domain
- ;;
- i386-sun)
- os=-sunos4.0.2
- ;;
- m68000-sun)
- os=-sunos3
- # This also exists in the configure program, but was not the
- # default.
- # os=-sunos4
- ;;
- m68*-cisco)
- os=-aout
- ;;
- mips*-cisco)
- os=-elf
- ;;
- mips*-*)
- os=-elf
- ;;
- or32-*)
- os=-coff
- ;;
- *-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
- ;;
- sparc-* | *-sun)
- os=-sunos4.1.1
- ;;
- *-be)
- os=-beos
- ;;
- *-haiku)
- os=-haiku
- ;;
- *-ibm)
- os=-aix
- ;;
- *-knuth)
- os=-mmixware
- ;;
- *-wec)
- os=-proelf
- ;;
- *-winbond)
- os=-proelf
- ;;
- *-oki)
- os=-proelf
- ;;
- *-hp)
- os=-hpux
- ;;
- *-hitachi)
- os=-hiux
- ;;
- i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- os=-sysv
- ;;
- *-cbm)
- os=-amigaos
- ;;
- *-dg)
- os=-dgux
- ;;
- *-dolphin)
- os=-sysv3
- ;;
- m68k-ccur)
- os=-rtu
- ;;
- m88k-omron*)
- os=-luna
- ;;
- *-next )
- os=-nextstep
- ;;
- *-sequent)
- os=-ptx
- ;;
- *-crds)
- os=-unos
- ;;
- *-ns)
- os=-genix
- ;;
- i370-*)
- os=-mvs
- ;;
- *-next)
- os=-nextstep3
- ;;
- *-gould)
- os=-sysv
- ;;
- *-highlevel)
- os=-bsd
- ;;
- *-encore)
- os=-bsd
- ;;
- *-sgi)
- os=-irix
- ;;
- *-siemens)
- os=-sysv4
- ;;
- *-masscomp)
- os=-rtu
- ;;
- f30[01]-fujitsu | f700-fujitsu)
- os=-uxpv
- ;;
- *-rom68k)
- os=-coff
- ;;
- *-*bug)
- os=-coff
- ;;
- *-apple)
- os=-macos
- ;;
- *-atari*)
- os=-mint
- ;;
- *)
- os=-none
- ;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer. We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
- *-unknown)
- case $os in
- -riscix*)
- vendor=acorn
- ;;
- -sunos*)
- vendor=sun
- ;;
- -aix*)
- vendor=ibm
- ;;
- -beos*)
- vendor=be
- ;;
- -hpux*)
- vendor=hp
- ;;
- -mpeix*)
- vendor=hp
- ;;
- -hiux*)
- vendor=hitachi
- ;;
- -unos*)
- vendor=crds
- ;;
- -dgux*)
- vendor=dg
- ;;
- -luna*)
- vendor=omron
- ;;
- -genix*)
- vendor=ns
- ;;
- -mvs* | -opened*)
- vendor=ibm
- ;;
- -os400*)
- vendor=ibm
- ;;
- -ptx*)
- vendor=sequent
- ;;
- -tpf*)
- vendor=ibm
- ;;
- -vxsim* | -vxworks* | -windiss*)
- vendor=wrs
- ;;
- -aux*)
- vendor=apple
- ;;
- -hms*)
- vendor=hitachi
- ;;
- -mpw* | -macos*)
- vendor=apple
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- vendor=atari
- ;;
- -vos*)
- vendor=stratus
- ;;
- esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- ;;
-esac
-
-echo $basic_machine$os
-exit
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/source3/lib/replace/configure.ac b/source3/lib/replace/configure.ac
deleted file mode 100644
index 81997e09b7..0000000000
--- a/source3/lib/replace/configure.ac
+++ /dev/null
@@ -1,30 +0,0 @@
-AC_PREREQ(2.50)
-AC_INIT(replace.c)
-AC_CONFIG_SRCDIR([replace.c])
-AC_CONFIG_HEADER(config.h)
-
-CFLAGS="$CFLAGS -I$srcdir"
-
-AC_LIBREPLACE_ALL_CHECKS
-AC_LIBREPLACE_NETWORK_CHECKS
-
-if test "$ac_cv_prog_gcc" = yes; then
- CFLAGS="$CFLAGS -Wall"
- CFLAGS="$CFLAGS -W"
- CFLAGS="$CFLAGS -Wshadow"
- CFLAGS="$CFLAGS -Wstrict-prototypes"
- CFLAGS="$CFLAGS -Wpointer-arith"
- CFLAGS="$CFLAGS -Wcast-qual"
- CFLAGS="$CFLAGS -Wcast-align"
- CFLAGS="$CFLAGS -Wwrite-strings"
- CFLAGS="$CFLAGS -Werror-implicit-function-declaration"
- CFLAGS="$CFLAGS -Wformat=2"
- CFLAGS="$CFLAGS -Wno-format-y2k"
-fi
-
-LIBS="${LIBREPLACE_NETWORK_LIBS}"
-AC_SUBST(LIBS)
-
-AC_SUBST(LDFLAGS)
-
-AC_OUTPUT(Makefile)
diff --git a/source3/lib/replace/dlfcn.c b/source3/lib/replace/dlfcn.c
deleted file mode 100644
index 3b109d7e40..0000000000
--- a/source3/lib/replace/dlfcn.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Samba system utilities
- Copyright (C) Andrew Tridgell 1992-1998
- Copyright (C) Jeremy Allison 1998-2002
-
- ** 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/>.
-*/
-
-#include "replace.h"
-#ifdef HAVE_DL_H
-#include <dl.h>
-#endif
-
-#ifndef HAVE_DLOPEN
-#ifdef DLOPEN_TAKES_UNSIGNED_FLAGS
-void *rep_dlopen(const char *name, unsigned int flags)
-#else
-void *rep_dlopen(const char *name, int flags)
-#endif
-{
-#ifdef HAVE_SHL_LOAD
- if (name == NULL)
- return PROG_HANDLE;
- return (void *)shl_load(name, flags, 0);
-#else
- return NULL;
-#endif
-}
-#endif
-
-#ifndef HAVE_DLSYM
-void *rep_dlsym(void *handle, const char *symbol)
-{
-#ifdef HAVE_SHL_FINDSYM
- void *sym_addr;
- if (!shl_findsym((shl_t *)&handle, symbol, TYPE_UNDEFINED, &sym_addr))
- return sym_addr;
-#endif
- return NULL;
-}
-#endif
-
-#ifndef HAVE_DLERROR
-char *rep_dlerror(void)
-{
- return "dynamic loading of objects not supported on this platform";
-}
-#endif
-
-#ifndef HAVE_DLCLOSE
-int rep_dlclose(void *handle)
-{
-#ifdef HAVE_SHL_CLOSE
- return shl_unload((shl_t)handle);
-#else
- return 0;
-#endif
-}
-#endif
diff --git a/source3/lib/replace/dlfcn.m4 b/source3/lib/replace/dlfcn.m4
deleted file mode 100644
index 42f56f26be..0000000000
--- a/source3/lib/replace/dlfcn.m4
+++ /dev/null
@@ -1,31 +0,0 @@
-dnl dummies provided by dlfcn.c if not available
-save_LIBS="$LIBS"
-LIBS=""
-
-libreplace_cv_dlfcn=no
-AC_SEARCH_LIBS(dlopen, dl)
-
-AC_CHECK_HEADERS(dlfcn.h)
-AC_CHECK_FUNCS([dlopen dlsym dlerror dlclose],[],[libreplace_cv_dlfcn=yes])
-
-libreplace_cv_shl=no
-AC_SEARCH_LIBS(shl_load, sl)
-AC_CHECK_HEADERS(dl.h)
-AC_CHECK_FUNCS([shl_load shl_unload shl_findsym],[],[libreplace_cv_shl=yes])
-
-AC_VERIFY_C_PROTOTYPE([void *dlopen(const char* filename, unsigned int flags)],
- [
- return 0;
- ],[
- AC_DEFINE(DLOPEN_TAKES_UNSIGNED_FLAGS, 1, [Whether dlopen takes unsigned int flags])
- ],[],[
- #include <dlfcn.h>
- ])
-
-if test x"${libreplace_cv_dlfcn}" = x"yes";then
- LIBREPLACEOBJ="${LIBREPLACEOBJ} dlfcn.o"
-fi
-
-LIBDL="$LIBS"
-AC_SUBST(LIBDL)
-LIBS="$save_LIBS"
diff --git a/source3/lib/replace/getaddrinfo.c b/source3/lib/replace/getaddrinfo.c
deleted file mode 100644
index c5cd52be93..0000000000
--- a/source3/lib/replace/getaddrinfo.c
+++ /dev/null
@@ -1,497 +0,0 @@
-/*
-PostgreSQL Database Management System
-(formerly known as Postgres, then as Postgres95)
-
-Portions Copyright (c) 1996-2005, The PostgreSQL Global Development Group
-
-Portions Copyright (c) 1994, The Regents of the University of California
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose, without fee, and without a written agreement
-is hereby granted, provided that the above copyright notice and this paragraph
-and the following two paragraphs appear in all copies.
-
-IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
-DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
-LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
-EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
-THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS
-TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-
-*/
-
-/*-------------------------------------------------------------------------
- *
- * getaddrinfo.c
- * Support getaddrinfo() on platforms that don't have it.
- *
- * We also supply getnameinfo() here, assuming that the platform will have
- * it if and only if it has getaddrinfo(). If this proves false on some
- * platform, we'll need to split this file and provide a separate configure
- * test for getnameinfo().
- *
- * Copyright (c) 2003-2007, PostgreSQL Global Development Group
- *
- * Copyright (C) 2007 Jeremy Allison.
- * Modified to return multiple IPv4 addresses for Samba.
- *
- *-------------------------------------------------------------------------
- */
-
-#include "replace.h"
-#include "system/network.h"
-
-#ifndef SMB_MALLOC
-#define SMB_MALLOC(s) malloc(s)
-#endif
-
-#ifndef SMB_STRDUP
-#define SMB_STRDUP(s) strdup(s)
-#endif
-
-static int check_hostent_err(struct hostent *hp)
-{
- if (!hp) {
- switch (h_errno) {
- case HOST_NOT_FOUND:
- case NO_DATA:
- return EAI_NONAME;
- case TRY_AGAIN:
- return EAI_AGAIN;
- case NO_RECOVERY:
- default:
- return EAI_FAIL;
- }
- }
- if (!hp->h_name || hp->h_addrtype != AF_INET) {
- return EAI_FAIL;
- }
- return 0;
-}
-
-static char *canon_name_from_hostent(struct hostent *hp,
- int *perr)
-{
- char *ret = NULL;
-
- *perr = check_hostent_err(hp);
- if (*perr) {
- return NULL;
- }
- ret = SMB_STRDUP(hp->h_name);
- if (!ret) {
- *perr = EAI_MEMORY;
- }
- return ret;
-}
-
-static char *get_my_canon_name(int *perr)
-{
- char name[HOST_NAME_MAX+1];
-
- if (gethostname(name, HOST_NAME_MAX) == -1) {
- *perr = EAI_FAIL;
- return NULL;
- }
- /* Ensure null termination. */
- name[HOST_NAME_MAX] = '\0';
- return canon_name_from_hostent(gethostbyname(name), perr);
-}
-
-static char *get_canon_name_from_addr(struct in_addr ip,
- int *perr)
-{
- return canon_name_from_hostent(
- gethostbyaddr(&ip, sizeof(ip), AF_INET),
- perr);
-}
-
-static struct addrinfo *alloc_entry(const struct addrinfo *hints,
- struct in_addr ip,
- unsigned short port)
-{
- struct sockaddr_in *psin = NULL;
- struct addrinfo *ai = SMB_MALLOC(sizeof(*ai));
-
- if (!ai) {
- return NULL;
- }
- memset(ai, '\0', sizeof(*ai));
-
- psin = SMB_MALLOC(sizeof(*psin));
- if (!psin) {
- free(ai);
- return NULL;
- }
-
- memset(psin, '\0', sizeof(*psin));
-
- psin->sin_family = AF_INET;
- psin->sin_port = htons(port);
- psin->sin_addr = ip;
-
- ai->ai_flags = 0;
- ai->ai_family = AF_INET;
- ai->ai_socktype = hints->ai_socktype;
- ai->ai_protocol = hints->ai_protocol;
- ai->ai_addrlen = sizeof(*psin);
- ai->ai_addr = (struct sockaddr *) psin;
- ai->ai_canonname = NULL;
- ai->ai_next = NULL;
-
- return ai;
-}
-
-/*
- * get address info for a single ipv4 address.
- *
- * Bugs: - servname can only be a number, not text.
- */
-
-static int getaddr_info_single_addr(const char *service,
- uint32_t addr,
- const struct addrinfo *hints,
- struct addrinfo **res)
-{
-
- struct addrinfo *ai = NULL;
- struct in_addr ip;
- unsigned short port = 0;
-
- if (service) {
- port = (unsigned short)atoi(service);
- }
- ip.s_addr = htonl(addr);
-
- ai = alloc_entry(hints, ip, port);
- if (!ai) {
- return EAI_MEMORY;
- }
-
- /* If we're asked for the canonical name,
- * make sure it returns correctly. */
- if (!(hints->ai_flags & AI_NUMERICSERV) &&
- hints->ai_flags & AI_CANONNAME) {
- int err;
- if (addr == INADDR_LOOPBACK || addr == INADDR_ANY) {
- ai->ai_canonname = get_my_canon_name(&err);
- } else {
- ai->ai_canonname =
- get_canon_name_from_addr(ip,&err);
- }
- if (ai->ai_canonname == NULL) {
- freeaddrinfo(ai);
- return err;
- }
- }
-
- *res = ai;
- return 0;
-}
-
-/*
- * get address info for multiple ipv4 addresses.
- *
- * Bugs: - servname can only be a number, not text.
- */
-
-static int getaddr_info_name(const char *node,
- const char *service,
- const struct addrinfo *hints,
- struct addrinfo **res)
-{
- struct addrinfo *listp = NULL, *prevp = NULL;
- char **pptr = NULL;
- int err;
- struct hostent *hp = NULL;
- unsigned short port = 0;
-
- if (service) {
- port = (unsigned short)atoi(service);
- }
-
- hp = gethostbyname(node);
- err = check_hostent_err(hp);
- if (err) {
- return err;
- }
-
- for(pptr = hp->h_addr_list; *pptr; pptr++) {
- struct in_addr ip = *(struct in_addr *)*pptr;
- struct addrinfo *ai = alloc_entry(hints, ip, port);
-
- if (!ai) {
- freeaddrinfo(listp);
- return EAI_MEMORY;
- }
-
- if (!listp) {
- listp = ai;
- prevp = ai;
- ai->ai_canonname = SMB_STRDUP(hp->h_name);
- if (!ai->ai_canonname) {
- freeaddrinfo(listp);
- return EAI_MEMORY;
- }
- } else {
- prevp->ai_next = ai;
- prevp = ai;
- }
- }
- *res = listp;
- return 0;
-}
-
-/*
- * get address info for ipv4 sockets.
- *
- * Bugs: - servname can only be a number, not text.
- */
-
-int rep_getaddrinfo(const char *node,
- const char *service,
- const struct addrinfo * hintp,
- struct addrinfo ** res)
-{
- struct addrinfo hints;
-
- /* Setup the hints struct. */
- if (hintp == NULL) {
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = AF_INET;
- hints.ai_socktype = SOCK_STREAM;
- } else {
- memcpy(&hints, hintp, sizeof(hints));
- }
-
- if (hints.ai_family != AF_INET && hints.ai_family != AF_UNSPEC) {
- return EAI_FAMILY;
- }
-
- if (hints.ai_socktype == 0) {
- hints.ai_socktype = SOCK_STREAM;
- }
-
- if (!node && !service) {
- return EAI_NONAME;
- }
-
- if (node) {
- if (node[0] == '\0') {
- return getaddr_info_single_addr(service,
- INADDR_ANY,
- &hints,
- res);
- } else if (hints.ai_flags & AI_NUMERICHOST) {
- struct in_addr ip;
- if (!inet_aton(node, &ip)) {
- return EAI_FAIL;
- }
- return getaddr_info_single_addr(service,
- ntohl(ip.s_addr),
- &hints,
- res);
- } else {
- return getaddr_info_name(node,
- service,
- &hints,
- res);
- }
- } else if (hints.ai_flags & AI_PASSIVE) {
- return getaddr_info_single_addr(service,
- INADDR_ANY,
- &hints,
- res);
- }
- return getaddr_info_single_addr(service,
- INADDR_LOOPBACK,
- &hints,
- res);
-}
-
-
-void rep_freeaddrinfo(struct addrinfo *res)
-{
- struct addrinfo *next = NULL;
-
- for (;res; res = next) {
- next = res->ai_next;
- if (res->ai_canonname) {
- free(res->ai_canonname);
- }
- if (res->ai_addr) {
- free(res->ai_addr);
- }
- free(res);
- }
-}
-
-
-const char *rep_gai_strerror(int errcode)
-{
-#ifdef HAVE_HSTRERROR
- int hcode;
-
- switch (errcode)
- {
- case EAI_NONAME:
- hcode = HOST_NOT_FOUND;
- break;
- case EAI_AGAIN:
- hcode = TRY_AGAIN;
- break;
- case EAI_FAIL:
- default:
- hcode = NO_RECOVERY;
- break;
- }
-
- return hstrerror(hcode);
-#else /* !HAVE_HSTRERROR */
-
- switch (errcode)
- {
- case EAI_NONAME:
- return "Unknown host";
- case EAI_AGAIN:
- return "Host name lookup failure";
-#ifdef EAI_BADFLAGS
- case EAI_BADFLAGS:
- return "Invalid argument";
-#endif
-#ifdef EAI_FAMILY
- case EAI_FAMILY:
- return "Address family not supported";
-#endif
-#ifdef EAI_MEMORY
- case EAI_MEMORY:
- return "Not enough memory";
-#endif
-#ifdef EAI_NODATA
- case EAI_NODATA:
- return "No host data of that type was found";
-#endif
-#ifdef EAI_SERVICE
- case EAI_SERVICE:
- return "Class type not found";
-#endif
-#ifdef EAI_SOCKTYPE
- case EAI_SOCKTYPE:
- return "Socket type not supported";
-#endif
- default:
- return "Unknown server error";
- }
-#endif /* HAVE_HSTRERROR */
-}
-
-static int gethostnameinfo(const struct sockaddr *sa,
- char *node,
- size_t nodelen,
- int flags)
-{
- int ret = -1;
- char *p = NULL;
-
- if (!(flags & NI_NUMERICHOST)) {
- struct hostent *hp = gethostbyaddr(
- &((struct sockaddr_in *)sa)->sin_addr,
- sizeof(struct in_addr),
- sa->sa_family);
- ret = check_hostent_err(hp);
- if (ret == 0) {
- /* Name looked up successfully. */
- ret = snprintf(node, nodelen, "%s", hp->h_name);
- if (ret < 0 || (size_t)ret >= nodelen) {
- return EAI_MEMORY;
- }
- if (flags & NI_NOFQDN) {
- p = strchr(node,'.');
- if (p) {
- *p = '\0';
- }
- }
- return 0;
- }
-
- if (flags & NI_NAMEREQD) {
- /* If we require a name and didn't get one,
- * automatically fail. */
- return ret;
- }
- /* Otherwise just fall into the numeric host code... */
- }
- p = inet_ntoa(((struct sockaddr_in *)sa)->sin_addr);
- ret = snprintf(node, nodelen, "%s", p);
- if (ret < 0 || (size_t)ret >= nodelen) {
- return EAI_MEMORY;
- }
- return 0;
-}
-
-static int getservicenameinfo(const struct sockaddr *sa,
- char *service,
- size_t servicelen,
- int flags)
-{
- int ret = -1;
- int port = ntohs(((struct sockaddr_in *)sa)->sin_port);
-
- if (!(flags & NI_NUMERICSERV)) {
- struct servent *se = getservbyport(
- port,
- (flags & NI_DGRAM) ? "udp" : "tcp");
- if (se && se->s_name) {
- /* Service name looked up successfully. */
- ret = snprintf(service, servicelen, "%s", se->s_name);
- if (ret < 0 || (size_t)ret >= servicelen) {
- return EAI_MEMORY;
- }
- return 0;
- }
- /* Otherwise just fall into the numeric service code... */
- }
- ret = snprintf(service, servicelen, "%d", port);
- if (ret < 0 || (size_t)ret >= servicelen) {
- return EAI_MEMORY;
- }
- return 0;
-}
-
-/*
- * Convert an ipv4 address to a hostname.
- *
- * Bugs: - No IPv6 support.
- */
-int rep_getnameinfo(const struct sockaddr *sa, socklen_t salen,
- char *node, size_t nodelen,
- char *service, size_t servicelen, int flags)
-{
-
- /* Invalid arguments. */
- if (sa == NULL || (node == NULL && service == NULL)) {
- return EAI_FAIL;
- }
-
- if (sa->sa_family != AF_INET) {
- return EAI_FAIL;
- }
-
- if (salen < sizeof(struct sockaddr_in)) {
- return EAI_FAIL;
- }
-
- if (node) {
- return gethostnameinfo(sa, node, nodelen, flags);
- }
-
- if (service) {
- return getservicenameinfo(sa, service, servicelen, flags);
- }
- return 0;
-}
diff --git a/source3/lib/replace/getaddrinfo.h b/source3/lib/replace/getaddrinfo.h
deleted file mode 100644
index dddd699b62..0000000000
--- a/source3/lib/replace/getaddrinfo.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-PostgreSQL Database Management System
-(formerly known as Postgres, then as Postgres95)
-
-Portions Copyright (c) 1996-2005, The PostgreSQL Global Development Group
-
-Portions Copyright (c) 1994, The Regents of the University of California
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose, without fee, and without a written agreement
-is hereby granted, provided that the above copyright notice and this paragraph
-and the following two paragraphs appear in all copies.
-
-IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
-DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
-LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
-EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
-THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
-ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS
-TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-
-*/
-
-/*-------------------------------------------------------------------------
- *
- * getaddrinfo.h
- * Support getaddrinfo() on platforms that don't have it.
- *
- * Note: we use our own routines on platforms that don't HAVE_STRUCT_ADDRINFO,
- * whether or not the library routine getaddrinfo() can be found. This
- * policy is needed because on some platforms a manually installed libbind.a
- * may provide getaddrinfo(), yet the system headers may not provide the
- * struct definitions needed to call it. To avoid conflict with the libbind
- * definition in such cases, we rename our routines to pg_xxx() via macros.
- *
-
-in lib/replace we use rep_xxx()
-
- * This code will also work on platforms where struct addrinfo is defined
- * in the system headers but no getaddrinfo() can be located.
- *
- * Copyright (c) 2003-2007, PostgreSQL Global Development Group
- *
- *-------------------------------------------------------------------------
- */
-#ifndef GETADDRINFO_H
-#define GETADDRINFO_H
-
-#ifndef HAVE_GETADDRINFO
-
-/* Rename private copies per comments above */
-#ifdef getaddrinfo
-#undef getaddrinfo
-#endif
-#define getaddrinfo rep_getaddrinfo
-#define HAVE_GETADDRINFO
-
-#ifdef freeaddrinfo
-#undef freeaddrinfo
-#endif
-#define freeaddrinfo rep_freeaddrinfo
-#define HAVE_FREEADDRINFO
-
-#ifdef gai_strerror
-#undef gai_strerror
-#endif
-#define gai_strerror rep_gai_strerror
-#define HAVE_GAI_STRERROR
-
-#ifdef getnameinfo
-#undef getnameinfo
-#endif
-#define getnameinfo rep_getnameinfo
-#define HAVE_GETNAMEINFO
-
-extern int rep_getaddrinfo(const char *node, const char *service,
- const struct addrinfo * hints, struct addrinfo ** res);
-extern void rep_freeaddrinfo(struct addrinfo * res);
-extern const char *rep_gai_strerror(int errcode);
-extern int rep_getnameinfo(const struct sockaddr * sa, socklen_t salen,
- char *node, size_t nodelen,
- char *service, size_t servicelen, int flags);
-#endif /* HAVE_GETADDRINFO */
-
-#endif /* GETADDRINFO_H */
diff --git a/source3/lib/replace/getifaddrs.c b/source3/lib/replace/getifaddrs.c
deleted file mode 100644
index f6f0ec080c..0000000000
--- a/source3/lib/replace/getifaddrs.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Samba utility functions
- Copyright (C) Andrew Tridgell 1998
- Copyright (C) Jeremy Allison 2007
- Copyright (C) Jelmer Vernooij <jelmer@samba.org> 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/>.
-*/
-
-#define SOCKET_WRAPPER_NOT_REPLACE
-
-#include "replace.h"
-#include "system/network.h"
-
-#include <unistd.h>
-#include <stdio.h>
-#include <sys/types.h>
-
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
-#ifndef SIOCGIFCONF
-#ifdef HAVE_SYS_SOCKIO_H
-#include <sys/sockio.h>
-#endif
-#endif
-
-#ifdef HAVE_IFACE_GETIFADDRS
-#define _FOUND_IFACE_ANY
-#else
-
-void rep_freeifaddrs(struct ifaddrs *ifp)
-{
- if (ifp != NULL) {
- free(ifp->ifa_name);
- free(ifp->ifa_addr);
- free(ifp->ifa_netmask);
- free(ifp->ifa_dstaddr);
- freeifaddrs(ifp->ifa_next);
- free(ifp);
- }
-}
-
-static struct sockaddr *sockaddr_dup(struct sockaddr *sa)
-{
- struct sockaddr *ret;
- socklen_t socklen;
-#ifdef HAVE_SOCKADDR_SA_LEN
- socklen = sa->sa_len;
-#else
- socklen = sizeof(struct sockaddr_storage);
-#endif
- ret = calloc(1, socklen);
- if (ret == NULL)
- return NULL;
- memcpy(ret, sa, socklen);
- return ret;
-}
-#endif
-
-#if HAVE_IFACE_IFCONF
-
-/* this works for Linux 2.2, Solaris 2.5, SunOS4, HPUX 10.20, OSF1
- V4.0, Ultrix 4.4, SCO Unix 3.2, IRIX 6.4 and FreeBSD 3.2.
-
- It probably also works on any BSD style system. */
-
-int rep_getifaddrs(struct ifaddrs **ifap)
-{
- struct ifconf ifc;
- char buff[8192];
- int fd, i, n;
- struct ifreq *ifr=NULL;
- struct in_addr ipaddr;
- struct in_addr nmask;
- char *iname;
- struct ifaddrs *curif;
- struct ifaddrs *lastif = NULL;
-
- *ifap = NULL;
-
- if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
- return -1;
- }
-
- ifc.ifc_len = sizeof(buff);
- ifc.ifc_buf = buff;
-
- if (ioctl(fd, SIOCGIFCONF, &ifc) != 0) {
- close(fd);
- return -1;
- }
-
- ifr = ifc.ifc_req;
-
- n = ifc.ifc_len / sizeof(struct ifreq);
-
- /* Loop through interfaces, looking for given IP address */
- for (i=n-1; i>=0; i--) {
- if (ioctl(fd, SIOCGIFFLAGS, &ifr[i]) == -1) {
- freeifaddrs(*ifap);
- return -1;
- }
-
- curif = calloc(1, sizeof(struct ifaddrs));
- curif->ifa_name = strdup(ifr[i].ifr_name);
- curif->ifa_flags = ifr[i].ifr_flags;
- curif->ifa_dstaddr = NULL;
- curif->ifa_data = NULL;
- curif->ifa_next = NULL;
-
- curif->ifa_addr = NULL;
- if (ioctl(fd, SIOCGIFADDR, &ifr[i]) != -1) {
- curif->ifa_addr = sockaddr_dup(&ifr[i].ifr_addr);
- }
-
- curif->ifa_netmask = NULL;
- if (ioctl(fd, SIOCGIFNETMASK, &ifr[i]) != -1) {
- curif->ifa_netmask = sockaddr_dup(&ifr[i].ifr_addr);
- }
-
- if (lastif == NULL) {
- *ifap = curif;
- } else {
- lastif->ifa_next = curif;
- }
- lastif = curif;
- }
-
- close(fd);
-
- return 0;
-}
-
-#define _FOUND_IFACE_ANY
-#endif /* HAVE_IFACE_IFCONF */
-#ifdef HAVE_IFACE_IFREQ
-
-#ifndef I_STR
-#include <sys/stropts.h>
-#endif
-
-/****************************************************************************
-this should cover most of the streams based systems
-Thanks to Andrej.Borsenkow@mow.siemens.ru for several ideas in this code
-****************************************************************************/
-int rep_getifaddrs(struct ifaddrs **ifap)
-{
- struct ifreq ifreq;
- struct strioctl strioctl;
- char buff[8192];
- int fd, i, n;
- struct ifreq *ifr=NULL;
- struct in_addr ipaddr;
- struct in_addr nmask;
- char *iname;
- struct ifaddrs *curif;
- struct ifaddrs *lastif = NULL;
-
- *ifap = NULL;
-
- if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
- return -1;
- }
-
- strioctl.ic_cmd = SIOCGIFCONF;
- strioctl.ic_dp = buff;
- strioctl.ic_len = sizeof(buff);
- if (ioctl(fd, I_STR, &strioctl) < 0) {
- close(fd);
- return -1;
- }
-
- /* we can ignore the possible sizeof(int) here as the resulting
- number of interface structures won't change */
- n = strioctl.ic_len / sizeof(struct ifreq);
-
- /* we will assume that the kernel returns the length as an int
- at the start of the buffer if the offered size is a
- multiple of the structure size plus an int */
- if (n*sizeof(struct ifreq) + sizeof(int) == strioctl.ic_len) {
- ifr = (struct ifreq *)(buff + sizeof(int));
- } else {
- ifr = (struct ifreq *)buff;
- }
-
- /* Loop through interfaces */
-
- for (i = 0; i<n; i++) {
- ifreq = ifr[i];
-
- curif = calloc(1, sizeof(struct ifaddrs));
- if (lastif == NULL) {
- *ifap = curif;
- } else {
- lastif->ifa_next = curif;
- }
-
- strioctl.ic_cmd = SIOCGIFFLAGS;
- strioctl.ic_dp = (char *)&ifreq;
- strioctl.ic_len = sizeof(struct ifreq);
- if (ioctl(fd, I_STR, &strioctl) != 0) {
- freeifaddrs(*ifap);
- return -1;
- }
-
- curif->ifa_flags = ifreq.ifr_flags;
-
- strioctl.ic_cmd = SIOCGIFADDR;
- strioctl.ic_dp = (char *)&ifreq;
- strioctl.ic_len = sizeof(struct ifreq);
- if (ioctl(fd, I_STR, &strioctl) != 0) {
- freeifaddrs(*ifap);
- return -1;
- }
-
- curif->ifa_name = strdup(ifreq.ifr_name);
- curif->ifa_addr = sockaddr_dup(&ifreq.ifr_addr);
- curif->ifa_dstaddr = NULL;
- curif->ifa_data = NULL;
- curif->ifa_next = NULL;
- curif->ifa_netmask = NULL;
-
- strioctl.ic_cmd = SIOCGIFNETMASK;
- strioctl.ic_dp = (char *)&ifreq;
- strioctl.ic_len = sizeof(struct ifreq);
- if (ioctl(fd, I_STR, &strioctl) != 0) {
- freeifaddrs(*ifap);
- return -1;
- }
-
- curif->ifa_netmask = sockaddr_dup(&ifreq.ifr_addr);
-
- lastif = curif;
- }
-
- close(fd);
-
- return 0;
-}
-
-#define _FOUND_IFACE_ANY
-#endif /* HAVE_IFACE_IFREQ */
-#ifdef HAVE_IFACE_AIX
-
-/****************************************************************************
-this one is for AIX (tested on 4.2)
-****************************************************************************/
-int rep_getifaddrs(struct ifaddrs **ifap)
-{
- char buff[8192];
- int fd, i;
- struct ifconf ifc;
- struct ifreq *ifr=NULL;
- struct in_addr ipaddr;
- struct in_addr nmask;
- char *iname;
- struct ifaddrs *curif;
- struct ifaddrs *lastif = NULL;
-
- *ifap = NULL;
-
- if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
- return -1;
- }
-
- ifc.ifc_len = sizeof(buff);
- ifc.ifc_buf = buff;
-
- if (ioctl(fd, SIOCGIFCONF, &ifc) != 0) {
- close(fd);
- return -1;
- }
-
- ifr = ifc.ifc_req;
-
- /* Loop through interfaces */
- i = ifc.ifc_len;
-
- while (i > 0) {
- uint_t inc;
-
- inc = ifr->ifr_addr.sa_len;
-
- if (ioctl(fd, SIOCGIFADDR, ifr) != 0) {
- freeaddrinfo(*ifap);
- return -1;
- }
-
- curif = calloc(1, sizeof(struct ifaddrs));
- if (lastif == NULL) {
- *ifap = curif;
- } else {
- lastif->ifa_next = curif;
- }
-
- curif->ifa_name = strdup(ifr->ifr_name);
- curif->ifa_addr = sockaddr_dup(&ifr->ifr_addr);
- curif->ifa_dstaddr = NULL;
- curif->ifa_data = NULL;
- curif->ifa_netmask = NULL;
- curif->ifa_next = NULL;
-
- if (ioctl(fd, SIOCGIFFLAGS, ifr) != 0) {
- freeaddrinfo(*ifap);
- return -1;
- }
-
- curif->ifa_flags = ifr->ifr_flags;
-
- if (ioctl(fd, SIOCGIFNETMASK, ifr) != 0) {
- freeaddrinfo(*ifap);
- return -1;
- }
-
- curif->ifa_netmask = sockaddr_dup(&ifr->ifr_addr);
-
- lastif = curif;
-
- next:
- /*
- * Patch from Archie Cobbs (archie@whistle.com). The
- * addresses in the SIOCGIFCONF interface list have a
- * minimum size. Usually this doesn't matter, but if
- * your machine has tunnel interfaces, etc. that have
- * a zero length "link address", this does matter. */
-
- if (inc < sizeof(ifr->ifr_addr))
- inc = sizeof(ifr->ifr_addr);
- inc += IFNAMSIZ;
-
- ifr = (struct ifreq*) (((char*) ifr) + inc);
- i -= inc;
- }
-
- close(fd);
- return 0;
-}
-
-#define _FOUND_IFACE_ANY
-#endif /* HAVE_IFACE_AIX */
-#ifndef _FOUND_IFACE_ANY
-int rep_getifaddrs(struct ifaddrs **ifap)
-{
- errno = ENOSYS;
- return -1;
-}
-#endif
diff --git a/source3/lib/replace/getpass.c b/source3/lib/replace/getpass.c
deleted file mode 100644
index 0be618fc91..0000000000
--- a/source3/lib/replace/getpass.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/* Copyright (C) 1992-1998 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C 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.
-
-The GNU C 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 the GNU C Library; see the file COPYING.LIB. If
-not, see <http://www.gnu.org/licenses/>. */
-
-/* Modified to use with samba by Jeremy Allison, 8th July 1995. */
-
-#include "replace.h"
-#include "system/filesys.h"
-#include "system/wait.h"
-#include "system/terminal.h"
-#include "system/passwd.h"
-
-/*
- * Define additional missing types
- */
-#ifndef HAVE_SIG_ATOMIC_T_TYPE
-typedef int sig_atomic_t;
-#endif
-
-#ifndef SIGCLD
-#define SIGCLD SIGCHLD
-#endif
-
-#ifndef SIGNAL_CAST
-#define SIGNAL_CAST (RETSIGTYPE (*)(int))
-#endif
-
-#ifdef SYSV_TERMIO
-
-/* SYSTEM V TERMIO HANDLING */
-
-static struct termio t;
-
-#define ECHO_IS_ON(t) ((t).c_lflag & ECHO)
-#define TURN_ECHO_OFF(t) ((t).c_lflag &= ~ECHO)
-#define TURN_ECHO_ON(t) ((t).c_lflag |= ECHO)
-
-#ifndef TCSAFLUSH
-#define TCSAFLUSH 1
-#endif
-
-#ifndef TCSANOW
-#define TCSANOW 0
-#endif
-
-static int tcgetattr(int fd, struct termio *_t)
-{
- return ioctl(fd, TCGETA, _t);
-}
-
-static int tcsetattr(int fd, int flags, struct termio *_t)
-{
- if(flags & TCSAFLUSH)
- ioctl(fd, TCFLSH, TCIOFLUSH);
- return ioctl(fd, TCSETS, _t);
-}
-
-#elif !defined(TCSAFLUSH)
-
-/* BSD TERMIO HANDLING */
-
-static struct sgttyb t;
-
-#define ECHO_IS_ON(t) ((t).sg_flags & ECHO)
-#define TURN_ECHO_OFF(t) ((t).sg_flags &= ~ECHO)
-#define TURN_ECHO_ON(t) ((t).sg_flags |= ECHO)
-
-#define TCSAFLUSH 1
-#define TCSANOW 0
-
-static int tcgetattr(int fd, struct sgttyb *_t)
-{
- return ioctl(fd, TIOCGETP, (char *)_t);
-}
-
-static int tcsetattr(int fd, int flags, struct sgttyb *_t)
-{
- return ioctl(fd, TIOCSETP, (char *)_t);
-}
-
-#else /* POSIX TERMIO HANDLING */
-#define ECHO_IS_ON(t) ((t).c_lflag & ECHO)
-#define TURN_ECHO_OFF(t) ((t).c_lflag &= ~ECHO)
-#define TURN_ECHO_ON(t) ((t).c_lflag |= ECHO)
-
-static struct termios t;
-#endif /* SYSV_TERMIO */
-
-static void catch_signal(int signum,void (*handler)(int ))
-{
-#ifdef HAVE_SIGACTION
- struct sigaction act;
- struct sigaction oldact;
-
- memset(&act, 0, sizeof(act));
-
- act.sa_handler = handler;
-#ifdef SA_RESTART
- /*
- * We *want* SIGALRM to interrupt a system call.
- */
- if(signum != SIGALRM)
- act.sa_flags = SA_RESTART;
-#endif
- sigemptyset(&act.sa_mask);
- sigaddset(&act.sa_mask,signum);
- sigaction(signum,&act,&oldact);
-#else /* !HAVE_SIGACTION */
- /* FIXME: need to handle sigvec and systems with broken signal() */
- signal(signum, handler);
-#endif
-}
-
-static sig_atomic_t gotintr;
-static int in_fd = -1;
-
-/***************************************************************
- Signal function to tell us were ^C'ed.
-****************************************************************/
-
-static void gotintr_sig(void)
-{
- gotintr = 1;
- if (in_fd != -1)
- close(in_fd); /* Safe way to force a return. */
- in_fd = -1;
-}
-
-char *rep_getpass(const char *prompt)
-{
- FILE *in, *out;
- int echo_off;
- static char buf[256];
- static size_t bufsize = sizeof(buf);
- size_t nread;
-
- /* Catch problematic signals */
- catch_signal(SIGINT, SIGNAL_CAST gotintr_sig);
-
- /* Try to write to and read from the terminal if we can.
- If we can't open the terminal, use stderr and stdin. */
-
- in = fopen ("/dev/tty", "w+");
- if (in == NULL) {
- in = stdin;
- out = stderr;
- } else {
- out = in;
- }
-
- setvbuf(in, NULL, _IONBF, 0);
-
- /* Turn echoing off if it is on now. */
-
- if (tcgetattr (fileno (in), &t) == 0) {
- if (ECHO_IS_ON(t)) {
- TURN_ECHO_OFF(t);
- echo_off = tcsetattr (fileno (in), TCSAFLUSH, &t) == 0;
- TURN_ECHO_ON(t);
- } else {
- echo_off = 0;
- }
- } else {
- echo_off = 0;
- }
-
- /* Write the prompt. */
- fputs(prompt, out);
- fflush(out);
-
- /* Read the password. */
- buf[0] = 0;
- if (!gotintr) {
- in_fd = fileno(in);
- if (fgets(buf, bufsize, in) == NULL) {
- buf[0] = 0;
- }
- }
- nread = strlen(buf);
- if (nread) {
- if (buf[nread - 1] == '\n')
- buf[nread - 1] = '\0';
- }
-
- /* Restore echoing. */
- if (echo_off) {
- if (gotintr && in_fd == -1) {
- in = fopen ("/dev/tty", "w+");
- }
- if (in != NULL)
- tcsetattr (fileno (in), TCSANOW, &t);
- }
-
- fprintf(out, "\n");
- fflush(out);
-
- if (in && in != stdin) /* We opened the terminal; now close it. */
- fclose(in);
-
- /* Catch problematic signals */
- catch_signal(SIGINT, SIGNAL_CAST SIG_DFL);
-
- if (gotintr) {
- printf("Interupted by signal.\n");
- fflush(stdout);
- exit(1);
- }
- return buf;
-}
diff --git a/source3/lib/replace/getpass.m4 b/source3/lib/replace/getpass.m4
deleted file mode 100644
index b93817f9d3..0000000000
--- a/source3/lib/replace/getpass.m4
+++ /dev/null
@@ -1,24 +0,0 @@
-AC_CHECK_FUNC(getpass, libreplace_cv_HAVE_GETPASS=yes)
-AC_CHECK_FUNC(getpassphrase, libreplace_cv_HAVE_GETPASSPHRASE=yes)
-if test x"$libreplace_cv_HAVE_GETPASS" = x"yes" -a x"$libreplace_cv_HAVE_GETPASSPHRASE" = x"yes"; then
- AC_DEFINE(REPLACE_GETPASS_BY_GETPASSPHRASE, 1, [getpass returns <9 chars where getpassphrase returns <265 chars])
- AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced])
- LIBREPLACEOBJ="${LIBREPLACEOBJ} getpass.o"
-else
-
-AC_CACHE_CHECK([whether getpass should be replaced],libreplace_cv_REPLACE_GETPASS,[
-SAVE_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS -I$libreplacedir/"
-AC_TRY_COMPILE([
-#include "confdefs.h"
-#define NO_CONFIG_H
-#include "$libreplacedir/getpass.c"
-],[],libreplace_cv_REPLACE_GETPASS=yes,libreplace_cv_REPLACE_GETPASS=no)
-CPPFLAGS="$SAVE_CPPFLAGS"
-])
-if test x"$libreplace_cv_REPLACE_GETPASS" = x"yes"; then
- AC_DEFINE(REPLACE_GETPASS,1,[Whether getpass should be replaced])
- LIBREPLACEOBJ="${LIBREPLACEOBJ} getpass.o"
-fi
-
-fi
diff --git a/source3/lib/replace/inet_aton.c b/source3/lib/replace/inet_aton.c
deleted file mode 100644
index c6b3bb11a7..0000000000
--- a/source3/lib/replace/inet_aton.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- * replacement functions
- * Copyright (C) Michael Adam <obnox@samba.org> 2008
- *
- * ** 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/>.
- */
-
-#include "replace.h"
-#include "system/network.h"
-
-/**
- * We know that we have inet_pton from earlier libreplace checks.
- */
-int rep_inet_aton(const char *src, struct in_addr *dst)
-{
- return (inet_pton(AF_INET, src, dst) > 0) ? 1 : 0;
-}
diff --git a/source3/lib/replace/inet_ntoa.c b/source3/lib/replace/inet_ntoa.c
deleted file mode 100644
index e3b80ebef8..0000000000
--- a/source3/lib/replace/inet_ntoa.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- * replacement routines for broken systems
- * Copyright (C) Andrew Tridgell 2003
- * Copyright (C) Michael Adam 2008
- *
- * ** 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/>.
- */
-
-#include "replace.h"
-#include "system/network.h"
-
-/**
- * NOTE: this is not thread safe, but it can't be, either
- * since it returns a pointer to static memory.
- */
-char *rep_inet_ntoa(struct in_addr ip)
-{
- uint8_t *p = (uint8_t *)&ip.s_addr;
- static char buf[18];
- slprintf(buf, 17, "%d.%d.%d.%d",
- (int)p[0], (int)p[1], (int)p[2], (int)p[3]);
- return buf;
-}
diff --git a/source3/lib/replace/inet_ntop.c b/source3/lib/replace/inet_ntop.c
deleted file mode 100644
index fb3d8e90c8..0000000000
--- a/source3/lib/replace/inet_ntop.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (C) 1996-2001 Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
- * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-
-#include "replace.h"
-#include "system/network.h"
-
-#define NS_INT16SZ 2
-#define NS_IN6ADDRSZ 16
-
-/*
- * WARNING: Don't even consider trying to compile this on a system where
- * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
- */
-
-static const char *inet_ntop4(const unsigned char *src, char *dst,
- socklen_t size);
-
-#ifdef AF_INET6
-static const char *inet_ntop6(const unsigned char *src, char *dst,
- socklen_t size);
-#endif
-
-/* char *
- * isc_net_ntop(af, src, dst, size)
- * convert a network format address to presentation format.
- * return:
- * pointer to presentation format address (`dst'), or NULL (see errno).
- * author:
- * Paul Vixie, 1996.
- */
-const char *
-rep_inet_ntop(int af, const void *src, char *dst, socklen_t size)
-{
- switch (af) {
- case AF_INET:
- return (inet_ntop4(src, dst, size));
-#ifdef AF_INET6
- case AF_INET6:
- return (inet_ntop6(src, dst, size));
-#endif
- default:
- errno = EAFNOSUPPORT;
- return (NULL);
- }
- /* NOTREACHED */
-}
-
-/* const char *
- * inet_ntop4(src, dst, size)
- * format an IPv4 address
- * return:
- * `dst' (as a const)
- * notes:
- * (1) uses no statics
- * (2) takes a unsigned char* not an in_addr as input
- * author:
- * Paul Vixie, 1996.
- */
-static const char *
-inet_ntop4(const unsigned char *src, char *dst, socklen_t size)
-{
- static const char *fmt = "%u.%u.%u.%u";
- char tmp[sizeof "255.255.255.255"];
- size_t len;
-
- len = snprintf(tmp, sizeof tmp, fmt, src[0], src[1], src[2], src[3]);
- if (len >= size) {
- errno = ENOSPC;
- return (NULL);
- }
- memcpy(dst, tmp, len + 1);
-
- return (dst);
-}
-
-/* const char *
- * isc_inet_ntop6(src, dst, size)
- * convert IPv6 binary address into presentation (printable) format
- * author:
- * Paul Vixie, 1996.
- */
-#ifdef AF_INET6
-static const char *
-inet_ntop6(const unsigned char *src, char *dst, socklen_t size)
-{
- /*
- * Note that int32_t and int16_t need only be "at least" large enough
- * to contain a value of the specified size. On some systems, like
- * Crays, there is no such thing as an integer variable with 16 bits.
- * Keep this in mind if you think this function should have been coded
- * to use pointer overlays. All the world's not a VAX.
- */
- char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
- struct { int base, len; } best, cur;
- unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ];
- int i, inc;
-
- /*
- * Preprocess:
- * Copy the input (bytewise) array into a wordwise array.
- * Find the longest run of 0x00's in src[] for :: shorthanding.
- */
- memset(words, '\0', sizeof words);
- for (i = 0; i < NS_IN6ADDRSZ; i++)
- words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3));
- best.base = -1;
- best.len = 0;
- cur.base = -1;
- cur.len = 0;
- for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) {
- if (words[i] == 0) {
- if (cur.base == -1)
- cur.base = i, cur.len = 1;
- else
- cur.len++;
- } else {
- if (cur.base != -1) {
- if (best.base == -1 || cur.len > best.len)
- best = cur;
- cur.base = -1;
- }
- }
- }
- if (cur.base != -1) {
- if (best.base == -1 || cur.len > best.len)
- best = cur;
- }
- if (best.base != -1 && best.len < 2)
- best.base = -1;
-
- /*
- * Format the result.
- */
- tp = tmp;
- for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) {
- /* Are we inside the best run of 0x00's? */
- if (best.base != -1 && i >= best.base &&
- i < (best.base + best.len)) {
- if (i == best.base)
- *tp++ = ':';
- continue;
- }
- /* Are we following an initial run of 0x00s or any real hex? */
- if (i != 0)
- *tp++ = ':';
- /* Is this address an encapsulated IPv4? */
- if (i == 6 && best.base == 0 &&
- (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) {
- if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp)))
- return (NULL);
- tp += strlen(tp);
- break;
- }
- inc = snprintf(tp, 5, "%x", words[i]);
- if (inc >= 5) {
- abort();
- }
- tp += inc;
- }
- /* Was it a trailing run of 0x00's? */
- if (best.base != -1 && (best.base + best.len) ==
- (NS_IN6ADDRSZ / NS_INT16SZ))
- *tp++ = ':';
- *tp++ = '\0';
-
- /*
- * Check for overflow, copy, and we're done.
- */
- if ((size_t)(tp - tmp) > size) {
- errno = ENOSPC;
- return (NULL);
- }
- memcpy(dst, tmp, tp - tmp);
- return (dst);
-}
-#endif /* AF_INET6 */
diff --git a/source3/lib/replace/inet_pton.c b/source3/lib/replace/inet_pton.c
deleted file mode 100644
index 80e4865ef4..0000000000
--- a/source3/lib/replace/inet_pton.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright (C) 1996-2001 Internet Software Consortium.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
- * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
- * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include "replace.h"
-#include "system/network.h"
-
-#define NS_INT16SZ 2
-#define NS_INADDRSZ 4
-#define NS_IN6ADDRSZ 16
-
-/*
- * WARNING: Don't even consider trying to compile this on a system where
- * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
- */
-
-static int inet_pton4(const char *src, unsigned char *dst);
-#ifdef AF_INET6
-static int inet_pton6(const char *src, unsigned char *dst);
-#endif
-
-/* int
- * inet_pton(af, src, dst)
- * convert from presentation format (which usually means ASCII printable)
- * to network format (which is usually some kind of binary format).
- * return:
- * 1 if the address was valid for the specified address family
- * 0 if the address wasn't valid (`dst' is untouched in this case)
- * -1 if some other error occurred (`dst' is untouched in this case, too)
- * author:
- * Paul Vixie, 1996.
- */
-int
-rep_inet_pton(int af,
- const char *src,
- void *dst)
-{
- switch (af) {
- case AF_INET:
- return (inet_pton4(src, dst));
-#ifdef AF_INET6
- case AF_INET6:
- return (inet_pton6(src, dst));
-#endif
- default:
- errno = EAFNOSUPPORT;
- return (-1);
- }
- /* NOTREACHED */
-}
-
-/* int
- * inet_pton4(src, dst)
- * like inet_aton() but without all the hexadecimal and shorthand.
- * return:
- * 1 if `src' is a valid dotted quad, else 0.
- * notice:
- * does not touch `dst' unless it's returning 1.
- * author:
- * Paul Vixie, 1996.
- */
-static int
-inet_pton4(src, dst)
- const char *src;
- unsigned char *dst;
-{
- static const char digits[] = "0123456789";
- int saw_digit, octets, ch;
- unsigned char tmp[NS_INADDRSZ], *tp;
-
- saw_digit = 0;
- octets = 0;
- *(tp = tmp) = 0;
- while ((ch = *src++) != '\0') {
- const char *pch;
-
- if ((pch = strchr(digits, ch)) != NULL) {
- unsigned int new = *tp * 10 + (pch - digits);
-
- if (new > 255)
- return (0);
- *tp = new;
- if (! saw_digit) {
- if (++octets > 4)
- return (0);
- saw_digit = 1;
- }
- } else if (ch == '.' && saw_digit) {
- if (octets == 4)
- return (0);
- *++tp = 0;
- saw_digit = 0;
- } else
- return (0);
- }
- if (octets < 4)
- return (0);
- memcpy(dst, tmp, NS_INADDRSZ);
- return (1);
-}
-
-/* int
- * inet_pton6(src, dst)
- * convert presentation level address to network order binary form.
- * return:
- * 1 if `src' is a valid [RFC1884 2.2] address, else 0.
- * notice:
- * (1) does not touch `dst' unless it's returning 1.
- * (2) :: in a full address is silently ignored.
- * credit:
- * inspired by Mark Andrews.
- * author:
- * Paul Vixie, 1996.
- */
-#ifdef AF_INET6
-static int
-inet_pton6(src, dst)
- const char *src;
- unsigned char *dst;
-{
- static const char xdigits_l[] = "0123456789abcdef",
- xdigits_u[] = "0123456789ABCDEF";
- unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
- const char *xdigits, *curtok;
- int ch, saw_xdigit;
- unsigned int val;
-
- memset((tp = tmp), '\0', NS_IN6ADDRSZ);
- endp = tp + NS_IN6ADDRSZ;
- colonp = NULL;
- /* Leading :: requires some special handling. */
- if (*src == ':')
- if (*++src != ':')
- return (0);
- curtok = src;
- saw_xdigit = 0;
- val = 0;
- while ((ch = *src++) != '\0') {
- const char *pch;
-
- if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
- pch = strchr((xdigits = xdigits_u), ch);
- if (pch != NULL) {
- val <<= 4;
- val |= (pch - xdigits);
- if (val > 0xffff)
- return (0);
- saw_xdigit = 1;
- continue;
- }
- if (ch == ':') {
- curtok = src;
- if (!saw_xdigit) {
- if (colonp)
- return (0);
- colonp = tp;
- continue;
- }
- if (tp + NS_INT16SZ > endp)
- return (0);
- *tp++ = (unsigned char) (val >> 8) & 0xff;
- *tp++ = (unsigned char) val & 0xff;
- saw_xdigit = 0;
- val = 0;
- continue;
- }
- if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
- inet_pton4(curtok, tp) > 0) {
- tp += NS_INADDRSZ;
- saw_xdigit = 0;
- break; /* '\0' was seen by inet_pton4(). */
- }
- return (0);
- }
- if (saw_xdigit) {
- if (tp + NS_INT16SZ > endp)
- return (0);
- *tp++ = (unsigned char) (val >> 8) & 0xff;
- *tp++ = (unsigned char) val & 0xff;
- }
- if (colonp != NULL) {
- /*
- * Since some memmove()'s erroneously fail to handle
- * overlapping regions, we'll do the shift by hand.
- */
- const int n = tp - colonp;
- int i;
-
- for (i = 1; i <= n; i++) {
- endp[- i] = colonp[n - i];
- colonp[n - i] = 0;
- }
- tp = endp;
- }
- if (tp != endp)
- return (0);
- memcpy(dst, tmp, NS_IN6ADDRSZ);
- return (1);
-}
-#endif
diff --git a/source3/lib/replace/install-sh b/source3/lib/replace/install-sh
deleted file mode 100755
index 58719246f0..0000000000
--- a/source3/lib/replace/install-sh
+++ /dev/null
@@ -1,238 +0,0 @@
-#! /bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-#
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- true
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- else
- instcmd=mkdir
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f $src -o -d $src ]
- then
- true
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- true
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- true
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
-
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
-
- pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
-
-# Make a temp file name in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd $src $dsttmp &&
-
- trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
diff --git a/source3/lib/replace/libreplace.m4 b/source3/lib/replace/libreplace.m4
deleted file mode 100644
index 71fa041672..0000000000
--- a/source3/lib/replace/libreplace.m4
+++ /dev/null
@@ -1,303 +0,0 @@
-AC_DEFUN_ONCE(AC_LIBREPLACE_LOCATION_CHECKS,
-[
-echo "LIBREPLACE_LOCATION_CHECKS: START"
-
-dnl find the libreplace sources. This is meant to work both for
-dnl libreplace standalone builds, and builds of packages using libreplace
-libreplacedir=""
-libreplacepaths="$srcdir $srcdir/lib/replace $srcdir/libreplace $srcdir/../libreplace $srcdir/../replace"
-for d in $libreplacepaths; do
- if test -f "$d/replace.c"; then
- libreplacedir="$d"
- AC_SUBST(libreplacedir)
- break;
- fi
-done
-if test x"$libreplacedir" = "x"; then
- AC_MSG_ERROR([cannot find libreplace in $libreplacepaths])
-fi
-LIBREPLACEOBJ="replace.o"
-AC_SUBST(LIBREPLACEOBJ)
-
-AC_CANONICAL_BUILD
-AC_CANONICAL_HOST
-AC_CANONICAL_TARGET
-
-echo "LIBREPLACE_LOCATION_CHECKS: END"
-]) dnl end AC_LIBREPLACE_LOCATION_CHECKS
-
-
-AC_DEFUN_ONCE(AC_LIBREPLACE_BROKEN_CHECKS,
-[
-echo "LIBREPLACE_BROKEN_CHECKS: START"
-
-dnl find the libreplace sources. This is meant to work both for
-dnl libreplace standalone builds, and builds of packages using libreplace
-libreplacedir=""
-for d in "$srcdir" "$srcdir/lib/replace" "$srcdir/libreplace" "$srcdir/../libreplace" "$srcdir/../replace"; do
- if test -f "$d/replace.c"; then
- libreplacedir="$d"
- AC_SUBST(libreplacedir)
- break;
- fi
-done
-LIBREPLACEOBJ="replace.o"
-AC_SUBST(LIBREPLACEOBJ)
-
-LIBREPLACEOBJ="${LIBREPLACEOBJ} snprintf.o"
-
-AC_TYPE_SIGNAL
-AC_TYPE_UID_T
-AC_TYPE_MODE_T
-AC_TYPE_OFF_T
-AC_TYPE_SIZE_T
-AC_TYPE_PID_T
-AC_STRUCT_ST_RDEV
-AC_CHECK_TYPE(ino_t,unsigned)
-AC_CHECK_TYPE(loff_t,off_t)
-AC_CHECK_TYPE(offset_t,loff_t)
-
-AC_FUNC_MEMCMP
-
-AC_CHECK_FUNCS(pipe strftime srandom random srand rand usleep setbuffer lstat getpgrp)
-
-AC_CHECK_HEADERS(stdbool.h stdint.h sys/select.h)
-AC_CHECK_HEADERS(setjmp.h)
-
-LIBREPLACE_PROVIDE_HEADER([stdint.h])
-LIBREPLACE_PROVIDE_HEADER([stdbool.h])
-
-AC_CHECK_TYPE(bool,
-[AC_DEFINE(HAVE_BOOL, 1, [Whether the bool type is available])],,
-[
-AC_INCLUDES_DEFAULT
-#ifdef HAVE_STDBOOL_H
-#include <stdbool.h>
-#endif]
-)
-
-AC_CHECK_TYPE(_Bool,
-[AC_DEFINE(HAVE__Bool, 1, [Whether the _Bool type is available])],,
-[
-AC_INCLUDES_DEFAULT
-#ifdef HAVE_STDBOOL_H
-#include <stdbool.h>
-#endif]
-)
-
-AC_CACHE_CHECK([for working mmap],libreplace_cv_HAVE_MMAP,[
-AC_TRY_RUN([#include "$libreplacedir/test/shared_mmap.c"],
- libreplace_cv_HAVE_MMAP=yes,libreplace_cv_HAVE_MMAP=no,libreplace_cv_HAVE_MMAP=cross)])
-if test x"$libreplace_cv_HAVE_MMAP" = x"yes"; then
- AC_DEFINE(HAVE_MMAP,1,[Whether mmap works])
-fi
-
-
-AC_CHECK_HEADERS(sys/syslog.h syslog.h)
-AC_CHECK_HEADERS(sys/time.h time.h)
-AC_CHECK_HEADERS(stdarg.h vararg.h)
-AC_CHECK_HEADERS(sys/mount.h mntent.h)
-AC_CHECK_HEADERS(stropts.h)
-
-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)
-AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r mkdtemp)
-AC_CHECK_FUNCS(isatty)
-AC_HAVE_DECL(setresuid, [#include <unistd.h>])
-AC_HAVE_DECL(setresgid, [#include <unistd.h>])
-AC_HAVE_DECL(errno, [#include <errno.h>])
-
-AC_CACHE_CHECK([for secure mkstemp],libreplace_cv_HAVE_SECURE_MKSTEMP,[
-AC_TRY_RUN([#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-main() {
- struct stat st;
- char tpl[20]="/tmp/test.XXXXXX";
- int fd = mkstemp(tpl);
- if (fd == -1) exit(1);
- unlink(tpl);
- if (fstat(fd, &st) != 0) exit(1);
- if ((st.st_mode & 0777) != 0600) exit(1);
- exit(0);
-}],
-libreplace_cv_HAVE_SECURE_MKSTEMP=yes,
-libreplace_cv_HAVE_SECURE_MKSTEMP=no,
-libreplace_cv_HAVE_SECURE_MKSTEMP=cross)])
-if test x"$libreplace_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
- AC_DEFINE(HAVE_SECURE_MKSTEMP,1,[Whether mkstemp is secure])
-fi
-
-dnl Provided by snprintf.c:
-AC_CHECK_HEADERS(stdio.h strings.h)
-AC_CHECK_DECLS([snprintf, vsnprintf, asprintf, vasprintf])
-AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
-
-AC_CACHE_CHECK([for C99 vsnprintf],libreplace_cv_HAVE_C99_VSNPRINTF,[
-AC_TRY_RUN([
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-void foo(const char *format, ...) {
- va_list ap;
- int len;
- char buf[20];
- long long l = 1234567890;
- l *= 100;
-
- va_start(ap, format);
- len = vsnprintf(buf, 0, format, ap);
- va_end(ap);
- if (len != 5) exit(1);
-
- va_start(ap, format);
- len = vsnprintf(0, 0, format, ap);
- va_end(ap);
- if (len != 5) exit(2);
-
- if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(3);
-
- if (snprintf(buf, 20, "%lld", l) != 12 || strcmp(buf, "123456789000") != 0) exit(4);
- if (snprintf(buf, 20, "%zu", 123456789) != 9 || strcmp(buf, "123456789") != 0) exit(5);
- if (snprintf(buf, 20, "%2\$d %1\$d", 3, 4) != 3 || strcmp(buf, "4 3") != 0) exit(6);
- if (snprintf(buf, 20, "%s", 0) < 3) exit(7);
-
- exit(0);
-}
-main() { foo("hello"); }
-],
-libreplace_cv_HAVE_C99_VSNPRINTF=yes,libreplace_cv_HAVE_C99_VSNPRINTF=no,libreplace_cv_HAVE_C99_VSNPRINTF=cross)])
-if test x"$libreplace_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
- AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Whether there is a C99 compliant vsnprintf])
-fi
-
-
-dnl VA_COPY
-AC_CACHE_CHECK([for va_copy],libreplace_cv_HAVE_VA_COPY,[
-AC_TRY_LINK([#include <stdarg.h>
-va_list ap1,ap2;], [va_copy(ap1,ap2);],
-libreplace_cv_HAVE_VA_COPY=yes,libreplace_cv_HAVE_VA_COPY=no)])
-if test x"$libreplace_cv_HAVE_VA_COPY" = x"yes"; then
- AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
-fi
-
-if test x"$libreplace_cv_HAVE_VA_COPY" != x"yes"; then
-AC_CACHE_CHECK([for __va_copy],libreplace_cv_HAVE___VA_COPY,[
-AC_TRY_LINK([#include <stdarg.h>
-va_list ap1,ap2;], [__va_copy(ap1,ap2);],
-libreplace_cv_HAVE___VA_COPY=yes,libreplace_cv_HAVE___VA_COPY=no)])
-if test x"$libreplace_cv_HAVE___VA_COPY" = x"yes"; then
- AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
-fi
-fi
-
-dnl __FUNCTION__ macro
-AC_CACHE_CHECK([for __FUNCTION__ macro],libreplace_cv_HAVE_FUNCTION_MACRO,[
-AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
-libreplace_cv_HAVE_FUNCTION_MACRO=yes,libreplace_cv_HAVE_FUNCTION_MACRO=no)])
-if test x"$libreplace_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
- AC_DEFINE(HAVE_FUNCTION_MACRO,1,[Whether there is a __FUNCTION__ macro])
-else
- dnl __func__ macro
- AC_CACHE_CHECK([for __func__ macro],libreplace_cv_HAVE_func_MACRO,[
- AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __func__);],
- libreplace_cv_HAVE_func_MACRO=yes,libreplace_cv_HAVE_func_MACRO=no)])
- if test x"$libreplace_cv_HAVE_func_MACRO" = x"yes"; then
- AC_DEFINE(HAVE_func_MACRO,1,[Whether there is a __func__ macro])
- fi
-fi
-
-AC_CHECK_HEADERS([sys/param.h limits.h])
-
-AC_CHECK_TYPE(comparison_fn_t,
-[AC_DEFINE(HAVE_COMPARISON_FN_T, 1,[Whether or not we have comparison_fn_t])])
-
-AC_HAVE_DECL(setenv, [#include <stdlib.h>])
-AC_CHECK_FUNCS(setenv unsetenv)
-
-AC_CHECK_FUNCS(strnlen)
-AC_CHECK_FUNCS(strtoull __strtoull strtouq strtoll __strtoll strtoq)
-
-# this test disabled as we don't actually need __VA_ARGS__ yet
-AC_TRY_CPP([
-#define eprintf(...) fprintf(stderr, __VA_ARGS__)
-eprintf("bla", "bar");
-], AC_DEFINE(HAVE__VA_ARGS__MACRO, 1, [Whether the __VA_ARGS__ macro is available]))
-
-
-AC_CACHE_CHECK([for sig_atomic_t type],libreplace_cv_sig_atomic_t, [
- AC_TRY_COMPILE([
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-#include <signal.h>],[sig_atomic_t i = 0],
- libreplace_cv_sig_atomic_t=yes,libreplace_cv_sig_atomic_t=no)])
-if test x"$libreplace_cv_sig_atomic_t" = x"yes"; then
- AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE,1,[Whether we have the atomic_t variable type])
-fi
-
-
-AC_CACHE_CHECK([for O_DIRECT flag to open(2)],libreplace_cv_HAVE_OPEN_O_DIRECT,[
-AC_TRY_COMPILE([
-#include <unistd.h>
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif],
-[int fd = open("/dev/null", O_DIRECT);],
-libreplace_cv_HAVE_OPEN_O_DIRECT=yes,libreplace_cv_HAVE_OPEN_O_DIRECT=no)])
-if test x"$libreplace_cv_HAVE_OPEN_O_DIRECT" = x"yes"; then
- AC_DEFINE(HAVE_OPEN_O_DIRECT,1,[Whether the open(2) accepts O_DIRECT])
-fi
-
-
-dnl Check if the C compiler understands volatile (it should, being ANSI).
-AC_CACHE_CHECK([that the C compiler understands volatile],libreplace_cv_volatile, [
- AC_TRY_COMPILE([#include <sys/types.h>],[volatile int i = 0],
- libreplace_cv_volatile=yes,libreplace_cv_volatile=no)])
-if test x"$libreplace_cv_volatile" = x"yes"; then
- AC_DEFINE(HAVE_VOLATILE, 1, [Whether the C compiler understands volatile])
-fi
-
-m4_include(system/config.m4)
-
-m4_include(dlfcn.m4)
-m4_include(getpass.m4)
-m4_include(strptime.m4)
-m4_include(win32.m4)
-m4_include(timegm.m4)
-m4_include(repdir.m4)
-
-AC_CHECK_FUNCS([syslog printf memset memcpy],,[AC_MSG_ERROR([Required function not found])])
-
-echo "LIBREPLACE_BROKEN_CHECKS: END"
-]) dnl end AC_LIBREPLACE_BROKEN_CHECKS
-
-AC_DEFUN_ONCE(AC__LIBREPLACE_ALL_CHECKS_START,
-[
-#LIBREPLACE_ALL_CHECKS: START"
-])
-AC_DEFUN_ONCE(AC__LIBREPLACE_ALL_CHECKS_END,
-[
-#LIBREPLACE_ALL_CHECKS: END"
-])
-m4_define(AC_LIBREPLACE_ALL_CHECKS,
-[
-AC__LIBREPLACE_ALL_CHECKS_START
-AC_LIBREPLACE_LOCATION_CHECKS
-AC_LIBREPLACE_CC_CHECKS
-AC_LIBREPLACE_BROKEN_CHECKS
-AC__LIBREPLACE_ALL_CHECKS_END
-CFLAGS="$CFLAGS -I$libreplacedir"
-])
-
-m4_include(libreplace_cc.m4)
-m4_include(libreplace_ld.m4)
-m4_include(libreplace_network.m4)
-m4_include(libreplace_macros.m4)
-
-m4_ifndef([AC_USE_SYSTEM_EXTENSIONS],[m4_include(autoconf-2.60.m4)])
diff --git a/source3/lib/replace/libreplace_cc.m4 b/source3/lib/replace/libreplace_cc.m4
deleted file mode 100644
index 30c63f2f05..0000000000
--- a/source3/lib/replace/libreplace_cc.m4
+++ /dev/null
@@ -1,182 +0,0 @@
-
-AC_DEFUN_ONCE(AC__LIBREPLACE_ONLY_CC_CHECKS_START,
-[
-echo "LIBREPLACE_CC_CHECKS: START"
-])
-
-AC_DEFUN_ONCE(AC__LIBREPLACE_ONLY_CC_CHECKS_END,
-[
-echo "LIBREPLACE_CC_CHECKS: END"
-])
-
-dnl
-dnl
-dnl AC_LIBREPLACE_CC_CHECKS
-dnl
-dnl Note: we need to use m4_define instead of AC_DEFUN because
-dnl of the ordering of tests
-dnl
-dnl
-m4_define(AC_LIBREPLACE_CC_CHECKS,
-[
-AC__LIBREPLACE_ONLY_CC_CHECKS_START
-
-dnl stop the C89 attempt by autoconf - if autoconf detects -Ae it will enable it
-dnl which conflicts with C99 on HPUX
-ac_cv_prog_cc_Ae=no
-
-savedCFLAGS=$CFLAGS
-AC_PROG_CC
-CFLAGS=$savedCFLAGS
-
-dnl don't try for C99 if we are using gcc, as otherwise we
-dnl lose immediate structure constants
-if test x"$GCC" != x"yes" ; then
-AC_PROG_CC_C99
-fi
-
-if test x"$GCC" = x"yes" ; then
- AC_MSG_CHECKING([for version of gcc])
- GCC_VERSION=`$CC -dumpversion`
- AC_MSG_RESULT(${GCC_VERSION})
-fi
-AC_USE_SYSTEM_EXTENSIONS
-AC_C_BIGENDIAN
-AC_C_INLINE
-LIBREPLACE_C99_STRUCT_INIT([],[AC_MSG_WARN([c99 structure initializer are not supported])])
-
-AC_PROG_INSTALL
-
-AC_ISC_POSIX
-AC_N_DEFINE(_XOPEN_SOURCE_EXTENDED)
-
-AC_SYS_LARGEFILE
-
-dnl Add #include for broken IRIX header files
-case "$host_os" in
- *irix6*) AC_ADD_INCLUDE(<standards.h>)
- ;;
- *hpux*)
- # mmap on HPUX is completely broken...
- AC_DEFINE(MMAP_BLACKLIST, 1, [Whether MMAP is broken])
- if test "`uname -r`" = "B.11.00" -o "`uname -r`" = "B.11.11"; then
- AC_MSG_WARN([Enabling HPUX 11.00/11.11 header bug workaround])
- CFLAGS="$CFLAGS -Dpread=pread64 -Dpwrite=pwrite64"
- fi
- if test "`uname -r`" = "B.11.23"; then
- AC_MSG_WARN([Enabling HPUX 11.23 machine/sys/getppdp.h bug workaround])
- CFLAGS="$CFLAGS -D_MACHINE_SYS_GETPPDP_INCLUDED"
- fi
- ;;
- *aix*)
- AC_DEFINE(BROKEN_STRNDUP, 1, [Whether strndup is broken])
- AC_DEFINE(BROKEN_STRNLEN, 1, [Whether strnlen is broken])
- if test "${GCC}" != "yes"; then
- ## for funky AIX compiler using strncpy()
- 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.
- #
- *vos*)
- case "$CFLAGS" in
- *-D_POSIX_C_SOURCE*);;
- *)
- CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112L"
- AC_DEFINE(_POSIX_C_SOURCE, 200112L, [Whether to enable POSIX support])
- ;;
- esac
- case "$CFLAGS" in
- *-D_SYSV*|*-D_SVID_SOURCE*);;
- *)
- CFLAGS="$CFLAGS -D_SYSV"
- AC_DEFINE(_SYSV, 1, [Whether to enable System V compatibility])
- ;;
- esac
- ;;
-esac
-
-
-
-AC_CHECK_HEADERS([standards.h])
-
-# Solaris needs HAVE_LONG_LONG defined
-AC_CHECK_TYPES(long long)
-
-AC_CHECK_SIZEOF(int)
-AC_CHECK_SIZEOF(char)
-AC_CHECK_SIZEOF(short)
-AC_CHECK_SIZEOF(long)
-AC_CHECK_SIZEOF(long long)
-
-AC_CHECK_TYPE(uint_t, unsigned int)
-AC_CHECK_TYPE(int8_t, char)
-AC_CHECK_TYPE(uint8_t, unsigned char)
-AC_CHECK_TYPE(int16_t, short)
-AC_CHECK_TYPE(uint16_t, unsigned short)
-
-if test $ac_cv_sizeof_int -eq 4 ; then
-AC_CHECK_TYPE(int32_t, int)
-AC_CHECK_TYPE(uint32_t, unsigned int)
-elif test $ac_cv_size_long -eq 4 ; then
-AC_CHECK_TYPE(int32_t, long)
-AC_CHECK_TYPE(uint32_t, unsigned long)
-else
-AC_MSG_ERROR([LIBREPLACE no 32-bit type found])
-fi
-
-AC_CHECK_TYPE(int64_t, long long)
-AC_CHECK_TYPE(uint64_t, unsigned long long)
-
-AC_CHECK_TYPE(size_t, unsigned int)
-AC_CHECK_TYPE(ssize_t, int)
-
-AC_CHECK_SIZEOF(off_t)
-AC_CHECK_SIZEOF(size_t)
-AC_CHECK_SIZEOF(ssize_t)
-
-AC_CHECK_TYPE(intptr_t, long long)
-AC_CHECK_TYPE(uintptr_t, unsigned long long)
-AC_CHECK_TYPE(ptrdiff_t, unsigned long long)
-
-if test x"$ac_cv_type_long_long" != x"yes";then
- AC_MSG_ERROR([LIBREPLACE needs type 'long long'])
-fi
-if test $ac_cv_sizeof_long_long -lt 8;then
- AC_MSG_ERROR([LIBREPLACE needs sizeof(long long) >= 8])
-fi
-
-############################################
-# check if the compiler can do immediate structures
-AC_SUBST(libreplace_cv_immediate_structures)
-AC_CACHE_CHECK([for immediate structures],libreplace_cv_immediate_structures,[
- AC_TRY_COMPILE([
- #include <stdio.h>
- ],[
- typedef struct {unsigned x;} FOOBAR;
- #define X_FOOBAR(x) ((FOOBAR) { x })
- #define FOO_ONE X_FOOBAR(1)
- FOOBAR f = FOO_ONE;
- static const struct {
- FOOBAR y;
- } f2[] = {
- {FOO_ONE}
- };
- static const FOOBAR f3[] = {FOO_ONE};
- ],
- libreplace_cv_immediate_structures=yes,
- libreplace_cv_immediate_structures=no,
- libreplace_cv_immediate_structures=cross)
-])
-if test x"$libreplace_cv_immediate_structures" = x"yes"; then
- AC_DEFINE(HAVE_IMMEDIATE_STRUCTURES,1,[Whether the compiler supports immediate structures])
-fi
-
-AC__LIBREPLACE_ONLY_CC_CHECKS_END
-]) dnl end AC_LIBREPLACE_CC_CHECKS
diff --git a/source3/lib/replace/libreplace_ld.m4 b/source3/lib/replace/libreplace_ld.m4
deleted file mode 100644
index 81bde46219..0000000000
--- a/source3/lib/replace/libreplace_ld.m4
+++ /dev/null
@@ -1,319 +0,0 @@
-#
-# 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"
-if AC_TRY_COMMAND([${CC-cc} $CFLAGS -Wl,--version 2>&1 | grep "GNU ld" >/dev/null]); then
- LD_EXPORT_DYNAMIC="-Wl,-export-dynamic"
-else
- case "$host_os" in
- hpux* )
- LD_EXPORT_DYNAMIC="-Wl,-E"
- ;;
- *)
- LD_EXPORT_DYNAMIC=""
- ;;
- esac
-fi
-AC_SUBST(LD_EXPORT_DYNAMIC)
-LDFLAGS="$saved_LDFLAGS"
-])
-
-AC_DEFUN([AC_LD_PICFLAG],
-[
-case "$host_os" in
- *linux*)
- PICFLAG="-fPIC"
- ;;
- *solaris*)
- if test "${GCC}" = "yes"; then
- PICFLAG="-fPIC"
- else
- PICFLAG="-KPIC"
- fi
- ;;
- *sunos*)
- PICFLAG="-KPIC" # Is this correct for SunOS
- ;;
- *netbsd* | *freebsd* | *dragonfly* )
- PICFLAG="-fPIC -DPIC"
- ;;
- *openbsd*)
- PICFLAG="-fPIC"
- ;;
- *irix*)
- if test "${GCC}" = "yes"; then
- PICFLAG="-fPIC"
- else
- PICFLAG="-KPIC"
- fi
- ;;
- *aix*)
- # as AIX code is always position independent...
- PICFLAG="-O2"
- ;;
- *hpux*)
- if test $ac_cv_prog_cc_Ae = yes; then
- PICFLAG="+z +ESnolit"
- elif test "${GCC}" = "yes"; then
- PICFLAG="-fPIC"
- fi
- if test "$host_cpu" = "ia64"; then
- PICFLAG="+z"
- fi
- ;;
- *osf*)
- PICFLAG="-fPIC"
- ;;
- *unixware*)
- PICFLAG="-KPIC"
- ;;
- *darwin*)
- PICFLAG="-fno-common"
- ;;
-esac
-AC_SUBST(PICFLAG)
-])
-
-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],
-[
- LD_SHLIB_FLAGS="-shared"
-
- case "$host_os" in
- *linux*)
- LD_SHLIB_FLAGS="-shared -Wl,-Bsymbolic"
- ;;
- *solaris*)
- LD_SHLIB_FLAGS="-G"
- if test "${GCC}" = "no"; then
- ## ${CFLAGS} added for building 64-bit shared
- ## libs using Sun's Compiler
- LD_SHLIB_FLAGS="-G \${CFLAGS}"
- fi
- ;;
- *sunos*)
- LD_SHLIB_FLAGS="-G"
- ;;
- *irix*)
- LD_SHLIB_FLAGS="-shared"
- ;;
- *aix*)
- LD_SHLIB_FLAGS="-Wl,-G,-bexpall,-bbigtoc"
- ;;
- *hpux*)
- if test "${GCC}" = "yes"; then
- LD_SHLIB_FLAGS="-shared"
- else
- LD_SHLIB_FLAGS="-b"
- fi
- ;;
- *osf*)
- LD_SHLIB_FLAGS="-shared"
- ;;
- *darwin*)
- 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)
-])
-
-AC_DEFUN([AC_LD_SHLIBEXT],
-[
- SHLIBEXT="so"
- case "$host_os" in
- *hpux*)
- if test "$host_cpu" = "ia64"; then
- SHLIBEXT="so"
- else
- SHLIBEXT="sl"
- fi
- ;;
- *darwin*)
- SHLIBEXT="dylib"
- ;;
- esac
- AC_SUBST(SHLIBEXT)
-])
-
-AC_DEFUN([AC_LD_SONAMEFLAG],
-[
- AC_SUBST(SONAMEFLAG)
- SONAMEFLAG=""
- case "$host_os" in
- *linux*)
- SONAMEFLAG="-Wl,-soname="
- ;;
- *solaris*)
- SONAMEFLAG="-h "
- if test "${GCC}" = "yes"; then
- SONAMEFLAG="-Wl,-soname="
- fi
- ;;
- *sunos*)
- SONAMEFLAG="-Wl,-h,"
- ;;
- *netbsd* | *freebsd* | *dragonfly* )
- SONAMEFLAG="-Wl,-soname,"
- ;;
- *openbsd*)
- SONAMEFLAG="-Wl,-soname,"
- ;;
- *irix*)
- SONAMEFLAG="-Wl,-soname,"
- ;;
- *hpux*)
- SONAMEFLAG="-Wl,+h,"
- ;;
- *osf*)
- SONAMEFLAG="-Wl,-soname,"
- ;;
- *unixware*)
- SONAMEFLAG="-Wl,-soname,"
- ;;
- *darwin*)
- 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"
- ;;
- *aix*)
- LD_SHLIB_ALLOW_UNDEF_FLAG="-Wl,-bnoentry"
- ;;
- 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
- ;;
- *netbsd*)
- 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)
-])
diff --git a/source3/lib/replace/libreplace_macros.m4 b/source3/lib/replace/libreplace_macros.m4
deleted file mode 100644
index 1856eacf66..0000000000
--- a/source3/lib/replace/libreplace_macros.m4
+++ /dev/null
@@ -1,332 +0,0 @@
-#
-# This is a collection of useful autoconf macros
-#
-
-############################################
-# Check if the compiler handles c99 struct initialization, and if not try -AC99 and -c99 flags
-# Usage: LIBREPLACE_C99_STRUCT_INIT(success-action,failure-action)
-# changes CFLAGS to add -AC99 or -c99 if needed
-AC_DEFUN([LIBREPLACE_C99_STRUCT_INIT],
-[
-saved_CFLAGS="$CFLAGS";
-c99_init=no
-if test x"$c99_init" = x"no"; then
- AC_MSG_CHECKING(for C99 designated initializers)
- CFLAGS="$saved_CFLAGS";
- AC_TRY_COMPILE([#include <stdio.h>],
- [ struct foo {int x;char y;};
- struct foo bar = { .y = 'X', .x = 1 };
- ],
- [AC_MSG_RESULT(yes); c99_init=yes],[AC_MSG_RESULT(no)])
-fi
-if test x"$c99_init" = x"no"; then
- AC_MSG_CHECKING(for C99 designated initializers with -AC99)
- CFLAGS="$saved_CFLAGS -AC99";
- AC_TRY_COMPILE([#include <stdio.h>],
- [ struct foo {int x;char y;};
- struct foo bar = { .y = 'X', .x = 1 };
- ],
- [AC_MSG_RESULT(yes); c99_init=yes],[AC_MSG_RESULT(no)])
-fi
-if test x"$c99_init" = x"no"; then
- AC_MSG_CHECKING(for C99 designated initializers with -qlanglvl=extc99)
- CFLAGS="$saved_CFLAGS -qlanglvl=extc99";
- AC_TRY_COMPILE([#include <stdio.h>],
- [ struct foo {int x;char y;};
- struct foo bar = { .y = 'X', .x = 1 };
- ],
- [AC_MSG_RESULT(yes); c99_init=yes],[AC_MSG_RESULT(no)])
-fi
-if test x"$c99_init" = x"no"; then
- AC_MSG_CHECKING(for C99 designated initializers with -qlanglvl=stdc99)
- CFLAGS="$saved_CFLAGS -qlanglvl=stdc99";
- AC_TRY_COMPILE([#include <stdio.h>],
- [ struct foo {int x;char y;};
- struct foo bar = { .y = 'X', .x = 1 };
- ],
- [AC_MSG_RESULT(yes); c99_init=yes],[AC_MSG_RESULT(no)])
-fi
-if test x"$c99_init" = x"no"; then
- AC_MSG_CHECKING(for C99 designated initializers with -c99)
- CFLAGS="$saved_CFLAGS -c99"
- AC_TRY_COMPILE([#include <stdio.h>],
- [ struct foo {int x;char y;};
- struct foo bar = { .y = 'X', .x = 1 };
- ],
- [AC_MSG_RESULT(yes); c99_init=yes],[AC_MSG_RESULT(no)])
-fi
-
-if test "`uname`" = "HP-UX"; then
- if test "$ac_cv_c_compiler_gnu" = no; then
- # special override for broken HP-UX compiler - I can't find a way to test
- # this properly (its a compiler bug)
- CFLAGS="$CFLAGS -AC99";
- c99_init=yes;
- fi
-fi
-
-if test x"$c99_init" = x"yes"; then
- saved_CFLAGS=""
- $1
-else
- CFLAGS="$saved_CFLAGS"
- saved_CFLAGS=""
- $2
-fi
-])
-
-dnl AC_PROG_CC_FLAG(flag)
-AC_DEFUN(AC_PROG_CC_FLAG,
-[AC_CACHE_CHECK(whether ${CC-cc} accepts -$1, ac_cv_prog_cc_$1,
-[echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -$1 -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_$1=yes
-else
- ac_cv_prog_cc_$1=no
-fi
-rm -f conftest*
-])])
-
-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)
-AC_DEFUN(AC_HAVE_DECL,
-[
- AC_CACHE_CHECK([for $1 declaration],ac_cv_have_$1_decl,[
- AC_TRY_COMPILE([$2],[int i = (int)$1],
- ac_cv_have_$1_decl=yes,ac_cv_have_$1_decl=no)])
- if test x"$ac_cv_have_$1_decl" = x"yes"; then
- AC_DEFINE([HAVE_]translit([$1], [a-z], [A-Z])[_DECL],1,[Whether $1() is available])
- fi
-])
-
-
-# AC_CHECK_LIB_EXT(LIBRARY, [EXT_LIBS], [FUNCTION],
-# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
-# [ADD-ACTION-IF-FOUND],[OTHER-LIBRARIES])
-# ------------------------------------------------------
-#
-# Use a cache variable name containing both the library and function name,
-# because the test really is for library $1 defining function $3, not
-# just for library $1. Separate tests with the same $1 and different $3s
-# may have different results.
-#
-# Note that using directly AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$3])
-# is asking for trouble, since AC_CHECK_LIB($lib, fun) would give
-# ac_cv_lib_$lib_fun, which is definitely not what was meant. Hence
-# the AS_LITERAL_IF indirection.
-#
-# FIXME: This macro is extremely suspicious. It DEFINEs unconditionally,
-# whatever the FUNCTION, in addition to not being a *S macro. Note
-# that the cache does depend upon the function we are looking for.
-#
-# It is on purpose we used `ac_check_lib_ext_save_LIBS' and not just
-# `ac_save_LIBS': there are many macros which don't want to see `LIBS'
-# changed but still want to use AC_CHECK_LIB_EXT, so they save `LIBS'.
-# And ``ac_save_LIBS' is too tempting a name, so let's leave them some
-# freedom.
-AC_DEFUN([AC_CHECK_LIB_EXT],
-[
-AH_CHECK_LIB_EXT([$1])
-ac_check_lib_ext_save_LIBS=$LIBS
-LIBS="-l$1 $$2 $7 $LIBS"
-AS_LITERAL_IF([$1],
- [AS_VAR_PUSHDEF([ac_Lib_ext], [ac_cv_lib_ext_$1])],
- [AS_VAR_PUSHDEF([ac_Lib_ext], [ac_cv_lib_ext_$1''])])dnl
-
-m4_ifval([$3],
- [
- AH_CHECK_FUNC_EXT([$3])
- AS_LITERAL_IF([$1],
- [AS_VAR_PUSHDEF([ac_Lib_func], [ac_cv_lib_ext_$1_$3])],
- [AS_VAR_PUSHDEF([ac_Lib_func], [ac_cv_lib_ext_$1''_$3])])dnl
- AC_CACHE_CHECK([for $3 in -l$1], ac_Lib_func,
- [AC_TRY_LINK_FUNC($3,
- [AS_VAR_SET(ac_Lib_func, yes);
- AS_VAR_SET(ac_Lib_ext, yes)],
- [AS_VAR_SET(ac_Lib_func, no);
- AS_VAR_SET(ac_Lib_ext, no)])
- ])
- AS_IF([test AS_VAR_GET(ac_Lib_func) = yes],
- [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$3))])dnl
- AS_VAR_POPDEF([ac_Lib_func])dnl
- ],[
- AC_CACHE_CHECK([for -l$1], ac_Lib_ext,
- [AC_TRY_LINK_FUNC([main],
- [AS_VAR_SET(ac_Lib_ext, yes)],
- [AS_VAR_SET(ac_Lib_ext, no)])
- ])
- ])
-LIBS=$ac_check_lib_ext_save_LIBS
-
-AS_IF([test AS_VAR_GET(ac_Lib_ext) = yes],
- [m4_default([$4],
- [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1))
- case "$$2" in
- *-l$1*)
- ;;
- *)
- $2="-l$1 $$2"
- ;;
- esac])
- [$6]
- ],
- [$5])dnl
-AS_VAR_POPDEF([ac_Lib_ext])dnl
-])# AC_CHECK_LIB_EXT
-
-# AH_CHECK_LIB_EXT(LIBNAME)
-# ---------------------
-m4_define([AH_CHECK_LIB_EXT],
-[AH_TEMPLATE(AS_TR_CPP(HAVE_LIB$1),
- [Define to 1 if you have the `]$1[' library (-l]$1[).])])
-
-dnl AC_SEARCH_LIBS_EXT(FUNCTION, SEARCH-LIBS, EXT_LIBS,
-dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
-dnl [OTHER-LIBRARIES])
-dnl --------------------------------------------------------
-dnl Search for a library defining FUNC, if it's not already available.
-AC_DEFUN([AC_SEARCH_LIBS_EXT],
-[AC_CACHE_CHECK([for library containing $1], [ac_cv_search_ext_$1],
-[
-ac_func_search_ext_save_LIBS=$LIBS
-ac_cv_search_ext_$1=no
-AC_LINK_IFELSE([AC_LANG_CALL([], [$1])],
- [ac_cv_search_ext_$1="none required"])
-if test "$ac_cv_search_ext_$1" = no; then
- for ac_lib in $2; do
- LIBS="-l$ac_lib $$3 $6 $ac_func_search_save_ext_LIBS"
- AC_LINK_IFELSE([AC_LANG_CALL([], [$1])],
- [ac_cv_search_ext_$1="-l$ac_lib"
-break])
- done
-fi
-LIBS=$ac_func_search_ext_save_LIBS])
-AS_IF([test "$ac_cv_search_ext_$1" != no],
- [test "$ac_cv_search_ext_$1" = "none required" || $3="$ac_cv_search_ext_$1 $$3"
- $4],
- [$5])dnl
-])
-
-dnl check for a function in a $LIBS and $OTHER_LIBS libraries variable.
-dnl AC_CHECK_FUNC_EXT(func,OTHER_LIBS,IF-TRUE,IF-FALSE)
-AC_DEFUN([AC_CHECK_FUNC_EXT],
-[
- AH_CHECK_FUNC_EXT($1)
- ac_check_func_ext_save_LIBS=$LIBS
- LIBS="$2 $LIBS"
- AS_VAR_PUSHDEF([ac_var], [ac_cv_func_ext_$1])dnl
- AC_CACHE_CHECK([for $1], ac_var,
- [AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])],
- [AS_VAR_SET(ac_var, yes)],
- [AS_VAR_SET(ac_var, no)])])
- LIBS=$ac_check_func_ext_save_LIBS
- AS_IF([test AS_VAR_GET(ac_var) = yes],
- [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$1])) $3],
- [$4])dnl
-AS_VAR_POPDEF([ac_var])dnl
-])# AC_CHECK_FUNC
-
-# AH_CHECK_FUNC_EXT(FUNCNAME)
-# ---------------------
-m4_define([AH_CHECK_FUNC_EXT],
-[AH_TEMPLATE(AS_TR_CPP(HAVE_$1),
- [Define to 1 if you have the `]$1[' function.])])
-
-dnl Define an AC_DEFINE with ifndef guard.
-dnl AC_N_DEFINE(VARIABLE [, VALUE])
-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
-])
-
-dnl Add an #include
-dnl AC_ADD_INCLUDE(VARIABLE)
-define(AC_ADD_INCLUDE,
-[cat >> confdefs.h <<\EOF
-[#include] $1
-EOF
-])
-
-dnl remove an #include
-dnl AC_REMOVE_INCLUDE(VARIABLE)
-define(AC_REMOVE_INCLUDE,
-[
-grep -v '[#include] $1' confdefs.h >confdefs.h.tmp
-cat confdefs.h.tmp > confdefs.h
-rm confdefs.h.tmp
-])
-
-dnl remove an #define
-dnl AC_REMOVE_DEFINE(VARIABLE)
-define(AC_REMOVE_DEFINE,
-[
-grep -v '[#define] $1 ' confdefs.h |grep -v '[#define] $1[$]'>confdefs.h.tmp
-cat confdefs.h.tmp > confdefs.h
-rm confdefs.h.tmp
-])
-
-dnl AS_HELP_STRING is not available in autoconf 2.57, and AC_HELP_STRING is deprecated
-dnl in autoconf 2.59, so define AS_HELP_STRING to be AC_HELP_STRING unless it is already
-dnl defined.
-m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])
-
-dnl check if the prototype in the header matches the given one
-dnl AC_VERIFY_C_PROTOTYPE(prototype,functionbody,[IF-TRUE].[IF-FALSE],[extraheaders])
-AC_DEFUN(AC_VERIFY_C_PROTOTYPE,
-[AC_CACHE_CHECK([for prototype $1], AS_TR_SH([ac_cv_c_prototype_$1]),
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([
- AC_INCLUDES_DEFAULT
- $5
- $1
- {
- $2
- }
- ])],[
- AS_TR_SH([ac_cv_c_prototype_$1])=yes
- ],[
- AS_TR_SH([ac_cv_c_prototype_$1])=no
- ])
-)
-AS_IF([test $AS_TR_SH([ac_cv_c_prototype_$1]) = yes],[$3],[$4])
-])
-
-AC_DEFUN(LIBREPLACE_PROVIDE_HEADER,
-[AC_CHECK_HEADER([$1],
- [ AC_CONFIG_COMMANDS(rm-$1, [rm -f $libreplacedir/$1], [libreplacedir=$libreplacedir]) ],
- [ AC_CONFIG_COMMANDS(mk-$1, [echo "#include \"replace.h\"" > $libreplacedir/$1], [libreplacedir=$libreplacedir]) ]
- )
-])
-
-dnl AC_HAVE_TYPE(TYPE,INCLUDES)
-AC_DEFUN([AC_HAVE_TYPE], [
-AC_REQUIRE([AC_HEADER_STDC])
-cv=`echo "$1" | sed 'y%./+- %__p__%'`
-AC_MSG_CHECKING(for $1)
-AC_CACHE_VAL([ac_cv_type_$cv],
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-AC_INCLUDES_DEFAULT
-$2]],
-[[$1 foo;]])],
-[eval "ac_cv_type_$cv=yes"],
-[eval "ac_cv_type_$cv=no"]))dnl
-ac_foo=`eval echo \\$ac_cv_type_$cv`
-AC_MSG_RESULT($ac_foo)
-if test "$ac_foo" = yes; then
- ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'`
-if false; then
- AC_CHECK_TYPES($1)
-fi
- AC_DEFINE_UNQUOTED($ac_tr_hdr, 1, [Define if you have type `$1'])
-fi
-])
diff --git a/source3/lib/replace/libreplace_network.m4 b/source3/lib/replace/libreplace_network.m4
deleted file mode 100644
index 4edb55c03a..0000000000
--- a/source3/lib/replace/libreplace_network.m4
+++ /dev/null
@@ -1,377 +0,0 @@
-AC_DEFUN_ONCE(AC_LIBREPLACE_NETWORK_CHECKS,
-[
-echo "LIBREPLACE_NETWORK_CHECKS: START"
-
-AC_DEFINE(LIBREPLACE_NETWORK_CHECKS, 1, [LIBREPLACE_NETWORK_CHECKS were used])
-LIBREPLACE_NETWORK_OBJS=""
-LIBREPLACE_NETWORK_LIBS=""
-
-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)
-
-dnl we need to check that net/if.h really can be used, to cope with hpux
-dnl where including it always fails
-AC_CACHE_CHECK([for usable net/if.h],libreplace_cv_USABLE_NET_IF_H,[
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([
- AC_INCLUDES_DEFAULT
- #if HAVE_SYS_SOCKET_H
- # include <sys/socket.h>
- #endif
- #include <net/if.h>
- int main(void) {return 0;}])],
- [libreplace_cv_USABLE_NET_IF_H=yes],
- [libreplace_cv_USABLE_NET_IF_H=no]
- )
-])
-if test x"$libreplace_cv_USABLE_NET_IF_H" = x"yes";then
- AC_DEFINE(HAVE_NET_IF_H, 1, usability of net/if.h)
-fi
-
-AC_HAVE_TYPE([socklen_t],[#include <sys/socket.h>])
-AC_HAVE_TYPE([sa_family_t],[#include <sys/socket.h>])
-AC_HAVE_TYPE([struct addrinfo], [#include <netdb.h>])
-AC_HAVE_TYPE([struct sockaddr], [#include <sys/socket.h>])
-AC_HAVE_TYPE([struct sockaddr_storage], [
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-])
-AC_HAVE_TYPE([struct sockaddr_in6], [
-#include <sys/socket.h>
-#include <sys/types.h>
-#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_CACHE_CHECK([for sin_len in sock],libreplace_cv_HAVE_SOCK_SIN_LEN,[
- AC_TRY_COMPILE(
- [
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
- ],[
-struct sockaddr_in sock; sock.sin_len = sizeof(sock);
- ],[
- libreplace_cv_HAVE_SOCK_SIN_LEN=yes
- ],[
- libreplace_cv_HAVE_SOCK_SIN_LEN=no
- ])
-])
-if test x"$libreplace_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
- AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property])
-fi
-
-############################################
-# check for unix domain sockets
-AC_CACHE_CHECK([for unix domain sockets],libreplace_cv_HAVE_UNIXSOCKET,[
- AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <sys/socket.h>
-#include <sys/un.h>
- ],[
-struct sockaddr_un sunaddr;
-sunaddr.sun_family = AF_UNIX;
- ],[
- libreplace_cv_HAVE_UNIXSOCKET=yes
- ],[
- libreplace_cv_HAVE_UNIXSOCKET=no
- ])
-])
-if test x"$libreplace_cv_HAVE_UNIXSOCKET" = x"yes"; then
- AC_DEFINE(HAVE_UNIXSOCKET,1,[If we need to build with unixscoket support])
-fi
-
-dnl The following test is roughl taken from the cvs sources.
-dnl
-dnl If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
-dnl The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
-dnl libsocket.so which has a bad implementation of gethostbyname (it
-dnl only looks in /etc/hosts), so we only look for -lsocket if we need
-dnl it.
-AC_CHECK_FUNCS(connect)
-if test x"$ac_cv_func_connect" = x"no"; then
- AC_CHECK_LIB_EXT(nsl_s, LIBREPLACE_NETWORK_LIBS, connect)
- AC_CHECK_LIB_EXT(nsl, LIBREPLACE_NETWORK_LIBS, connect)
- AC_CHECK_LIB_EXT(socket, LIBREPLACE_NETWORK_LIBS, connect)
- AC_CHECK_LIB_EXT(inet, LIBREPLACE_NETWORK_LIBS, connect)
- dnl We can't just call AC_CHECK_FUNCS(connect) here,
- dnl because the value has been cached.
- if test x"$ac_cv_lib_ext_nsl_s_connect" = x"yes" ||
- test x"$ac_cv_lib_ext_nsl_connect" = x"yes" ||
- test x"$ac_cv_lib_ext_socket_connect" = x"yes" ||
- test x"$ac_cv_lib_ext_inet_connect" = x"yes"
- then
- AC_DEFINE(HAVE_CONNECT,1,[Whether the system has connect()])
- fi
-fi
-
-AC_CHECK_FUNCS(gethostbyname)
-if test x"$ac_cv_func_gethostbyname" = x"no"; then
- AC_CHECK_LIB_EXT(nsl_s, LIBREPLACE_NETWORK_LIBS, gethostbyname)
- AC_CHECK_LIB_EXT(nsl, LIBREPLACE_NETWORK_LIBS, gethostbyname)
- AC_CHECK_LIB_EXT(socket, LIBREPLACE_NETWORK_LIBS, gethostbyname)
- dnl We can't just call AC_CHECK_FUNCS(gethostbyname) here,
- dnl because the value has been cached.
- if test x"$ac_cv_lib_ext_nsl_s_gethostbyname" = x"yes" ||
- test x"$ac_cv_lib_ext_nsl_gethostbyname" = x"yes" ||
- test x"$ac_cv_lib_ext_socket_gethostbyname" = x"yes"
- then
- AC_DEFINE(HAVE_GETHOSTBYNAME,1,
- [Whether the system has gethostbyname()])
- fi
-fi
-
-dnl HP-UX has if_nametoindex in -lipv6
-AC_CHECK_FUNCS(if_nametoindex)
-if test x"$ac_cv_func_if_nametoindex" = x"no"; then
- AC_CHECK_LIB_EXT(ipv6, LIBREPLACE_NETWORK_LIBS, if_nametoindex)
- dnl We can't just call AC_CHECK_FUNCS(if_nametoindex) here,
- dnl because the value has been cached.
- if test x"$ac_cv_lib_ext_ipv6_if_nametoindex" = x"yes"
- then
- AC_DEFINE(HAVE_IF_NAMETOINDEX, 1,
- [Whether the system has if_nametoindex()])
- fi
-fi
-
-# The following tests need LIBS="${LIBREPLACE_NETWORK_LIBS}"
-old_LIBS=$LIBS
-LIBS="${LIBREPLACE_NETWORK_LIBS}"
-SAVE_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS -I$libreplacedir"
-
-AC_CHECK_FUNCS(socketpair,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} socketpair.o"])
-
-AC_CACHE_CHECK([for broken inet_ntoa],libreplace_cv_REPLACE_INET_NTOA,[
-AC_TRY_RUN([
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-main() { struct in_addr ip; ip.s_addr = 0x12345678;
-if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
- strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
-exit(1);}],
- libreplace_cv_REPLACE_INET_NTOA=yes,libreplace_cv_REPLACE_INET_NTOA=no,libreplace_cv_REPLACE_INET_NTOA=cross)])
-
-AC_CHECK_FUNCS(inet_ntoa,[],[libreplace_cv_REPLACE_INET_NTOA=yes])
-if test x"$libreplace_cv_REPLACE_INET_NTOA" = x"yes"; then
- AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced])
- LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} inet_ntoa.o"
-fi
-
-AC_CHECK_FUNCS(inet_aton,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} inet_aton.o"])
-
-AC_CHECK_FUNCS(inet_ntop,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} inet_ntop.o"])
-
-AC_CHECK_FUNCS(inet_pton,[],[LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} inet_pton.o"])
-
-dnl test for getaddrinfo/getnameinfo
-AC_CACHE_CHECK([for getaddrinfo],libreplace_cv_HAVE_GETADDRINFO,[
-AC_TRY_LINK([
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-#include <sys/socket.h>
-#include <netdb.h>],
-[
-struct sockaddr sa;
-struct addrinfo *ai = NULL;
-int ret = getaddrinfo(NULL, NULL, NULL, &ai);
-if (ret != 0) {
- const char *es = gai_strerror(ret);
-}
-freeaddrinfo(ai);
-ret = getnameinfo(&sa, sizeof(sa),
- NULL, 0,
- NULL, 0, 0);
-
-],
-libreplace_cv_HAVE_GETADDRINFO=yes,libreplace_cv_HAVE_GETADDRINFO=no)])
-if test x"$libreplace_cv_HAVE_GETADDRINFO" = x"yes"; then
- AC_DEFINE(HAVE_GETADDRINFO,1,[Whether the system has getaddrinfo])
- AC_DEFINE(HAVE_GETNAMEINFO,1,[Whether the system has getnameinfo])
- AC_DEFINE(HAVE_FREEADDRINFO,1,[Whether the system has freeaddrinfo])
- AC_DEFINE(HAVE_GAI_STRERROR,1,[Whether the system has gai_strerror])
-else
- LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} getaddrinfo.o"
-fi
-
-AC_CHECK_HEADERS([ifaddrs.h])
-
-dnl Used when getifaddrs is not available
-AC_CHECK_MEMBERS([struct sockaddr.sa_len],
- [AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Whether struct sockaddr has a sa_len member])],
- [],
- [#include <sys/socket.h>])
-
-dnl test for getifaddrs and freeifaddrs
-AC_CACHE_CHECK([for getifaddrs and freeifaddrs],libreplace_cv_HAVE_GETIFADDRS,[
-AC_TRY_COMPILE([
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <ifaddrs.h>
-#include <netdb.h>],
-[
-struct ifaddrs *ifp = NULL;
-int ret = getifaddrs (&ifp);
-freeifaddrs(ifp);
-],
-libreplace_cv_HAVE_GETIFADDRS=yes,libreplace_cv_HAVE_GETIFADDRS=no)])
-if test x"$libreplace_cv_HAVE_GETIFADDRS" = x"yes"; then
- AC_DEFINE(HAVE_GETIFADDRS,1,[Whether the system has getifaddrs])
- AC_DEFINE(HAVE_FREEIFADDRS,1,[Whether the system has freeifaddrs])
- AC_DEFINE(HAVE_STRUCT_IFADDRS,1,[Whether struct ifaddrs is available])
-fi
-
-##################
-# look for a method of finding the list of network interfaces
-iface=no;
-AC_CACHE_CHECK([for iface getifaddrs],libreplace_cv_HAVE_IFACE_GETIFADDRS,[
-AC_TRY_RUN([
-#define HAVE_IFACE_GETIFADDRS 1
-#define NO_CONFIG_H 1
-#define AUTOCONF_TEST 1
-#define SOCKET_WRAPPER_NOT_REPLACE
-#include "$libreplacedir/replace.c"
-#include "$libreplacedir/inet_ntop.c"
-#include "$libreplacedir/snprintf.c"
-#include "$libreplacedir/getifaddrs.c"
-#define getifaddrs_test main
-#include "$libreplacedir/test/getifaddrs.c"],
- libreplace_cv_HAVE_IFACE_GETIFADDRS=yes,libreplace_cv_HAVE_IFACE_GETIFADDRS=no,libreplace_cv_HAVE_IFACE_GETIFADDRS=cross)])
-if test x"$libreplace_cv_HAVE_IFACE_GETIFADDRS" = x"yes"; then
- iface=yes;AC_DEFINE(HAVE_IFACE_GETIFADDRS,1,[Whether iface getifaddrs is available])
-else
- LIBREPLACE_NETWORK_OBJS="${LIBREPLACE_NETWORK_OBJS} getifaddrs.o"
-fi
-
-
-if test $iface = no; then
-AC_CACHE_CHECK([for iface AIX],libreplace_cv_HAVE_IFACE_AIX,[
-AC_TRY_RUN([
-#define HAVE_IFACE_AIX 1
-#define NO_CONFIG_H 1
-#define AUTOCONF_TEST 1
-#undef _XOPEN_SOURCE_EXTENDED
-#define SOCKET_WRAPPER_NOT_REPLACE
-#include "$libreplacedir/replace.c"
-#include "$libreplacedir/inet_ntop.c"
-#include "$libreplacedir/snprintf.c"
-#include "$libreplacedir/getifaddrs.c"
-#define getifaddrs_test main
-#include "$libreplacedir/test/getifaddrs.c"],
- libreplace_cv_HAVE_IFACE_AIX=yes,libreplace_cv_HAVE_IFACE_AIX=no,libreplace_cv_HAVE_IFACE_AIX=cross)])
-if test x"$libreplace_cv_HAVE_IFACE_AIX" = x"yes"; then
- iface=yes;AC_DEFINE(HAVE_IFACE_AIX,1,[Whether iface AIX is available])
-fi
-fi
-
-
-if test $iface = no; then
-AC_CACHE_CHECK([for iface ifconf],libreplace_cv_HAVE_IFACE_IFCONF,[
-AC_TRY_RUN([
-#define HAVE_IFACE_IFCONF 1
-#define NO_CONFIG_H 1
-#define AUTOCONF_TEST 1
-#define SOCKET_WRAPPER_NOT_REPLACE
-#include "$libreplacedir/replace.c"
-#include "$libreplacedir/inet_ntop.c"
-#include "$libreplacedir/snprintf.c"
-#include "$libreplacedir/getifaddrs.c"
-#define getifaddrs_test main
-#include "$libreplacedir/test/getifaddrs.c"],
- libreplace_cv_HAVE_IFACE_IFCONF=yes,libreplace_cv_HAVE_IFACE_IFCONF=no,libreplace_cv_HAVE_IFACE_IFCONF=cross)])
-if test x"$libreplace_cv_HAVE_IFACE_IFCONF" = x"yes"; then
- iface=yes;AC_DEFINE(HAVE_IFACE_IFCONF,1,[Whether iface ifconf is available])
-fi
-fi
-
-if test $iface = no; then
-AC_CACHE_CHECK([for iface ifreq],libreplace_cv_HAVE_IFACE_IFREQ,[
-AC_TRY_RUN([
-#define HAVE_IFACE_IFREQ 1
-#define NO_CONFIG_H 1
-#define AUTOCONF_TEST 1
-#define SOCKET_WRAPPER_NOT_REPLACE
-#include "$libreplacedir/replace.c"
-#include "$libreplacedir/inet_ntop.c"
-#include "$libreplacedir/snprintf.c"
-#include "$libreplacedir/getifaddrs.c"
-#define getifaddrs_test main
-#include "$libreplacedir/test/getifaddrs.c"],
- libreplace_cv_HAVE_IFACE_IFREQ=yes,libreplace_cv_HAVE_IFACE_IFREQ=no,libreplace_cv_HAVE_IFACE_IFREQ=cross)])
-if test x"$libreplace_cv_HAVE_IFACE_IFREQ" = x"yes"; then
- iface=yes;AC_DEFINE(HAVE_IFACE_IFREQ,1,[Whether iface ifreq is available])
-fi
-fi
-
-dnl test for ipv6
-AC_CACHE_CHECK([for ipv6 support],libreplace_cv_HAVE_IPV6,[
- AC_TRY_LINK([
-#include <stdlib.h> /* for NULL */
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netdb.h>
- ],
- [
-struct sockaddr_storage sa_store;
-struct addrinfo *ai = NULL;
-struct in6_addr in6addr;
-int idx = if_nametoindex("iface1");
-int s = socket(AF_INET6, SOCK_STREAM, 0);
-int ret = getaddrinfo(NULL, NULL, NULL, &ai);
-if (ret != 0) {
- const char *es = gai_strerror(ret);
-}
-freeaddrinfo(ai);
- ],[
- libreplace_cv_HAVE_IPV6=yes
- ],[
- libreplace_cv_HAVE_IPV6=no
- ])
-])
-if test x"$libreplace_cv_HAVE_IPV6" = x"yes"; then
- AC_DEFINE(HAVE_IPV6,1,[Whether the system has IPv6 support])
-fi
-
-LIBS=$old_LIBS
-CPPFLAGS="$SAVE_CPPFLAGS"
-
-LIBREPLACEOBJ="${LIBREPLACEOBJ} ${LIBREPLACE_NETWORK_OBJS}"
-
-echo "LIBREPLACE_NETWORK_CHECKS: END"
-]) dnl end AC_LIBREPLACE_NETWORK_CHECKS
diff --git a/source3/lib/replace/repdir.m4 b/source3/lib/replace/repdir.m4
deleted file mode 100644
index f53a4c2974..0000000000
--- a/source3/lib/replace/repdir.m4
+++ /dev/null
@@ -1,78 +0,0 @@
-AC_CACHE_CHECK([for broken readdir],libreplace_cv_READDIR_NEEDED,[
- AC_TRY_RUN([
-#define test_readdir_os2_delete main
-#include "$libreplacedir/test/os2_delete.c"],
- [libreplace_cv_READDIR_NEEDED=no],
- [libreplace_cv_READDIR_NEEDED=yes],
- [libreplace_cv_READDIR_NEEDED="assuming not"])
-])
-
-#
-# try to replace with getdirentries() if needed
-#
-if test x"$libreplace_cv_READDIR_NEEDED" = x"yes"; then
-AC_CHECK_FUNCS(getdirentries)
-AC_VERIFY_C_PROTOTYPE([long telldir(const DIR *dir)],
- [
- return 0;
- ],[
- AC_DEFINE(TELLDIR_TAKES_CONST_DIR, 1, [Whether telldir takes a const pointer])
- ],[],[
- #include <dirent.h>
- ])
-
-AC_VERIFY_C_PROTOTYPE([int seekdir(DIR *dir, long ofs)],
- [
- return 0;
- ],[
- AC_DEFINE(SEEKDIR_RETURNS_INT, 1, [Whether seekdir returns an int])
- ],[],[
- #include <dirent.h>
- ])
-AC_CACHE_CHECK([for replacing readdir using getdirentries()],libreplace_cv_READDIR_GETDIRENTRIES,[
- AC_TRY_RUN([
-#define _LIBREPLACE_REPLACE_H
-#include "$libreplacedir/repdir_getdirentries.c"
-#define test_readdir_os2_delete main
-#include "$libreplacedir/test/os2_delete.c"],
- [libreplace_cv_READDIR_GETDIRENTRIES=yes],
- [libreplace_cv_READDIR_GETDIRENTRIES=no])
-])
-fi
-if test x"$libreplace_cv_READDIR_GETDIRENTRIES" = x"yes"; then
- AC_DEFINE(REPLACE_READDIR,1,[replace readdir])
- AC_DEFINE(REPLACE_READDIR_GETDIRENTRIES,1,[replace readdir using getdirentries()])
- LIBREPLACEOBJ="${LIBREPLACEOBJ} repdir_getdirentries.o"
- libreplace_cv_READDIR_NEEDED=no
-fi
-
-#
-# try to replace with getdents() if needed
-#
-if test x"$libreplace_cv_READDIR_NEEDED" = x"yes"; then
-AC_CHECK_FUNCS(getdents)
-AC_CACHE_CHECK([for replacing readdir using getdents()],libreplace_cv_READDIR_GETDENTS,[
- AC_TRY_RUN([
-#define _LIBREPLACE_REPLACE_H
-#error _donot_use_getdents_replacement_anymore
-#include "$libreplacedir/repdir_getdents.c"
-#define test_readdir_os2_delete main
-#include "$libreplacedir/test/os2_delete.c"],
- [libreplace_cv_READDIR_GETDENTS=yes],
- [libreplace_cv_READDIR_GETDENTS=no])
-])
-fi
-if test x"$libreplace_cv_READDIR_GETDENTS" = x"yes"; then
- AC_DEFINE(REPLACE_READDIR,1,[replace readdir])
- AC_DEFINE(REPLACE_READDIR_GETDENTS,1,[replace readdir using getdents()])
- LIBREPLACEOBJ="${LIBREPLACEOBJ} repdir_getdents.o"
- libreplace_cv_READDIR_NEEDED=no
-fi
-
-AC_MSG_CHECKING([a usable readdir()])
-if test x"$libreplace_cv_READDIR_NEEDED" = x"yes"; then
- AC_MSG_RESULT(no)
- AC_MSG_WARN([the provided readdir() is broken])
-else
- AC_MSG_RESULT(yes)
-fi
diff --git a/source3/lib/replace/repdir_getdents.c b/source3/lib/replace/repdir_getdents.c
deleted file mode 100644
index afc634a796..0000000000
--- a/source3/lib/replace/repdir_getdents.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- Copyright (C) Andrew Tridgell 2005
-
- ** 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/>.
-*/
-/*
- a replacement for opendir/readdir/telldir/seekdir/closedir for BSD systems
-
- This is needed because the existing directory handling in FreeBSD
- and OpenBSD (and possibly NetBSD) doesn't correctly handle unlink()
- on files in a directory where telldir() has been used. On a block
- boundary it will occasionally miss a file when seekdir() is used to
- return to a position previously recorded with telldir().
-
- This also fixes a severe performance and memory usage problem with
- telldir() on BSD systems. Each call to telldir() in BSD adds an
- entry to a linked list, and those entries are cleaned up on
- closedir(). This means with a large directory closedir() can take an
- arbitrary amount of time, causing network timeouts as millions of
- telldir() entries are freed
-
- Note! This replacement code is not portable. It relies on getdents()
- always leaving the file descriptor at a seek offset that is a
- multiple of DIR_BUF_SIZE. If the code detects that this doesn't
- happen then it will abort(). It also does not handle directories
- with offsets larger than can be stored in a long,
-
- This code is available under other free software licenses as
- well. Contact the author.
-*/
-
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <dirent.h>
-
-#define DIR_BUF_BITS 9
-#define DIR_BUF_SIZE (1<<DIR_BUF_BITS)
-
-struct dir_buf {
- int fd;
- int nbytes, ofs;
- off_t seekpos;
- char buf[DIR_BUF_SIZE];
-};
-
-DIR *opendir(const char *dname)
-{
- struct dir_buf *d;
- struct stat sb;
- d = malloc(sizeof(*d));
- if (d == NULL) {
- errno = ENOMEM;
- return NULL;
- }
- d->fd = open(dname, O_RDONLY);
- if (d->fd == -1) {
- free(d);
- return NULL;
- }
- if (fstat(d->fd, &sb) < 0) {
- close(d->fd);
- free(d);
- return NULL;
- }
- if (!S_ISDIR(sb.st_mode)) {
- close(d->fd);
- free(d);
- errno = ENOTDIR;
- return NULL;
- }
- d->ofs = 0;
- d->seekpos = 0;
- d->nbytes = 0;
- return (DIR *)d;
-}
-
-struct dirent *readdir(DIR *dir)
-{
- struct dir_buf *d = (struct dir_buf *)dir;
- struct dirent *de;
-
- if (d->ofs >= d->nbytes) {
- d->seekpos = lseek(d->fd, 0, SEEK_CUR);
- d->nbytes = getdents(d->fd, d->buf, DIR_BUF_SIZE);
- d->ofs = 0;
- }
- if (d->ofs >= d->nbytes) {
- return NULL;
- }
- de = (struct dirent *)&d->buf[d->ofs];
- d->ofs += de->d_reclen;
- return de;
-}
-
-long telldir(DIR *dir)
-{
- struct dir_buf *d = (struct dir_buf *)dir;
- if (d->ofs >= d->nbytes) {
- d->seekpos = lseek(d->fd, 0, SEEK_CUR);
- d->ofs = 0;
- d->nbytes = 0;
- }
- /* this relies on seekpos always being a multiple of
- DIR_BUF_SIZE. Is that always true on BSD systems? */
- if (d->seekpos & (DIR_BUF_SIZE-1)) {
- abort();
- }
- return d->seekpos + d->ofs;
-}
-
-void seekdir(DIR *dir, long ofs)
-{
- struct dir_buf *d = (struct dir_buf *)dir;
- d->seekpos = lseek(d->fd, ofs & ~(DIR_BUF_SIZE-1), SEEK_SET);
- d->nbytes = getdents(d->fd, d->buf, DIR_BUF_SIZE);
- d->ofs = 0;
- while (d->ofs < (ofs & (DIR_BUF_SIZE-1))) {
- if (readdir(dir) == NULL) break;
- }
-}
-
-void rewinddir(DIR *dir)
-{
- seekdir(dir, 0);
-}
-
-int closedir(DIR *dir)
-{
- struct dir_buf *d = (struct dir_buf *)dir;
- int r = close(d->fd);
- if (r != 0) {
- return r;
- }
- free(d);
- return 0;
-}
-
-#ifndef dirfd
-/* darn, this is a macro on some systems. */
-int dirfd(DIR *dir)
-{
- struct dir_buf *d = (struct dir_buf *)dir;
- return d->fd;
-}
-#endif
diff --git a/source3/lib/replace/repdir_getdirentries.c b/source3/lib/replace/repdir_getdirentries.c
deleted file mode 100644
index 197e5931fc..0000000000
--- a/source3/lib/replace/repdir_getdirentries.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- Copyright (C) Andrew Tridgell 2005
-
- ** 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/>.
-*/
-/*
- a replacement for opendir/readdir/telldir/seekdir/closedir for BSD
- systems using getdirentries
-
- This is needed because the existing directory handling in FreeBSD
- and OpenBSD (and possibly NetBSD) doesn't correctly handle unlink()
- on files in a directory where telldir() has been used. On a block
- boundary it will occasionally miss a file when seekdir() is used to
- return to a position previously recorded with telldir().
-
- This also fixes a severe performance and memory usage problem with
- telldir() on BSD systems. Each call to telldir() in BSD adds an
- entry to a linked list, and those entries are cleaned up on
- closedir(). This means with a large directory closedir() can take an
- arbitrary amount of time, causing network timeouts as millions of
- telldir() entries are freed
-
- Note! This replacement code is not portable. It relies on
- getdirentries() always leaving the file descriptor at a seek offset
- that is a multiple of DIR_BUF_SIZE. If the code detects that this
- doesn't happen then it will abort(). It also does not handle
- directories with offsets larger than can be stored in a long,
-
- This code is available under other free software licenses as
- well. Contact the author.
-*/
-
-#include "replace.h"
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <dirent.h>
-
-#define DIR_BUF_BITS 9
-#define DIR_BUF_SIZE (1<<DIR_BUF_BITS)
-
-struct dir_buf {
- int fd;
- int nbytes, ofs;
- off_t seekpos;
- char buf[DIR_BUF_SIZE];
-};
-
-DIR *opendir(const char *dname)
-{
- struct dir_buf *d;
- struct stat sb;
- d = malloc(sizeof(*d));
- if (d == NULL) {
- errno = ENOMEM;
- return NULL;
- }
- d->fd = open(dname, O_RDONLY);
- if (d->fd == -1) {
- free(d);
- return NULL;
- }
- if (fstat(d->fd, &sb) < 0) {
- close(d->fd);
- free(d);
- return NULL;
- }
- if (!S_ISDIR(sb.st_mode)) {
- close(d->fd);
- free(d);
- errno = ENOTDIR;
- return NULL;
- }
- d->ofs = 0;
- d->seekpos = 0;
- d->nbytes = 0;
- return (DIR *)d;
-}
-
-struct dirent *readdir(DIR *dir)
-{
- struct dir_buf *d = (struct dir_buf *)dir;
- struct dirent *de;
-
- if (d->ofs >= d->nbytes) {
- long pos;
- d->nbytes = getdirentries(d->fd, d->buf, DIR_BUF_SIZE, &pos);
- d->seekpos = pos;
- d->ofs = 0;
- }
- if (d->ofs >= d->nbytes) {
- return NULL;
- }
- de = (struct dirent *)&d->buf[d->ofs];
- d->ofs += de->d_reclen;
- return de;
-}
-
-#ifdef TELLDIR_TAKES_CONST_DIR
-long telldir(const DIR *dir)
-#else
-long telldir(DIR *dir)
-#endif
-{
- struct dir_buf *d = (struct dir_buf *)dir;
- if (d->ofs >= d->nbytes) {
- d->seekpos = lseek(d->fd, 0, SEEK_CUR);
- d->ofs = 0;
- d->nbytes = 0;
- }
- /* this relies on seekpos always being a multiple of
- DIR_BUF_SIZE. Is that always true on BSD systems? */
- if (d->seekpos & (DIR_BUF_SIZE-1)) {
- abort();
- }
- return d->seekpos + d->ofs;
-}
-
-#ifdef SEEKDIR_RETURNS_INT
-int seekdir(DIR *dir, long ofs)
-#else
-void seekdir(DIR *dir, long ofs)
-#endif
-{
- struct dir_buf *d = (struct dir_buf *)dir;
- long pos;
- d->seekpos = lseek(d->fd, ofs & ~(DIR_BUF_SIZE-1), SEEK_SET);
- d->nbytes = getdirentries(d->fd, d->buf, DIR_BUF_SIZE, &pos);
- d->ofs = 0;
- while (d->ofs < (ofs & (DIR_BUF_SIZE-1))) {
- if (readdir(dir) == NULL) break;
- }
-#ifdef SEEKDIR_RETURNS_INT
- return -1;
-#endif
-}
-
-void rewinddir(DIR *dir)
-{
- seekdir(dir, 0);
-}
-
-int closedir(DIR *dir)
-{
- struct dir_buf *d = (struct dir_buf *)dir;
- int r = close(d->fd);
- if (r != 0) {
- return r;
- }
- free(d);
- return 0;
-}
-
-#ifndef dirfd
-/* darn, this is a macro on some systems. */
-int dirfd(DIR *dir)
-{
- struct dir_buf *d = (struct dir_buf *)dir;
- return d->fd;
-}
-#endif
-
-
diff --git a/source3/lib/replace/replace.c b/source3/lib/replace/replace.c
deleted file mode 100644
index 98d799b07e..0000000000
--- a/source3/lib/replace/replace.c
+++ /dev/null
@@ -1,616 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- replacement routines for broken systems
- Copyright (C) Andrew Tridgell 1992-1998
-
- ** 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/>.
-*/
-
-#include "replace.h"
-
-#include "system/filesys.h"
-#include "system/time.h"
-#include "system/passwd.h"
-#include "system/syslog.h"
-#include "system/locale.h"
-#include "system/wait.h"
-
-void replace_dummy(void);
-void replace_dummy(void) {}
-
-#ifndef HAVE_FTRUNCATE
- /*******************************************************************
-ftruncate for operating systems that don't have it
-********************************************************************/
-int rep_ftruncate(int f, off_t l)
-{
-#ifdef HAVE_CHSIZE
- return chsize(f,l);
-#elif defined(F_FREESP)
- struct flock fl;
-
- fl.l_whence = 0;
- fl.l_len = 0;
- fl.l_start = l;
- fl.l_type = F_WRLCK;
- return fcntl(f, F_FREESP, &fl);
-#else
-#error "you must have a ftruncate function"
-#endif
-}
-#endif /* HAVE_FTRUNCATE */
-
-
-#ifndef HAVE_STRLCPY
-/* like strncpy but does not 0 fill the buffer and always null
- terminates. bufsize is the size of the destination buffer */
-size_t rep_strlcpy(char *d, const char *s, size_t bufsize)
-{
- size_t len = strlen(s);
- size_t ret = len;
- if (bufsize <= 0) return 0;
- if (len >= bufsize) len = bufsize-1;
- memcpy(d, s, len);
- d[len] = 0;
- return ret;
-}
-#endif
-
-#ifndef HAVE_STRLCAT
-/* like strncat but does not 0 fill the buffer and always null
- terminates. bufsize is the length of the buffer, which should
- be one more than the maximum resulting string length */
-size_t rep_strlcat(char *d, const char *s, size_t bufsize)
-{
- size_t len1 = strlen(d);
- size_t len2 = strlen(s);
- size_t ret = len1 + len2;
-
- if (len1+len2 >= bufsize) {
- if (bufsize < (len1+1)) {
- return ret;
- }
- len2 = bufsize - (len1+1);
- }
- if (len2 > 0) {
- memcpy(d+len1, s, len2);
- d[len1+len2] = 0;
- }
- return ret;
-}
-#endif
-
-#ifndef HAVE_MKTIME
-/*******************************************************************
-a mktime() replacement for those who don't have it - contributed by
-C.A. Lademann <cal@zls.com>
-Corrections by richard.kettlewell@kewill.com
-********************************************************************/
-
-#define MINUTE 60
-#define HOUR 60*MINUTE
-#define DAY 24*HOUR
-#define YEAR 365*DAY
-time_t rep_mktime(struct tm *t)
-{
- struct tm *u;
- time_t epoch = 0;
- int n;
- int mon [] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
- y, m, i;
-
- if(t->tm_year < 70)
- return((time_t)-1);
-
- n = t->tm_year + 1900 - 1;
- epoch = (t->tm_year - 70) * YEAR +
- ((n / 4 - n / 100 + n / 400) - (1969 / 4 - 1969 / 100 + 1969 / 400)) * DAY;
-
- y = t->tm_year + 1900;
- m = 0;
-
- for(i = 0; i < t->tm_mon; i++) {
- epoch += mon [m] * DAY;
- if(m == 1 && y % 4 == 0 && (y % 100 != 0 || y % 400 == 0))
- epoch += DAY;
-
- if(++m > 11) {
- m = 0;
- y++;
- }
- }
-
- epoch += (t->tm_mday - 1) * DAY;
- epoch += t->tm_hour * HOUR + t->tm_min * MINUTE + t->tm_sec;
-
- if((u = localtime(&epoch)) != NULL) {
- t->tm_sec = u->tm_sec;
- t->tm_min = u->tm_min;
- t->tm_hour = u->tm_hour;
- t->tm_mday = u->tm_mday;
- t->tm_mon = u->tm_mon;
- t->tm_year = u->tm_year;
- t->tm_wday = u->tm_wday;
- t->tm_yday = u->tm_yday;
- t->tm_isdst = u->tm_isdst;
- }
-
- return(epoch);
-}
-#endif /* !HAVE_MKTIME */
-
-
-#ifndef HAVE_INITGROUPS
-/****************************************************************************
- some systems don't have an initgroups call
-****************************************************************************/
-int rep_initgroups(char *name, gid_t id)
-{
-#ifndef HAVE_SETGROUPS
- /* yikes! no SETGROUPS or INITGROUPS? how can this work? */
- errno = ENOSYS;
- return -1;
-#else /* HAVE_SETGROUPS */
-
-#include <grp.h>
-
- gid_t *grouplst = NULL;
- int max_gr = NGROUPS_MAX;
- int ret;
- int i,j;
- struct group *g;
- char *gr;
-
- if((grouplst = malloc(sizeof(gid_t) * max_gr)) == NULL) {
- errno = ENOMEM;
- return -1;
- }
-
- grouplst[0] = id;
- i = 1;
- while (i < max_gr && ((g = (struct group *)getgrent()) != (struct group *)NULL)) {
- if (g->gr_gid == id)
- continue;
- j = 0;
- gr = g->gr_mem[0];
- while (gr && (*gr != (char)NULL)) {
- if (strcmp(name,gr) == 0) {
- grouplst[i] = g->gr_gid;
- i++;
- gr = (char *)NULL;
- break;
- }
- gr = g->gr_mem[++j];
- }
- }
- endgrent();
- ret = setgroups(i, grouplst);
- free(grouplst);
- return ret;
-#endif /* HAVE_SETGROUPS */
-}
-#endif /* HAVE_INITGROUPS */
-
-
-#if (defined(SecureWare) && defined(SCO))
-/* This is needed due to needing the nap() function but we don't want
- to include the Xenix libraries since that will break other things...
- BTW: system call # 0x0c28 is the same as calling nap() */
-long nap(long milliseconds) {
- return syscall(0x0c28, milliseconds);
- }
-#endif
-
-
-#ifndef HAVE_MEMMOVE
-/*******************************************************************
-safely copies memory, ensuring no overlap problems.
-this is only used if the machine does not have its own memmove().
-this is not the fastest algorithm in town, but it will do for our
-needs.
-********************************************************************/
-void *rep_memmove(void *dest,const void *src,int size)
-{
- unsigned long d,s;
- int i;
- if (dest==src || !size) return(dest);
-
- d = (unsigned long)dest;
- s = (unsigned long)src;
-
- if ((d >= (s+size)) || (s >= (d+size))) {
- /* no overlap */
- memcpy(dest,src,size);
- return(dest);
- }
-
- if (d < s) {
- /* we can forward copy */
- if (s-d >= sizeof(int) &&
- !(s%sizeof(int)) &&
- !(d%sizeof(int)) &&
- !(size%sizeof(int))) {
- /* do it all as words */
- int *idest = (int *)dest;
- int *isrc = (int *)src;
- size /= sizeof(int);
- for (i=0;i<size;i++) idest[i] = isrc[i];
- } else {
- /* simplest */
- char *cdest = (char *)dest;
- char *csrc = (char *)src;
- for (i=0;i<size;i++) cdest[i] = csrc[i];
- }
- } else {
- /* must backward copy */
- if (d-s >= sizeof(int) &&
- !(s%sizeof(int)) &&
- !(d%sizeof(int)) &&
- !(size%sizeof(int))) {
- /* do it all as words */
- int *idest = (int *)dest;
- int *isrc = (int *)src;
- size /= sizeof(int);
- for (i=size-1;i>=0;i--) idest[i] = isrc[i];
- } else {
- /* simplest */
- char *cdest = (char *)dest;
- char *csrc = (char *)src;
- for (i=size-1;i>=0;i--) cdest[i] = csrc[i];
- }
- }
- return(dest);
-}
-#endif /* HAVE_MEMMOVE */
-
-#ifndef HAVE_STRDUP
-/****************************************************************************
-duplicate a string
-****************************************************************************/
-char *rep_strdup(const char *s)
-{
- size_t len;
- char *ret;
-
- if (!s) return(NULL);
-
- len = strlen(s)+1;
- ret = (char *)malloc(len);
- if (!ret) return(NULL);
- memcpy(ret,s,len);
- return(ret);
-}
-#endif /* HAVE_STRDUP */
-
-#ifndef HAVE_SETLINEBUF
-void rep_setlinebuf(FILE *stream)
-{
- setvbuf(stream, (char *)NULL, _IOLBF, 0);
-}
-#endif /* HAVE_SETLINEBUF */
-
-#ifndef HAVE_VSYSLOG
-#ifdef HAVE_SYSLOG
-void rep_vsyslog (int facility_priority, const char *format, va_list arglist)
-{
- char *msg = NULL;
- vasprintf(&msg, format, arglist);
- if (!msg)
- return;
- syslog(facility_priority, "%s", msg);
- free(msg);
-}
-#endif /* HAVE_SYSLOG */
-#endif /* HAVE_VSYSLOG */
-
-#ifndef HAVE_STRNLEN
-/**
- Some platforms don't have strnlen
-**/
- size_t rep_strnlen(const char *s, size_t max)
-{
- size_t len;
-
- for (len = 0; len < max; len++) {
- if (s[len] == '\0') {
- break;
- }
- }
- return len;
-}
-#endif
-
-#ifndef HAVE_STRNDUP
-/**
- Some platforms don't have strndup.
-**/
-char *rep_strndup(const char *s, size_t n)
-{
- char *ret;
-
- n = strnlen(s, n);
- ret = malloc(n+1);
- if (!ret)
- return NULL;
- memcpy(ret, s, n);
- ret[n] = 0;
-
- return ret;
-}
-#endif
-
-#ifndef HAVE_WAITPID
-int rep_waitpid(pid_t pid,int *status,int options)
-{
- return wait4(pid, status, options, NULL);
-}
-#endif
-
-#ifndef HAVE_SETEUID
-int rep_seteuid(uid_t euid)
-{
-#ifdef HAVE_SETRESUID
- return setresuid(-1, euid, -1);
-#else
-# error "You need a seteuid function"
-#endif
-}
-#endif
-
-#ifndef HAVE_SETEGID
-int rep_setegid(gid_t egid)
-{
-#ifdef HAVE_SETRESGID
- return setresgid(-1, egid, -1);
-#else
-# error "You need a setegid function"
-#endif
-}
-#endif
-
-/*******************************************************************
-os/2 also doesn't have chroot
-********************************************************************/
-#ifndef HAVE_CHROOT
-int rep_chroot(const char *dname)
-{
- errno = ENOSYS;
- return -1;
-}
-#endif
-
-/*****************************************************************
- Possibly replace mkstemp if it is broken.
-*****************************************************************/
-
-#ifndef HAVE_SECURE_MKSTEMP
-int rep_mkstemp(char *template)
-{
- /* have a reasonable go at emulating it. Hope that
- the system mktemp() isn't completly hopeless */
- char *p = mktemp(template);
- if (!p)
- return -1;
- return open(p, O_CREAT|O_EXCL|O_RDWR, 0600);
-}
-#endif
-
-#ifndef HAVE_MKDTEMP
-char *rep_mkdtemp(char *template)
-{
- char *dname;
-
- if ((dname = mktemp(template))) {
- if (mkdir(dname, 0700) >= 0) {
- return dname;
- }
- }
-
- return NULL;
-}
-#endif
-
-/*****************************************************************
- Watch out: this is not thread safe.
-*****************************************************************/
-
-#ifndef HAVE_PREAD
-ssize_t rep_pread(int __fd, void *__buf, size_t __nbytes, off_t __offset)
-{
- if (lseek(__fd, __offset, SEEK_SET) != __offset) {
- return -1;
- }
- return read(__fd, __buf, __nbytes);
-}
-#endif
-
-/*****************************************************************
- Watch out: this is not thread safe.
-*****************************************************************/
-
-#ifndef HAVE_PWRITE
-ssize_t rep_pwrite(int __fd, const void *__buf, size_t __nbytes, off_t __offset)
-{
- if (lseek(__fd, __offset, SEEK_SET) != __offset) {
- return -1;
- }
- return write(__fd, __buf, __nbytes);
-}
-#endif
-
-#ifndef HAVE_STRCASESTR
-char *rep_strcasestr(const char *haystack, const char *needle)
-{
- const char *s;
- size_t nlen = strlen(needle);
- for (s=haystack;*s;s++) {
- if (toupper(*needle) == toupper(*s) &&
- strncasecmp(s, needle, nlen) == 0) {
- return (char *)((uintptr_t)s);
- }
- }
- return NULL;
-}
-#endif
-
-#ifndef HAVE_STRTOK_R
-/* based on GLIBC version, copyright Free Software Foundation */
-char *rep_strtok_r(char *s, const char *delim, char **save_ptr)
-{
- char *token;
-
- if (s == NULL) s = *save_ptr;
-
- s += strspn(s, delim);
- if (*s == '\0') {
- *save_ptr = s;
- return NULL;
- }
-
- token = s;
- s = strpbrk(token, delim);
- if (s == NULL) {
- *save_ptr = token + strlen(token);
- } else {
- *s = '\0';
- *save_ptr = s + 1;
- }
-
- return token;
-}
-#endif
-
-#ifndef HAVE_STRTOLL
-long long int rep_strtoll(const char *str, char **endptr, int base)
-{
-#ifdef HAVE_STRTOQ
- return strtoq(str, endptr, base);
-#elif defined(HAVE___STRTOLL)
- return __strtoll(str, endptr, base);
-#elif SIZEOF_LONG == SIZEOF_LONG_LONG
- return (long long int) strtol(str, endptr, base);
-#else
-# error "You need a strtoll function"
-#endif
-}
-#endif
-
-
-#ifndef HAVE_STRTOULL
-unsigned long long int rep_strtoull(const char *str, char **endptr, int base)
-{
-#ifdef HAVE_STRTOUQ
- return strtouq(str, endptr, base);
-#elif defined(HAVE___STRTOULL)
- return __strtoull(str, endptr, base);
-#elif SIZEOF_LONG == SIZEOF_LONG_LONG
- return (unsigned long long int) strtoul(str, endptr, base);
-#else
-# error "You need a strtoull function"
-#endif
-}
-#endif
-
-#ifndef HAVE_SETENV
-int rep_setenv(const char *name, const char *value, int overwrite)
-{
- char *p;
- size_t l1, l2;
- int ret;
-
- if (!overwrite && getenv(name)) {
- return 0;
- }
-
- l1 = strlen(name);
- l2 = strlen(value);
-
- p = malloc(l1+l2+2);
- if (p == NULL) {
- return -1;
- }
- memcpy(p, name, l1);
- p[l1] = '=';
- memcpy(p+l1+1, value, l2);
- p[l1+l2+1] = 0;
-
- ret = putenv(p);
- if (ret != 0) {
- free(p);
- }
-
- return ret;
-}
-#endif
-
-#ifndef HAVE_UNSETENV
-int rep_unsetenv(const char *name)
-{
- extern char **environ;
- size_t len = strlen(name);
- size_t i, count;
-
- if (environ == NULL || getenv(name) == NULL) {
- return 0;
- }
-
- for (i=0;environ[i];i++) /* noop */ ;
-
- count=i;
-
- for (i=0;i<count;) {
- if (strncmp(environ[i], name, len) == 0 && environ[i][len] == '=') {
- /* note: we do _not_ free the old variable here. It is unsafe to
- do so, as the pointer may not have come from malloc */
- memmove(&environ[i], &environ[i+1], (count-i)*sizeof(char *));
- count--;
- } else {
- i++;
- }
- }
-
- return 0;
-}
-#endif
-
-#ifndef HAVE_UTIME
-int rep_utime(const char *filename, const struct utimbuf *buf)
-{
- errno = ENOSYS;
- return -1;
-}
-#endif
-
-#ifndef HAVE_UTIMES
-int rep_utimes(const char *filename, const struct timeval tv[2])
-{
- struct utimbuf u;
-
- u.actime = tv[0].tv_sec;
- if (tv[0].tv_usec > 500000) {
- u.actime += 1;
- }
-
- u.modtime = tv[1].tv_sec;
- if (tv[1].tv_usec > 500000) {
- u.modtime += 1;
- }
-
- return utime(filename, &u);
-}
-#endif
diff --git a/source3/lib/replace/replace.h b/source3/lib/replace/replace.h
deleted file mode 100644
index c69ea6cdac..0000000000
--- a/source3/lib/replace/replace.h
+++ /dev/null
@@ -1,582 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- macros to go along with the lib/replace/ portability layer code
-
- Copyright (C) Andrew Tridgell 2005
- Copyright (C) Jelmer Vernooij 2006
- Copyright (C) Jeremy Allison 2007.
-
- ** 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/>.
-*/
-
-#ifndef _LIBREPLACE_REPLACE_H
-#define _LIBREPLACE_REPLACE_H
-
-#ifndef NO_CONFIG_H
-#include "config.h"
-#endif
-
-#ifdef HAVE_STANDARDS_H
-#include <standards.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <errno.h>
-
-#if defined(_MSC_VER) || defined(__MINGW32__)
-#include "win32_replace.h"
-#endif
-
-
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-/* force off HAVE_INTTYPES_H so that roken doesn't try to include both,
- which causes a warning storm on irix */
-#undef HAVE_INTTYPES_H
-#elif HAVE_INTTYPES_H
-#include <inttypes.h>
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-
-#ifndef HAVE_STRERROR
-extern char *sys_errlist[];
-#define strerror(i) sys_errlist[i]
-#endif
-
-#ifndef HAVE_ERRNO_DECL
-extern int errno;
-#endif
-
-#ifndef HAVE_STRDUP
-#define strdup rep_strdup
-char *rep_strdup(const char *s);
-#endif
-
-#ifndef HAVE_MEMMOVE
-#define memmove rep_memmove
-void *rep_memmove(void *dest,const void *src,int size);
-#endif
-
-#ifndef HAVE_MKTIME
-#define mktime rep_mktime
-/* prototype is in "system/time.h" */
-#endif
-
-#ifndef HAVE_TIMEGM
-#define timegm rep_timegm
-/* prototype is in "system/time.h" */
-#endif
-
-#ifndef HAVE_UTIME
-#define utime rep_utime
-/* prototype is in "system/time.h" */
-#endif
-
-#ifndef HAVE_UTIMES
-#define utimes rep_utimes
-/* prototype is in "system/time.h" */
-#endif
-
-#ifndef HAVE_STRLCPY
-#define strlcpy rep_strlcpy
-size_t rep_strlcpy(char *d, const char *s, size_t bufsize);
-#endif
-
-#ifndef HAVE_STRLCAT
-#define strlcat rep_strlcat
-size_t rep_strlcat(char *d, const char *s, size_t bufsize);
-#endif
-
-#if (defined(BROKEN_STRNDUP) || !defined(HAVE_STRNDUP))
-#undef HAVE_STRNDUP
-#define strndup rep_strndup
-char *rep_strndup(const char *s, size_t n);
-#endif
-
-#if (defined(BROKEN_STRNLEN) || !defined(HAVE_STRNLEN))
-#undef HAVE_STRNLEN
-#define strnlen rep_strnlen
-size_t rep_strnlen(const char *s, size_t n);
-#endif
-
-#ifndef HAVE_SETENV
-#define setenv rep_setenv
-int rep_setenv(const char *name, const char *value, int overwrite);
-#else
-#ifndef HAVE_SETENV_DECL
-int setenv(const char *name, const char *value, int overwrite);
-#endif
-#endif
-
-#ifndef HAVE_UNSETENV
-#define unsetenv rep_unsetenv
-int rep_unsetenv(const char *name);
-#endif
-
-#ifndef HAVE_SETEUID
-#define seteuid rep_seteuid
-int rep_seteuid(uid_t);
-#endif
-
-#ifndef HAVE_SETEGID
-#define setegid rep_setegid
-int rep_setegid(gid_t);
-#endif
-
-#ifndef HAVE_SETLINEBUF
-#define setlinebuf rep_setlinebuf
-void rep_setlinebuf(FILE *);
-#endif
-
-#ifndef HAVE_STRCASESTR
-#define strcasestr rep_strcasestr
-char *rep_strcasestr(const char *haystack, const char *needle);
-#endif
-
-#ifndef HAVE_STRTOK_R
-#define strtok_r rep_strtok_r
-char *rep_strtok_r(char *s, const char *delim, char **save_ptr);
-#endif
-
-#ifndef HAVE_STRTOLL
-#define strtoll rep_strtoll
-long long int rep_strtoll(const char *str, char **endptr, int base);
-#endif
-
-#ifndef HAVE_STRTOULL
-#define strtoull rep_strtoull
-unsigned long long int rep_strtoull(const char *str, char **endptr, int base);
-#endif
-
-#ifndef HAVE_FTRUNCATE
-#define ftruncate rep_ftruncate
-int rep_ftruncate(int,off_t);
-#endif
-
-#ifndef HAVE_INITGROUPS
-#define initgroups rep_initgroups
-int rep_initgroups(char *name, gid_t id);
-#endif
-
-#if !defined(HAVE_BZERO) && defined(HAVE_MEMSET)
-#define bzero(a,b) memset((a),'\0',(b))
-#endif
-
-#ifndef HAVE_DLERROR
-#define dlerror rep_dlerror
-char *rep_dlerror(void);
-#endif
-
-#ifndef HAVE_DLOPEN
-#define dlopen rep_dlopen
-#ifdef DLOPEN_TAKES_UNSIGNED_FLAGS
-void *rep_dlopen(const char *name, unsigned int flags);
-#else
-void *rep_dlopen(const char *name, int flags);
-#endif
-#endif
-
-#ifndef HAVE_DLSYM
-#define dlsym rep_dlsym
-void *rep_dlsym(void *handle, const char *symbol);
-#endif
-
-#ifndef HAVE_DLCLOSE
-#define dlclose rep_dlclose
-int rep_dlclose(void *handle);
-#endif
-
-#ifndef HAVE_SOCKETPAIR
-#define socketpair rep_socketpair
-/* prototype is in system/network.h */
-#endif
-
-#ifndef PRINTF_ATTRIBUTE
-#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 )
-/** Use gcc attribute to check printf fns. a1 is the 1-based index of
- * the parameter containing the format, and a2 the index of the first
- * argument. Note that some gcc 2.x versions don't handle this
- * properly **/
-#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2)))
-#else
-#define PRINTF_ATTRIBUTE(a1, a2)
-#endif
-#endif
-
-#ifndef _DEPRECATED_
-#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 )
-#define _DEPRECATED_ __attribute__ ((deprecated))
-#else
-#define _DEPRECATED_
-#endif
-#endif
-
-#ifndef HAVE_VASPRINTF
-#define vasprintf rep_vasprintf
-int rep_vasprintf(char **ptr, const char *format, va_list ap) PRINTF_ATTRIBUTE(2,0);
-#endif
-
-#if !defined(HAVE_SNPRINTF) || !defined(HAVE_C99_VSNPRINTF)
-#define snprintf rep_snprintf
-int rep_snprintf(char *,size_t ,const char *, ...) PRINTF_ATTRIBUTE(3,4);
-#endif
-
-#if !defined(HAVE_VSNPRINTF) || !defined(HAVE_C99_VSNPRINTF)
-#define vsnprintf rep_vsnprintf
-int rep_vsnprintf(char *,size_t ,const char *, va_list ap) PRINTF_ATTRIBUTE(3,0);
-#endif
-
-#ifndef HAVE_ASPRINTF
-#define asprintf rep_asprintf
-int rep_asprintf(char **,const char *, ...) PRINTF_ATTRIBUTE(2,3);
-#endif
-
-#ifndef HAVE_VSYSLOG
-#ifdef HAVE_SYSLOG
-#define vsyslog rep_vsyslog
-void rep_vsyslog (int facility_priority, const char *format, va_list arglist) PRINTF_ATTRIBUTE(2,0);
-#endif
-#endif
-
-/* we used to use these fns, but now we have good replacements
- for snprintf and vsnprintf */
-#define slprintf snprintf
-
-
-#ifndef HAVE_VA_COPY
-#undef va_copy
-#ifdef HAVE___VA_COPY
-#define va_copy(dest, src) __va_copy(dest, src)
-#else
-#define va_copy(dest, src) (dest) = (src)
-#endif
-#endif
-
-#ifndef HAVE_VOLATILE
-#define volatile
-#endif
-
-#ifndef HAVE_COMPARISON_FN_T
-typedef int (*comparison_fn_t)(const void *, const void *);
-#endif
-
-#ifdef REPLACE_STRPTIME
-#define strptime rep_strptime
-struct tm;
-char *rep_strptime(const char *buf, const char *format, struct tm *tm);
-#endif
-
-/* Load header file for dynamic linking stuff */
-#ifdef HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#ifndef RTLD_LAZY
-#define RTLD_LAZY 0
-#endif
-#ifndef RTLD_NOW
-#define RTLD_NOW 0
-#endif
-#ifndef RTLD_GLOBAL
-#define RTLD_GLOBAL 0
-#endif
-
-#ifndef HAVE_SECURE_MKSTEMP
-#define mkstemp(path) rep_mkstemp(path)
-int rep_mkstemp(char *temp);
-#endif
-
-#ifndef HAVE_MKDTEMP
-#define mkdtemp rep_mkdtemp
-char *rep_mkdtemp(char *template);
-#endif
-
-#ifndef HAVE_PREAD
-#define pread rep_pread
-ssize_t rep_pread(int __fd, void *__buf, size_t __nbytes, off_t __offset);
-#endif
-
-#ifndef HAVE_PWRITE
-#define pwrite rep_pwrite
-ssize_t rep_pwrite(int __fd, const void *__buf, size_t __nbytes, off_t __offset);
-#endif
-
-#if !defined(HAVE_INET_NTOA) || defined(REPLACE_INET_NTOA)
-#define inet_ntoa rep_inet_ntoa
-/* prototype is in "system/network.h" */
-#endif
-
-#ifndef HAVE_INET_PTON
-#define inet_pton rep_inet_pton
-/* prototype is in "system/network.h" */
-#endif
-
-#ifndef HAVE_INET_NTOP
-#define inet_ntop rep_inet_ntop
-/* prototype is in "system/network.h" */
-#endif
-
-#ifndef HAVE_INET_ATON
-#define inet_aton rep_inet_aton
-/* prototype is in "system/network.h" */
-#endif
-
-#ifndef HAVE_CONNECT
-#define connect rep_connect
-/* prototype is in "system/network.h" */
-#endif
-
-#ifndef HAVE_GETHOSTBYNAME
-#define gethostbyname rep_gethostbyname
-/* prototype is in "system/network.h" */
-#endif
-
-#ifndef HAVE_GETIFADDRS
-#define getifaddrs rep_getifaddrs
-/* prototype is in "system/network.h" */
-#endif
-
-#ifndef HAVE_FREEIFADDRS
-#define freeifaddrs rep_freeifaddrs
-/* prototype is in "system/network.h" */
-#endif
-
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#endif
-
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-
-/* The extra casts work around common compiler bugs. */
-#define _TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
-/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
- It is necessary at least when t == time_t. */
-#define _TYPE_MINIMUM(t) ((t) (_TYPE_SIGNED (t) \
- ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
-#define _TYPE_MAXIMUM(t) ((t) (~ (t) 0 - _TYPE_MINIMUM (t)))
-
-#ifndef HOST_NAME_MAX
-#define HOST_NAME_MAX 255
-#endif
-
-/*
- * Some older systems seem not to have MAXHOSTNAMELEN
- * defined.
- */
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN HOST_NAME_MAX
-#endif
-
-#ifndef UINT16_MAX
-#define UINT16_MAX 65535
-#endif
-
-#ifndef UINT32_MAX
-#define UINT32_MAX (4294967295U)
-#endif
-
-#ifndef UINT64_MAX
-#define UINT64_MAX ((uint64_t)-1)
-#endif
-
-#ifndef CHAR_BIT
-#define CHAR_BIT 8
-#endif
-
-#ifndef INT32_MAX
-#define INT32_MAX _TYPE_MAXIMUM(int32_t)
-#endif
-
-#ifdef HAVE_STDBOOL_H
-#include <stdbool.h>
-#endif
-
-#if !defined(HAVE_BOOL)
-#ifdef HAVE__Bool
-#define bool _Bool
-#else
-typedef int bool;
-#endif
-#endif
-
-/*
- * to prevent <rpcsvc/yp_prot.h> from doing a redefine of 'bool'
- *
- * IRIX, HPUX, MacOS 10 and Solaris need BOOL_DEFINED
- * Tru64 needs _BOOL_EXISTS
- * AIX needs _BOOL,_TRUE,_FALSE
- */
-#ifndef BOOL_DEFINED
-#define BOOL_DEFINED
-#endif
-#ifndef _BOOL_EXISTS
-#define _BOOL_EXISTS
-#endif
-#ifndef _BOOL
-#define _BOOL
-#endif
-
-#ifndef __bool_true_false_are_defined
-#define __bool_true_false_are_defined
-#endif
-
-#ifndef true
-#define true (1)
-#endif
-#ifndef false
-#define false (0)
-#endif
-
-#ifndef _TRUE
-#define _TRUE true
-#endif
-#ifndef _FALSE
-#define _FALSE false
-#endif
-
-#ifndef HAVE_FUNCTION_MACRO
-#ifdef HAVE_func_MACRO
-#define __FUNCTION__ __func__
-#else
-#define __FUNCTION__ ("")
-#endif
-#endif
-
-
-#ifndef MIN
-#define MIN(a,b) ((a)<(b)?(a):(b))
-#endif
-
-#ifndef MAX
-#define MAX(a,b) ((a)>(b)?(a):(b))
-#endif
-
-#if !defined(HAVE_VOLATILE)
-#define volatile
-#endif
-
-/**
- this is a warning hack. The idea is to use this everywhere that we
- get the "discarding const" warning from gcc. That doesn't actually
- fix the problem of course, but it means that when we do get to
- cleaning them up we can do it by searching the code for
- discard_const.
-
- It also means that other error types aren't as swamped by the noise
- of hundreds of const warnings, so we are more likely to notice when
- we get new errors.
-
- Please only add more uses of this macro when you find it
- _really_ hard to fix const warnings. Our aim is to eventually use
- this function in only a very few places.
-
- Also, please call this via the discard_const_p() macro interface, as that
- makes the return type safe.
-*/
-#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
-
-/** Type-safe version of discard_const */
-#define discard_const_p(type, ptr) ((type *)discard_const(ptr))
-
-#ifndef __STRING
-#define __STRING(x) #x
-#endif
-
-#ifndef __STRINGSTRING
-#define __STRINGSTRING(x) __STRING(x)
-#endif
-
-#ifndef __LINESTR__
-#define __LINESTR__ __STRINGSTRING(__LINE__)
-#endif
-
-#ifndef __location__
-#define __location__ __FILE__ ":" __LINESTR__
-#endif
-
-/**
- * zero a structure
- */
-#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
-
-/**
- * zero a structure given a pointer to the structure
- */
-#define ZERO_STRUCTP(x) do { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); } while(0)
-
-/**
- * zero a structure given a pointer to the structure - no zero check
- */
-#define ZERO_STRUCTPN(x) memset((char *)(x), 0, sizeof(*(x)))
-
-/* zero an array - note that sizeof(array) must work - ie. it must not be a
- pointer */
-#define ZERO_ARRAY(x) memset((char *)(x), 0, sizeof(x))
-
-/**
- * work out how many elements there are in a static array
- */
-#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
-
-/**
- * pointer difference macro
- */
-#define PTR_DIFF(p1,p2) ((ptrdiff_t)(((const char *)(p1)) - (const char *)(p2)))
-
-#if MMAP_BLACKLIST
-#undef HAVE_MMAP
-#endif
-
-#ifdef __COMPAR_FN_T
-#define QSORT_CAST (__compar_fn_t)
-#endif
-
-#ifndef QSORT_CAST
-#define QSORT_CAST (int (*)(const void *, const void *))
-#endif
-
-#ifndef PATH_MAX
-#define PATH_MAX 1024
-#endif
-
-#ifndef MAX_DNS_NAME_LENGTH
-#define MAX_DNS_NAME_LENGTH 256 /* Actually 255 but +1 for terminating null. */
-#endif
-
-#endif /* _LIBREPLACE_REPLACE_H */
diff --git a/source3/lib/replace/samba.m4 b/source3/lib/replace/samba.m4
deleted file mode 100644
index 07c4d38887..0000000000
--- a/source3/lib/replace/samba.m4
+++ /dev/null
@@ -1,35 +0,0 @@
-AC_LIBREPLACE_BROKEN_CHECKS
-AC_LIBREPLACE_NETWORK_CHECKS
-
-SMB_EXT_LIB(LIBREPLACE_EXT, [${LIBDL}])
-SMB_ENABLE(LIBREPLACE_EXT)
-
-SMB_EXT_LIB(LIBREPLACE_NETWORK, [${LIBREPLACE_NETWORK_LIBS}])
-SMB_ENABLE(LIBREPLACE_NETWORK)
-
-# remove leading ./
-LIBREPLACE_DIR=`echo ${libreplacedir} |sed -e 's/^\.\///g'`
-
-# remove leading srcdir .. we are looking for the relative
-# path within the samba source tree or wherever libreplace is.
-# We need to make sure the object is not forced to end up in
-# the source directory because we might be using a separate
-# build directory.
-LIBREPLACE_DIR=`echo ${LIBREPLACE_DIR} | sed -e "s|^$srcdir/||g"`
-
-LIBREPLACE_OBJS=""
-for obj in ${LIBREPLACEOBJ}; do
- LIBREPLACE_OBJS="${LIBREPLACE_OBJS} ${LIBREPLACE_DIR}/${obj}"
-done
-
-SMB_SUBSYSTEM(LIBREPLACE,
- [${LIBREPLACE_OBJS}],
- [LIBREPLACE_EXT LIBREPLACE_NETWORK],
- [-Ilib/replace])
-
-LIBREPLACE_HOSTCC_OBJS=`echo ${LIBREPLACE_OBJS} |sed -e 's/\.o/\.ho/g'`
-
-SMB_SUBSYSTEM(LIBREPLACE_HOSTCC,
- [${LIBREPLACE_HOSTCC_OBJS}],
- [],
- [-Ilib/replace])
diff --git a/source3/lib/replace/snprintf.c b/source3/lib/replace/snprintf.c
deleted file mode 100644
index c54d721ce5..0000000000
--- a/source3/lib/replace/snprintf.c
+++ /dev/null
@@ -1,1530 +0,0 @@
-/*
- * NOTE: If you change this file, please merge it into rsync, samba, etc.
- */
-
-/*
- * Copyright Patrick Powell 1995
- * This code is based on code written by Patrick Powell (papowell@astart.com)
- * It may be used for any purpose as long as this notice remains intact
- * on all source code distributions
- */
-
-/**************************************************************
- * Original:
- * Patrick Powell Tue Apr 11 09:48:21 PDT 1995
- * A bombproof version of doprnt (dopr) included.
- * Sigh. This sort of thing is always nasty do deal with. Note that
- * the version here does not include floating point...
- *
- * snprintf() is used instead of sprintf() as it does limit checks
- * for string length. This covers a nasty loophole.
- *
- * The other functions are there to prevent NULL pointers from
- * causing nast effects.
- *
- * More Recently:
- * Brandon Long <blong@fiction.net> 9/15/96 for mutt 0.43
- * This was ugly. It is still ugly. I opted out of floating point
- * numbers, but the formatter understands just about everything
- * from the normal C string format, at least as far as I can tell from
- * the Solaris 2.5 printf(3S) man page.
- *
- * Brandon Long <blong@fiction.net> 10/22/97 for mutt 0.87.1
- * Ok, added some minimal floating point support, which means this
- * probably requires libm on most operating systems. Don't yet
- * support the exponent (e,E) and sigfig (g,G). Also, fmtint()
- * was pretty badly broken, it just wasn't being exercised in ways
- * which showed it, so that's been fixed. Also, formated the code
- * to mutt conventions, and removed dead code left over from the
- * original. Also, there is now a builtin-test, just compile with:
- * gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
- * and run snprintf for results.
- *
- * Thomas Roessler <roessler@guug.de> 01/27/98 for mutt 0.89i
- * The PGP code was using unsigned hexadecimal formats.
- * Unfortunately, unsigned formats simply didn't work.
- *
- * Michael Elkins <me@cs.hmc.edu> 03/05/98 for mutt 0.90.8
- * The original code assumed that both snprintf() and vsnprintf() were
- * missing. Some systems only have snprintf() but not vsnprintf(), so
- * the code is now broken down under HAVE_SNPRINTF and HAVE_VSNPRINTF.
- *
- * Andrew Tridgell (tridge@samba.org) Oct 1998
- * fixed handling of %.0f
- * added test for HAVE_LONG_DOUBLE
- *
- * tridge@samba.org, idra@samba.org, April 2001
- * got rid of fcvt code (twas buggy and made testing harder)
- * added C99 semantics
- *
- * date: 2002/12/19 19:56:31; author: herb; state: Exp; lines: +2 -0
- * actually print args for %g and %e
- *
- * date: 2002/06/03 13:37:52; author: jmcd; state: Exp; lines: +8 -0
- * Since includes.h isn't included here, VA_COPY has to be defined here. I don't
- * see any include file that is guaranteed to be here, so I'm defining it
- * locally. Fixes AIX and Solaris builds.
- *
- * date: 2002/06/03 03:07:24; author: tridge; state: Exp; lines: +5 -13
- * put the ifdef for HAVE_VA_COPY in one place rather than in lots of
- * functions
- *
- * date: 2002/05/17 14:51:22; author: jmcd; state: Exp; lines: +21 -4
- * Fix usage of va_list passed as an arg. Use __va_copy before using it
- * when it exists.
- *
- * date: 2002/04/16 22:38:04; author: idra; state: Exp; lines: +20 -14
- * Fix incorrect zpadlen handling in fmtfp.
- * Thanks to Ollie Oldham <ollie.oldham@metro-optix.com> for spotting it.
- * few mods to make it easier to compile the tests.
- * addedd the "Ollie" test to the floating point ones.
- *
- * Martin Pool (mbp@samba.org) April 2003
- * Remove NO_CONFIG_H so that the test case can be built within a source
- * tree with less trouble.
- * Remove unnecessary SAFE_FREE() definition.
- *
- * Martin Pool (mbp@samba.org) May 2003
- * Put in a prototype for dummy_snprintf() to quiet compiler warnings.
- *
- * Move #endif to make sure VA_COPY, LDOUBLE, etc are defined even
- * if the C library has some snprintf functions already.
- *
- * Darren Tucker (dtucker@zip.com.au) 2005
- * Fix bug allowing read overruns of the source string with "%.*s"
- * Usually harmless unless the read runs outside the process' allocation
- * (eg if your malloc does guard pages) in which case it will segfault.
- * From OpenSSH. Also added test for same.
- *
- * Simo Sorce (idra@samba.org) Jan 2006
- *
- * Add support for position independent parameters
- * fix fmtstr now it conforms to sprintf wrt min.max
- *
- **************************************************************/
-
-#include "replace.h"
-#include "system/locale.h"
-
-#ifdef TEST_SNPRINTF /* need math library headers for testing */
-
-/* In test mode, we pretend that this system doesn't have any snprintf
- * functions, regardless of what config.h says. */
-# undef HAVE_SNPRINTF
-# undef HAVE_VSNPRINTF
-# undef HAVE_C99_VSNPRINTF
-# undef HAVE_ASPRINTF
-# undef HAVE_VASPRINTF
-# include <math.h>
-#endif /* TEST_SNPRINTF */
-
-#if defined(HAVE_SNPRINTF) && defined(HAVE_VSNPRINTF) && defined(HAVE_C99_VSNPRINTF)
-/* only include stdio.h if we are not re-defining snprintf or vsnprintf */
-#include <stdio.h>
- /* make the compiler happy with an empty file */
- void dummy_snprintf(void);
- void dummy_snprintf(void) {}
-#endif /* HAVE_SNPRINTF, etc */
-
-/* yes this really must be a ||. Don't muck with this (tridge) */
-#if !defined(HAVE_VSNPRINTF) || !defined(HAVE_C99_VSNPRINTF)
-
-#ifdef HAVE_LONG_DOUBLE
-#define LDOUBLE long double
-#else
-#define LDOUBLE double
-#endif
-
-#ifdef HAVE_LONG_LONG
-#define LLONG long long
-#else
-#define LLONG long
-#endif
-
-#ifndef VA_COPY
-#ifdef HAVE_VA_COPY
-#define VA_COPY(dest, src) va_copy(dest, src)
-#else
-#ifdef HAVE___VA_COPY
-#define VA_COPY(dest, src) __va_copy(dest, src)
-#else
-#define VA_COPY(dest, src) (dest) = (src)
-#endif
-#endif
-
-/*
- * dopr(): poor man's version of doprintf
- */
-
-/* format read states */
-#define DP_S_DEFAULT 0
-#define DP_S_FLAGS 1
-#define DP_S_MIN 2
-#define DP_S_DOT 3
-#define DP_S_MAX 4
-#define DP_S_MOD 5
-#define DP_S_CONV 6
-#define DP_S_DONE 7
-
-/* format flags - Bits */
-#define DP_F_MINUS (1 << 0)
-#define DP_F_PLUS (1 << 1)
-#define DP_F_SPACE (1 << 2)
-#define DP_F_NUM (1 << 3)
-#define DP_F_ZERO (1 << 4)
-#define DP_F_UP (1 << 5)
-#define DP_F_UNSIGNED (1 << 6)
-
-/* Conversion Flags */
-#define DP_C_CHAR 1
-#define DP_C_SHORT 2
-#define DP_C_LONG 3
-#define DP_C_LDOUBLE 4
-#define DP_C_LLONG 5
-#define DP_C_SIZET 6
-
-/* Chunk types */
-#define CNK_FMT_STR 0
-#define CNK_INT 1
-#define CNK_OCTAL 2
-#define CNK_UINT 3
-#define CNK_HEX 4
-#define CNK_FLOAT 5
-#define CNK_CHAR 6
-#define CNK_STRING 7
-#define CNK_PTR 8
-#define CNK_NUM 9
-#define CNK_PRCNT 10
-
-#define char_to_int(p) ((p)- '0')
-#ifndef MAX
-#define MAX(p,q) (((p) >= (q)) ? (p) : (q))
-#endif
-
-struct pr_chunk {
- int type; /* chunk type */
- int num; /* parameter number */
- int min;
- int max;
- int flags;
- int cflags;
- int start;
- int len;
- LLONG value;
- LDOUBLE fvalue;
- char *strvalue;
- void *pnum;
- struct pr_chunk *min_star;
- struct pr_chunk *max_star;
- struct pr_chunk *next;
-};
-
-struct pr_chunk_x {
- struct pr_chunk **chunks;
- int num;
-};
-
-static int dopr(char *buffer, size_t maxlen, const char *format,
- va_list args_in);
-static void fmtstr(char *buffer, size_t *currlen, size_t maxlen,
- char *value, int flags, int min, int max);
-static void fmtint(char *buffer, size_t *currlen, size_t maxlen,
- LLONG value, int base, int min, int max, int flags);
-static void fmtfp(char *buffer, size_t *currlen, size_t maxlen,
- LDOUBLE fvalue, int min, int max, int flags);
-static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c);
-static struct pr_chunk *new_chunk(void);
-static int add_cnk_list_entry(struct pr_chunk_x **list,
- int max_num, struct pr_chunk *chunk);
-
-static int dopr(char *buffer, size_t maxlen, const char *format, va_list args_in)
-{
- char ch;
- int state;
- int pflag;
- int pnum;
- int pfirst;
- size_t currlen;
- va_list args;
- const char *base;
- struct pr_chunk *chunks = NULL;
- struct pr_chunk *cnk = NULL;
- struct pr_chunk_x *clist = NULL;
- int max_pos;
- int ret = -1;
-
- VA_COPY(args, args_in);
-
- state = DP_S_DEFAULT;
- pfirst = 1;
- pflag = 0;
- pnum = 0;
-
- max_pos = 0;
- base = format;
- ch = *format++;
-
- /* retrieve the string structure as chunks */
- while (state != DP_S_DONE) {
- if (ch == '\0')
- state = DP_S_DONE;
-
- switch(state) {
- case DP_S_DEFAULT:
-
- if (cnk) {
- cnk->next = new_chunk();
- cnk = cnk->next;
- } else {
- cnk = new_chunk();
- }
- if (!cnk) goto done;
- if (!chunks) chunks = cnk;
-
- if (ch == '%') {
- state = DP_S_FLAGS;
- ch = *format++;
- } else {
- cnk->type = CNK_FMT_STR;
- cnk->start = format - base -1;
- while ((ch != '\0') && (ch != '%')) ch = *format++;
- cnk->len = format - base - cnk->start -1;
- }
- break;
- case DP_S_FLAGS:
- switch (ch) {
- case '-':
- cnk->flags |= DP_F_MINUS;
- ch = *format++;
- break;
- case '+':
- cnk->flags |= DP_F_PLUS;
- ch = *format++;
- break;
- case ' ':
- cnk->flags |= DP_F_SPACE;
- ch = *format++;
- break;
- case '#':
- cnk->flags |= DP_F_NUM;
- ch = *format++;
- break;
- case '0':
- cnk->flags |= DP_F_ZERO;
- ch = *format++;
- break;
- case 'I':
- /* internationalization not supported yet */
- ch = *format++;
- break;
- default:
- state = DP_S_MIN;
- break;
- }
- break;
- case DP_S_MIN:
- if (isdigit((unsigned char)ch)) {
- cnk->min = 10 * cnk->min + char_to_int (ch);
- ch = *format++;
- } else if (ch == '$') {
- if (!pfirst && !pflag) {
- /* parameters must be all positioned or none */
- goto done;
- }
- if (pfirst) {
- pfirst = 0;
- pflag = 1;
- }
- if (cnk->min == 0) /* what ?? */
- goto done;
- cnk->num = cnk->min;
- cnk->min = 0;
- ch = *format++;
- } else if (ch == '*') {
- if (pfirst) pfirst = 0;
- cnk->min_star = new_chunk();
- if (!cnk->min_star) /* out of memory :-( */
- goto done;
- cnk->min_star->type = CNK_INT;
- if (pflag) {
- int num;
- ch = *format++;
- if (!isdigit((unsigned char)ch)) {
- /* parameters must be all positioned or none */
- goto done;
- }
- for (num = 0; isdigit((unsigned char)ch); ch = *format++) {
- num = 10 * num + char_to_int(ch);
- }
- cnk->min_star->num = num;
- if (ch != '$') /* what ?? */
- goto done;
- } else {
- cnk->min_star->num = ++pnum;
- }
- max_pos = add_cnk_list_entry(&clist, max_pos, cnk->min_star);
- if (max_pos == 0) /* out of memory :-( */
- goto done;
- ch = *format++;
- state = DP_S_DOT;
- } else {
- if (pfirst) pfirst = 0;
- state = DP_S_DOT;
- }
- break;
- case DP_S_DOT:
- if (ch == '.') {
- state = DP_S_MAX;
- ch = *format++;
- } else {
- state = DP_S_MOD;
- }
- break;
- case DP_S_MAX:
- if (isdigit((unsigned char)ch)) {
- if (cnk->max < 0)
- cnk->max = 0;
- cnk->max = 10 * cnk->max + char_to_int (ch);
- ch = *format++;
- } else if (ch == '$') {
- if (!pfirst && !pflag) {
- /* parameters must be all positioned or none */
- goto done;
- }
- if (cnk->max <= 0) /* what ?? */
- goto done;
- cnk->num = cnk->max;
- cnk->max = -1;
- ch = *format++;
- } else if (ch == '*') {
- cnk->max_star = new_chunk();
- if (!cnk->max_star) /* out of memory :-( */
- goto done;
- cnk->max_star->type = CNK_INT;
- if (pflag) {
- int num;
- ch = *format++;
- if (!isdigit((unsigned char)ch)) {
- /* parameters must be all positioned or none */
- goto done;
- }
- for (num = 0; isdigit((unsigned char)ch); ch = *format++) {
- num = 10 * num + char_to_int(ch);
- }
- cnk->max_star->num = num;
- if (ch != '$') /* what ?? */
- goto done;
- } else {
- cnk->max_star->num = ++pnum;
- }
- max_pos = add_cnk_list_entry(&clist, max_pos, cnk->max_star);
- if (max_pos == 0) /* out of memory :-( */
- goto done;
-
- ch = *format++;
- state = DP_S_MOD;
- } else {
- state = DP_S_MOD;
- }
- break;
- case DP_S_MOD:
- switch (ch) {
- case 'h':
- cnk->cflags = DP_C_SHORT;
- ch = *format++;
- if (ch == 'h') {
- cnk->cflags = DP_C_CHAR;
- ch = *format++;
- }
- break;
- case 'l':
- cnk->cflags = DP_C_LONG;
- ch = *format++;
- if (ch == 'l') { /* It's a long long */
- cnk->cflags = DP_C_LLONG;
- ch = *format++;
- }
- break;
- case 'L':
- cnk->cflags = DP_C_LDOUBLE;
- ch = *format++;
- break;
- case 'z':
- cnk->cflags = DP_C_SIZET;
- ch = *format++;
- break;
- default:
- break;
- }
- state = DP_S_CONV;
- break;
- case DP_S_CONV:
- if (cnk->num == 0) cnk->num = ++pnum;
- max_pos = add_cnk_list_entry(&clist, max_pos, cnk);
- if (max_pos == 0) /* out of memory :-( */
- goto done;
-
- switch (ch) {
- case 'd':
- case 'i':
- cnk->type = CNK_INT;
- break;
- case 'o':
- cnk->type = CNK_OCTAL;
- cnk->flags |= DP_F_UNSIGNED;
- break;
- case 'u':
- cnk->type = CNK_UINT;
- cnk->flags |= DP_F_UNSIGNED;
- break;
- case 'X':
- cnk->flags |= DP_F_UP;
- case 'x':
- cnk->type = CNK_HEX;
- cnk->flags |= DP_F_UNSIGNED;
- break;
- case 'A':
- /* hex float not supported yet */
- case 'E':
- case 'G':
- case 'F':
- cnk->flags |= DP_F_UP;
- case 'a':
- /* hex float not supported yet */
- case 'e':
- case 'f':
- case 'g':
- cnk->type = CNK_FLOAT;
- break;
- case 'c':
- cnk->type = CNK_CHAR;
- break;
- case 's':
- cnk->type = CNK_STRING;
- break;
- case 'p':
- cnk->type = CNK_PTR;
- break;
- case 'n':
- cnk->type = CNK_NUM;
- break;
- case '%':
- cnk->type = CNK_PRCNT;
- break;
- default:
- /* Unknown, bail out*/
- goto done;
- }
- ch = *format++;
- state = DP_S_DEFAULT;
- break;
- case DP_S_DONE:
- break;
- default:
- /* hmm? */
- break; /* some picky compilers need this */
- }
- }
-
- /* retrieve the format arguments */
- for (pnum = 0; pnum < max_pos; pnum++) {
- int i;
-
- if (clist[pnum].num == 0) {
- /* ignoring a parameter should not be permitted
- * all parameters must be matched at least once
- * BUT seem some system ignore this rule ...
- * at least my glibc based system does --SSS
- */
-#ifdef DEBUG_SNPRINTF
- printf("parameter at position %d not used\n", pnum+1);
-#endif
- /* eat the parameter */
- va_arg (args, int);
- continue;
- }
- for (i = 1; i < clist[pnum].num; i++) {
- if (clist[pnum].chunks[0]->type != clist[pnum].chunks[i]->type) {
- /* nooo noo no!
- * all the references to a parameter
- * must be of the same type
- */
- goto done;
- }
- }
- cnk = clist[pnum].chunks[0];
- switch (cnk->type) {
- case CNK_INT:
- if (cnk->cflags == DP_C_SHORT)
- cnk->value = va_arg (args, int);
- else if (cnk->cflags == DP_C_LONG)
- cnk->value = va_arg (args, long int);
- else if (cnk->cflags == DP_C_LLONG)
- cnk->value = va_arg (args, LLONG);
- else if (cnk->cflags == DP_C_SIZET)
- cnk->value = va_arg (args, ssize_t);
- else
- cnk->value = va_arg (args, int);
-
- for (i = 1; i < clist[pnum].num; i++) {
- clist[pnum].chunks[i]->value = cnk->value;
- }
- break;
-
- case CNK_OCTAL:
- case CNK_UINT:
- case CNK_HEX:
- if (cnk->cflags == DP_C_SHORT)
- cnk->value = va_arg (args, unsigned int);
- else if (cnk->cflags == DP_C_LONG)
- cnk->value = (unsigned long int)va_arg (args, unsigned long int);
- else if (cnk->cflags == DP_C_LLONG)
- cnk->value = (LLONG)va_arg (args, unsigned LLONG);
- else if (cnk->cflags == DP_C_SIZET)
- cnk->value = (size_t)va_arg (args, size_t);
- else
- cnk->value = (unsigned int)va_arg (args, unsigned int);
-
- for (i = 1; i < clist[pnum].num; i++) {
- clist[pnum].chunks[i]->value = cnk->value;
- }
- break;
-
- case CNK_FLOAT:
- if (cnk->cflags == DP_C_LDOUBLE)
- cnk->fvalue = va_arg (args, LDOUBLE);
- else
- cnk->fvalue = va_arg (args, double);
-
- for (i = 1; i < clist[pnum].num; i++) {
- clist[pnum].chunks[i]->fvalue = cnk->fvalue;
- }
- break;
-
- case CNK_CHAR:
- cnk->value = va_arg (args, int);
-
- for (i = 1; i < clist[pnum].num; i++) {
- clist[pnum].chunks[i]->value = cnk->value;
- }
- break;
-
- case CNK_STRING:
- cnk->strvalue = va_arg (args, char *);
- if (!cnk->strvalue) cnk->strvalue = "(NULL)";
-
- for (i = 1; i < clist[pnum].num; i++) {
- clist[pnum].chunks[i]->strvalue = cnk->strvalue;
- }
- break;
-
- case CNK_PTR:
- cnk->strvalue = va_arg (args, void *);
- for (i = 1; i < clist[pnum].num; i++) {
- clist[pnum].chunks[i]->strvalue = cnk->strvalue;
- }
- break;
-
- case CNK_NUM:
- if (cnk->cflags == DP_C_CHAR)
- cnk->pnum = va_arg (args, char *);
- else if (cnk->cflags == DP_C_SHORT)
- cnk->pnum = va_arg (args, short int *);
- else if (cnk->cflags == DP_C_LONG)
- cnk->pnum = va_arg (args, long int *);
- else if (cnk->cflags == DP_C_LLONG)
- cnk->pnum = va_arg (args, LLONG *);
- else if (cnk->cflags == DP_C_SIZET)
- cnk->pnum = va_arg (args, ssize_t *);
- else
- cnk->pnum = va_arg (args, int *);
-
- for (i = 1; i < clist[pnum].num; i++) {
- clist[pnum].chunks[i]->pnum = cnk->pnum;
- }
- break;
-
- case CNK_PRCNT:
- break;
-
- default:
- /* what ?? */
- goto done;
- }
- }
- /* print out the actual string from chunks */
- currlen = 0;
- cnk = chunks;
- while (cnk) {
- int len, min, max;
-
- if (cnk->min_star) min = cnk->min_star->value;
- else min = cnk->min;
- if (cnk->max_star) max = cnk->max_star->value;
- else max = cnk->max;
-
- switch (cnk->type) {
-
- case CNK_FMT_STR:
- if (maxlen != 0 && maxlen > currlen) {
- if (maxlen > (currlen + cnk->len)) len = cnk->len;
- else len = maxlen - currlen;
-
- memcpy(&(buffer[currlen]), &(base[cnk->start]), len);
- }
- currlen += cnk->len;
-
- break;
-
- case CNK_INT:
- case CNK_UINT:
- fmtint (buffer, &currlen, maxlen, cnk->value, 10, min, max, cnk->flags);
- break;
-
- case CNK_OCTAL:
- fmtint (buffer, &currlen, maxlen, cnk->value, 8, min, max, cnk->flags);
- break;
-
- case CNK_HEX:
- fmtint (buffer, &currlen, maxlen, cnk->value, 16, min, max, cnk->flags);
- break;
-
- case CNK_FLOAT:
- fmtfp (buffer, &currlen, maxlen, cnk->fvalue, min, max, cnk->flags);
- break;
-
- case CNK_CHAR:
- dopr_outch (buffer, &currlen, maxlen, cnk->value);
- break;
-
- case CNK_STRING:
- if (max == -1) {
- max = strlen(cnk->strvalue);
- }
- fmtstr (buffer, &currlen, maxlen, cnk->strvalue, cnk->flags, min, max);
- break;
-
- case CNK_PTR:
- fmtint (buffer, &currlen, maxlen, (long)(cnk->strvalue), 16, min, max, cnk->flags);
- break;
-
- case CNK_NUM:
- if (cnk->cflags == DP_C_CHAR)
- *((char *)(cnk->pnum)) = (char)currlen;
- else if (cnk->cflags == DP_C_SHORT)
- *((short int *)(cnk->pnum)) = (short int)currlen;
- else if (cnk->cflags == DP_C_LONG)
- *((long int *)(cnk->pnum)) = (long int)currlen;
- else if (cnk->cflags == DP_C_LLONG)
- *((LLONG *)(cnk->pnum)) = (LLONG)currlen;
- else if (cnk->cflags == DP_C_SIZET)
- *((ssize_t *)(cnk->pnum)) = (ssize_t)currlen;
- else
- *((int *)(cnk->pnum)) = (int)currlen;
- break;
-
- case CNK_PRCNT:
- dopr_outch (buffer, &currlen, maxlen, '%');
- break;
-
- default:
- /* what ?? */
- goto done;
- }
- cnk = cnk->next;
- }
- if (maxlen != 0) {
- if (currlen < maxlen - 1)
- buffer[currlen] = '\0';
- else if (maxlen > 0)
- buffer[maxlen - 1] = '\0';
- }
- ret = currlen;
-
-done:
- va_end(args);
-
- while (chunks) {
- cnk = chunks->next;
- free(chunks);
- chunks = cnk;
- }
- if (clist) {
- for (pnum = 0; pnum < max_pos; pnum++) {
- if (clist[pnum].chunks) free(clist[pnum].chunks);
- }
- free(clist);
- }
- return ret;
-}
-
-static void fmtstr(char *buffer, size_t *currlen, size_t maxlen,
- char *value, int flags, int min, int max)
-{
- int padlen, strln; /* amount to pad */
- int cnt = 0;
-
-#ifdef DEBUG_SNPRINTF
- printf("fmtstr min=%d max=%d s=[%s]\n", min, max, value);
-#endif
- if (value == 0) {
- value = "<NULL>";
- }
-
- for (strln = 0; strln < max && value[strln]; ++strln); /* strlen */
- padlen = min - strln;
- if (padlen < 0)
- padlen = 0;
- if (flags & DP_F_MINUS)
- padlen = -padlen; /* Left Justify */
-
- while (padlen > 0) {
- dopr_outch (buffer, currlen, maxlen, ' ');
- --padlen;
- }
- while (*value && (cnt < max)) {
- dopr_outch (buffer, currlen, maxlen, *value++);
- ++cnt;
- }
- while (padlen < 0) {
- dopr_outch (buffer, currlen, maxlen, ' ');
- ++padlen;
- }
-}
-
-/* Have to handle DP_F_NUM (ie 0x and 0 alternates) */
-
-static void fmtint(char *buffer, size_t *currlen, size_t maxlen,
- LLONG value, int base, int min, int max, int flags)
-{
- int signvalue = 0;
- unsigned LLONG uvalue;
- char convert[20];
- int place = 0;
- int spadlen = 0; /* amount to space pad */
- int zpadlen = 0; /* amount to zero pad */
- int caps = 0;
-
- if (max < 0)
- max = 0;
-
- uvalue = value;
-
- if(!(flags & DP_F_UNSIGNED)) {
- if( value < 0 ) {
- signvalue = '-';
- uvalue = -value;
- } else {
- if (flags & DP_F_PLUS) /* Do a sign (+/i) */
- signvalue = '+';
- else if (flags & DP_F_SPACE)
- signvalue = ' ';
- }
- }
-
- if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
-
- do {
- convert[place++] =
- (caps? "0123456789ABCDEF":"0123456789abcdef")
- [uvalue % (unsigned)base ];
- uvalue = (uvalue / (unsigned)base );
- } while(uvalue && (place < 20));
- if (place == 20) place--;
- convert[place] = 0;
-
- zpadlen = max - place;
- spadlen = min - MAX (max, place) - (signvalue ? 1 : 0);
- if (zpadlen < 0) zpadlen = 0;
- if (spadlen < 0) spadlen = 0;
- if (flags & DP_F_ZERO) {
- zpadlen = MAX(zpadlen, spadlen);
- spadlen = 0;
- }
- if (flags & DP_F_MINUS)
- spadlen = -spadlen; /* Left Justifty */
-
-#ifdef DEBUG_SNPRINTF
- printf("zpad: %d, spad: %d, min: %d, max: %d, place: %d\n",
- zpadlen, spadlen, min, max, place);
-#endif
-
- /* Spaces */
- while (spadlen > 0) {
- dopr_outch (buffer, currlen, maxlen, ' ');
- --spadlen;
- }
-
- /* Sign */
- if (signvalue)
- dopr_outch (buffer, currlen, maxlen, signvalue);
-
- /* Zeros */
- if (zpadlen > 0) {
- while (zpadlen > 0) {
- dopr_outch (buffer, currlen, maxlen, '0');
- --zpadlen;
- }
- }
-
- /* Digits */
- while (place > 0)
- dopr_outch (buffer, currlen, maxlen, convert[--place]);
-
- /* Left Justified spaces */
- while (spadlen < 0) {
- dopr_outch (buffer, currlen, maxlen, ' ');
- ++spadlen;
- }
-}
-
-static LDOUBLE abs_val(LDOUBLE value)
-{
- LDOUBLE result = value;
-
- if (value < 0)
- result = -value;
-
- return result;
-}
-
-static LDOUBLE POW10(int exp)
-{
- LDOUBLE result = 1;
-
- while (exp) {
- result *= 10;
- exp--;
- }
-
- return result;
-}
-
-static LLONG ROUND(LDOUBLE value)
-{
- LLONG intpart;
-
- intpart = (LLONG)value;
- value = value - intpart;
- if (value >= 0.5) intpart++;
-
- return intpart;
-}
-
-/* a replacement for modf that doesn't need the math library. Should
- be portable, but slow */
-static double my_modf(double x0, double *iptr)
-{
- int i;
- LLONG l=0;
- double x = x0;
- double f = 1.0;
-
- for (i=0;i<100;i++) {
- l = (long)x;
- if (l <= (x+1) && l >= (x-1)) break;
- x *= 0.1;
- f *= 10.0;
- }
-
- if (i == 100) {
- /* yikes! the number is beyond what we can handle. What do we do? */
- (*iptr) = 0;
- return 0;
- }
-
- if (i != 0) {
- double i2;
- double ret;
-
- ret = my_modf(x0-l*f, &i2);
- (*iptr) = l*f + i2;
- return ret;
- }
-
- (*iptr) = l;
- return x - (*iptr);
-}
-
-
-static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
- LDOUBLE fvalue, int min, int max, int flags)
-{
- int signvalue = 0;
- double ufvalue;
- char iconvert[311];
- char fconvert[311];
- int iplace = 0;
- int fplace = 0;
- int padlen = 0; /* amount to pad */
- int zpadlen = 0;
- int caps = 0;
- int idx;
- double intpart;
- double fracpart;
- double temp;
-
- /*
- * AIX manpage says the default is 0, but Solaris says the default
- * is 6, and sprintf on AIX defaults to 6
- */
- if (max < 0)
- max = 6;
-
- ufvalue = abs_val (fvalue);
-
- if (fvalue < 0) {
- signvalue = '-';
- } else {
- if (flags & DP_F_PLUS) { /* Do a sign (+/i) */
- signvalue = '+';
- } else {
- if (flags & DP_F_SPACE)
- signvalue = ' ';
- }
- }
-
-#if 0
- if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
-#endif
-
-#if 0
- if (max == 0) ufvalue += 0.5; /* if max = 0 we must round */
-#endif
-
- /*
- * Sorry, we only support 9 digits past the decimal because of our
- * conversion method
- */
- if (max > 9)
- max = 9;
-
- /* We "cheat" by converting the fractional part to integer by
- * multiplying by a factor of 10
- */
-
- temp = ufvalue;
- my_modf(temp, &intpart);
-
- fracpart = ROUND((POW10(max)) * (ufvalue - intpart));
-
- if (fracpart >= POW10(max)) {
- intpart++;
- fracpart -= POW10(max);
- }
-
-
- /* Convert integer part */
- do {
- temp = intpart*0.1;
- my_modf(temp, &intpart);
- idx = (int) ((temp -intpart +0.05)* 10.0);
- /* idx = (int) (((double)(temp*0.1) -intpart +0.05) *10.0); */
- /* printf ("%llf, %f, %x\n", temp, intpart, idx); */
- iconvert[iplace++] =
- (caps? "0123456789ABCDEF":"0123456789abcdef")[idx];
- } while (intpart && (iplace < 311));
- if (iplace == 311) iplace--;
- iconvert[iplace] = 0;
-
- /* Convert fractional part */
- if (fracpart)
- {
- do {
- temp = fracpart*0.1;
- my_modf(temp, &fracpart);
- idx = (int) ((temp -fracpart +0.05)* 10.0);
- /* idx = (int) ((((temp/10) -fracpart) +0.05) *10); */
- /* printf ("%lf, %lf, %ld\n", temp, fracpart, idx ); */
- fconvert[fplace++] =
- (caps? "0123456789ABCDEF":"0123456789abcdef")[idx];
- } while(fracpart && (fplace < 311));
- if (fplace == 311) fplace--;
- }
- fconvert[fplace] = 0;
-
- /* -1 for decimal point, another -1 if we are printing a sign */
- padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0);
- zpadlen = max - fplace;
- if (zpadlen < 0) zpadlen = 0;
- if (padlen < 0)
- padlen = 0;
- if (flags & DP_F_MINUS)
- padlen = -padlen; /* Left Justifty */
-
- if ((flags & DP_F_ZERO) && (padlen > 0)) {
- if (signvalue) {
- dopr_outch (buffer, currlen, maxlen, signvalue);
- --padlen;
- signvalue = 0;
- }
- while (padlen > 0) {
- dopr_outch (buffer, currlen, maxlen, '0');
- --padlen;
- }
- }
- while (padlen > 0) {
- dopr_outch (buffer, currlen, maxlen, ' ');
- --padlen;
- }
- if (signvalue)
- dopr_outch (buffer, currlen, maxlen, signvalue);
-
- while (iplace > 0)
- dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]);
-
-#ifdef DEBUG_SNPRINTF
- printf("fmtfp: fplace=%d zpadlen=%d\n", fplace, zpadlen);
-#endif
-
- /*
- * Decimal point. This should probably use locale to find the correct
- * char to print out.
- */
- if (max > 0) {
- dopr_outch (buffer, currlen, maxlen, '.');
-
- while (zpadlen > 0) {
- dopr_outch (buffer, currlen, maxlen, '0');
- --zpadlen;
- }
-
- while (fplace > 0)
- dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]);
- }
-
- while (padlen < 0) {
- dopr_outch (buffer, currlen, maxlen, ' ');
- ++padlen;
- }
-}
-
-static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c)
-{
- if (*currlen < maxlen) {
- buffer[(*currlen)] = c;
- }
- (*currlen)++;
-}
-
-static struct pr_chunk *new_chunk(void) {
- struct pr_chunk *new_c = (struct pr_chunk *)malloc(sizeof(struct pr_chunk));
-
- if (!new_c)
- return NULL;
-
- new_c->type = 0;
- new_c->num = 0;
- new_c->min = 0;
- new_c->min_star = NULL;
- new_c->max = -1;
- new_c->max_star = NULL;
- new_c->flags = 0;
- new_c->cflags = 0;
- new_c->start = 0;
- new_c->len = 0;
- new_c->value = 0;
- new_c->fvalue = 0;
- new_c->strvalue = NULL;
- new_c->pnum = NULL;
- new_c->next = NULL;
-
- return new_c;
-}
-
-static int add_cnk_list_entry(struct pr_chunk_x **list,
- int max_num, struct pr_chunk *chunk) {
- struct pr_chunk_x *l;
- struct pr_chunk **c;
- int max;
- int cnum;
- int i, pos;
-
- if (chunk->num > max_num) {
- max = chunk->num;
-
- if (*list == NULL) {
- l = (struct pr_chunk_x *)malloc(sizeof(struct pr_chunk_x) * max);
- pos = 0;
- } else {
- l = (struct pr_chunk_x *)realloc(*list, sizeof(struct pr_chunk_x) * max);
- pos = max_num;
- }
- if (l == NULL) {
- for (i = 0; i < max; i++) {
- if ((*list)[i].chunks) free((*list)[i].chunks);
- }
- return 0;
- }
- for (i = pos; i < max; i++) {
- l[i].chunks = NULL;
- l[i].num = 0;
- }
- } else {
- l = *list;
- max = max_num;
- }
-
- i = chunk->num - 1;
- cnum = l[i].num + 1;
- if (l[i].chunks == NULL) {
- c = (struct pr_chunk **)malloc(sizeof(struct pr_chunk *) * cnum);
- } else {
- c = (struct pr_chunk **)realloc(l[i].chunks, sizeof(struct pr_chunk *) * cnum);
- }
- if (c == NULL) {
- for (i = 0; i < max; i++) {
- if (l[i].chunks) free(l[i].chunks);
- }
- return 0;
- }
- c[l[i].num] = chunk;
- l[i].chunks = c;
- l[i].num = cnum;
-
- *list = l;
- return max;
-}
-
- int vsnprintf (char *str, size_t count, const char *fmt, va_list args)
-{
- return dopr(str, count, fmt, args);
-}
-#endif
-
-/* yes this really must be a ||. Don't muck with this (tridge)
- *
- * The logic for these two is that we need our own definition if the
- * OS *either* has no definition of *sprintf, or if it does have one
- * that doesn't work properly according to the autoconf test.
- */
-#if !defined(HAVE_SNPRINTF) || !defined(HAVE_C99_VSNPRINTF)
- int snprintf(char *str,size_t count,const char *fmt,...)
-{
- size_t ret;
- va_list ap;
-
- va_start(ap, fmt);
- ret = vsnprintf(str, count, fmt, ap);
- va_end(ap);
- return ret;
-}
-#endif
-
-#ifndef HAVE_C99_VSNPRINTF
- int printf(const char *fmt, ...)
-{
- va_list ap;
- int ret;
- char *s;
-
- s = NULL;
- va_start(ap, fmt);
- ret = vasprintf(&s, fmt, ap);
- va_end(ap);
-
- if (s) {
- fwrite(s, 1, strlen(s), stdout);
- }
- free(s);
-
- return ret;
-}
-#endif
-
-#ifndef HAVE_C99_VSNPRINTF
- int fprintf(FILE *stream, const char *fmt, ...)
-{
- va_list ap;
- int ret;
- char *s;
-
- s = NULL;
- va_start(ap, fmt);
- ret = vasprintf(&s, fmt, ap);
- va_end(ap);
-
- if (s) {
- fwrite(s, 1, strlen(s), stream);
- }
- free(s);
-
- return ret;
-}
-#endif
-
-#endif
-
-#ifndef HAVE_VASPRINTF
- int vasprintf(char **ptr, const char *format, va_list ap)
-{
- int ret;
- va_list ap2;
-
- VA_COPY(ap2, ap);
- ret = vsnprintf(NULL, 0, format, ap2);
- va_end(ap2);
- if (ret < 0) return ret;
-
- (*ptr) = (char *)malloc(ret+1);
- if (!*ptr) return -1;
-
- VA_COPY(ap2, ap);
- ret = vsnprintf(*ptr, ret+1, format, ap2);
- va_end(ap2);
-
- return ret;
-}
-#endif
-
-
-#ifndef HAVE_ASPRINTF
- int asprintf(char **ptr, const char *format, ...)
-{
- va_list ap;
- int ret;
-
- *ptr = NULL;
- va_start(ap, format);
- ret = vasprintf(ptr, format, ap);
- va_end(ap);
-
- return ret;
-}
-#endif
-
-#ifdef TEST_SNPRINTF
-
- int sprintf(char *str,const char *fmt,...);
- int printf(const char *fmt,...);
-
- int main (void)
-{
- char buf1[1024];
- char buf2[1024];
- char *buf3;
- char *fp_fmt[] = {
- "%1.1f",
- "%-1.5f",
- "%1.5f",
- "%123.9f",
- "%10.5f",
- "% 10.5f",
- "%+22.9f",
- "%+4.9f",
- "%01.3f",
- "%4f",
- "%3.1f",
- "%3.2f",
- "%.0f",
- "%f",
- "%-8.8f",
- "%-9.9f",
- NULL
- };
- double fp_nums[] = { 6442452944.1234, -1.5, 134.21, 91340.2, 341.1234, 203.9, 0.96, 0.996,
- 0.9996, 1.996, 4.136, 5.030201, 0.00205,
- /* END LIST */ 0};
- char *int_fmt[] = {
- "%-1.5d",
- "%1.5d",
- "%123.9d",
- "%5.5d",
- "%10.5d",
- "% 10.5d",
- "%+22.33d",
- "%01.3d",
- "%4d",
- "%d",
- NULL
- };
- long int_nums[] = { -1, 134, 91340, 341, 0203, 1234567890, 0};
- char *str_fmt[] = {
- "%10.5s",
- "%-10.5s",
- "%5.10s",
- "%-5.10s",
- "%10.1s",
- "%0.10s",
- "%10.0s",
- "%1.10s",
- "%s",
- "%.1s",
- "%.10s",
- "%10s",
- NULL
- };
- char *str_vals[] = {"hello", "a", "", "a longer string", NULL};
-#ifdef HAVE_LONG_LONG
- char *ll_fmt[] = {
- "%llu",
- NULL
- };
- LLONG ll_nums[] = { 134, 91340, 341, 0203, 1234567890, 128006186140000000LL, 0};
-#endif
- int x, y;
- int fail = 0;
- int num = 0;
- int l1, l2;
- char *ss_fmt[] = {
- "%zd",
- "%zu",
- NULL
- };
- size_t ss_nums[] = {134, 91340, 123456789, 0203, 1234567890, 0};
-
- printf ("Testing snprintf format codes against system sprintf...\n");
-
- for (x = 0; fp_fmt[x] ; x++) {
- for (y = 0; fp_nums[y] != 0 ; y++) {
- buf1[0] = buf2[0] = '\0';
- l1 = snprintf(buf1, sizeof(buf1), fp_fmt[x], fp_nums[y]);
- l2 = sprintf (buf2, fp_fmt[x], fp_nums[y]);
- buf1[1023] = buf2[1023] = '\0';
- if (strcmp (buf1, buf2) || (l1 != l2)) {
- printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
- fp_fmt[x], l1, buf1, l2, buf2);
- fail++;
- }
- num++;
- }
- }
-
- for (x = 0; int_fmt[x] ; x++) {
- for (y = 0; int_nums[y] != 0 ; y++) {
- buf1[0] = buf2[0] = '\0';
- l1 = snprintf(buf1, sizeof(buf1), int_fmt[x], int_nums[y]);
- l2 = sprintf (buf2, int_fmt[x], int_nums[y]);
- buf1[1023] = buf2[1023] = '\0';
- if (strcmp (buf1, buf2) || (l1 != l2)) {
- printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
- int_fmt[x], l1, buf1, l2, buf2);
- fail++;
- }
- num++;
- }
- }
-
- for (x = 0; str_fmt[x] ; x++) {
- for (y = 0; str_vals[y] != 0 ; y++) {
- buf1[0] = buf2[0] = '\0';
- l1 = snprintf(buf1, sizeof(buf1), str_fmt[x], str_vals[y]);
- l2 = sprintf (buf2, str_fmt[x], str_vals[y]);
- buf1[1023] = buf2[1023] = '\0';
- if (strcmp (buf1, buf2) || (l1 != l2)) {
- printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
- str_fmt[x], l1, buf1, l2, buf2);
- fail++;
- }
- num++;
- }
- }
-
-#ifdef HAVE_LONG_LONG
- for (x = 0; ll_fmt[x] ; x++) {
- for (y = 0; ll_nums[y] != 0 ; y++) {
- buf1[0] = buf2[0] = '\0';
- l1 = snprintf(buf1, sizeof(buf1), ll_fmt[x], ll_nums[y]);
- l2 = sprintf (buf2, ll_fmt[x], ll_nums[y]);
- buf1[1023] = buf2[1023] = '\0';
- if (strcmp (buf1, buf2) || (l1 != l2)) {
- printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
- ll_fmt[x], l1, buf1, l2, buf2);
- fail++;
- }
- num++;
- }
- }
-#endif
-
-#define BUFSZ 2048
-
- buf1[0] = buf2[0] = '\0';
- if ((buf3 = malloc(BUFSZ)) == NULL) {
- fail++;
- } else {
- num++;
- memset(buf3, 'a', BUFSZ);
- snprintf(buf1, sizeof(buf1), "%.*s", 1, buf3);
- buf1[1023] = '\0';
- if (strcmp(buf1, "a") != 0) {
- printf("length limit buf1 '%s' expected 'a'\n", buf1);
- fail++;
- }
- }
-
- buf1[0] = buf2[0] = '\0';
- l1 = snprintf(buf1, sizeof(buf1), "%4$*1$d %2$s %3$*1$.*1$f", 3, "pos test", 12.3456, 9);
- l2 = sprintf(buf2, "%4$*1$d %2$s %3$*1$.*1$f", 3, "pos test", 12.3456, 9);
- buf1[1023] = buf2[1023] = '\0';
- if (strcmp(buf1, buf2) || (l1 != l2)) {
- printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
- "%4$*1$d %2$s %3$*1$.*1$f", l1, buf1, l2, buf2);
- fail++;
- }
-
- buf1[0] = buf2[0] = '\0';
- l1 = snprintf(buf1, sizeof(buf1), "%4$*4$d %2$s %3$*4$.*4$f", 3, "pos test", 12.3456, 9);
- l2 = sprintf(buf2, "%4$*4$d %2$s %3$*4$.*4$f", 3, "pos test", 12.3456, 9);
- buf1[1023] = buf2[1023] = '\0';
- if (strcmp(buf1, buf2)) {
- printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
- "%4$*1$d %2$s %3$*1$.*1$f", l1, buf1, l2, buf2);
- fail++;
- }
-
- for (x = 0; ss_fmt[x] ; x++) {
- for (y = 0; ss_nums[y] != 0 ; y++) {
- buf1[0] = buf2[0] = '\0';
- l1 = snprintf(buf1, sizeof(buf1), ss_fmt[x], ss_nums[y]);
- l2 = sprintf (buf2, ss_fmt[x], ss_nums[y]);
- buf1[1023] = buf2[1023] = '\0';
- if (strcmp (buf1, buf2) || (l1 != l2)) {
- printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
- ss_fmt[x], l1, buf1, l2, buf2);
- fail++;
- }
- num++;
- }
- }
-#if 0
- buf1[0] = buf2[0] = '\0';
- l1 = snprintf(buf1, sizeof(buf1), "%lld", (LLONG)1234567890);
- l2 = sprintf(buf2, "%lld", (LLONG)1234567890);
- buf1[1023] = buf2[1023] = '\0';
- if (strcmp(buf1, buf2)) {
- printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
- "%lld", l1, buf1, l2, buf2);
- fail++;
- }
-
- buf1[0] = buf2[0] = '\0';
- l1 = snprintf(buf1, sizeof(buf1), "%Lf", (LDOUBLE)890.1234567890123);
- l2 = sprintf(buf2, "%Lf", (LDOUBLE)890.1234567890123);
- buf1[1023] = buf2[1023] = '\0';
- if (strcmp(buf1, buf2)) {
- printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
- "%Lf", l1, buf1, l2, buf2);
- fail++;
- }
-#endif
- printf ("%d tests failed out of %d.\n", fail, num);
-
- printf("seeing how many digits we support\n");
- {
- double v0 = 0.12345678901234567890123456789012345678901;
- for (x=0; x<100; x++) {
- double p = pow(10, x);
- double r = v0*p;
- snprintf(buf1, sizeof(buf1), "%1.1f", r);
- sprintf(buf2, "%1.1f", r);
- if (strcmp(buf1, buf2)) {
- printf("we seem to support %d digits\n", x-1);
- break;
- }
- }
- }
-
- return 0;
-}
-#endif /* TEST_SNPRINTF */
diff --git a/source3/lib/replace/socket.c b/source3/lib/replace/socket.c
deleted file mode 100644
index 35e975fce7..0000000000
--- a/source3/lib/replace/socket.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- *
- * Dummy replacements for socket functions.
- *
- * Copyright (C) Michael Adam <obnox@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/>.
- */
-
-#include "replace.h"
-#include "system/network.h"
-
-int rep_connect(int sockfd, const struct sockaddr *serv_addr, socklen_t addrlen)
-{
- errno = ENOSYS;
- return -1;
-}
-
-struct hostent *rep_gethostbyname(const char *name)
-{
- errno = ENOSYS;
- return NULL;
-}
diff --git a/source3/lib/replace/socketpair.c b/source3/lib/replace/socketpair.c
deleted file mode 100644
index c775730952..0000000000
--- a/source3/lib/replace/socketpair.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- * replacement routines for broken systems
- * Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2006
- * Copyright (C) Michael Adam <obnox@samba.org> 2008
- *
- * ** 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/>.
- */
-
-#include "replace.h"
-#include "system/network.h"
-
-int rep_socketpair(int d, int type, int protocol, int sv[2])
-{
- if (d != AF_UNIX) {
- errno = EAFNOSUPPORT;
- return -1;
- }
-
- if (protocol != 0) {
- errno = EPROTONOSUPPORT;
- return -1;
- }
-
- if (type != SOCK_STREAM) {
- errno = EOPNOTSUPP;
- return -1;
- }
-
- return pipe(sv);
-}
diff --git a/source3/lib/replace/strptime.c b/source3/lib/replace/strptime.c
deleted file mode 100644
index 0e40f7561a..0000000000
--- a/source3/lib/replace/strptime.c
+++ /dev/null
@@ -1,990 +0,0 @@
-/* Convert a string representation of time to a time value.
- Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C 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.
-
- The GNU C 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 the GNU C Library; see the file COPYING.LIB. If not,
- see <http://www.gnu.org/licenses/>. */
-
-/* XXX This version of the implementation is not really complete.
- Some of the fields cannot add information alone. But if seeing
- some of them in the same format (such as year, week and weekday)
- this is enough information for determining the date. */
-
-#include "replace.h"
-#include "system/locale.h"
-#include "system/time.h"
-
-#ifndef __P
-# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
-# define __P(args) args
-# else
-# define __P(args) ()
-# endif /* GCC. */
-#endif /* Not __P. */
-
-#if ! HAVE_LOCALTIME_R && ! defined localtime_r
-# ifdef _LIBC
-# define localtime_r __localtime_r
-# else
-/* Approximate localtime_r as best we can in its absence. */
-# define localtime_r my_localtime_r
-static struct tm *localtime_r __P ((const time_t *, struct tm *));
-static struct tm *
-localtime_r (t, tp)
- const time_t *t;
- struct tm *tp;
-{
- struct tm *l = localtime (t);
- if (! l)
- return 0;
- *tp = *l;
- return tp;
-}
-# endif /* ! _LIBC */
-#endif /* ! HAVE_LOCALTIME_R && ! defined (localtime_r) */
-
-
-#define match_char(ch1, ch2) if (ch1 != ch2) return NULL
-#if defined __GNUC__ && __GNUC__ >= 2
-# define match_string(cs1, s2) \
- ({ size_t len = strlen (cs1); \
- int result = strncasecmp ((cs1), (s2), len) == 0; \
- if (result) (s2) += len; \
- result; })
-#else
-/* Oh come on. Get a reasonable compiler. */
-# define match_string(cs1, s2) \
- (strncasecmp ((cs1), (s2), strlen (cs1)) ? 0 : ((s2) += strlen (cs1), 1))
-#endif
-/* We intentionally do not use isdigit() for testing because this will
- lead to problems with the wide character version. */
-#define get_number(from, to, n) \
- do { \
- int __n = n; \
- val = 0; \
- while (*rp == ' ') \
- ++rp; \
- if (*rp < '0' || *rp > '9') \
- return NULL; \
- do { \
- val *= 10; \
- val += *rp++ - '0'; \
- } while (--__n > 0 && val * 10 <= to && *rp >= '0' && *rp <= '9'); \
- if (val < from || val > to) \
- return NULL; \
- } while (0)
-#ifdef _NL_CURRENT
-# define get_alt_number(from, to, n) \
- ({ \
- __label__ do_normal; \
- if (*decided != raw) \
- { \
- const char *alts = _NL_CURRENT (LC_TIME, ALT_DIGITS); \
- int __n = n; \
- int any = 0; \
- while (*rp == ' ') \
- ++rp; \
- val = 0; \
- do { \
- val *= 10; \
- while (*alts != '\0') \
- { \
- size_t len = strlen (alts); \
- if (strncasecmp (alts, rp, len) == 0) \
- break; \
- alts += len + 1; \
- ++val; \
- } \
- if (*alts == '\0') \
- { \
- if (*decided == not && ! any) \
- goto do_normal; \
- /* If we haven't read anything it's an error. */ \
- if (! any) \
- return NULL; \
- /* Correct the premature multiplication. */ \
- val /= 10; \
- break; \
- } \
- else \
- *decided = loc; \
- } while (--__n > 0 && val * 10 <= to); \
- if (val < from || val > to) \
- return NULL; \
- } \
- else \
- { \
- do_normal: \
- get_number (from, to, n); \
- } \
- 0; \
- })
-#else
-# define get_alt_number(from, to, n) \
- /* We don't have the alternate representation. */ \
- get_number(from, to, n)
-#endif
-#define recursive(new_fmt) \
- (*(new_fmt) != '\0' \
- && (rp = strptime_internal (rp, (new_fmt), tm, decided, era_cnt)) != NULL)
-
-
-#ifdef _LIBC
-/* This is defined in locale/C-time.c in the GNU libc. */
-extern const struct locale_data _nl_C_LC_TIME;
-extern const unsigned short int __mon_yday[2][13];
-
-# define weekday_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (DAY_1)].string)
-# define ab_weekday_name \
- (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABDAY_1)].string)
-# define month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (MON_1)].string)
-# define ab_month_name (&_nl_C_LC_TIME.values[_NL_ITEM_INDEX (ABMON_1)].string)
-# define HERE_D_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_T_FMT)].string)
-# define HERE_D_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (D_FMT)].string)
-# define HERE_AM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (AM_STR)].string)
-# define HERE_PM_STR (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (PM_STR)].string)
-# define HERE_T_FMT_AMPM \
- (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (T_FMT_AMPM)].string)
-# define HERE_T_FMT (_nl_C_LC_TIME.values[_NL_ITEM_INDEX (T_FMT)].string)
-
-# define strncasecmp(s1, s2, n) __strncasecmp (s1, s2, n)
-#else
-static char const weekday_name[][10] =
- {
- "Sunday", "Monday", "Tuesday", "Wednesday",
- "Thursday", "Friday", "Saturday"
- };
-static char const ab_weekday_name[][4] =
- {
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
- };
-static char const month_name[][10] =
- {
- "January", "February", "March", "April", "May", "June",
- "July", "August", "September", "October", "November", "December"
- };
-static char const ab_month_name[][4] =
- {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
- };
-# define HERE_D_T_FMT "%a %b %e %H:%M:%S %Y"
-# define HERE_D_FMT "%m/%d/%y"
-# define HERE_AM_STR "AM"
-# define HERE_PM_STR "PM"
-# define HERE_T_FMT_AMPM "%I:%M:%S %p"
-# define HERE_T_FMT "%H:%M:%S"
-
-static const unsigned short int __mon_yday[2][13] =
- {
- /* Normal years. */
- { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
- /* Leap years. */
- { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
- };
-#endif
-
-/* Status of lookup: do we use the locale data or the raw data? */
-enum locale_status { not, loc, raw };
-
-
-#ifndef __isleap
-/* Nonzero if YEAR is a leap year (every 4 years,
- except every 100th isn't, and every 400th is). */
-# define __isleap(year) \
- ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
-#endif
-
-/* Compute the day of the week. */
-static void
-day_of_the_week (struct tm *tm)
-{
- /* We know that January 1st 1970 was a Thursday (= 4). Compute the
- the difference between this data in the one on TM and so determine
- the weekday. */
- int corr_year = 1900 + tm->tm_year - (tm->tm_mon < 2);
- int wday = (-473
- + (365 * (tm->tm_year - 70))
- + (corr_year / 4)
- - ((corr_year / 4) / 25) + ((corr_year / 4) % 25 < 0)
- + (((corr_year / 4) / 25) / 4)
- + __mon_yday[0][tm->tm_mon]
- + tm->tm_mday - 1);
- tm->tm_wday = ((wday % 7) + 7) % 7;
-}
-
-/* Compute the day of the year. */
-static void
-day_of_the_year (struct tm *tm)
-{
- tm->tm_yday = (__mon_yday[__isleap (1900 + tm->tm_year)][tm->tm_mon]
- + (tm->tm_mday - 1));
-}
-
-static char *
-#ifdef _LIBC
-internal_function
-#endif
-strptime_internal __P ((const char *rp, const char *fmt, struct tm *tm,
- enum locale_status *decided, int era_cnt));
-
-static char *
-#ifdef _LIBC
-internal_function
-#endif
-strptime_internal (rp, fmt, tm, decided, era_cnt)
- const char *rp;
- const char *fmt;
- struct tm *tm;
- enum locale_status *decided;
- int era_cnt;
-{
- const char *rp_backup;
- int cnt;
- size_t val;
- int have_I, is_pm;
- int century, want_century;
- int want_era;
- int have_wday, want_xday;
- int have_yday;
- int have_mon, have_mday;
-#ifdef _NL_CURRENT
- size_t num_eras;
-#endif
- struct era_entry *era;
-
- have_I = is_pm = 0;
- century = -1;
- want_century = 0;
- want_era = 0;
- era = NULL;
-
- have_wday = want_xday = have_yday = have_mon = have_mday = 0;
-
- while (*fmt != '\0')
- {
- /* A white space in the format string matches 0 more or white
- space in the input string. */
- if (isspace (*fmt))
- {
- while (isspace (*rp))
- ++rp;
- ++fmt;
- continue;
- }
-
- /* Any character but `%' must be matched by the same character
- in the iput string. */
- if (*fmt != '%')
- {
- match_char (*fmt++, *rp++);
- continue;
- }
-
- ++fmt;
-#ifndef _NL_CURRENT
- /* We need this for handling the `E' modifier. */
- start_over:
-#endif
-
- /* Make back up of current processing pointer. */
- rp_backup = rp;
-
- switch (*fmt++)
- {
- case '%':
- /* Match the `%' character itself. */
- match_char ('%', *rp++);
- break;
- case 'a':
- case 'A':
- /* Match day of week. */
- for (cnt = 0; cnt < 7; ++cnt)
- {
-#ifdef _NL_CURRENT
- if (*decided !=raw)
- {
- if (match_string (_NL_CURRENT (LC_TIME, DAY_1 + cnt), rp))
- {
- if (*decided == not
- && strcmp (_NL_CURRENT (LC_TIME, DAY_1 + cnt),
- weekday_name[cnt]))
- *decided = loc;
- break;
- }
- if (match_string (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt), rp))
- {
- if (*decided == not
- && strcmp (_NL_CURRENT (LC_TIME, ABDAY_1 + cnt),
- ab_weekday_name[cnt]))
- *decided = loc;
- break;
- }
- }
-#endif
- if (*decided != loc
- && (match_string (weekday_name[cnt], rp)
- || match_string (ab_weekday_name[cnt], rp)))
- {
- *decided = raw;
- break;
- }
- }
- if (cnt == 7)
- /* Does not match a weekday name. */
- return NULL;
- tm->tm_wday = cnt;
- have_wday = 1;
- break;
- case 'b':
- case 'B':
- case 'h':
- /* Match month name. */
- for (cnt = 0; cnt < 12; ++cnt)
- {
-#ifdef _NL_CURRENT
- if (*decided !=raw)
- {
- if (match_string (_NL_CURRENT (LC_TIME, MON_1 + cnt), rp))
- {
- if (*decided == not
- && strcmp (_NL_CURRENT (LC_TIME, MON_1 + cnt),
- month_name[cnt]))
- *decided = loc;
- break;
- }
- if (match_string (_NL_CURRENT (LC_TIME, ABMON_1 + cnt), rp))
- {
- if (*decided == not
- && strcmp (_NL_CURRENT (LC_TIME, ABMON_1 + cnt),
- ab_month_name[cnt]))
- *decided = loc;
- break;
- }
- }
-#endif
- if (match_string (month_name[cnt], rp)
- || match_string (ab_month_name[cnt], rp))
- {
- *decided = raw;
- break;
- }
- }
- if (cnt == 12)
- /* Does not match a month name. */
- return NULL;
- tm->tm_mon = cnt;
- want_xday = 1;
- break;
- case 'c':
- /* Match locale's date and time format. */
-#ifdef _NL_CURRENT
- if (*decided != raw)
- {
- if (!recursive (_NL_CURRENT (LC_TIME, D_T_FMT)))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (*decided == not &&
- strcmp (_NL_CURRENT (LC_TIME, D_T_FMT), HERE_D_T_FMT))
- *decided = loc;
- want_xday = 1;
- break;
- }
- *decided = raw;
- }
-#endif
- if (!recursive (HERE_D_T_FMT))
- return NULL;
- want_xday = 1;
- break;
- case 'C':
- /* Match century number. */
-#ifdef _NL_CURRENT
- match_century:
-#endif
- get_number (0, 99, 2);
- century = val;
- want_xday = 1;
- break;
- case 'd':
- case 'e':
- /* Match day of month. */
- get_number (1, 31, 2);
- tm->tm_mday = val;
- have_mday = 1;
- want_xday = 1;
- break;
- case 'F':
- if (!recursive ("%Y-%m-%d"))
- return NULL;
- want_xday = 1;
- break;
- case 'x':
-#ifdef _NL_CURRENT
- if (*decided != raw)
- {
- if (!recursive (_NL_CURRENT (LC_TIME, D_FMT)))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (*decided == not
- && strcmp (_NL_CURRENT (LC_TIME, D_FMT), HERE_D_FMT))
- *decided = loc;
- want_xday = 1;
- break;
- }
- *decided = raw;
- }
-#endif
- /* Fall through. */
- case 'D':
- /* Match standard day format. */
- if (!recursive (HERE_D_FMT))
- return NULL;
- want_xday = 1;
- break;
- case 'k':
- case 'H':
- /* Match hour in 24-hour clock. */
- get_number (0, 23, 2);
- tm->tm_hour = val;
- have_I = 0;
- break;
- case 'I':
- /* Match hour in 12-hour clock. */
- get_number (1, 12, 2);
- tm->tm_hour = val % 12;
- have_I = 1;
- break;
- case 'j':
- /* Match day number of year. */
- get_number (1, 366, 3);
- tm->tm_yday = val - 1;
- have_yday = 1;
- break;
- case 'm':
- /* Match number of month. */
- get_number (1, 12, 2);
- tm->tm_mon = val - 1;
- have_mon = 1;
- want_xday = 1;
- break;
- case 'M':
- /* Match minute. */
- get_number (0, 59, 2);
- tm->tm_min = val;
- break;
- case 'n':
- case 't':
- /* Match any white space. */
- while (isspace (*rp))
- ++rp;
- break;
- case 'p':
- /* Match locale's equivalent of AM/PM. */
-#ifdef _NL_CURRENT
- if (*decided != raw)
- {
- if (match_string (_NL_CURRENT (LC_TIME, AM_STR), rp))
- {
- if (strcmp (_NL_CURRENT (LC_TIME, AM_STR), HERE_AM_STR))
- *decided = loc;
- break;
- }
- if (match_string (_NL_CURRENT (LC_TIME, PM_STR), rp))
- {
- if (strcmp (_NL_CURRENT (LC_TIME, PM_STR), HERE_PM_STR))
- *decided = loc;
- is_pm = 1;
- break;
- }
- *decided = raw;
- }
-#endif
- if (!match_string (HERE_AM_STR, rp)) {
- if (match_string (HERE_PM_STR, rp)) {
- is_pm = 1;
- } else {
- return NULL;
- }
- }
- break;
- case 'r':
-#ifdef _NL_CURRENT
- if (*decided != raw)
- {
- if (!recursive (_NL_CURRENT (LC_TIME, T_FMT_AMPM)))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (*decided == not &&
- strcmp (_NL_CURRENT (LC_TIME, T_FMT_AMPM),
- HERE_T_FMT_AMPM))
- *decided = loc;
- break;
- }
- *decided = raw;
- }
-#endif
- if (!recursive (HERE_T_FMT_AMPM))
- return NULL;
- break;
- case 'R':
- if (!recursive ("%H:%M"))
- return NULL;
- break;
- case 's':
- {
- /* The number of seconds may be very high so we cannot use
- the `get_number' macro. Instead read the number
- character for character and construct the result while
- doing this. */
- time_t secs = 0;
- if (*rp < '0' || *rp > '9')
- /* We need at least one digit. */
- return NULL;
-
- do
- {
- secs *= 10;
- secs += *rp++ - '0';
- }
- while (*rp >= '0' && *rp <= '9');
-
- if (localtime_r (&secs, tm) == NULL)
- /* Error in function. */
- return NULL;
- }
- break;
- case 'S':
- get_number (0, 61, 2);
- tm->tm_sec = val;
- break;
- case 'X':
-#ifdef _NL_CURRENT
- if (*decided != raw)
- {
- if (!recursive (_NL_CURRENT (LC_TIME, T_FMT)))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (strcmp (_NL_CURRENT (LC_TIME, T_FMT), HERE_T_FMT))
- *decided = loc;
- break;
- }
- *decided = raw;
- }
-#endif
- /* Fall through. */
- case 'T':
- if (!recursive (HERE_T_FMT))
- return NULL;
- break;
- case 'u':
- get_number (1, 7, 1);
- tm->tm_wday = val % 7;
- have_wday = 1;
- break;
- case 'g':
- get_number (0, 99, 2);
- /* XXX This cannot determine any field in TM. */
- break;
- case 'G':
- if (*rp < '0' || *rp > '9')
- return NULL;
- /* XXX Ignore the number since we would need some more
- information to compute a real date. */
- do
- ++rp;
- while (*rp >= '0' && *rp <= '9');
- break;
- case 'U':
- case 'V':
- case 'W':
- get_number (0, 53, 2);
- /* XXX This cannot determine any field in TM without some
- information. */
- break;
- case 'w':
- /* Match number of weekday. */
- get_number (0, 6, 1);
- tm->tm_wday = val;
- have_wday = 1;
- break;
- case 'y':
-#ifdef _NL_CURRENT
- match_year_in_century:
-#endif
- /* Match year within century. */
- get_number (0, 99, 2);
- /* The "Year 2000: The Millennium Rollover" paper suggests that
- values in the range 69-99 refer to the twentieth century. */
- tm->tm_year = val >= 69 ? val : val + 100;
- /* Indicate that we want to use the century, if specified. */
- want_century = 1;
- want_xday = 1;
- break;
- case 'Y':
- /* Match year including century number. */
- get_number (0, 9999, 4);
- tm->tm_year = val - 1900;
- want_century = 0;
- want_xday = 1;
- break;
- case 'Z':
- /* XXX How to handle this? */
- break;
- case 'E':
-#ifdef _NL_CURRENT
- switch (*fmt++)
- {
- case 'c':
- /* Match locale's alternate date and time format. */
- if (*decided != raw)
- {
- const char *fmt = _NL_CURRENT (LC_TIME, ERA_D_T_FMT);
-
- if (*fmt == '\0')
- fmt = _NL_CURRENT (LC_TIME, D_T_FMT);
-
- if (!recursive (fmt))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (strcmp (fmt, HERE_D_T_FMT))
- *decided = loc;
- want_xday = 1;
- break;
- }
- *decided = raw;
- }
- /* The C locale has no era information, so use the
- normal representation. */
- if (!recursive (HERE_D_T_FMT))
- return NULL;
- want_xday = 1;
- break;
- case 'C':
- if (*decided != raw)
- {
- if (era_cnt >= 0)
- {
- era = _nl_select_era_entry (era_cnt);
- if (match_string (era->era_name, rp))
- {
- *decided = loc;
- break;
- }
- else
- return NULL;
- }
- else
- {
- num_eras = _NL_CURRENT_WORD (LC_TIME,
- _NL_TIME_ERA_NUM_ENTRIES);
- for (era_cnt = 0; era_cnt < (int) num_eras;
- ++era_cnt, rp = rp_backup)
- {
- era = _nl_select_era_entry (era_cnt);
- if (match_string (era->era_name, rp))
- {
- *decided = loc;
- break;
- }
- }
- if (era_cnt == (int) num_eras)
- {
- era_cnt = -1;
- if (*decided == loc)
- return NULL;
- }
- else
- break;
- }
-
- *decided = raw;
- }
- /* The C locale has no era information, so use the
- normal representation. */
- goto match_century;
- case 'y':
- if (*decided == raw)
- goto match_year_in_century;
-
- get_number(0, 9999, 4);
- tm->tm_year = val;
- want_era = 1;
- want_xday = 1;
- break;
- case 'Y':
- if (*decided != raw)
- {
- num_eras = _NL_CURRENT_WORD (LC_TIME,
- _NL_TIME_ERA_NUM_ENTRIES);
- for (era_cnt = 0; era_cnt < (int) num_eras;
- ++era_cnt, rp = rp_backup)
- {
- era = _nl_select_era_entry (era_cnt);
- if (recursive (era->era_format))
- break;
- }
- if (era_cnt == (int) num_eras)
- {
- era_cnt = -1;
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- *decided = loc;
- era_cnt = -1;
- break;
- }
-
- *decided = raw;
- }
- get_number (0, 9999, 4);
- tm->tm_year = val - 1900;
- want_century = 0;
- want_xday = 1;
- break;
- case 'x':
- if (*decided != raw)
- {
- const char *fmt = _NL_CURRENT (LC_TIME, ERA_D_FMT);
-
- if (*fmt == '\0')
- fmt = _NL_CURRENT (LC_TIME, D_FMT);
-
- if (!recursive (fmt))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (strcmp (fmt, HERE_D_FMT))
- *decided = loc;
- break;
- }
- *decided = raw;
- }
- if (!recursive (HERE_D_FMT))
- return NULL;
- break;
- case 'X':
- if (*decided != raw)
- {
- const char *fmt = _NL_CURRENT (LC_TIME, ERA_T_FMT);
-
- if (*fmt == '\0')
- fmt = _NL_CURRENT (LC_TIME, T_FMT);
-
- if (!recursive (fmt))
- {
- if (*decided == loc)
- return NULL;
- else
- rp = rp_backup;
- }
- else
- {
- if (strcmp (fmt, HERE_T_FMT))
- *decided = loc;
- break;
- }
- *decided = raw;
- }
- if (!recursive (HERE_T_FMT))
- return NULL;
- break;
- default:
- return NULL;
- }
- break;
-#else
- /* We have no information about the era format. Just use
- the normal format. */
- if (*fmt != 'c' && *fmt != 'C' && *fmt != 'y' && *fmt != 'Y'
- && *fmt != 'x' && *fmt != 'X')
- /* This is an illegal format. */
- return NULL;
-
- goto start_over;
-#endif
- case 'O':
- switch (*fmt++)
- {
- case 'd':
- case 'e':
- /* Match day of month using alternate numeric symbols. */
- get_alt_number (1, 31, 2);
- tm->tm_mday = val;
- have_mday = 1;
- want_xday = 1;
- break;
- case 'H':
- /* Match hour in 24-hour clock using alternate numeric
- symbols. */
- get_alt_number (0, 23, 2);
- tm->tm_hour = val;
- have_I = 0;
- break;
- case 'I':
- /* Match hour in 12-hour clock using alternate numeric
- symbols. */
- get_alt_number (1, 12, 2);
- tm->tm_hour = val - 1;
- have_I = 1;
- break;
- case 'm':
- /* Match month using alternate numeric symbols. */
- get_alt_number (1, 12, 2);
- tm->tm_mon = val - 1;
- have_mon = 1;
- want_xday = 1;
- break;
- case 'M':
- /* Match minutes using alternate numeric symbols. */
- get_alt_number (0, 59, 2);
- tm->tm_min = val;
- break;
- case 'S':
- /* Match seconds using alternate numeric symbols. */
- get_alt_number (0, 61, 2);
- tm->tm_sec = val;
- break;
- case 'U':
- case 'V':
- case 'W':
- get_alt_number (0, 53, 2);
- /* XXX This cannot determine any field in TM without
- further information. */
- break;
- case 'w':
- /* Match number of weekday using alternate numeric symbols. */
- get_alt_number (0, 6, 1);
- tm->tm_wday = val;
- have_wday = 1;
- break;
- case 'y':
- /* Match year within century using alternate numeric symbols. */
- get_alt_number (0, 99, 2);
- tm->tm_year = val >= 69 ? val : val + 100;
- want_xday = 1;
- break;
- default:
- return NULL;
- }
- break;
- default:
- return NULL;
- }
- }
-
- if (have_I && is_pm)
- tm->tm_hour += 12;
-
- if (century != -1)
- {
- if (want_century)
- tm->tm_year = tm->tm_year % 100 + (century - 19) * 100;
- else
- /* Only the century, but not the year. Strange, but so be it. */
- tm->tm_year = (century - 19) * 100;
- }
-
-#ifdef _NL_CURRENT
- if (era_cnt != -1)
- {
- era = _nl_select_era_entry(era_cnt);
- if (want_era)
- tm->tm_year = (era->start_date[0]
- + ((tm->tm_year - era->offset)
- * era->absolute_direction));
- else
- /* Era start year assumed. */
- tm->tm_year = era->start_date[0];
- }
- else
-#endif
- if (want_era)
- return NULL;
-
- if (want_xday && !have_wday)
- {
- if ( !(have_mon && have_mday) && have_yday)
- {
- /* We don't have tm_mon and/or tm_mday, compute them. */
- int t_mon = 0;
- while (__mon_yday[__isleap(1900 + tm->tm_year)][t_mon] <= tm->tm_yday)
- t_mon++;
- if (!have_mon)
- tm->tm_mon = t_mon - 1;
- if (!have_mday)
- tm->tm_mday =
- (tm->tm_yday
- - __mon_yday[__isleap(1900 + tm->tm_year)][t_mon - 1] + 1);
- }
- day_of_the_week (tm);
- }
- if (want_xday && !have_yday)
- day_of_the_year (tm);
-
- return discard_const_p(char, rp);
-}
-
-
-char *rep_strptime(const char *buf, const char *format, struct tm *tm)
-{
- enum locale_status decided;
-
-#ifdef _NL_CURRENT
- decided = not;
-#else
- decided = raw;
-#endif
- return strptime_internal (buf, format, tm, &decided, -1);
-}
diff --git a/source3/lib/replace/strptime.m4 b/source3/lib/replace/strptime.m4
deleted file mode 100644
index da22fc5a97..0000000000
--- a/source3/lib/replace/strptime.m4
+++ /dev/null
@@ -1,13 +0,0 @@
-AC_CACHE_CHECK([whether strptime is available and works],libreplace_cv_STRPTIME_OK,[
- AC_TRY_RUN([
- #define LIBREPLACE_CONFIGURE_TEST_STRPTIME
- #include "$libreplacedir/test/strptime.c"
- ],
- [libreplace_cv_STRPTIME_OK=yes],
- [libreplace_cv_STRPTIME_OK=no],
- [libreplace_cv_STRPTIME_OK="assuming not"])
-])
-if test x"$libreplace_cv_STRPTIME_OK" != x"yes"; then
- AC_DEFINE(REPLACE_STRPTIME,1,[Whether strptime should be replaced])
- LIBREPLACEOBJ="${LIBREPLACEOBJ} strptime.o"
-fi
diff --git a/source3/lib/replace/system/README b/source3/lib/replace/system/README
deleted file mode 100644
index 69a2b80b56..0000000000
--- a/source3/lib/replace/system/README
+++ /dev/null
@@ -1,4 +0,0 @@
-This directory contains wrappers around logical groups of system
-include files. The idea is to avoid #ifdef blocks in the main code,
-and instead put all the necessary conditional includes in subsystem
-specific header files in this directory.
diff --git a/source3/lib/replace/system/aio.h b/source3/lib/replace/system/aio.h
deleted file mode 100644
index 784d77fa28..0000000000
--- a/source3/lib/replace/system/aio.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef _system_aio_h
-#define _system_aio_h
-/*
- Unix SMB/CIFS implementation.
-
- AIO system include wrappers
-
- Copyright (C) Andrew Tridgell 2006
-
- ** 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 HAVE_LIBAIO_H
-#include <libaio.h>
-#endif
-
-#endif
diff --git a/source3/lib/replace/system/capability.h b/source3/lib/replace/system/capability.h
deleted file mode 100644
index a7b78f0275..0000000000
--- a/source3/lib/replace/system/capability.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef _system_capability_h
-#define _system_capability_h
-/*
- Unix SMB/CIFS implementation.
-
- capability 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 HAVE_SYS_CAPABILITY_H
-
-#if defined(BROKEN_REDHAT_7_SYSTEM_HEADERS) && !defined(_I386_STATFS_H) && !defined(_PPC_STATFS_H)
-#define _I386_STATFS_H
-#define _PPC_STATFS_H
-#define BROKEN_REDHAT_7_STATFS_WORKAROUND
-#endif
-
-#if defined(BROKEN_RHEL5_SYS_CAP_HEADER) && !defined(_LINUX_TYPES_H)
-#define BROKEN_RHEL5_SYS_CAP_HEADER_WORKAROUND
-#endif
-
-#include <sys/capability.h>
-
-#ifdef BROKEN_RHEL5_SYS_CAP_HEADER_WORKAROUND
-#undef _LINUX_TYPES_H
-#undef BROKEN_RHEL5_SYS_CAP_HEADER_WORKAROUND
-#endif
-
-#ifdef BROKEN_REDHAT_7_STATFS_WORKAROUND
-#undef _PPC_STATFS_H
-#undef _I386_STATFS_H
-#undef BROKEN_REDHAT_7_STATFS_WORKAROUND
-#endif
-
-#endif
-
-#endif
diff --git a/source3/lib/replace/system/config.m4 b/source3/lib/replace/system/config.m4
deleted file mode 100644
index 5c9b53d5c5..0000000000
--- a/source3/lib/replace/system/config.m4
+++ /dev/null
@@ -1,130 +0,0 @@
-# filesys
-AC_HEADER_DIRENT
-AC_CHECK_HEADERS(fcntl.h sys/fcntl.h sys/resource.h sys/ioctl.h sys/mode.h sys/filio.h sys/fs/s5param.h sys/filsys.h)
-AC_CHECK_HEADERS(sys/acl.h acl/libacl.h)
-
-# select
-AC_CHECK_HEADERS(sys/select.h)
-
-# time
-AC_CHECK_HEADERS(sys/time.h utime.h)
-AC_HEADER_TIME
-AC_CHECK_FUNCS(utime utimes)
-
-# wait
-AC_HEADER_SYS_WAIT
-
-# capability
-AC_CHECK_HEADERS(sys/capability.h)
-
-case "$host_os" in
-*linux*)
-AC_CACHE_CHECK([for broken RedHat 7.2 system header files],libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[
-AC_TRY_COMPILE([
- #ifdef HAVE_SYS_VFS_H
- #include <sys/vfs.h>
- #endif
- #ifdef HAVE_SYS_CAPABILITY_H
- #include <sys/capability.h>
- #endif
- ],[
- int i;
- ],
- libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,
- libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes
-)])
-if test x"$libreplace_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then
- AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files])
-fi
-
-AC_CACHE_CHECK([for broken RHEL5 sys/capability.h],libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER,[
-AC_TRY_COMPILE([
- #ifdef HAVE_SYS_CAPABILITY_H
- #include <sys/capability.h>
- #endif
- #include <linux/types.h>
- ],[
- __s8 i;
- ],
- libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER=no,
- libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER=yes
-)])
-if test x"$libreplace_cv_BROKEN_RHEL5_SYS_CAP_HEADER" = x"yes"; then
- AC_DEFINE(BROKEN_RHEL5_SYS_CAP_HEADER,1,[Broken RHEL5 sys/capability.h])
-fi
-;;
-esac
-
-# passwd
-AC_CHECK_HEADERS(grp.h sys/id.h compat.h shadow.h sys/priv.h pwd.h sys/security.h)
-AC_CHECK_FUNCS(getpwnam_r getpwuid_r getpwent_r)
-AC_HAVE_DECL(getpwent_r, [
- #include <unistd.h>
- #include <pwd.h>
- ])
-AC_VERIFY_C_PROTOTYPE([struct passwd *getpwent_r(struct passwd *src, char *buf, int buflen)],
- [
- #ifndef HAVE_GETPWENT_R_DECL
- #error missing getpwent_r prototype
- #endif
- return NULL;
- ],[
- AC_DEFINE(SOLARIS_GETPWENT_R, 1, [getpwent_r solaris function prototype])
- ],[],[
- #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>
- #include <grp.h>
- ])
-AC_VERIFY_C_PROTOTYPE([struct group *getgrent_r(struct group *src, char *buf, int buflen)],
- [
- #ifndef HAVE_GETGRENT_R_DECL
- #error missing getgrent_r prototype
- #endif
- return NULL;
- ],[
- AC_DEFINE(SOLARIS_GETGRENT_R, 1, [getgrent_r solaris function prototype])
- ],[],[
- #include <unistd.h>
- #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)
-
-# glob
-AC_CHECK_HEADERS(fnmatch.h)
-
-# shmem
-AC_CHECK_HEADERS(sys/ipc.h sys/mman.h sys/shm.h )
-
-# terminal
-AC_CHECK_HEADERS(termios.h termio.h sys/termio.h )
diff --git a/source3/lib/replace/system/dir.h b/source3/lib/replace/system/dir.h
deleted file mode 100644
index dec2d54649..0000000000
--- a/source3/lib/replace/system/dir.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef _system_dir_h
-#define _system_dir_h
-/*
- Unix SMB/CIFS implementation.
-
- directory 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/>.
-*/
-
-#if HAVE_DIRENT_H
-# include <dirent.h>
-# define NAMLEN(dirent) strlen((dirent)->d_name)
-#else
-# define dirent direct
-# define NAMLEN(dirent) (dirent)->d_namlen
-# if HAVE_SYS_NDIR_H
-# include <sys/ndir.h>
-# endif
-# if HAVE_SYS_DIR_H
-# include <sys/dir.h>
-# endif
-# if HAVE_NDIR_H
-# include <ndir.h>
-# endif
-#endif
-
-#ifndef HAVE_MKDIR_MODE
-#define mkdir(dir, mode) mkdir(dir)
-#endif
-
-/* Test whether a file name is the "." or ".." directory entries.
- * These really should be inline functions.
- */
-#ifndef ISDOT
-#define ISDOT(path) ( \
- *((const char *)(path)) == '.' && \
- *(((const char *)(path)) + 1) == '\0' \
- )
-#endif
-
-#ifndef ISDOTDOT
-#define ISDOTDOT(path) ( \
- *((const char *)(path)) == '.' && \
- *(((const char *)(path)) + 1) == '.' && \
- *(((const char *)(path)) + 2) == '\0' \
- )
-#endif
-
-#endif
diff --git a/source3/lib/replace/system/filesys.h b/source3/lib/replace/system/filesys.h
deleted file mode 100644
index 4bf1f64865..0000000000
--- a/source3/lib/replace/system/filesys.h
+++ /dev/null
@@ -1,182 +0,0 @@
-#ifndef _system_filesys_h
-#define _system_filesys_h
-/*
- Unix SMB/CIFS implementation.
-
- filesystem 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/>.
-
-*/
-
-#include <unistd.h>
-#include <sys/stat.h>
-
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-
-#ifdef HAVE_SYS_MOUNT_H
-#include <sys/mount.h>
-#endif
-
-#ifdef HAVE_MNTENT_H
-#include <mntent.h>
-#endif
-
-#ifdef HAVE_SYS_VFS_H
-#include <sys/vfs.h>
-#endif
-
-#ifdef HAVE_SYS_ACL_H
-#include <sys/acl.h>
-#endif
-
-#ifdef HAVE_ACL_LIBACL_H
-#include <acl/libacl.h>
-#endif
-
-#ifdef HAVE_SYS_FS_S5PARAM_H
-#include <sys/fs/s5param.h>
-#endif
-
-#if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY)
-#include <sys/filsys.h>
-#endif
-
-#ifdef HAVE_SYS_STATFS_H
-# include <sys/statfs.h>
-#endif
-
-#ifdef HAVE_DUSTAT_H
-#include <sys/dustat.h>
-#endif
-
-#ifdef HAVE_SYS_STATVFS_H
-#include <sys/statvfs.h>
-#endif
-
-#ifdef HAVE_SYS_FILIO_H
-#include <sys/filio.h>
-#endif
-
-#include <sys/file.h>
-
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#else
-#ifdef HAVE_SYS_FCNTL_H
-#include <sys/fcntl.h>
-#endif
-#endif
-
-#ifdef HAVE_SYS_MODE_H
-/* apparently AIX needs this for S_ISLNK */
-#ifndef S_ISLNK
-#include <sys/mode.h>
-#endif
-#endif
-
-#ifdef HAVE_SYS_IOCTL_H
-#include <sys/ioctl.h>
-#endif
-
-/*
- * Veritas File System. Often in addition to native.
- * Quotas different.
- */
-#if defined(HAVE_SYS_FS_VX_QUOTA_H)
-#define VXFS_QUOTA
-#endif
-
-#if HAVE_SYS_ATTRIBUTES_H
-#include <sys/attributes.h>
-#endif
-
-/* mutually exclusive (SuSE 8.2) */
-#if HAVE_ATTR_XATTR_H
-#include <attr/xattr.h>
-#elif HAVE_SYS_XATTR_H
-#include <sys/xattr.h>
-#endif
-
-
-#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
-#endif
-
-/* Some POSIX definitions for those without */
-
-#ifndef S_IFDIR
-#define S_IFDIR 0x4000
-#endif
-#ifndef S_ISDIR
-#define S_ISDIR(mode) ((mode & 0xF000) == S_IFDIR)
-#endif
-#ifndef S_IRWXU
-#define S_IRWXU 00700 /* read, write, execute: owner */
-#endif
-#ifndef S_IRUSR
-#define S_IRUSR 00400 /* read permission: owner */
-#endif
-#ifndef S_IWUSR
-#define S_IWUSR 00200 /* write permission: owner */
-#endif
-#ifndef S_IXUSR
-#define S_IXUSR 00100 /* execute permission: owner */
-#endif
-#ifndef S_IRWXG
-#define S_IRWXG 00070 /* read, write, execute: group */
-#endif
-#ifndef S_IRGRP
-#define S_IRGRP 00040 /* read permission: group */
-#endif
-#ifndef S_IWGRP
-#define S_IWGRP 00020 /* write permission: group */
-#endif
-#ifndef S_IXGRP
-#define S_IXGRP 00010 /* execute permission: group */
-#endif
-#ifndef S_IRWXO
-#define S_IRWXO 00007 /* read, write, execute: other */
-#endif
-#ifndef S_IROTH
-#define S_IROTH 00004 /* read permission: other */
-#endif
-#ifndef S_IWOTH
-#define S_IWOTH 00002 /* write permission: other */
-#endif
-#ifndef S_IXOTH
-#define S_IXOTH 00001 /* execute permission: other */
-#endif
-
-#ifndef O_ACCMODE
-#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
-#endif
-
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 256
-#endif
-
-#ifndef SEEK_SET
-#define SEEK_SET 0
-#endif
-
-#endif
diff --git a/source3/lib/replace/system/glob.h b/source3/lib/replace/system/glob.h
deleted file mode 100644
index 3e23db6828..0000000000
--- a/source3/lib/replace/system/glob.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef _system_glob_h
-#define _system_glob_h
-/*
- Unix SMB/CIFS implementation.
-
- glob 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 HAVE_GLOB_H
-#include <glob.h>
-#endif
-
-#ifdef HAVE_FNMATCH_H
-#include <fnmatch.h>
-#endif
-
-#endif
diff --git a/source3/lib/replace/system/iconv.h b/source3/lib/replace/system/iconv.h
deleted file mode 100644
index 3c8a71f2f7..0000000000
--- a/source3/lib/replace/system/iconv.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef _system_iconv_h
-#define _system_iconv_h
-/*
- Unix SMB/CIFS implementation.
-
- iconv memory 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/>.
-
-*/
-
-#if !defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
-#define HAVE_ICONV
-#endif
-
-#if !defined(HAVE_GICONV) && defined(HAVE_GICONV_H)
-#define HAVE_GICONV
-#endif
-
-#if !defined(HAVE_BICONV) && defined(HAVE_BICONV_H)
-#define HAVE_BICONV
-#endif
-
-#ifdef HAVE_NATIVE_ICONV
-#if defined(HAVE_ICONV)
-#include <iconv.h>
-#elif defined(HAVE_GICONV)
-#include <giconv.h>
-#elif defined(HAVE_BICONV)
-#include <biconv.h>
-#endif
-#endif /* HAVE_NATIVE_ICONV */
-
-/* needed for some systems without iconv. Doesn't really matter
- what error code we use */
-#ifndef EILSEQ
-#define EILSEQ EIO
-#endif
-
-#endif
diff --git a/source3/lib/replace/system/kerberos.h b/source3/lib/replace/system/kerberos.h
deleted file mode 100644
index 2981024bee..0000000000
--- a/source3/lib/replace/system/kerberos.h
+++ /dev/null
@@ -1,137 +0,0 @@
-#ifndef _system_kerberos_h
-#define _system_kerberos_h
-
-/*
- Unix SMB/CIFS implementation.
-
- kerberos 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 HAVE_KRB5
-/* Whether the krb5_address struct has a addrtype property */
-/* #undef HAVE_ADDRTYPE_IN_KRB5_ADDRESS */
-/* Whether the krb5_address struct has a addr_type property */
-#define HAVE_ADDR_TYPE_IN_KRB5_ADDRESS 1
-/* Define to 1 if you have the `gsskrb5_extract_authz_data_from_sec_context' */
-#define HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT 1
-/* Define to 1 if you have the `gsskrb5_get_initiator_subkey' function. */
-#define HAVE_GSSKRB5_GET_INITIATOR_SUBKEY 1
-/* Define to 1 if you have the `gsskrb5_register_acceptor_identity' function. */
-#define HAVE_GSSKRB5_REGISTER_ACCEPTOR_IDENTITY 1
-/* Define to 1 if you have the `gss_krb5_ccache_name' function. */
-#define HAVE_GSS_KRB5_CCACHE_NAME 1
-/* Define to 1 if you have the `krb5_addlog_func' function. */
-#define HAVE_KRB5_ADDLOG_FUNC 1
-/* Define to 1 if you have the `krb5_auth_con_setkey' function. */
-#define HAVE_KRB5_AUTH_CON_SETKEY 1
-/* Define to 1 if you have the `krb5_auth_con_setuseruserkey' function. */
-/* #undef HAVE_KRB5_AUTH_CON_SETUSERUSERKEY */
-/* Define to 1 if you have the `krb5_c_enctype_compare' function. */
-#define HAVE_KRB5_C_ENCTYPE_COMPARE 1
-/* Define to 1 if you have the `krb5_c_verify_checksum' function. */
-#define HAVE_KRB5_C_VERIFY_CHECKSUM 1
-/* Whether the type krb5_encrypt_block exists */
-/* #undef HAVE_KRB5_ENCRYPT_BLOCK */
-/* Define to 1 if you have the `krb5_encrypt_data' function. */
-/* #undef HAVE_KRB5_ENCRYPT_DATA */
-/* Define to 1 if you have the `krb5_enctypes_compatible_keys' function. */
-#define HAVE_KRB5_ENCTYPES_COMPATIBLE_KEYS 1
-/* Define to 1 if you have the `krb5_free_data_contents' function. */
-#define HAVE_KRB5_FREE_DATA_CONTENTS 1
-/* Define to 1 if you have the `krb5_free_error_string' function. */
-#define HAVE_KRB5_FREE_ERROR_STRING 1
-/* Define to 1 if you have the `krb5_free_keytab_entry_contents' function. */
-/* #undef HAVE_KRB5_FREE_KEYTAB_ENTRY_CONTENTS */
-/* Define to 1 if you have the `krb5_free_ktypes' function. */
-/* #undef HAVE_KRB5_FREE_KTYPES */
-/* Define to 1 if you have the `krb5_free_unparsed_name' function. */
-/* #undef HAVE_KRB5_FREE_UNPARSED_NAME */
-/* Define to 1 if you have the `krb5_get_default_in_tkt_etypes' function. */
-#define HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES 1
-/* Define to 1 if you have the `krb5_get_error_string' function. */
-#define HAVE_KRB5_GET_ERROR_STRING 1
-/* Define to 1 if you have the `krb5_get_permitted_enctypes' function. */
-/* #undef HAVE_KRB5_GET_PERMITTED_ENCTYPES */
-/* Define to 1 if you have the `krb5_get_pw_salt' function. */
-#define HAVE_KRB5_GET_PW_SALT 1
-/* Define to 1 if you have the <krb5.h> header file. */
-#define HAVE_KRB5_H 1
-/* Define to 1 if you have the `krb5_initlog' function. */
-#define HAVE_KRB5_INITLOG 1
-/* Define to 1 if you have the `krb5_kdc_default_config' function. */
-#define HAVE_KRB5_KDC_DEFAULT_CONFIG 1
-/* Whether the krb5_creds struct has a keyblock property */
-/* #undef HAVE_KRB5_KEYBLOCK_IN_CREDS */
-/* Whether the krb5_keyblock struct has a keyvalue property */
-#define HAVE_KRB5_KEYBLOCK_KEYVALUE 1
-/* Whether krb5_keytab_entry has key member */
-/* #undef HAVE_KRB5_KEYTAB_ENTRY_KEY */
-/* Whether krb5_keytab_entry has keyblock member */
-#define HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK 1
-/* Define to 1 if you have the `krb5_krbhst_get_addrinfo' function. */
-#define HAVE_KRB5_KRBHST_GET_ADDRINFO 1
-/* Define to 1 if you have the `krb5_kt_compare' function. */
-#define HAVE_KRB5_KT_COMPARE 1
-/* Define to 1 if you have the `krb5_kt_free_entry' function. */
-#define HAVE_KRB5_KT_FREE_ENTRY 1
-/* Whether the type krb5_log_facility exists */
-#define HAVE_KRB5_LOG_FACILITY 1
-/* Define to 1 if you have the `krb5_mk_req_extended' function. */
-#define HAVE_KRB5_MK_REQ_EXTENDED 1
-/* Define to 1 if you have the `krb5_principal2salt' function. */
-/* #undef HAVE_KRB5_PRINCIPAL2SALT */
-/* Define to 1 if you have the `krb5_principal_get_comp_string' function. */
-#define HAVE_KRB5_PRINCIPAL_GET_COMP_STRING 1
-/* Whether krb5_princ_component is available */
-/* #undef HAVE_KRB5_PRINC_COMPONENT */
-/* Whether the krb5_creds struct has a session property */
-#define HAVE_KRB5_SESSION_IN_CREDS 1
-/* Define to 1 if you have the `krb5_set_default_in_tkt_etypes' function. */
-#define HAVE_KRB5_SET_DEFAULT_IN_TKT_ETYPES 1
-/* Define to 1 if you have the `krb5_set_default_tgs_ktypes' function. */
-/* #undef HAVE_KRB5_SET_DEFAULT_TGS_KTYPES */
-/* Define to 1 if you have the `krb5_set_real_time' function. */
-#define HAVE_KRB5_SET_REAL_TIME 1
-/* Define to 1 if you have the `krb5_set_warn_dest' function. */
-#define HAVE_KRB5_SET_WARN_DEST 1
-/* Define to 1 if you have the `krb5_string_to_key' function. */
-#define HAVE_KRB5_STRING_TO_KEY 1
-/* Define to 1 if you have the `krb5_string_to_key_salt' function. */
-#define HAVE_KRB5_STRING_TO_KEY_SALT 1
-/* Define to 1 if you have the `krb5_ticket_get_authorization_data_type' */
-#define HAVE_KRB5_TICKET_GET_AUTHORIZATION_DATA_TYPE 1
-/* Whether the krb5_ticket struct has a enc_part2 property */
-/* #undef HAVE_KRB5_TKT_ENC_PART2 */
-/* Define to 1 if you have the `krb5_use_enctype' function. */
-/* #undef HAVE_KRB5_USE_ENCTYPE */
-/* Define to 1 if you have the `krb5_verify_checksum' function. */
-#define HAVE_KRB5_VERIFY_CHECKSUM 1
-/* Whether krb5_princ_realm returns krb5_realm or krb5_data */
-#define KRB5_PRINC_REALM_RETURNS_REALM 1
-
-#include <krb5.h>
-#include <com_err.h>
-
-#endif
-
-#endif
diff --git a/source3/lib/replace/system/locale.h b/source3/lib/replace/system/locale.h
deleted file mode 100644
index e73a9bb274..0000000000
--- a/source3/lib/replace/system/locale.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef _system_locale_h
-#define _system_locale_h
-
-/*
- Unix SMB/CIFS implementation.
-
- locale 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 HAVE_CTYPE_H
-#include <ctype.h>
-#endif
-
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
-
-#endif
diff --git a/source3/lib/replace/system/network.h b/source3/lib/replace/system/network.h
deleted file mode 100644
index 077892a54e..0000000000
--- a/source3/lib/replace/system/network.h
+++ /dev/null
@@ -1,332 +0,0 @@
-#ifndef _system_network_h
-#define _system_network_h
-/*
- Unix SMB/CIFS implementation.
-
- networking system include wrappers
-
- Copyright (C) Andrew Tridgell 2004
- Copyright (C) Jelmer Vernooij 2007
-
- ** 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/>.
-
-*/
-
-#ifndef LIBREPLACE_NETWORK_CHECKS
-#error "AC_LIBREPLACE_NETWORK_CHECKS missing in configure"
-#endif
-
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifdef HAVE_UNIXSOCKET
-#include <sys/un.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-
-#ifdef HAVE_NETINET_TCP_H
-#include <netinet/tcp.h>
-#endif
-
-/*
- * The next three defines are needed to access the IPTOS_* options
- * on some systems.
- */
-
-#ifdef HAVE_NETINET_IN_SYSTM_H
-#include <netinet/in_systm.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_IP_H
-#include <netinet/in_ip.h>
-#endif
-
-#ifdef HAVE_NETINET_IP_H
-#include <netinet/ip.h>
-#endif
-
-#ifdef HAVE_NET_IF_H
-#include <net/if.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef HAVE_SYS_IOCTL_H
-#include <sys/ioctl.h>
-#endif
-
-#ifdef HAVE_STROPTS_H
-#include <stropts.h>
-#endif
-
-#ifndef HAVE_SOCKLEN_T
-#define HAVE_SOCKLEN_T
-typedef int socklen_t;
-#endif
-
-#if !defined (HAVE_INET_NTOA) || defined(REPLACE_INET_NTOA)
-/* define is in "replace.h" */
-char *rep_inet_ntoa(struct in_addr ip);
-#endif
-
-#ifndef HAVE_INET_PTON
-/* define is in "replace.h" */
-int rep_inet_pton(int af, const char *src, void *dst);
-#endif
-
-#ifndef HAVE_INET_NTOP
-/* define is in "replace.h" */
-const char *rep_inet_ntop(int af, const void *src, char *dst, socklen_t size);
-#endif
-
-#ifndef HAVE_INET_ATON
-/* define is in "replace.h" */
-int rep_inet_aton(const char *src, struct in_addr *dst);
-#endif
-
-#ifndef HAVE_CONNECT
-/* define is in "replace.h" */
-int rep_connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
-#endif
-
-#ifndef HAVE_GETHOSTBYNAME
-/* define is in "replace.h" */
-struct hostent *rep_gethostbyname(const char *name);
-#endif
-
-#ifdef HAVE_IFADDRS_H
-#include <ifaddrs.h>
-#endif
-
-#ifndef HAVE_STRUCT_IFADDRS
-struct ifaddrs {
- struct ifaddrs *ifa_next; /* Pointer to next struct */
- char *ifa_name; /* Interface name */
- unsigned int ifa_flags; /* Interface flags */
- struct sockaddr *ifa_addr; /* Interface address */
- struct sockaddr *ifa_netmask; /* Interface netmask */
-#undef ifa_dstaddr
- struct sockaddr *ifa_dstaddr; /* P2P interface destination */
- void *ifa_data; /* Address specific data */
-};
-#endif
-
-#ifndef HAVE_GETIFADDRS
-int rep_getifaddrs(struct ifaddrs **);
-#endif
-
-#ifndef HAVE_FREEIFADDRS
-void rep_freeifaddrs(struct ifaddrs *);
-#endif
-
-#ifndef HAVE_SOCKETPAIR
-/* define is in "replace.h" */
-int rep_socketpair(int d, int type, int protocol, int sv[2]);
-#endif
-
-/*
- * Some systems have getaddrinfo but not the
- * defines needed to use it.
- */
-
-/* Various macros that ought to be in <netdb.h>, but might not be */
-
-#ifndef EAI_FAIL
-#define EAI_BADFLAGS (-1)
-#define EAI_NONAME (-2)
-#define EAI_AGAIN (-3)
-#define EAI_FAIL (-4)
-#define EAI_FAMILY (-6)
-#define EAI_SOCKTYPE (-7)
-#define EAI_SERVICE (-8)
-#define EAI_MEMORY (-10)
-#define EAI_SYSTEM (-11)
-#endif /* !EAI_FAIL */
-
-#ifndef AI_PASSIVE
-#define AI_PASSIVE 0x0001
-#endif
-
-#ifndef AI_CANONNAME
-#define AI_CANONNAME 0x0002
-#endif
-
-#ifndef AI_NUMERICHOST
-/*
- * some platforms don't support AI_NUMERICHOST; define as zero if using
- * the system version of getaddrinfo...
- */
-#if defined(HAVE_STRUCT_ADDRINFO) && defined(HAVE_GETADDRINFO)
-#define AI_NUMERICHOST 0
-#else
-#define AI_NUMERICHOST 0x0004
-#endif
-#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
-/*
- * logic copied from AI_NUMERICHOST
- */
-#if defined(HAVE_STRUCT_ADDRINFO) && defined(HAVE_GETADDRINFO)
-#define AI_NUMERICSERV 0
-#else
-#define AI_NUMERICSERV 0x0400
-#endif
-#endif
-
-#ifndef NI_NUMERICHOST
-#define NI_NUMERICHOST 1
-#endif
-
-#ifndef NI_NUMERICSERV
-#define NI_NUMERICSERV 2
-#endif
-
-#ifndef NI_NOFQDN
-#define NI_NOFQDN 4
-#endif
-
-#ifndef NI_NAMEREQD
-#define NI_NAMEREQD 8
-#endif
-
-#ifndef NI_DGRAM
-#define NI_DGRAM 16
-#endif
-
-
-#ifndef NI_MAXHOST
-#define NI_MAXHOST 1025
-#endif
-
-#ifndef NI_MAXSERV
-#define NI_MAXSERV 32
-#endif
-
-/*
- * glibc on linux doesn't seem to have MSG_WAITALL
- * defined. I think the kernel has it though..
- */
-#ifndef MSG_WAITALL
-#define MSG_WAITALL 0
-#endif
-
-#ifndef INADDR_LOOPBACK
-#define INADDR_LOOPBACK 0x7f000001
-#endif
-
-#ifndef INADDR_NONE
-#define INADDR_NONE 0xffffffff
-#endif
-
-#ifndef EAFNOSUPPORT
-#define EAFNOSUPPORT EINVAL
-#endif
-
-#ifndef INET_ADDRSTRLEN
-#define INET_ADDRSTRLEN 16
-#endif
-
-#ifndef INET6_ADDRSTRLEN
-#define INET6_ADDRSTRLEN 46
-#endif
-
-#ifndef HOST_NAME_MAX
-#define HOST_NAME_MAX 256
-#endif
-
-#ifndef HAVE_SA_FAMILY_T
-#define HAVE_SA_FAMILY_T
-typedef unsigned short int sa_family_t;
-#endif
-
-#ifndef HAVE_STRUCT_SOCKADDR_STORAGE
-#define HAVE_STRUCT_SOCKADDR_STORAGE
-#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
-
-#ifndef HAVE_STRUCT_ADDRINFO
-#define HAVE_STRUCT_ADDRINFO
-struct addrinfo {
- int ai_flags;
- int ai_family;
- int ai_socktype;
- int ai_protocol;
- socklen_t ai_addrlen;
- struct sockaddr *ai_addr;
- char *ai_canonname;
- struct addrinfo *ai_next;
-};
-#endif /* HAVE_STRUCT_ADDRINFO */
-
-#if !defined(HAVE_GETADDRINFO)
-#include "getaddrinfo.h"
-#endif
-
-/* Needed for some systems that don't define it (Solaris). */
-#ifndef ifr_netmask
-#define ifr_netmask ifr_addr
-#endif
-
-#ifdef SOCKET_WRAPPER
-#ifndef SOCKET_WRAPPER_NOT_REPLACE
-#define SOCKET_WRAPPER_REPLACE
-#endif
-#include "lib/socket_wrapper/socket_wrapper.h"
-#endif
-
-#endif
diff --git a/source3/lib/replace/system/passwd.h b/source3/lib/replace/system/passwd.h
deleted file mode 100644
index cad3197ccb..0000000000
--- a/source3/lib/replace/system/passwd.h
+++ /dev/null
@@ -1,110 +0,0 @@
-#ifndef _system_passwd_h
-#define _system_passwd_h
-
-/*
- Unix SMB/CIFS implementation.
-
- passwd 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/>.
-
-*/
-
-/* this needs to be included before nss_wrapper.h on some systems */
-#include <unistd.h>
-
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
-#ifdef HAVE_GRP_H
-#include <grp.h>
-#endif
-#ifdef HAVE_SYS_PRIV_H
-#include <sys/priv.h>
-#endif
-#ifdef HAVE_SYS_ID_H
-#include <sys/id.h>
-#endif
-
-#ifdef HAVE_CRYPT_H
-#include <crypt.h>
-#endif
-
-#ifdef HAVE_SHADOW_H
-#include <shadow.h>
-#endif
-
-#ifdef HAVE_SYS_SECURITY_H
-#include <sys/security.h>
-#include <prot.h>
-#define PASSWORD_LENGTH 16
-#endif /* HAVE_SYS_SECURITY_H */
-
-#ifdef HAVE_GETPWANAM
-#include <sys/label.h>
-#include <sys/audit.h>
-#include <pwdadj.h>
-#endif
-
-#ifdef HAVE_COMPAT_H
-#include <compat.h>
-#endif
-
-#ifdef REPLACE_GETPASS
-#if defined(REPLACE_GETPASS_BY_GETPASSPHRASE)
-#define getpass(prompt) getpassphrase(prompt)
-#else
-#define getpass(prompt) rep_getpass(prompt)
-char *rep_getpass(const char *prompt);
-#endif
-#endif
-
-#ifndef NGROUPS_MAX
-#define NGROUPS_MAX 32 /* Guess... */
-#endif
-
-/* what is the longest significant password available on your system?
- Knowing this speeds up password searches a lot */
-#ifndef PASSWORD_LENGTH
-#define PASSWORD_LENGTH 8
-#endif
-
-#if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS)
-#define OSF1_ENH_SEC 1
-#endif
-
-#ifndef ALLOW_CHANGE_PASSWORD
-#if (defined(HAVE_TERMIOS_H) && defined(HAVE_DUP2) && defined(HAVE_SETSID))
-#define ALLOW_CHANGE_PASSWORD 1
-#endif
-#endif
-
-#if defined(HAVE_CRYPT16) && defined(HAVE_GETAUTHUID)
-#define ULTRIX_AUTH 1
-#endif
-
-#ifdef NSS_WRAPPER
-#ifndef NSS_WRAPPER_NOT_REPLACE
-#define NSS_WRAPPER_REPLACE
-#endif
-#include "lib/nss_wrapper/nss_wrapper.h"
-#endif
-
-#endif
diff --git a/source3/lib/replace/system/readline.h b/source3/lib/replace/system/readline.h
deleted file mode 100644
index ba34dc6a61..0000000000
--- a/source3/lib/replace/system/readline.h
+++ /dev/null
@@ -1,52 +0,0 @@
-#ifndef _system_readline_h
-#define _system_readline_h
-/*
- Unix SMB/CIFS implementation.
-
- Readline wrappers
-
- ** 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 HAVE_LIBREADLINE
-# ifdef HAVE_READLINE_READLINE_H
-# include <readline/readline.h>
-# ifdef HAVE_READLINE_HISTORY_H
-# include <readline/history.h>
-# endif
-# else
-# ifdef HAVE_READLINE_H
-# include <readline.h>
-# ifdef HAVE_HISTORY_H
-# include <history.h>
-# endif
-# else
-# undef HAVE_LIBREADLINE
-# endif
-# endif
-#endif
-
-#ifdef HAVE_NEW_LIBREADLINE
-# define RL_COMPLETION_CAST (rl_completion_func_t *)
-#else
-/* This type is missing from libreadline<4.0 (approximately) */
-# define RL_COMPLETION_CAST
-#endif /* HAVE_NEW_LIBREADLINE */
-
-#endif
diff --git a/source3/lib/replace/system/select.h b/source3/lib/replace/system/select.h
deleted file mode 100644
index da18de0cfc..0000000000
--- a/source3/lib/replace/system/select.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef _system_select_h
-#define _system_select_h
-/*
- Unix SMB/CIFS implementation.
-
- select 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 HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-
-#ifdef HAVE_SYS_EPOLL_H
-#include <sys/epoll.h>
-#endif
-
-#ifndef SELECT_CAST
-#define SELECT_CAST
-#endif
-
-#endif
diff --git a/source3/lib/replace/system/shmem.h b/source3/lib/replace/system/shmem.h
deleted file mode 100644
index 64fe39b6cb..0000000000
--- a/source3/lib/replace/system/shmem.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef _system_shmem_h
-#define _system_shmem_h
-/*
- Unix SMB/CIFS implementation.
-
- shared memory 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/>.
-
-*/
-
-#if defined(HAVE_SYS_IPC_H)
-#include <sys/ipc.h>
-#endif /* HAVE_SYS_IPC_H */
-
-#if defined(HAVE_SYS_SHM_H)
-#include <sys/shm.h>
-#endif /* HAVE_SYS_SHM_H */
-
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-
-/* NetBSD doesn't have these */
-#ifndef SHM_R
-#define SHM_R 0400
-#endif
-
-#ifndef SHM_W
-#define SHM_W 0200
-#endif
-
-
-#ifndef MAP_FILE
-#define MAP_FILE 0
-#endif
-
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void *)-1)
-#endif
-
-#endif
diff --git a/source3/lib/replace/system/syslog.h b/source3/lib/replace/system/syslog.h
deleted file mode 100644
index 104be1df84..0000000000
--- a/source3/lib/replace/system/syslog.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef _system_syslog_h
-#define _system_syslog_h
-/*
- Unix SMB/CIFS implementation.
-
- syslog 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 HAVE_SYSLOG_H
-#include <syslog.h>
-#else
-#ifdef HAVE_SYS_SYSLOG_H
-#include <sys/syslog.h>
-#endif
-#endif
-
-/* For sys_adminlog(). */
-#ifndef LOG_EMERG
-#define LOG_EMERG 0 /* system is unusable */
-#endif
-
-#ifndef LOG_ALERT
-#define LOG_ALERT 1 /* action must be taken immediately */
-#endif
-
-#ifndef LOG_CRIT
-#define LOG_CRIT 2 /* critical conditions */
-#endif
-
-#ifndef LOG_ERR
-#define LOG_ERR 3 /* error conditions */
-#endif
-
-#ifndef LOG_WARNING
-#define LOG_WARNING 4 /* warning conditions */
-#endif
-
-#ifndef LOG_NOTICE
-#define LOG_NOTICE 5 /* normal but significant condition */
-#endif
-
-#ifndef LOG_INFO
-#define LOG_INFO 6 /* informational */
-#endif
-
-#ifndef LOG_DEBUG
-#define LOG_DEBUG 7 /* debug-level messages */
-#endif
-
-#endif
diff --git a/source3/lib/replace/system/terminal.h b/source3/lib/replace/system/terminal.h
deleted file mode 100644
index 9ad601ace0..0000000000
--- a/source3/lib/replace/system/terminal.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef _system_terminal_h
-#define _system_terminal_h
-/*
- Unix SMB/CIFS implementation.
-
- terminal 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 SUNOS4
-/* on SUNOS4 termios.h conflicts with sys/ioctl.h */
-#undef HAVE_TERMIOS_H
-#endif
-
-
-#if defined(HAVE_TERMIOS_H)
-/* POSIX terminal handling. */
-#include <termios.h>
-#elif defined(HAVE_TERMIO_H)
-/* Older SYSV terminal handling - don't use if we can avoid it. */
-#include <termio.h>
-#elif defined(HAVE_SYS_TERMIO_H)
-/* Older SYSV terminal handling - don't use if we can avoid it. */
-#include <sys/termio.h>
-#endif
-
-#endif
diff --git a/source3/lib/replace/system/time.h b/source3/lib/replace/system/time.h
deleted file mode 100644
index 4abf295d1a..0000000000
--- a/source3/lib/replace/system/time.h
+++ /dev/null
@@ -1,69 +0,0 @@
-#ifndef _system_time_h
-#define _system_time_h
-/*
- Unix SMB/CIFS implementation.
-
- time 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 TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#else
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#endif
-
-#ifdef HAVE_UTIME_H
-#include <utime.h>
-#else
-struct utimbuf {
- time_t actime; /* access time */
- time_t modtime; /* modification time */
-};
-#endif
-
-#ifndef HAVE_MKTIME
-/* define is in "replace.h" */
-time_t rep_mktime(struct tm *t);
-#endif
-
-#ifndef HAVE_TIMEGM
-/* define is in "replace.h" */
-time_t rep_timegm(struct tm *tm);
-#endif
-
-#ifndef HAVE_UTIME
-/* define is in "replace.h" */
-int rep_utime(const char *filename, const struct utimbuf *buf);
-#endif
-
-#ifndef HAVE_UTIMES
-/* define is in "replace.h" */
-int rep_utimes(const char *filename, const struct timeval tv[2]);
-#endif
-
-#endif
diff --git a/source3/lib/replace/system/wait.h b/source3/lib/replace/system/wait.h
deleted file mode 100644
index 5784b1ae92..0000000000
--- a/source3/lib/replace/system/wait.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef _system_wait_h
-#define _system_wait_h
-/*
- Unix SMB/CIFS implementation.
-
- waitpid 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 HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-
-#include <signal.h>
-
-#ifndef SIGCLD
-#define SIGCLD SIGCHLD
-#endif
-
-#ifndef SIGNAL_CAST
-#define SIGNAL_CAST (RETSIGTYPE (*)(int))
-#endif
-
-#ifdef HAVE_SETJMP_H
-#include <setjmp.h>
-#endif
-
-#ifndef SA_RESETHAND
-#define SA_RESETHAND SA_ONESHOT
-#endif
-
-#if !defined(HAVE_SIG_ATOMIC_T_TYPE)
-typedef int sig_atomic_t;
-#endif
-
-#endif
diff --git a/source3/lib/replace/test/getifaddrs.c b/source3/lib/replace/test/getifaddrs.c
deleted file mode 100644
index 8b00ac2f40..0000000000
--- a/source3/lib/replace/test/getifaddrs.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Unix SMB/CIFS implementation.
- *
- * libreplace getifaddrs test
- *
- * Copyright (C) Michael Adam <obnox@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/>.
- */
-
-#ifndef AUTOCONF_TEST
-#include "replace.h"
-#include "system/network.h"
-#endif
-
-#ifdef HAVE_INET_NTOP
-#define rep_inet_ntop inet_ntop
-#endif
-
-static const char *format_sockaddr(struct sockaddr *addr,
- char *addrstring,
- socklen_t addrlen)
-{
- const char *result = NULL;
-
- if (addr->sa_family == AF_INET) {
- result = rep_inet_ntop(AF_INET,
- &((struct sockaddr_in *)addr)->sin_addr,
- addrstring,
- addrlen);
-#ifdef HAVE_STRUCT_SOCKADDR_IN6
- } else if (addr->sa_family == AF_INET6) {
- result = rep_inet_ntop(AF_INET6,
- &((struct sockaddr_in6 *)addr)->sin6_addr,
- addrstring,
- addrlen);
-#endif
- }
- return result;
-}
-
-int getifaddrs_test(void)
-{
- struct ifaddrs *ifs = NULL;
- struct ifaddrs *ifs_head = NULL;
- int ret;
-
- ret = getifaddrs(&ifs);
- ifs_head = ifs;
- if (ret != 0) {
- fprintf(stderr, "getifaddrs() failed: %s\n", strerror(errno));
- return 1;
- }
-
- while (ifs) {
- printf("%-10s ", ifs->ifa_name);
- if (ifs->ifa_addr != NULL) {
- char addrstring[INET6_ADDRSTRLEN];
- const char *result;
-
- result = format_sockaddr(ifs->ifa_addr,
- addrstring,
- sizeof(addrstring));
- if (result != NULL) {
- printf("IP=%s ", addrstring);
- }
-
- if (ifs->ifa_netmask != NULL) {
- result = format_sockaddr(ifs->ifa_netmask,
- addrstring,
- sizeof(addrstring));
- if (result != NULL) {
- printf("NETMASK=%s", addrstring);
- }
- } else {
- printf("AF=%d ", ifs->ifa_addr->sa_family);
- }
- } else {
- printf("<no address>");
- }
-
- printf("\n");
- ifs = ifs->ifa_next;
- }
-
- freeifaddrs(ifs_head);
-
- return 0;
-}
diff --git a/source3/lib/replace/test/os2_delete.c b/source3/lib/replace/test/os2_delete.c
deleted file mode 100644
index b45c135355..0000000000
--- a/source3/lib/replace/test/os2_delete.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- test readdir/unlink pattern that OS/2 uses
- tridge@samba.org July 2005
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <errno.h>
-#include <string.h>
-#include <fcntl.h>
-
-#define NUM_FILES 700
-#define READDIR_SIZE 100
-#define DELETE_SIZE 4
-
-#define TESTDIR "test.dir"
-
-static int test_readdir_os2_delete_ret;
-
-#define FAILED(d) (printf("failure: readdir [\nFailed for %s - %d = %s\n]\n", d, errno, strerror(errno)), test_readdir_os2_delete_ret = 1, 1)
-
-#ifndef MIN
-#define MIN(a,b) ((a)<(b)?(a):(b))
-#endif
-
-static void cleanup(void)
-{
- /* I'm a lazy bastard */
- system("rm -rf " TESTDIR);
- mkdir(TESTDIR, 0700) == 0 || FAILED("mkdir");
-}
-
-static void create_files(void)
-{
- int i;
- for (i=0;i<NUM_FILES;i++) {
- char fname[40];
- int fd;
- sprintf(fname, TESTDIR "/test%u.txt", i);
- fd = open(fname, O_CREAT|O_RDWR, 0600);
- if (fd < 0) {
- FAILED("open");
- }
- if (close(fd) != 0) {
- FAILED("close");
- }
- }
-}
-
-static int os2_delete(DIR *d)
-{
- off_t offsets[READDIR_SIZE];
- int i, j;
- struct dirent *de;
- char names[READDIR_SIZE][30];
-
- /* scan, remembering offsets */
- for (i=0, de=readdir(d);
- de && i < READDIR_SIZE;
- de=readdir(d), i++) {
- offsets[i] = telldir(d);
- strcpy(names[i], de->d_name);
- }
-
- if (i == 0) {
- return 0;
- }
-
- /* delete the first few */
- for (j=0; j<MIN(i, DELETE_SIZE); j++) {
- char fname[40];
- sprintf(fname, TESTDIR "/%s", names[j]);
- unlink(fname) == 0 || FAILED("unlink");
- }
-
- /* seek to just after the deletion */
- seekdir(d, offsets[j-1]);
-
- /* return number deleted */
- return j;
-}
-
-int test_readdir_os2_delete(void)
-{
- int total_deleted = 0;
- DIR *d;
- struct dirent *de;
-
- test_readdir_os2_delete_ret = 0;
-
- cleanup();
- create_files();
-
- d = opendir(TESTDIR "/test0.txt");
- if (d != NULL) FAILED("opendir() on file succeed");
- if (errno != ENOTDIR) FAILED("opendir() on file didn't give ENOTDIR");
-
- d = opendir(TESTDIR);
-
- /* skip past . and .. */
- de = readdir(d);
- strcmp(de->d_name, ".") == 0 || FAILED("match .");
- de = readdir(d);
- strcmp(de->d_name, "..") == 0 || FAILED("match ..");
-
- while (1) {
- int n = os2_delete(d);
- if (n == 0) break;
- total_deleted += n;
- }
- closedir(d);
-
- fprintf(stderr, "Deleted %d files of %d\n", total_deleted, NUM_FILES);
-
- rmdir(TESTDIR) == 0 || FAILED("rmdir");
-
- system("rm -rf " TESTDIR);
-
- return test_readdir_os2_delete_ret;
-}
diff --git a/source3/lib/replace/test/shared_mmap.c b/source3/lib/replace/test/shared_mmap.c
deleted file mode 100644
index 50dad8d696..0000000000
--- a/source3/lib/replace/test/shared_mmap.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* this tests whether we can use a shared writeable mmap on a file -
- as needed for the mmap variant of FAST_SHARE_MODES */
-
-#if defined(HAVE_UNISTD_H)
-#include <unistd.h>
-#endif
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#define DATA "conftest.mmap"
-
-#ifndef MAP_FILE
-#define MAP_FILE 0
-#endif
-
-main()
-{
- int *buf;
- int i;
- int fd = open(DATA,O_RDWR|O_CREAT|O_TRUNC,0666);
- int count=7;
-
- if (fd == -1) exit(1);
-
- for (i=0;i<10000;i++) {
- write(fd,&i,sizeof(i));
- }
-
- close(fd);
-
- if (fork() == 0) {
- fd = open(DATA,O_RDWR);
- if (fd == -1) exit(1);
-
- buf = (int *)mmap(NULL, 10000*sizeof(int),
- (PROT_READ | PROT_WRITE),
- MAP_FILE | MAP_SHARED,
- fd, 0);
-
- while (count-- && buf[9124] != 55732) sleep(1);
-
- if (count <= 0) exit(1);
-
- buf[1763] = 7268;
- exit(0);
- }
-
- fd = open(DATA,O_RDWR);
- if (fd == -1) exit(1);
-
- buf = (int *)mmap(NULL, 10000*sizeof(int),
- (PROT_READ | PROT_WRITE),
- MAP_FILE | MAP_SHARED,
- fd, 0);
-
- if (buf == (int *)-1) exit(1);
-
- buf[9124] = 55732;
-
- while (count-- && buf[1763] != 7268) sleep(1);
-
- unlink(DATA);
-
- if (count > 0) exit(0);
- exit(1);
-}
diff --git a/source3/lib/replace/test/strptime.c b/source3/lib/replace/test/strptime.c
deleted file mode 100644
index fade3ecc57..0000000000
--- a/source3/lib/replace/test/strptime.c
+++ /dev/null
@@ -1,172 +0,0 @@
-
-#ifdef LIBREPLACE_CONFIGURE_TEST_STRPTIME
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-
-#define true 1
-#define false 0
-
-#ifndef __STRING
-#define __STRING(x) #x
-#endif
-
-/* make printf a no-op */
-#define printf if(0) printf
-
-#else /* LIBREPLACE_CONFIGURE_TEST_STRPTIME */
-
-#include "replace.h"
-#include "system/time.h"
-
-#endif /* LIBREPLACE_CONFIGURE_TEST_STRPTIME */
-
-int libreplace_test_strptime(void)
-{
- const char *s = "20070414101546Z";
- char *ret;
- struct tm t, t2;
-
- memset(&t, 0, sizeof(t));
- memset(&t2, 0, sizeof(t2));
-
- printf("test: strptime\n");
-
- ret = strptime(s, "%Y%m%d%H%M%S", &t);
- if ( ret == NULL ) {
- printf("failure: strptime [\n"
- "returned NULL\n"
- "]\n");
- return false;
- }
-
- if ( *ret != 'Z' ) {
- printf("failure: strptime [\n"
- "ret doesn't point to 'Z'\n"
- "]\n");
- return false;
- }
-
- ret = strptime(s, "%Y%m%d%H%M%SZ", &t2);
- if ( ret == NULL ) {
- printf("failure: strptime [\n"
- "returned NULL with Z\n"
- "]\n");
- return false;
- }
-
- if ( *ret != '\0' ) {
- printf("failure: strptime [\n"
- "ret doesn't point to '\\0'\n"
- "]\n");
- return false;
- }
-
-#define CMP_TM_ELEMENT(t1,t2,elem) \
- if (t1.elem != t2.elem) { \
- printf("failure: strptime [\n" \
- "result differs if the format string has a 'Z' at the end\n" \
- "element: %s %d != %d\n" \
- "]\n", \
- __STRING(elen), t1.elem, t2.elem); \
- return false; \
- }
-
- CMP_TM_ELEMENT(t,t2,tm_sec);
- CMP_TM_ELEMENT(t,t2,tm_min);
- CMP_TM_ELEMENT(t,t2,tm_hour);
- CMP_TM_ELEMENT(t,t2,tm_mday);
- CMP_TM_ELEMENT(t,t2,tm_mon);
- CMP_TM_ELEMENT(t,t2,tm_year);
- CMP_TM_ELEMENT(t,t2,tm_wday);
- CMP_TM_ELEMENT(t,t2,tm_yday);
- CMP_TM_ELEMENT(t,t2,tm_isdst);
-
- if (t.tm_sec != 46) {
- printf("failure: strptime [\n"
- "tm_sec: expected: 46, got: %d\n"
- "]\n",
- t.tm_sec);
- return false;
- }
-
- if (t.tm_min != 15) {
- printf("failure: strptime [\n"
- "tm_min: expected: 15, got: %d\n"
- "]\n",
- t.tm_min);
- return false;
- }
-
- if (t.tm_hour != 10) {
- printf("failure: strptime [\n"
- "tm_hour: expected: 10, got: %d\n"
- "]\n",
- t.tm_hour);
- return false;
- }
-
- if (t.tm_mday != 14) {
- printf("failure: strptime [\n"
- "tm_mday: expected: 14, got: %d\n"
- "]\n",
- t.tm_mday);
- return false;
- }
-
- if (t.tm_mon != 3) {
- printf("failure: strptime [\n"
- "tm_mon: expected: 3, got: %d\n"
- "]\n",
- t.tm_mon);
- return false;
- }
-
- if (t.tm_year != 107) {
- printf("failure: strptime [\n"
- "tm_year: expected: 107, got: %d\n"
- "]\n",
- t.tm_year);
- return false;
- }
-
- if (t.tm_wday != 6) { /* saturday */
- printf("failure: strptime [\n"
- "tm_wday: expected: 6, got: %d\n"
- "]\n",
- t.tm_wday);
- return false;
- }
-
- if (t.tm_yday != 103) {
- printf("failure: strptime [\n"
- "tm_yday: expected: 103, got: %d\n"
- "]\n",
- t.tm_yday);
- return false;
- }
-
- /* we don't test this as it depends on the host configuration
- if (t.tm_isdst != 0) {
- printf("failure: strptime [\n"
- "tm_isdst: expected: 0, got: %d\n"
- "]\n",
- t.tm_isdst);
- return false;
- }*/
-
- printf("success: strptime\n");
-
- return true;
-}
-
-#ifdef LIBREPLACE_CONFIGURE_TEST_STRPTIME
-int main (void)
-{
- int ret;
- ret = libreplace_test_strptime();
- if (ret == false) return 1;
- return 0;
-}
-#endif
diff --git a/source3/lib/replace/test/testsuite.c b/source3/lib/replace/test/testsuite.c
deleted file mode 100644
index 1e8290906e..0000000000
--- a/source3/lib/replace/test/testsuite.c
+++ /dev/null
@@ -1,1080 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- libreplace tests
-
- Copyright (C) Jelmer Vernooij 2006
-
- ** NOTE! The following LGPL license applies to the talloc
- ** 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/>.
-*/
-
-#include "replace.h"
-
-/*
- we include all the system/ include files here so that libreplace tests
- them in the build farm
-*/
-#include "system/capability.h"
-#include "system/dir.h"
-#include "system/filesys.h"
-#include "system/glob.h"
-#include "system/iconv.h"
-#include "system/locale.h"
-#include "system/network.h"
-#include "system/passwd.h"
-#include "system/readline.h"
-#include "system/select.h"
-#include "system/shmem.h"
-#include "system/syslog.h"
-#include "system/terminal.h"
-#include "system/time.h"
-#include "system/wait.h"
-#include "system/aio.h"
-
-#define TESTFILE "testfile.dat"
-
-/*
- test ftruncate() function
- */
-static int test_ftruncate(void)
-{
- struct stat st;
- int fd;
- const int size = 1234;
- printf("test: ftruncate\n");
- unlink(TESTFILE);
- fd = open(TESTFILE, O_RDWR|O_CREAT, 0600);
- if (fd == -1) {
- printf("failure: ftruncate [\n"
- "creating '%s' failed - %s\n]\n", TESTFILE, strerror(errno));
- return false;
- }
- if (ftruncate(fd, size) != 0) {
- printf("failure: ftruncate [\n%s\n]\n", strerror(errno));
- return false;
- }
- if (fstat(fd, &st) != 0) {
- printf("failure: ftruncate [\nfstat failed - %s\n]\n", strerror(errno));
- return false;
- }
- if (st.st_size != size) {
- printf("failure: ftruncate [\ngave wrong size %d - expected %d\n]\n",
- (int)st.st_size, size);
- return false;
- }
- unlink(TESTFILE);
- printf("success: ftruncate\n");
- return true;
-}
-
-/*
- test strlcpy() function.
- see http://www.gratisoft.us/todd/papers/strlcpy.html
- */
-static int test_strlcpy(void)
-{
- char buf[4];
- const struct {
- const char *src;
- size_t result;
- } tests[] = {
- { "abc", 3 },
- { "abcdef", 6 },
- { "abcd", 4 },
- { "", 0 },
- { NULL, 0 }
- };
- int i;
- printf("test: strlcpy\n");
- for (i=0;tests[i].src;i++) {
- if (strlcpy(buf, tests[i].src, sizeof(buf)) != tests[i].result) {
- printf("failure: strlcpy [\ntest %d failed\n]\n", i);
- return false;
- }
- }
- printf("success: strlcpy\n");
- return true;
-}
-
-static int test_strlcat(void)
-{
- char tmp[10];
- printf("test: strlcat\n");
- strlcpy(tmp, "", sizeof(tmp));
- if (strlcat(tmp, "bla", 3) != 3) {
- printf("failure: strlcat [\ninvalid return code\n]\n");
- return false;
- }
- if (strcmp(tmp, "bl") != 0) {
- printf("failure: strlcat [\nexpected \"bl\", got \"%s\"\n]\n",
- tmp);
- return false;
- }
-
- strlcpy(tmp, "da", sizeof(tmp));
- if (strlcat(tmp, "me", 4) != 4) {
- printf("failure: strlcat [\nexpected \"dam\", got \"%s\"\n]\n",
- tmp);
- return false;
- }
-
- printf("success: strlcat\n");
- return true;
-}
-
-static int test_mktime(void)
-{
- /* FIXME */
- return true;
-}
-
-static int test_initgroups(void)
-{
- /* FIXME */
- return true;
-}
-
-static int test_memmove(void)
-{
- /* FIXME */
- return true;
-}
-
-static int test_strdup(void)
-{
- char *x;
- printf("test: strdup\n");
- x = strdup("bla");
- if (strcmp("bla", x) != 0) {
- printf("failure: strdup [\nfailed: expected \"bla\", got \"%s\"\n]\n",
- x);
- return false;
- }
- free(x);
- printf("success: strdup\n");
- return true;
-}
-
-static int test_setlinebuf(void)
-{
- printf("test: setlinebuf\n");
- setlinebuf(stdout);
- printf("success: setlinebuf\n");
- return true;
-}
-
-static int test_vsyslog(void)
-{
- /* FIXME */
- return true;
-}
-
-static int test_timegm(void)
-{
- /* FIXME */
- return true;
-}
-
-static int test_setenv(void)
-{
-#define TEST_SETENV(key, value, overwrite, result) do { \
- int _ret; \
- char *_v; \
- _ret = setenv(key, value, overwrite); \
- if (_ret != 0) { \
- printf("failure: setenv [\n" \
- "setenv(%s, %s, %d) failed\n" \
- "]\n", \
- key, value, overwrite); \
- return false; \
- } \
- _v=getenv(key); \
- if (!_v) { \
- printf("failure: setenv [\n" \
- "getenv(%s) returned NULL\n" \
- "]\n", \
- key); \
- return false; \
- } \
- if (strcmp(result, _v) != 0) { \
- printf("failure: setenv [\n" \
- "getenv(%s): '%s' != '%s'\n" \
- "]\n", \
- key, result, _v); \
- return false; \
- } \
-} while(0)
-
-#define TEST_UNSETENV(key) do { \
- char *_v; \
- unsetenv(key); \
- _v=getenv(key); \
- if (_v) { \
- printf("failure: setenv [\n" \
- "getenv(%s): NULL != '%s'\n" \
- "]\n", \
- SETENVTEST_KEY, _v); \
- return false; \
- } \
-} while (0)
-
-#define SETENVTEST_KEY "SETENVTESTKEY"
-#define SETENVTEST_VAL "SETENVTESTVAL"
-
- printf("test: setenv\n");
- TEST_SETENV(SETENVTEST_KEY, SETENVTEST_VAL"1", 0, SETENVTEST_VAL"1");
- TEST_SETENV(SETENVTEST_KEY, SETENVTEST_VAL"2", 0, SETENVTEST_VAL"1");
- TEST_SETENV(SETENVTEST_KEY, SETENVTEST_VAL"3", 1, SETENVTEST_VAL"3");
- TEST_SETENV(SETENVTEST_KEY, SETENVTEST_VAL"4", 1, SETENVTEST_VAL"4");
- TEST_UNSETENV(SETENVTEST_KEY);
- TEST_UNSETENV(SETENVTEST_KEY);
- TEST_SETENV(SETENVTEST_KEY, SETENVTEST_VAL"5", 0, SETENVTEST_VAL"5");
- TEST_UNSETENV(SETENVTEST_KEY);
- TEST_UNSETENV(SETENVTEST_KEY);
- printf("success: setenv\n");
- return true;
-}
-
-static int test_strndup(void)
-{
- char *x;
- printf("test: strndup\n");
- x = strndup("bla", 0);
- if (strcmp(x, "") != 0) {
- printf("failure: strndup [\ninvalid\n]\n");
- return false;
- }
- free(x);
- x = strndup("bla", 2);
- if (strcmp(x, "bl") != 0) {
- printf("failure: strndup [\ninvalid\n]\n");
- return false;
- }
- free(x);
- x = strndup("bla", 10);
- if (strcmp(x, "bla") != 0) {
- printf("failure: strndup [\ninvalid\n]\n");
- return false;
- }
- free(x);
- printf("success: strndup\n");
- return true;
-}
-
-static int test_strnlen(void)
-{
- printf("test: strnlen\n");
- if (strnlen("bla", 2) != 2) {
- printf("failure: strnlen [\nunexpected length\n]\n");
- return false;
- }
-
- if (strnlen("some text\n", 0) != 0) {
- printf("failure: strnlen [\nunexpected length\n]\n");
- return false;
- }
-
- if (strnlen("some text", 20) != 9) {
- printf("failure: strnlen [\nunexpected length\n]\n");
- return false;
- }
-
- printf("success: strnlen\n");
- return true;
-}
-
-static int test_waitpid(void)
-{
- /* FIXME */
- return true;
-}
-
-static int test_seteuid(void)
-{
- /* FIXME */
- return true;
-}
-
-static int test_setegid(void)
-{
- /* FIXME */
- return true;
-}
-
-static int test_asprintf(void)
-{
- char *x;
- printf("test: asprintf\n");
- if (asprintf(&x, "%d", 9) != 1) {
- printf("failure: asprintf [\ngenerate asprintf\n]\n");
- return false;
- }
- if (strcmp(x, "9") != 0) {
- printf("failure: asprintf [\ngenerate asprintf\n]\n");
- return false;
- }
- if (asprintf(&x, "dat%s", "a") != 4) {
- printf("failure: asprintf [\ngenerate asprintf\n]\n");
- return false;
- }
- if (strcmp(x, "data") != 0) {
- printf("failure: asprintf [\ngenerate asprintf\n]\n");
- return false;
- }
- printf("success: asprintf\n");
- return true;
-}
-
-static int test_snprintf(void)
-{
- char tmp[10];
- printf("test: snprintf\n");
- if (snprintf(tmp, 3, "foo%d", 9) != 4) {
- printf("failure: snprintf [\nsnprintf return code failed\n]\n");
- return false;
- }
-
- if (strcmp(tmp, "fo") != 0) {
- printf("failure: snprintf [\nsnprintf failed\n]\n");
- return false;
- }
-
- printf("success: snprintf\n");
- return true;
-}
-
-static int test_vasprintf(void)
-{
- /* FIXME */
- return true;
-}
-
-static int test_vsnprintf(void)
-{
- /* FIXME */
- return true;
-}
-
-static int test_opendir(void)
-{
- /* FIXME */
- return true;
-}
-
-extern int test_readdir_os2_delete(void);
-
-static int test_readdir(void)
-{
- printf("test: readdir\n");
- if (test_readdir_os2_delete() != 0) {
- return false;
- }
- printf("success: readdir\n");
- return true;
-}
-
-static int test_telldir(void)
-{
- /* FIXME */
- return true;
-}
-
-static int test_seekdir(void)
-{
- /* FIXME */
- return true;
-}
-
-static int test_dlopen(void)
-{
- /* FIXME: test dlopen, dlsym, dlclose, dlerror */
- return true;
-}
-
-
-static int test_chroot(void)
-{
- /* FIXME: chroot() */
- return true;
-}
-
-static int test_bzero(void)
-{
- /* FIXME: bzero */
- return true;
-}
-
-static int test_strerror(void)
-{
- /* FIXME */
- return true;
-}
-
-static int test_errno(void)
-{
- printf("test: errno\n");
- errno = 3;
- if (errno != 3) {
- printf("failure: errno [\nerrno failed\n]\n");
- return false;
- }
-
- printf("success: errno\n");
- return true;
-}
-
-static int test_mkdtemp(void)
-{
- /* FIXME */
- return true;
-}
-
-static int test_mkstemp(void)
-{
- /* FIXME */
- return true;
-}
-
-static int test_pread(void)
-{
- /* FIXME */
- return true;
-}
-
-static int test_pwrite(void)
-{
- /* FIXME */
- return true;
-}
-
-static int test_getpass(void)
-{
- /* FIXME */
- return true;
-}
-
-static int test_inet_ntoa(void)
-{
- /* FIXME */
- return true;
-}
-
-#define TEST_STRTO_X(type,fmt,func,str,base,res,diff,rrnoo) do {\
- type _v; \
- char _s[64]; \
- char *_p = NULL;\
- char *_ep = NULL; \
- strlcpy(_s, str, sizeof(_s));\
- if (diff >= 0) { \
- _ep = &_s[diff]; \
- } \
- errno = 0; \
- _v = func(_s, &_p, base); \
- if (errno != rrnoo) { \
- printf("failure: %s [\n" \
- "\t%s\n" \
- "\t%s(\"%s\",%d,%d): " fmt " (=/!)= " fmt "\n" \
- "\terrno: %d != %d\n" \
- "]\n", \
- __STRING(func), __location__, __STRING(func), \
- str, diff, base, res, _v, rrnoo, errno); \
- return false; \
- } else if (_v != res) { \
- printf("failure: %s [\n" \
- "\t%s\n" \
- "\t%s(\"%s\",%d,%d): " fmt " != " fmt "\n" \
- "]\n", \
- __STRING(func), __location__, __STRING(func), \
- str, diff, base, res, _v); \
- return false; \
- } else if (_p != _ep) { \
- printf("failure: %s [\n" \
- "\t%s\n" \
- "\t%s(\"%s\",%d,%d): " fmt " (=/!)= " fmt "\n" \
- "\tptr: %p - %p = %d != %d\n" \
- "]\n", \
- __STRING(func), __location__, __STRING(func), \
- str, diff, base, res, _v, _ep, _p, (int)(diff - (_ep - _p)), diff); \
- return false; \
- } \
-} while (0)
-
-static int test_strtoll(void)
-{
- printf("test: strtoll\n");
-
-#define TEST_STRTOLL(str,base,res,diff,errnoo) TEST_STRTO_X(long long int, "%lld", strtoll,str,base,res,diff,errnoo)
-
- TEST_STRTOLL("15", 10, 15LL, 2, 0);
- TEST_STRTOLL(" 15", 10, 15LL, 4, 0);
- TEST_STRTOLL("15", 0, 15LL, 2, 0);
- TEST_STRTOLL(" 15 ", 0, 15LL, 3, 0);
- TEST_STRTOLL("+15", 10, 15LL, 3, 0);
- TEST_STRTOLL(" +15", 10, 15LL, 5, 0);
- TEST_STRTOLL("+15", 0, 15LL, 3, 0);
- TEST_STRTOLL(" +15 ", 0, 15LL, 4, 0);
- TEST_STRTOLL("-15", 10, -15LL, 3, 0);
- TEST_STRTOLL(" -15", 10, -15LL, 5, 0);
- TEST_STRTOLL("-15", 0, -15LL, 3, 0);
- TEST_STRTOLL(" -15 ", 0, -15LL, 4, 0);
- TEST_STRTOLL("015", 10, 15LL, 3, 0);
- TEST_STRTOLL(" 015", 10, 15LL, 5, 0);
- TEST_STRTOLL("015", 0, 13LL, 3, 0);
- TEST_STRTOLL(" 015", 0, 13LL, 5, 0);
- TEST_STRTOLL("0x15", 10, 0LL, 1, 0);
- TEST_STRTOLL(" 0x15", 10, 0LL, 3, 0);
- TEST_STRTOLL("0x15", 0, 21LL, 4, 0);
- TEST_STRTOLL(" 0x15", 0, 21LL, 6, 0);
-
- TEST_STRTOLL("10", 16, 16LL, 2, 0);
- TEST_STRTOLL(" 10 ", 16, 16LL, 4, 0);
- TEST_STRTOLL("0x10", 16, 16LL, 4, 0);
- TEST_STRTOLL("0x10", 0, 16LL, 4, 0);
- TEST_STRTOLL(" 0x10 ", 0, 16LL, 5, 0);
- TEST_STRTOLL("+10", 16, 16LL, 3, 0);
- TEST_STRTOLL(" +10 ", 16, 16LL, 5, 0);
- TEST_STRTOLL("+0x10", 16, 16LL, 5, 0);
- TEST_STRTOLL("+0x10", 0, 16LL, 5, 0);
- TEST_STRTOLL(" +0x10 ", 0, 16LL, 6, 0);
- TEST_STRTOLL("-10", 16, -16LL, 3, 0);
- TEST_STRTOLL(" -10 ", 16, -16LL, 5, 0);
- TEST_STRTOLL("-0x10", 16, -16LL, 5, 0);
- TEST_STRTOLL("-0x10", 0, -16LL, 5, 0);
- TEST_STRTOLL(" -0x10 ", 0, -16LL, 6, 0);
- TEST_STRTOLL("010", 16, 16LL, 3, 0);
- TEST_STRTOLL(" 010 ", 16, 16LL, 5, 0);
- TEST_STRTOLL("-010", 16, -16LL, 4, 0);
-
- TEST_STRTOLL("11", 8, 9LL, 2, 0);
- TEST_STRTOLL("011", 8, 9LL, 3, 0);
- TEST_STRTOLL("011", 0, 9LL, 3, 0);
- TEST_STRTOLL("-11", 8, -9LL, 3, 0);
- TEST_STRTOLL("-011", 8, -9LL, 4, 0);
- TEST_STRTOLL("-011", 0, -9LL, 4, 0);
-
- TEST_STRTOLL("011", 8, 9LL, 3, 0);
- TEST_STRTOLL("011", 0, 9LL, 3, 0);
- TEST_STRTOLL("-11", 8, -9LL, 3, 0);
- TEST_STRTOLL("-011", 8, -9LL, 4, 0);
- TEST_STRTOLL("-011", 0, -9LL, 4, 0);
-
- TEST_STRTOLL("Text", 0, 0LL, 0, 0);
-
- TEST_STRTOLL("9223372036854775807", 10, 9223372036854775807LL, 19, 0);
- TEST_STRTOLL("9223372036854775807", 0, 9223372036854775807LL, 19, 0);
- TEST_STRTOLL("9223372036854775808", 0, 9223372036854775807LL, 19, ERANGE);
- TEST_STRTOLL("9223372036854775808", 10, 9223372036854775807LL, 19, ERANGE);
- TEST_STRTOLL("0x7FFFFFFFFFFFFFFF", 0, 9223372036854775807LL, 18, 0);
- TEST_STRTOLL("0x7FFFFFFFFFFFFFFF", 16, 9223372036854775807LL, 18, 0);
- TEST_STRTOLL("7FFFFFFFFFFFFFFF", 16, 9223372036854775807LL, 16, 0);
- TEST_STRTOLL("0x8000000000000000", 0, 9223372036854775807LL, 18, ERANGE);
- TEST_STRTOLL("0x8000000000000000", 16, 9223372036854775807LL, 18, ERANGE);
- TEST_STRTOLL("80000000000000000", 16, 9223372036854775807LL, 17, ERANGE);
- TEST_STRTOLL("0777777777777777777777", 0, 9223372036854775807LL, 22, 0);
- TEST_STRTOLL("0777777777777777777777", 8, 9223372036854775807LL, 22, 0);
- TEST_STRTOLL("777777777777777777777", 8, 9223372036854775807LL, 21, 0);
- TEST_STRTOLL("01000000000000000000000", 0, 9223372036854775807LL, 23, ERANGE);
- TEST_STRTOLL("01000000000000000000000", 8, 9223372036854775807LL, 23, ERANGE);
- TEST_STRTOLL("1000000000000000000000", 8, 9223372036854775807LL, 22, ERANGE);
-
- TEST_STRTOLL("-9223372036854775808", 10, -9223372036854775807LL -1, 20, 0);
- TEST_STRTOLL("-9223372036854775808", 0, -9223372036854775807LL -1, 20, 0);
- TEST_STRTOLL("-9223372036854775809", 0, -9223372036854775807LL -1, 20, ERANGE);
- TEST_STRTOLL("-9223372036854775809", 10, -9223372036854775807LL -1, 20, ERANGE);
- TEST_STRTOLL("-0x8000000000000000", 0, -9223372036854775807LL -1, 19, 0);
- TEST_STRTOLL("-0x8000000000000000", 16, -9223372036854775807LL -1, 19, 0);
- TEST_STRTOLL("-8000000000000000", 16, -9223372036854775807LL -1, 17, 0);
- TEST_STRTOLL("-0x8000000000000001", 0, -9223372036854775807LL -1, 19, ERANGE);
- TEST_STRTOLL("-0x8000000000000001", 16, -9223372036854775807LL -1, 19, ERANGE);
- TEST_STRTOLL("-80000000000000001", 16, -9223372036854775807LL -1, 18, ERANGE);
- TEST_STRTOLL("-01000000000000000000000",0, -9223372036854775807LL -1, 24, 0);
- TEST_STRTOLL("-01000000000000000000000",8, -9223372036854775807LL -1, 24, 0);
- TEST_STRTOLL("-1000000000000000000000", 8, -9223372036854775807LL -1, 23, 0);
- TEST_STRTOLL("-01000000000000000000001",0, -9223372036854775807LL -1, 24, ERANGE);
- TEST_STRTOLL("-01000000000000000000001",8, -9223372036854775807LL -1, 24, ERANGE);
- TEST_STRTOLL("-1000000000000000000001", 8, -9223372036854775807LL -1, 23, ERANGE);
-
- printf("success: strtoll\n");
- return true;
-}
-
-static int test_strtoull(void)
-{
- printf("test: strtoull\n");
-
-#define TEST_STRTOULL(str,base,res,diff,errnoo) TEST_STRTO_X(long long unsigned int,"%llu",strtoull,str,base,res,diff,errnoo)
-
- TEST_STRTOULL("15", 10, 15LLU, 2, 0);
- TEST_STRTOULL(" 15", 10, 15LLU, 4, 0);
- TEST_STRTOULL("15", 0, 15LLU, 2, 0);
- TEST_STRTOULL(" 15 ", 0, 15LLU, 3, 0);
- TEST_STRTOULL("+15", 10, 15LLU, 3, 0);
- TEST_STRTOULL(" +15", 10, 15LLU, 5, 0);
- TEST_STRTOULL("+15", 0, 15LLU, 3, 0);
- TEST_STRTOULL(" +15 ", 0, 15LLU, 4, 0);
- TEST_STRTOULL("-15", 10, 18446744073709551601LLU, 3, 0);
- TEST_STRTOULL(" -15", 10, 18446744073709551601LLU, 5, 0);
- TEST_STRTOULL("-15", 0, 18446744073709551601LLU, 3, 0);
- TEST_STRTOULL(" -15 ", 0, 18446744073709551601LLU, 4, 0);
- TEST_STRTOULL("015", 10, 15LLU, 3, 0);
- TEST_STRTOULL(" 015", 10, 15LLU, 5, 0);
- TEST_STRTOULL("015", 0, 13LLU, 3, 0);
- TEST_STRTOULL(" 015", 0, 13LLU, 5, 0);
- TEST_STRTOULL("0x15", 10, 0LLU, 1, 0);
- TEST_STRTOULL(" 0x15", 10, 0LLU, 3, 0);
- TEST_STRTOULL("0x15", 0, 21LLU, 4, 0);
- TEST_STRTOULL(" 0x15", 0, 21LLU, 6, 0);
-
- TEST_STRTOULL("10", 16, 16LLU, 2, 0);
- TEST_STRTOULL(" 10 ", 16, 16LLU, 4, 0);
- TEST_STRTOULL("0x10", 16, 16LLU, 4, 0);
- TEST_STRTOULL("0x10", 0, 16LLU, 4, 0);
- TEST_STRTOULL(" 0x10 ", 0, 16LLU, 5, 0);
- TEST_STRTOULL("+10", 16, 16LLU, 3, 0);
- TEST_STRTOULL(" +10 ", 16, 16LLU, 5, 0);
- TEST_STRTOULL("+0x10", 16, 16LLU, 5, 0);
- TEST_STRTOULL("+0x10", 0, 16LLU, 5, 0);
- TEST_STRTOULL(" +0x10 ", 0, 16LLU, 6, 0);
- TEST_STRTOULL("-10", 16, -16LLU, 3, 0);
- TEST_STRTOULL(" -10 ", 16, -16LLU, 5, 0);
- TEST_STRTOULL("-0x10", 16, -16LLU, 5, 0);
- TEST_STRTOULL("-0x10", 0, -16LLU, 5, 0);
- TEST_STRTOULL(" -0x10 ", 0, -16LLU, 6, 0);
- TEST_STRTOULL("010", 16, 16LLU, 3, 0);
- TEST_STRTOULL(" 010 ", 16, 16LLU, 5, 0);
- TEST_STRTOULL("-010", 16, -16LLU, 4, 0);
-
- TEST_STRTOULL("11", 8, 9LLU, 2, 0);
- TEST_STRTOULL("011", 8, 9LLU, 3, 0);
- TEST_STRTOULL("011", 0, 9LLU, 3, 0);
- TEST_STRTOULL("-11", 8, -9LLU, 3, 0);
- TEST_STRTOULL("-011", 8, -9LLU, 4, 0);
- TEST_STRTOULL("-011", 0, -9LLU, 4, 0);
-
- TEST_STRTOULL("011", 8, 9LLU, 3, 0);
- TEST_STRTOULL("011", 0, 9LLU, 3, 0);
- TEST_STRTOULL("-11", 8, -9LLU, 3, 0);
- TEST_STRTOULL("-011", 8, -9LLU, 4, 0);
- TEST_STRTOULL("-011", 0, -9LLU, 4, 0);
-
- TEST_STRTOULL("Text", 0, 0LLU, 0, 0);
-
- TEST_STRTOULL("9223372036854775807", 10, 9223372036854775807LLU, 19, 0);
- TEST_STRTOULL("9223372036854775807", 0, 9223372036854775807LLU, 19, 0);
- TEST_STRTOULL("9223372036854775808", 0, 9223372036854775808LLU, 19, 0);
- TEST_STRTOULL("9223372036854775808", 10, 9223372036854775808LLU, 19, 0);
- TEST_STRTOULL("0x7FFFFFFFFFFFFFFF", 0, 9223372036854775807LLU, 18, 0);
- TEST_STRTOULL("0x7FFFFFFFFFFFFFFF", 16, 9223372036854775807LLU, 18, 0);
- TEST_STRTOULL("7FFFFFFFFFFFFFFF", 16, 9223372036854775807LLU, 16, 0);
- TEST_STRTOULL("0x8000000000000000", 0, 9223372036854775808LLU, 18, 0);
- TEST_STRTOULL("0x8000000000000000", 16, 9223372036854775808LLU, 18, 0);
- TEST_STRTOULL("8000000000000000", 16, 9223372036854775808LLU, 16, 0);
- TEST_STRTOULL("0777777777777777777777", 0, 9223372036854775807LLU, 22, 0);
- TEST_STRTOULL("0777777777777777777777", 8, 9223372036854775807LLU, 22, 0);
- TEST_STRTOULL("777777777777777777777", 8, 9223372036854775807LLU, 21, 0);
- TEST_STRTOULL("01000000000000000000000",0, 9223372036854775808LLU, 23, 0);
- TEST_STRTOULL("01000000000000000000000",8, 9223372036854775808LLU, 23, 0);
- TEST_STRTOULL("1000000000000000000000", 8, 9223372036854775808LLU, 22, 0);
-
- TEST_STRTOULL("-9223372036854775808", 10, 9223372036854775808LLU, 20, 0);
- TEST_STRTOULL("-9223372036854775808", 0, 9223372036854775808LLU, 20, 0);
- TEST_STRTOULL("-9223372036854775809", 0, 9223372036854775807LLU, 20, 0);
- TEST_STRTOULL("-9223372036854775809", 10, 9223372036854775807LLU, 20, 0);
- TEST_STRTOULL("-0x8000000000000000", 0, 9223372036854775808LLU, 19, 0);
- TEST_STRTOULL("-0x8000000000000000", 16, 9223372036854775808LLU, 19, 0);
- TEST_STRTOULL("-8000000000000000", 16, 9223372036854775808LLU, 17, 0);
- TEST_STRTOULL("-0x8000000000000001", 0, 9223372036854775807LLU, 19, 0);
- TEST_STRTOULL("-0x8000000000000001", 16, 9223372036854775807LLU, 19, 0);
- TEST_STRTOULL("-8000000000000001", 16, 9223372036854775807LLU, 17, 0);
- TEST_STRTOULL("-01000000000000000000000",0, 9223372036854775808LLU, 24, 0);
- TEST_STRTOULL("-01000000000000000000000",8, 9223372036854775808LLU, 24, 0);
- TEST_STRTOULL("-1000000000000000000000",8, 9223372036854775808LLU, 23, 0);
- TEST_STRTOULL("-01000000000000000000001",0, 9223372036854775807LLU, 24, 0);
- TEST_STRTOULL("-01000000000000000000001",8, 9223372036854775807LLU, 24, 0);
- TEST_STRTOULL("-1000000000000000000001",8, 9223372036854775807LLU, 23, 0);
-
- TEST_STRTOULL("18446744073709551615", 0, 18446744073709551615LLU, 20, 0);
- TEST_STRTOULL("18446744073709551615", 10, 18446744073709551615LLU, 20, 0);
- TEST_STRTOULL("18446744073709551616", 0, 18446744073709551615LLU, 20, ERANGE);
- TEST_STRTOULL("18446744073709551616", 10, 18446744073709551615LLU, 20, ERANGE);
- TEST_STRTOULL("0xFFFFFFFFFFFFFFFF", 0, 18446744073709551615LLU, 18, 0);
- TEST_STRTOULL("0xFFFFFFFFFFFFFFFF", 16, 18446744073709551615LLU, 18, 0);
- TEST_STRTOULL("FFFFFFFFFFFFFFFF", 16, 18446744073709551615LLU, 16, 0);
- TEST_STRTOULL("0x10000000000000000", 0, 18446744073709551615LLU, 19, ERANGE);
- TEST_STRTOULL("0x10000000000000000", 16, 18446744073709551615LLU, 19, ERANGE);
- TEST_STRTOULL("10000000000000000", 16, 18446744073709551615LLU, 17, ERANGE);
- TEST_STRTOULL("01777777777777777777777",0, 18446744073709551615LLU, 23, 0);
- TEST_STRTOULL("01777777777777777777777",8, 18446744073709551615LLU, 23, 0);
- TEST_STRTOULL("1777777777777777777777", 8, 18446744073709551615LLU, 22, 0);
- TEST_STRTOULL("02000000000000000000000",0, 18446744073709551615LLU, 23, ERANGE);
- TEST_STRTOULL("02000000000000000000000",8, 18446744073709551615LLU, 23, ERANGE);
- TEST_STRTOULL("2000000000000000000000", 8, 18446744073709551615LLU, 22, ERANGE);
-
- TEST_STRTOULL("-18446744073709551615", 0, 1LLU, 21, 0);
- TEST_STRTOULL("-18446744073709551615", 10, 1LLU, 21, 0);
- TEST_STRTOULL("-18446744073709551616", 0, 18446744073709551615LLU, 21, ERANGE);
- TEST_STRTOULL("-18446744073709551616", 10, 18446744073709551615LLU, 21, ERANGE);
- TEST_STRTOULL("-0xFFFFFFFFFFFFFFFF", 0, 1LLU, 19, 0);
- TEST_STRTOULL("-0xFFFFFFFFFFFFFFFF", 16, 1LLU, 19, 0);
- TEST_STRTOULL("-FFFFFFFFFFFFFFFF", 16, 1LLU, 17, 0);
- TEST_STRTOULL("-0x10000000000000000", 0, 18446744073709551615LLU, 20, ERANGE);
- TEST_STRTOULL("-0x10000000000000000", 16, 18446744073709551615LLU, 20, ERANGE);
- TEST_STRTOULL("-10000000000000000", 16, 18446744073709551615LLU, 18, ERANGE);
- TEST_STRTOULL("-01777777777777777777777",0, 1LLU, 24, 0);
- TEST_STRTOULL("-01777777777777777777777",8, 1LLU, 24, 0);
- TEST_STRTOULL("-1777777777777777777777",8, 1LLU, 23, 0);
- TEST_STRTOULL("-02000000000000000000000",0, 18446744073709551615LLU, 24, ERANGE);
- TEST_STRTOULL("-02000000000000000000000",8, 18446744073709551615LLU, 24, ERANGE);
- TEST_STRTOULL("-2000000000000000000000",8, 18446744073709551615LLU, 23, ERANGE);
-
- printf("success: strtoull\n");
- return true;
-}
-
-/*
-FIXME:
-Types:
-bool
-socklen_t
-uint_t
-uint{8,16,32,64}_t
-int{8,16,32,64}_t
-intptr_t
-
-Constants:
-PATH_NAME_MAX
-UINT{16,32,64}_MAX
-INT32_MAX
-*/
-
-static int test_va_copy(void)
-{
- /* FIXME */
- return true;
-}
-
-static int test_FUNCTION(void)
-{
- printf("test: FUNCTION\n");
- if (strcmp(__FUNCTION__, "test_FUNCTION") != 0) {
- printf("failure: FAILURE [\nFAILURE invalid\n]\n");
- return false;
- }
- printf("success: FUNCTION\n");
- return true;
-}
-
-static int test_MIN(void)
-{
- printf("test: MIN\n");
- if (MIN(20, 1) != 1) {
- printf("failure: MIN [\nMIN invalid\n]\n");
- return false;
- }
- if (MIN(1, 20) != 1) {
- printf("failure: MIN [\nMIN invalid\n]\n");
- return false;
- }
- printf("success: MIN\n");
- return true;
-}
-
-static int test_MAX(void)
-{
- printf("test: MAX\n");
- if (MAX(20, 1) != 20) {
- printf("failure: MAX [\nMAX invalid\n]\n");
- return false;
- }
- if (MAX(1, 20) != 20) {
- printf("failure: MAX [\nMAX invalid\n]\n");
- return false;
- }
- printf("success: MAX\n");
- return true;
-}
-
-static int test_socketpair(void)
-{
- int sock[2];
- char buf[20];
-
- printf("test: socketpair\n");
-
- if (socketpair(AF_UNIX, SOCK_STREAM, 0, sock) == -1) {
- printf("failure: socketpair [\n"
- "socketpair() failed\n"
- "]\n");
- return false;
- }
-
- if (write(sock[1], "automatisch", 12) == -1) {
- printf("failure: socketpair [\n"
- "write() failed: %s\n"
- "]\n", strerror(errno));
- return false;
- }
-
- if (read(sock[0], buf, 12) == -1) {
- printf("failure: socketpair [\n"
- "read() failed: %s\n"
- "]\n", strerror(errno));
- return false;
- }
-
- if (strcmp(buf, "automatisch") != 0) {
- printf("failure: socketpair [\n"
- "expected: automatisch, got: %s\n"
- "]\n", buf);
- return false;
- }
-
- printf("success: socketpair\n");
-
- return true;
-}
-
-extern int libreplace_test_strptime(void);
-
-static int test_strptime(void)
-{
- return libreplace_test_strptime();
-}
-
-extern int getifaddrs_test(void);
-
-static int test_getifaddrs(void)
-{
-
- printf("test: getifaddrs\n");
-
- if (getifaddrs_test() != 0) {
- printf("failure: getifaddrs\n");
- return false;
- }
-
- printf("success: getifaddrs\n");
- return true;
-}
-
-static int test_utime(void)
-{
- struct utimbuf u;
- struct stat st1, st2, st3;
- int fd;
-
- printf("test: utime\n");
- unlink(TESTFILE);
-
- fd = open(TESTFILE, O_RDWR|O_CREAT, 0600);
- if (fd == -1) {
- printf("failure: utime [\n"
- "creating '%s' failed - %s\n]\n",
- TESTFILE, strerror(errno));
- return false;
- }
-
- if (fstat(fd, &st1) != 0) {
- printf("failure: utime [\n"
- "fstat (1) failed - %s\n]\n",
- strerror(errno));
- return false;
- }
-
- u.actime = st1.st_atime + 300;
- u.modtime = st1.st_mtime - 300;
- if (utime(TESTFILE, &u) != 0) {
- printf("failure: utime [\n"
- "utime(&u) failed - %s\n]\n",
- strerror(errno));
- return false;
- }
-
- if (fstat(fd, &st2) != 0) {
- printf("failure: utime [\n"
- "fstat (2) failed - %s\n]\n",
- strerror(errno));
- return false;
- }
-
- if (utime(TESTFILE, NULL) != 0) {
- printf("failure: utime [\n"
- "utime(NULL) failed - %s\n]\n",
- strerror(errno));
- return false;
- }
-
- if (fstat(fd, &st3) != 0) {
- printf("failure: utime [\n"
- "fstat (3) failed - %s\n]\n",
- strerror(errno));
- return false;
- }
-
-#define CMP_VAL(a,c,b) do { \
- if (a c b) { \
- printf("failure: utime [\n" \
- "%s: %s(%d) %s %s(%d)\n]\n", \
- __location__, \
- #a, (int)a, #c, #b, (int)b); \
- return false; \
- } \
-} while(0)
-#define EQUAL_VAL(a,b) CMP_VAL(a,!=,b)
-#define GREATER_VAL(a,b) CMP_VAL(a,<=,b)
-#define LESSER_VAL(a,b) CMP_VAL(a,>=,b)
-
- EQUAL_VAL(st2.st_atime, st1.st_atime + 300);
- EQUAL_VAL(st2.st_mtime, st1.st_mtime - 300);
- LESSER_VAL(st3.st_atime, st2.st_atime);
- GREATER_VAL(st3.st_mtime, st2.st_mtime);
-
-#undef CMP_VAL
-#undef EQUAL_VAL
-#undef GREATER_VAL
-#undef LESSER_VAL
-
- unlink(TESTFILE);
- printf("success: utime\n");
- return true;
-}
-
-static int test_utimes(void)
-{
- struct timeval tv[2];
- struct stat st1, st2;
- int fd;
-
- printf("test: utimes\n");
- unlink(TESTFILE);
-
- fd = open(TESTFILE, O_RDWR|O_CREAT, 0600);
- if (fd == -1) {
- printf("failure: utimes [\n"
- "creating '%s' failed - %s\n]\n",
- TESTFILE, strerror(errno));
- return false;
- }
-
- if (fstat(fd, &st1) != 0) {
- printf("failure: utimes [\n"
- "fstat (1) failed - %s\n]\n",
- strerror(errno));
- return false;
- }
-
- ZERO_STRUCT(tv);
- tv[0].tv_sec = st1.st_atime + 300;
- tv[1].tv_sec = st1.st_mtime - 300;
- if (utimes(TESTFILE, tv) != 0) {
- printf("failure: utimes [\n"
- "utimes(tv) failed - %s\n]\n",
- strerror(errno));
- return false;
- }
-
- if (fstat(fd, &st2) != 0) {
- printf("failure: utimes [\n"
- "fstat (2) failed - %s\n]\n",
- strerror(errno));
- return false;
- }
-
-#define EQUAL_VAL(a,b) do { \
- if (a != b) { \
- printf("failure: utimes [\n" \
- "%s: %s(%d) != %s(%d)\n]\n", \
- __location__, \
- #a, (int)a, #b, (int)b); \
- return false; \
- } \
-} while(0)
-
- EQUAL_VAL(st2.st_atime, st1.st_atime + 300);
- EQUAL_VAL(st2.st_mtime, st1.st_mtime - 300);
-
-#undef EQUAL_VAL
-
- unlink(TESTFILE);
- printf("success: utimes\n");
- return true;
-}
-
-struct torture_context;
-bool torture_local_replace(struct torture_context *ctx)
-{
- bool ret = true;
- ret &= test_ftruncate();
- ret &= test_strlcpy();
- ret &= test_strlcat();
- ret &= test_mktime();
- ret &= test_initgroups();
- ret &= test_memmove();
- ret &= test_strdup();
- ret &= test_setlinebuf();
- ret &= test_vsyslog();
- ret &= test_timegm();
- ret &= test_setenv();
- ret &= test_strndup();
- ret &= test_strnlen();
- ret &= test_waitpid();
- ret &= test_seteuid();
- ret &= test_setegid();
- ret &= test_asprintf();
- ret &= test_snprintf();
- ret &= test_vasprintf();
- ret &= test_vsnprintf();
- ret &= test_opendir();
- ret &= test_readdir();
- ret &= test_telldir();
- ret &= test_seekdir();
- ret &= test_dlopen();
- ret &= test_chroot();
- ret &= test_bzero();
- ret &= test_strerror();
- ret &= test_errno();
- ret &= test_mkdtemp();
- ret &= test_mkstemp();
- ret &= test_pread();
- ret &= test_pwrite();
- ret &= test_getpass();
- ret &= test_inet_ntoa();
- ret &= test_strtoll();
- ret &= test_strtoull();
- ret &= test_va_copy();
- ret &= test_FUNCTION();
- ret &= test_MIN();
- ret &= test_MAX();
- ret &= test_socketpair();
- ret &= test_strptime();
- ret &= test_getifaddrs();
- ret &= test_utime();
- ret &= test_utimes();
-
- return ret;
-}
-
-#if _SAMBA_BUILD_<4
-int main(void)
-{
- bool ret = torture_local_replace(NULL);
- if (ret)
- return 0;
- return -1;
-}
-#endif
diff --git a/source3/lib/replace/timegm.c b/source3/lib/replace/timegm.c
deleted file mode 100644
index 395c684e11..0000000000
--- a/source3/lib/replace/timegm.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 1997 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- adapted for Samba4 by Andrew Tridgell
-*/
-
-#include "replace.h"
-#include "system/time.h"
-
-static int is_leap(unsigned y)
-{
- y += 1900;
- return (y % 4) == 0 && ((y % 100) != 0 || (y % 400) == 0);
-}
-
-time_t rep_timegm(struct tm *tm)
-{
- static const unsigned ndays[2][12] ={
- {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
- {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}};
- time_t res = 0;
- unsigned i;
-
- if (tm->tm_mon > 12 ||
- tm->tm_mon < 0 ||
- tm->tm_mday > 31 ||
- tm->tm_min > 60 ||
- tm->tm_sec > 60 ||
- tm->tm_hour > 24) {
- /* invalid tm structure */
- return 0;
- }
-
- for (i = 70; i < tm->tm_year; ++i)
- res += is_leap(i) ? 366 : 365;
-
- for (i = 0; i < tm->tm_mon; ++i)
- res += ndays[is_leap(tm->tm_year)][i];
- res += tm->tm_mday - 1;
- res *= 24;
- res += tm->tm_hour;
- res *= 60;
- res += tm->tm_min;
- res *= 60;
- res += tm->tm_sec;
- return res;
-}
diff --git a/source3/lib/replace/timegm.m4 b/source3/lib/replace/timegm.m4
deleted file mode 100644
index 59f3ae0521..0000000000
--- a/source3/lib/replace/timegm.m4
+++ /dev/null
@@ -1 +0,0 @@
-AC_CHECK_FUNCS(timegm,[],[LIBREPLACEOBJ="${LIBREPLACEOBJ} timegm.o"])
diff --git a/source3/lib/replace/win32.m4 b/source3/lib/replace/win32.m4
deleted file mode 100644
index eb364e2cb9..0000000000
--- a/source3/lib/replace/win32.m4
+++ /dev/null
@@ -1,20 +0,0 @@
-AC_CHECK_HEADERS(direct.h windows.h winsock2.h ws2tcpip.h)
-
-#######################################
-# Check for mkdir mode
-AC_CACHE_CHECK( [whether mkdir supports mode], libreplace_cv_mkdir_has_mode,
- AC_TRY_COMPILE([
- #include <stdio.h>
- #ifdef HAVE_DIRECT_H
- #include <direct.h>
- #endif],[
- mkdir("foo",0777);
- return 0;
- ],
- libreplace_cv_mkdir_has_mode="yes",
- libreplace_cv_mkdir_has_mode="no") )
-
-if test "$libreplace_cv_mkdir_has_mode" = "yes"
-then
- AC_DEFINE(HAVE_MKDIR_MODE, 1, [Define if target mkdir supports mode option])
-fi
diff --git a/source3/lib/replace/win32_replace.h b/source3/lib/replace/win32_replace.h
deleted file mode 100644
index 9901e72f6e..0000000000
--- a/source3/lib/replace/win32_replace.h
+++ /dev/null
@@ -1,159 +0,0 @@
-#ifndef _WIN32_REPLACE_H
-#define _WIN32_REPLACE_H
-
-#ifdef HAVE_WINSOCK2_H
-#include <winsock2.h>
-#endif
-
-#ifdef HAVE_WS2TCPIP_H
-#include <ws2tcpip.h>
-#endif
-
-#ifdef HAVE_WINDOWS_H
-#include <windows.h>
-#endif
-
-/* Map BSD Socket errorcodes to the WSA errorcodes (if possible) */
-
-#define EAFNOSUPPORT WSAEAFNOSUPPORT
-#define ECONNREFUSED WSAECONNREFUSED
-#define EINPROGRESS WSAEINPROGRESS
-#define EMSGSIZE WSAEMSGSIZE
-#define ENOBUFS WSAENOBUFS
-#define ENOTSOCK WSAENOTSOCK
-#define ENETUNREACH WSAENETUNREACH
-#define ENOPROTOOPT WSAENOPROTOOPT
-#define ENOTCONN WSAENOTCONN
-#define ENOTSUP 134
-
-/* We undefine the following constants due to conflicts with the w32api headers
- * and the Windows Platform SDK/DDK.
- */
-
-#undef interface
-
-#undef ERROR_INVALID_PARAMETER
-#undef ERROR_INSUFFICIENT_BUFFER
-#undef ERROR_INVALID_DATATYPE
-
-#undef FILE_GENERIC_READ
-#undef FILE_GENERIC_WRITE
-#undef FILE_GENERIC_EXECUTE
-#undef FILE_ATTRIBUTE_READONLY
-#undef FILE_ATTRIBUTE_HIDDEN
-#undef FILE_ATTRIBUTE_SYSTEM
-#undef FILE_ATTRIBUTE_DIRECTORY
-#undef FILE_ATTRIBUTE_ARCHIVE
-#undef FILE_ATTRIBUTE_DEVICE
-#undef FILE_ATTRIBUTE_NORMAL
-#undef FILE_ATTRIBUTE_TEMPORARY
-#undef FILE_ATTRIBUTE_REPARSE_POINT
-#undef FILE_ATTRIBUTE_COMPRESSED
-#undef FILE_ATTRIBUTE_OFFLINE
-#undef FILE_ATTRIBUTE_ENCRYPTED
-#undef FILE_FLAG_WRITE_THROUGH
-#undef FILE_FLAG_NO_BUFFERING
-#undef FILE_FLAG_RANDOM_ACCESS
-#undef FILE_FLAG_SEQUENTIAL_SCAN
-#undef FILE_FLAG_DELETE_ON_CLOSE
-#undef FILE_FLAG_BACKUP_SEMANTICS
-#undef FILE_FLAG_POSIX_SEMANTICS
-#undef FILE_TYPE_DISK
-#undef FILE_TYPE_UNKNOWN
-#undef FILE_CASE_SENSITIVE_SEARCH
-#undef FILE_CASE_PRESERVED_NAMES
-#undef FILE_UNICODE_ON_DISK
-#undef FILE_PERSISTENT_ACLS
-#undef FILE_FILE_COMPRESSION
-#undef FILE_VOLUME_QUOTAS
-#undef FILE_VOLUME_IS_COMPRESSED
-#undef FILE_NOTIFY_CHANGE_FILE_NAME
-#undef FILE_NOTIFY_CHANGE_DIR_NAME
-#undef FILE_NOTIFY_CHANGE_ATTRIBUTES
-#undef FILE_NOTIFY_CHANGE_SIZE
-#undef FILE_NOTIFY_CHANGE_LAST_WRITE
-#undef FILE_NOTIFY_CHANGE_LAST_ACCESS
-#undef FILE_NOTIFY_CHANGE_CREATION
-#undef FILE_NOTIFY_CHANGE_EA
-#undef FILE_NOTIFY_CHANGE_SECURITY
-#undef FILE_NOTIFY_CHANGE_STREAM_NAME
-#undef FILE_NOTIFY_CHANGE_STREAM_SIZE
-#undef FILE_NOTIFY_CHANGE_STREAM_WRITE
-#undef FILE_NOTIFY_CHANGE_NAME
-
-#undef PRINTER_ATTRIBUTE_QUEUED
-#undef PRINTER_ATTRIBUTE_DIRECT
-#undef PRINTER_ATTRIBUTE_DEFAULT
-#undef PRINTER_ATTRIBUTE_SHARED
-#undef PRINTER_ATTRIBUTE_NETWORK
-#undef PRINTER_ATTRIBUTE_HIDDEN
-#undef PRINTER_ATTRIBUTE_LOCAL
-#undef PRINTER_ATTRIBUTE_ENABLE_DEVQ
-#undef PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS
-#undef PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST
-#undef PRINTER_ATTRIBUTE_WORK_OFFLINE
-#undef PRINTER_ATTRIBUTE_ENABLE_BIDI
-#undef PRINTER_ATTRIBUTE_RAW_ONLY
-#undef PRINTER_ATTRIBUTE_PUBLISHED
-#undef PRINTER_ENUM_DEFAULT
-#undef PRINTER_ENUM_LOCAL
-#undef PRINTER_ENUM_CONNECTIONS
-#undef PRINTER_ENUM_FAVORITE
-#undef PRINTER_ENUM_NAME
-#undef PRINTER_ENUM_REMOTE
-#undef PRINTER_ENUM_SHARED
-#undef PRINTER_ENUM_NETWORK
-#undef PRINTER_ENUM_EXPAND
-#undef PRINTER_ENUM_CONTAINER
-#undef PRINTER_ENUM_ICON1
-#undef PRINTER_ENUM_ICON2
-#undef PRINTER_ENUM_ICON3
-#undef PRINTER_ENUM_ICON4
-#undef PRINTER_ENUM_ICON5
-#undef PRINTER_ENUM_ICON6
-#undef PRINTER_ENUM_ICON7
-#undef PRINTER_ENUM_ICON8
-#undef PRINTER_STATUS_PAUSED
-#undef PRINTER_STATUS_ERROR
-#undef PRINTER_STATUS_PENDING_DELETION
-#undef PRINTER_STATUS_PAPER_JAM
-#undef PRINTER_STATUS_PAPER_OUT
-#undef PRINTER_STATUS_MANUAL_FEED
-#undef PRINTER_STATUS_PAPER_PROBLEM
-#undef PRINTER_STATUS_OFFLINE
-#undef PRINTER_STATUS_IO_ACTIVE
-#undef PRINTER_STATUS_BUSY
-#undef PRINTER_STATUS_PRINTING
-#undef PRINTER_STATUS_OUTPUT_BIN_FULL
-#undef PRINTER_STATUS_NOT_AVAILABLE
-#undef PRINTER_STATUS_WAITING
-#undef PRINTER_STATUS_PROCESSING
-#undef PRINTER_STATUS_INITIALIZING
-#undef PRINTER_STATUS_WARMING_UP
-#undef PRINTER_STATUS_TONER_LOW
-#undef PRINTER_STATUS_NO_TONER
-#undef PRINTER_STATUS_PAGE_PUNT
-#undef PRINTER_STATUS_USER_INTERVENTION
-#undef PRINTER_STATUS_OUT_OF_MEMORY
-#undef PRINTER_STATUS_DOOR_OPEN
-#undef PRINTER_STATUS_SERVER_UNKNOWN
-#undef PRINTER_STATUS_POWER_SAVE
-
-#undef DWORD
-#undef HKEY_CLASSES_ROOT
-#undef HKEY_CURRENT_USER
-#undef HKEY_LOCAL_MACHINE
-#undef HKEY_USERS
-#undef HKEY_PERFORMANCE_DATA
-#undef HKEY_CURRENT_CONFIG
-#undef HKEY_DYN_DATA
-#undef REG_DWORD
-#undef REG_QWORD
-
-#undef SERVICE_STATE_ALL
-
-#undef SE_GROUP_MANDATORY
-#undef SE_GROUP_ENABLED_BY_DEFAULT
-#undef SE_GROUP_ENABLED
-
-#endif /* _WIN32_REPLACE_H */
diff --git a/source3/lib/secace.c b/source3/lib/secace.c
index 8760a6109a..9f5a0c02ba 100644
--- a/source3/lib/secace.c
+++ b/source3/lib/secace.c
@@ -55,7 +55,7 @@ void sec_ace_copy(SEC_ACE *ace_dest, SEC_ACE *ace_src)
********************************************************************/
void init_sec_ace(SEC_ACE *t, const DOM_SID *sid, enum security_ace_type type,
- uint32 mask, uint8 flag)
+ uint32_t mask, uint8 flag)
{
t->type = type;
t->flags = flag;
diff --git a/source3/lib/secdesc.c b/source3/lib/secdesc.c
index 44ae23271e..52ff067d6a 100644
--- a/source3/lib/secdesc.c
+++ b/source3/lib/secdesc.c
@@ -249,7 +249,7 @@ NTSTATUS marshall_sec_desc(TALLOC_CTX *mem_ctx,
enum ndr_err_code ndr_err;
ndr_err = ndr_push_struct_blob(
- &blob, mem_ctx, secdesc,
+ &blob, mem_ctx, NULL, secdesc,
(ndr_push_flags_fn_t)ndr_push_security_descriptor);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -285,7 +285,7 @@ NTSTATUS unmarshall_sec_desc(TALLOC_CTX *mem_ctx, uint8 *data, size_t len,
blob = data_blob_const(data, len);
ndr_err = ndr_pull_struct_blob(
- &blob, result, result,
+ &blob, result, NULL, result,
(ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -512,7 +512,7 @@ SEC_DESC_BUF *se_create_child_secdesc(TALLOC_CTX *ctx, SEC_DESC *parent_ctr,
if (!inherit)
continue;
- init_sec_access(&new_ace->access_mask, ace->access_mask);
+ new_ace->access_mask = ace->access_mask;
init_sec_ace(new_ace, &ace->trustee, ace->type,
new_ace->access_mask, new_flags);
@@ -546,14 +546,3 @@ SEC_DESC_BUF *se_create_child_secdesc(TALLOC_CTX *ctx, SEC_DESC *parent_ctr,
return sdb;
}
-
-/*******************************************************************
- Sets up a SEC_ACCESS structure.
-********************************************************************/
-
-void init_sec_access(uint32 *t, uint32 mask)
-{
- *t = mask;
-}
-
-
diff --git a/source3/lib/select.c b/source3/lib/select.c
index c3da6a9bba..14e59257ba 100644
--- a/source3/lib/select.c
+++ b/source3/lib/select.c
@@ -30,7 +30,7 @@
static pid_t initialised;
static int select_pipe[2];
-static VOLATILE unsigned pipe_written, pipe_read;
+static volatile unsigned pipe_written, pipe_read;
/*******************************************************************
Call this from all Samba signal handlers if you want to avoid a
@@ -161,7 +161,7 @@ int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorf
errorfds_buf = *errorfds;
if (ptval && (errno == EINTR)) {
struct timeval now_time;
- SMB_BIG_INT tdif;
+ int64_t tdif;
GetTimeOfDay(&now_time);
tdif = usec_time_diff(&end_time, &now_time);
diff --git a/source3/lib/sharesec.c b/source3/lib/sharesec.c
index 33f66ca47f..298655e181 100644
--- a/source3/lib/sharesec.c
+++ b/source3/lib/sharesec.c
@@ -124,7 +124,7 @@ static bool share_info_db_init(void)
SEC_DESC *get_share_security_default( TALLOC_CTX *ctx, size_t *psize, uint32 def_access)
{
- SEC_ACCESS sa;
+ uint32_t sa;
SEC_ACE ace;
SEC_ACL *psa = NULL;
SEC_DESC *psd = NULL;
@@ -132,7 +132,7 @@ SEC_DESC *get_share_security_default( TALLOC_CTX *ctx, size_t *psize, uint32 def
se_map_generic(&spec_access, &file_generic_mapping);
- init_sec_access(&sa, def_access | spec_access );
+ sa = (def_access | spec_access );
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) {
@@ -332,7 +332,7 @@ bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, SEC_DESC **ppsd)
}
for (i = 0; i < num_aces; i++) {
- SEC_ACCESS sa;
+ uint32_t sa;
uint32 g_access;
uint32 s_access;
DOM_SID sid;
@@ -380,7 +380,7 @@ bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, SEC_DESC **ppsd)
pacl++; /* Go past any ',' */
se_map_generic(&s_access, &file_generic_mapping);
- init_sec_access(&sa, g_access | s_access );
+ sa = (g_access | s_access);
init_sec_ace(&ace_list[i], &sid, type, sa, 0);
}
diff --git a/source3/lib/signal.c b/source3/lib/signal.c
deleted file mode 100644
index 4b1c95eb77..0000000000
--- a/source3/lib/signal.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- signal handling functions
-
- Copyright (C) Andrew Tridgell 1998
-
- 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"
-
-/****************************************************************************
- Catch child exits and reap the child zombie status.
-****************************************************************************/
-
-static void sig_cld(int signum)
-{
- while (sys_waitpid((pid_t)-1,(int *)NULL, WNOHANG) > 0)
- ;
-
- /*
- * Turns out it's *really* important not to
- * restore the signal handler here if we have real POSIX
- * signal handling. If we do, then we get the signal re-delivered
- * immediately - hey presto - instant loop ! JRA.
- */
-
-#if !defined(HAVE_SIGACTION)
- CatchSignal(SIGCLD, sig_cld);
-#endif
-}
-
-/****************************************************************************
-catch child exits - leave status;
-****************************************************************************/
-
-static void sig_cld_leave_status(int signum)
-{
- /*
- * Turns out it's *really* important not to
- * restore the signal handler here if we have real POSIX
- * signal handling. If we do, then we get the signal re-delivered
- * immediately - hey presto - instant loop ! JRA.
- */
-
-#if !defined(HAVE_SIGACTION)
- CatchSignal(SIGCLD, sig_cld_leave_status);
-#endif
-}
-
-/*******************************************************************
- Block sigs.
-********************************************************************/
-
-void BlockSignals(bool block,int signum)
-{
-#ifdef HAVE_SIGPROCMASK
- sigset_t set;
- sigemptyset(&set);
- sigaddset(&set,signum);
- sigprocmask(block?SIG_BLOCK:SIG_UNBLOCK,&set,NULL);
-#elif defined(HAVE_SIGBLOCK)
- if (block) {
- sigblock(sigmask(signum));
- } else {
- sigsetmask(siggetmask() & ~sigmask(signum));
- }
-#else
- /* yikes! This platform can't block signals? */
- static int done;
- if (!done) {
- DEBUG(0,("WARNING: No signal blocking available\n"));
- done=1;
- }
-#endif
-}
-
-/*******************************************************************
- Catch a signal. This should implement the following semantics:
-
- 1) The handler remains installed after being called.
- 2) The signal should be blocked during handler execution.
-********************************************************************/
-
-void (*CatchSignal(int signum,void (*handler)(int )))(int)
-{
-#ifdef HAVE_SIGACTION
- struct sigaction act;
- struct sigaction oldact;
-
- ZERO_STRUCT(act);
-
- act.sa_handler = handler;
-#ifdef SA_RESTART
- /*
- * We *want* SIGALRM to interrupt a system call.
- */
- if(signum != SIGALRM)
- act.sa_flags = SA_RESTART;
-#endif
- sigemptyset(&act.sa_mask);
- sigaddset(&act.sa_mask,signum);
- sigaction(signum,&act,&oldact);
- return oldact.sa_handler;
-#else /* !HAVE_SIGACTION */
- /* FIXME: need to handle sigvec and systems with broken signal() */
- return signal(signum, handler);
-#endif
-}
-
-/*******************************************************************
- Ignore SIGCLD via whatever means is necessary for this OS.
-********************************************************************/
-
-void CatchChild(void)
-{
- CatchSignal(SIGCLD, sig_cld);
-}
-
-/*******************************************************************
- Catch SIGCLD but leave the child around so it's status can be reaped.
-********************************************************************/
-
-void CatchChildLeaveStatus(void)
-{
- CatchSignal(SIGCLD, sig_cld_leave_status);
-}
diff --git a/source3/lib/smbconf/smbconf_txt.c b/source3/lib/smbconf/smbconf_txt.c
index 1a29f40164..1393a098d5 100644
--- a/source3/lib/smbconf/smbconf_txt.c
+++ b/source3/lib/smbconf/smbconf_txt.c
@@ -183,7 +183,7 @@ static WERROR smbconf_txt_load_file(struct smbconf_ctx *ctx)
WERROR werr;
uint64_t new_csn;
- if (!file_exist(ctx->path, NULL)) {
+ if (!file_exist(ctx->path)) {
return WERR_BADFILE;
}
diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c
index 93494d6dad..f2161dc946 100644
--- a/source3/lib/smbldap.c
+++ b/source3/lib/smbldap.c
@@ -1025,13 +1025,6 @@ static int smbldap_open(struct smbldap_state *ldap_state)
int rc, opt_rc;
bool reopen = False;
SMB_ASSERT(ldap_state);
-
-#ifndef NO_LDAP_SECURITY
- if (geteuid() != 0) {
- DEBUG(0, ("smbldap_open: cannot access LDAP when not root\n"));
- return LDAP_INSUFFICIENT_ACCESS;
- }
-#endif
if ((ldap_state->ldap_struct != NULL) && ((ldap_state->last_ping + SMBLDAP_DONT_PING_TIME) < time(NULL))) {
@@ -1211,7 +1204,7 @@ static int smbldap_search_ext(struct smbldap_state *ldap_state,
if (ldap_state->last_rebind.tv_sec > 0) {
struct timeval tval;
- SMB_BIG_INT tdiff = 0;
+ int64_t tdiff = 0;
int sleep_time = 0;
ZERO_STRUCT(tval);
diff --git a/source3/lib/socket_wrapper/config.m4 b/source3/lib/socket_wrapper/config.m4
deleted file mode 100644
index f3ffb895a9..0000000000
--- a/source3/lib/socket_wrapper/config.m4
+++ /dev/null
@@ -1,22 +0,0 @@
-AC_ARG_ENABLE(socket-wrapper,
-[ --enable-socket-wrapper Turn on socket wrapper library (default=no)])
-
-DEFAULT_TEST_OPTIONS=
-HAVE_SOCKET_WRAPPER=no
-
-if eval "test x$developer = xyes"; then
- enable_socket_wrapper=yes
-fi
-
-if eval "test x$enable_socket_wrapper = xyes"; then
- AC_DEFINE(SOCKET_WRAPPER,1,[Use socket wrapper library])
- DEFAULT_TEST_OPTIONS=--socket-wrapper
- HAVE_SOCKET_WRAPPER=yes
-
- # this is only used for samba3
- SOCKET_WRAPPER_OBJS="lib/socket_wrapper/socket_wrapper.o"
-fi
-
-AC_SUBST(DEFAULT_TEST_OPTIONS)
-AC_SUBST(HAVE_SOCKET_WRAPPER)
-AC_SUBST(SOCKET_WRAPPER_OBJS)
diff --git a/source3/lib/socket_wrapper/config.mk b/source3/lib/socket_wrapper/config.mk
deleted file mode 100644
index 60cfb3209a..0000000000
--- a/source3/lib/socket_wrapper/config.mk
+++ /dev/null
@@ -1,8 +0,0 @@
-##############################
-# Start SUBSYSTEM SOCKET_WRAPPER
-[SUBSYSTEM::SOCKET_WRAPPER]
-PRIVATE_DEPENDENCIES = LIBREPLACE_NETWORK
-# End SUBSYSTEM SOCKET_WRAPPER
-##############################
-
-SOCKET_WRAPPER_OBJ_FILES = $(socketwrappersrcdir)/socket_wrapper.o
diff --git a/source3/lib/socket_wrapper/socket_wrapper.c b/source3/lib/socket_wrapper/socket_wrapper.c
deleted file mode 100644
index 33e4b38370..0000000000
--- a/source3/lib/socket_wrapper/socket_wrapper.c
+++ /dev/null
@@ -1,1841 +0,0 @@
-/*
- * Copyright (C) Jelmer Vernooij 2005,2008 <jelmer@samba.org>
- * Copyright (C) Stefan Metzmacher 2006 <metze@samba.org>
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-/*
- Socket wrapper library. Passes all socket communication over
- unix domain sockets if the environment variable SOCKET_WRAPPER_DIR
- is set.
-*/
-
-#ifdef _SAMBA_BUILD_
-
-#define SOCKET_WRAPPER_NOT_REPLACE
-#include "lib/replace/replace.h"
-#include "system/network.h"
-#include "system/filesys.h"
-#include "system/time.h"
-
-#else /* _SAMBA_BUILD_ */
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/filio.h>
-#include <errno.h>
-#include <sys/un.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdint.h>
-
-#endif
-
-#ifndef _PUBLIC_
-#define _PUBLIC_
-#endif
-
-#define SWRAP_DLIST_ADD(list,item) do { \
- if (!(list)) { \
- (item)->prev = NULL; \
- (item)->next = NULL; \
- (list) = (item); \
- } else { \
- (item)->prev = NULL; \
- (item)->next = (list); \
- (list)->prev = (item); \
- (list) = (item); \
- } \
-} while (0)
-
-#define SWRAP_DLIST_REMOVE(list,item) do { \
- if ((list) == (item)) { \
- (list) = (item)->next; \
- if (list) { \
- (list)->prev = NULL; \
- } \
- } else { \
- if ((item)->prev) { \
- (item)->prev->next = (item)->next; \
- } \
- if ((item)->next) { \
- (item)->next->prev = (item)->prev; \
- } \
- } \
- (item)->prev = NULL; \
- (item)->next = NULL; \
-} while (0)
-
-/* LD_PRELOAD doesn't work yet, so REWRITE_CALLS is all we support
- * for now */
-#define REWRITE_CALLS
-
-#ifdef REWRITE_CALLS
-#define real_accept accept
-#define real_connect connect
-#define real_bind bind
-#define real_listen listen
-#define real_getpeername getpeername
-#define real_getsockname getsockname
-#define real_getsockopt getsockopt
-#define real_setsockopt setsockopt
-#define real_recvfrom recvfrom
-#define real_sendto sendto
-#define real_ioctl ioctl
-#define real_recv recv
-#define real_send send
-#define real_socket socket
-#define real_close close
-#endif
-
-#ifdef HAVE_GETTIMEOFDAY_TZ
-#define swrapGetTimeOfDay(tval) gettimeofday(tval,NULL)
-#else
-#define swrapGetTimeOfDay(tval) gettimeofday(tval)
-#endif
-
-/* we need to use a very terse format here as IRIX 6.4 silently
- truncates names to 16 chars, so if we use a longer name then we
- can't tell which port a packet came from with recvfrom()
-
- with this format we have 8 chars left for the directory name
-*/
-#define SOCKET_FORMAT "%c%02X%04X"
-#define SOCKET_TYPE_CHAR_TCP 'T'
-#define SOCKET_TYPE_CHAR_UDP 'U'
-#define SOCKET_TYPE_CHAR_TCP_V6 'X'
-#define SOCKET_TYPE_CHAR_UDP_V6 'Y'
-
-#define MAX_WRAPPED_INTERFACES 16
-
-#define SW_IPV6_ADDRESS 1
-
-static struct sockaddr *sockaddr_dup(const void *data, socklen_t len)
-{
- struct sockaddr *ret = (struct sockaddr *)malloc(len);
- memcpy(ret, data, len);
- return ret;
-}
-
-static void set_port(int family, int prt, struct sockaddr *addr)
-{
- switch (family) {
- case AF_INET:
- ((struct sockaddr_in *)addr)->sin_port = htons(prt);
- break;
-#ifdef HAVE_IPV6
- case AF_INET6:
- ((struct sockaddr_in6 *)addr)->sin6_port = htons(prt);
- break;
-#endif
- }
-}
-
-static size_t socket_length(int family)
-{
- switch (family) {
- case AF_INET:
- return sizeof(struct sockaddr_in);
-#ifdef HAVE_IPV6
- case AF_INET6:
- return sizeof(struct sockaddr_in6);
-#endif
- }
- return 0;
-}
-
-
-
-struct socket_info
-{
- int fd;
-
- int family;
- int type;
- int protocol;
- int bound;
- int bcast;
- int is_server;
-
- char *path;
- char *tmp_path;
-
- struct sockaddr *myname;
- socklen_t myname_len;
-
- struct sockaddr *peername;
- socklen_t peername_len;
-
- struct {
- unsigned long pck_snd;
- unsigned long pck_rcv;
- } io;
-
- struct socket_info *prev, *next;
-};
-
-static struct socket_info *sockets;
-
-const char *socket_wrapper_dir(void)
-{
- const char *s = getenv("SOCKET_WRAPPER_DIR");
- if (s == NULL) {
- return NULL;
- }
- if (strncmp(s, "./", 2) == 0) {
- s += 2;
- }
- return s;
-}
-
-unsigned int socket_wrapper_default_iface(void)
-{
- const char *s = getenv("SOCKET_WRAPPER_DEFAULT_IFACE");
- if (s) {
- unsigned int iface;
- if (sscanf(s, "%u", &iface) == 1) {
- if (iface >= 1 && iface <= MAX_WRAPPED_INTERFACES) {
- return iface;
- }
- }
- }
-
- return 1;/* 127.0.0.1 */
-}
-
-static int convert_un_in(const struct sockaddr_un *un, struct sockaddr *in, socklen_t *len)
-{
- unsigned int iface;
- unsigned int prt;
- const char *p;
- char type;
-
- p = strrchr(un->sun_path, '/');
- if (p) p++; else p = un->sun_path;
-
- if (sscanf(p, SOCKET_FORMAT, &type, &iface, &prt) != 3) {
- errno = EINVAL;
- return -1;
- }
-
- if (iface == 0 || iface > MAX_WRAPPED_INTERFACES) {
- errno = EINVAL;
- return -1;
- }
-
- if (prt > 0xFFFF) {
- errno = EINVAL;
- return -1;
- }
-
- switch(type) {
- case SOCKET_TYPE_CHAR_TCP:
- case SOCKET_TYPE_CHAR_UDP: {
- struct sockaddr_in *in2 = (struct sockaddr_in *)in;
-
- if ((*len) < sizeof(*in2)) {
- errno = EINVAL;
- return -1;
- }
-
- memset(in2, 0, sizeof(*in2));
- in2->sin_family = AF_INET;
- in2->sin_addr.s_addr = htonl((127<<24) | iface);
- in2->sin_port = htons(prt);
-
- *len = sizeof(*in2);
- break;
- }
-#ifdef HAVE_IPV6
- case SOCKET_TYPE_CHAR_TCP_V6:
- case SOCKET_TYPE_CHAR_UDP_V6: {
- struct sockaddr_in6 *in2 = (struct sockaddr_in6 *)in;
-
- if ((*len) < sizeof(*in2)) {
- errno = EINVAL;
- return -1;
- }
-
- memset(in2, 0, sizeof(*in2));
- in2->sin6_family = AF_INET6;
- in2->sin6_addr.s6_addr[0] = SW_IPV6_ADDRESS;
- in2->sin6_port = htons(prt);
-
- *len = sizeof(*in2);
- break;
- }
-#endif
- default:
- errno = EINVAL;
- return -1;
- }
-
- return 0;
-}
-
-static int convert_in_un_remote(struct socket_info *si, const struct sockaddr *inaddr, struct sockaddr_un *un,
- int *bcast)
-{
- char type = '\0';
- unsigned int prt;
- unsigned int iface;
- int is_bcast = 0;
-
- if (bcast) *bcast = 0;
-
- switch (si->family) {
- case AF_INET: {
- const struct sockaddr_in *in =
- (const struct sockaddr_in *)inaddr;
- unsigned int addr = ntohl(in->sin_addr.s_addr);
- char u_type = '\0';
- char b_type = '\0';
- char a_type = '\0';
-
- switch (si->type) {
- case SOCK_STREAM:
- u_type = SOCKET_TYPE_CHAR_TCP;
- break;
- case SOCK_DGRAM:
- u_type = SOCKET_TYPE_CHAR_UDP;
- a_type = SOCKET_TYPE_CHAR_UDP;
- b_type = SOCKET_TYPE_CHAR_UDP;
- break;
- }
-
- prt = ntohs(in->sin_port);
- if (a_type && addr == 0xFFFFFFFF) {
- /* 255.255.255.255 only udp */
- is_bcast = 2;
- type = a_type;
- iface = socket_wrapper_default_iface();
- } else if (b_type && addr == 0x7FFFFFFF) {
- /* 127.255.255.255 only udp */
- is_bcast = 1;
- type = b_type;
- iface = socket_wrapper_default_iface();
- } else if ((addr & 0xFFFFFF00) == 0x7F000000) {
- /* 127.0.0.X */
- is_bcast = 0;
- type = u_type;
- iface = (addr & 0x000000FF);
- } else {
- errno = ENETUNREACH;
- return -1;
- }
- if (bcast) *bcast = is_bcast;
- break;
- }
-#ifdef HAVE_IPV6
- case AF_INET6: {
- const struct sockaddr_in6 *in =
- (const struct sockaddr_in6 *)inaddr;
-
- switch (si->type) {
- case SOCK_STREAM:
- type = SOCKET_TYPE_CHAR_TCP_V6;
- break;
- case SOCK_DGRAM:
- type = SOCKET_TYPE_CHAR_UDP_V6;
- break;
- }
-
- /* XXX no multicast/broadcast */
-
- prt = ntohs(in->sin6_port);
- iface = SW_IPV6_ADDRESS;
-
- break;
- }
-#endif
- default:
- errno = ENETUNREACH;
- return -1;
- }
-
- if (prt == 0) {
- errno = EINVAL;
- return -1;
- }
-
- if (is_bcast) {
- snprintf(un->sun_path, sizeof(un->sun_path), "%s/EINVAL",
- socket_wrapper_dir());
- /* the caller need to do more processing */
- return 0;
- }
-
- snprintf(un->sun_path, sizeof(un->sun_path), "%s/"SOCKET_FORMAT,
- socket_wrapper_dir(), type, iface, prt);
-
- return 0;
-}
-
-static int convert_in_un_alloc(struct socket_info *si, const struct sockaddr *inaddr, struct sockaddr_un *un,
- int *bcast)
-{
- char type = '\0';
- unsigned int prt;
- unsigned int iface;
- struct stat st;
- int is_bcast = 0;
-
- if (bcast) *bcast = 0;
-
- switch (si->family) {
- case AF_INET: {
- const struct sockaddr_in *in =
- (const struct sockaddr_in *)inaddr;
- unsigned int addr = ntohl(in->sin_addr.s_addr);
- char u_type = '\0';
- char d_type = '\0';
- char b_type = '\0';
- char a_type = '\0';
-
- prt = ntohs(in->sin_port);
-
- switch (si->type) {
- case SOCK_STREAM:
- u_type = SOCKET_TYPE_CHAR_TCP;
- d_type = SOCKET_TYPE_CHAR_TCP;
- break;
- case SOCK_DGRAM:
- u_type = SOCKET_TYPE_CHAR_UDP;
- d_type = SOCKET_TYPE_CHAR_UDP;
- a_type = SOCKET_TYPE_CHAR_UDP;
- b_type = SOCKET_TYPE_CHAR_UDP;
- break;
- }
-
- if (addr == 0) {
- /* 0.0.0.0 */
- is_bcast = 0;
- type = d_type;
- iface = socket_wrapper_default_iface();
- } else if (a_type && addr == 0xFFFFFFFF) {
- /* 255.255.255.255 only udp */
- is_bcast = 2;
- type = a_type;
- iface = socket_wrapper_default_iface();
- } else if (b_type && addr == 0x7FFFFFFF) {
- /* 127.255.255.255 only udp */
- is_bcast = 1;
- type = b_type;
- iface = socket_wrapper_default_iface();
- } else if ((addr & 0xFFFFFF00) == 0x7F000000) {
- /* 127.0.0.X */
- is_bcast = 0;
- type = u_type;
- iface = (addr & 0x000000FF);
- } else {
- errno = EADDRNOTAVAIL;
- return -1;
- }
- break;
- }
-#ifdef HAVE_IPV6
- case AF_INET6: {
- const struct sockaddr_in6 *in =
- (const struct sockaddr_in6 *)inaddr;
-
- switch (si->type) {
- case SOCK_STREAM:
- type = SOCKET_TYPE_CHAR_TCP_V6;
- break;
- case SOCK_DGRAM:
- type = SOCKET_TYPE_CHAR_UDP_V6;
- break;
- }
-
- /* XXX no multicast/broadcast */
-
- prt = ntohs(in->sin6_port);
- iface = SW_IPV6_ADDRESS;
-
- break;
- }
-#endif
- default:
- errno = ENETUNREACH;
- return -1;
- }
-
-
- if (bcast) *bcast = is_bcast;
-
- if (prt == 0) {
- /* handle auto-allocation of ephemeral ports */
- for (prt = 5001; prt < 10000; prt++) {
- snprintf(un->sun_path, sizeof(un->sun_path), "%s/"SOCKET_FORMAT,
- socket_wrapper_dir(), type, iface, prt);
- if (stat(un->sun_path, &st) == 0) continue;
-
- set_port(si->family, prt, si->myname);
- break;
- }
- if (prt == 10000) {
- errno = ENFILE;
- return -1;
- }
- }
-
- snprintf(un->sun_path, sizeof(un->sun_path), "%s/"SOCKET_FORMAT,
- socket_wrapper_dir(), type, iface, prt);
- return 0;
-}
-
-static struct socket_info *find_socket_info(int fd)
-{
- struct socket_info *i;
- for (i = sockets; i; i = i->next) {
- if (i->fd == fd)
- return i;
- }
-
- return NULL;
-}
-
-static int sockaddr_convert_to_un(struct socket_info *si, const struct sockaddr *in_addr, socklen_t in_len,
- struct sockaddr_un *out_addr, int alloc_sock, int *bcast)
-{
- if (!out_addr)
- return 0;
-
- out_addr->sun_family = AF_UNIX;
-
- switch (in_addr->sa_family) {
- case AF_INET:
-#ifdef HAVE_IPV6
- case AF_INET6:
-#endif
- switch (si->type) {
- case SOCK_STREAM:
- case SOCK_DGRAM:
- break;
- default:
- errno = ESOCKTNOSUPPORT;
- return -1;
- }
- if (alloc_sock) {
- return convert_in_un_alloc(si, in_addr, out_addr, bcast);
- } else {
- return convert_in_un_remote(si, in_addr, out_addr, bcast);
- }
- default:
- break;
- }
-
- errno = EAFNOSUPPORT;
- return -1;
-}
-
-static int sockaddr_convert_from_un(const struct socket_info *si,
- const struct sockaddr_un *in_addr,
- socklen_t un_addrlen,
- int family,
- struct sockaddr *out_addr,
- socklen_t *out_addrlen)
-{
- if (out_addr == NULL || out_addrlen == NULL)
- return 0;
-
- if (un_addrlen == 0) {
- *out_addrlen = 0;
- return 0;
- }
-
- switch (family) {
- case AF_INET:
-#ifdef HAVE_IPV6
- case AF_INET6:
-#endif
- switch (si->type) {
- case SOCK_STREAM:
- case SOCK_DGRAM:
- break;
- default:
- errno = ESOCKTNOSUPPORT;
- return -1;
- }
- return convert_un_in(in_addr, out_addr, out_addrlen);
- default:
- break;
- }
-
- errno = EAFNOSUPPORT;
- return -1;
-}
-
-enum swrap_packet_type {
- SWRAP_CONNECT_SEND,
- SWRAP_CONNECT_UNREACH,
- SWRAP_CONNECT_RECV,
- SWRAP_CONNECT_ACK,
- SWRAP_ACCEPT_SEND,
- SWRAP_ACCEPT_RECV,
- SWRAP_ACCEPT_ACK,
- SWRAP_RECVFROM,
- SWRAP_SENDTO,
- SWRAP_SENDTO_UNREACH,
- SWRAP_PENDING_RST,
- SWRAP_RECV,
- SWRAP_RECV_RST,
- SWRAP_SEND,
- SWRAP_SEND_RST,
- SWRAP_CLOSE_SEND,
- SWRAP_CLOSE_RECV,
- SWRAP_CLOSE_ACK
-};
-
-struct swrap_file_hdr {
- uint32_t magic;
- uint16_t version_major;
- uint16_t version_minor;
- int32_t timezone;
- uint32_t sigfigs;
- uint32_t frame_max_len;
-#define SWRAP_FRAME_LENGTH_MAX 0xFFFF
- uint32_t link_type;
-};
-#define SWRAP_FILE_HDR_SIZE 24
-
-struct swrap_packet {
- struct {
- uint32_t seconds;
- uint32_t micro_seconds;
- uint32_t recorded_length;
- uint32_t full_length;
- } frame;
-#define SWRAP_PACKET__FRAME_SIZE 16
-
- struct {
- struct {
- uint8_t ver_hdrlen;
- uint8_t tos;
- uint16_t packet_length;
- uint16_t identification;
- uint8_t flags;
- uint8_t fragment;
- uint8_t ttl;
- uint8_t protocol;
- uint16_t hdr_checksum;
- uint32_t src_addr;
- uint32_t dest_addr;
- } hdr;
-#define SWRAP_PACKET__IP_HDR_SIZE 20
-
- union {
- struct {
- uint16_t source_port;
- uint16_t dest_port;
- uint32_t seq_num;
- uint32_t ack_num;
- uint8_t hdr_length;
- uint8_t control;
- uint16_t window;
- uint16_t checksum;
- uint16_t urg;
- } tcp;
-#define SWRAP_PACKET__IP_P_TCP_SIZE 20
- struct {
- uint16_t source_port;
- uint16_t dest_port;
- uint16_t length;
- uint16_t checksum;
- } udp;
-#define SWRAP_PACKET__IP_P_UDP_SIZE 8
- struct {
- uint8_t type;
- uint8_t code;
- uint16_t checksum;
- uint32_t unused;
- } icmp;
-#define SWRAP_PACKET__IP_P_ICMP_SIZE 8
- } p;
- } ip;
-};
-#define SWRAP_PACKET_SIZE 56
-
-static const char *socket_wrapper_pcap_file(void)
-{
- static int initialized = 0;
- static const char *s = NULL;
- static const struct swrap_file_hdr h = { 0, };
- static const struct swrap_packet p = { { 0, }, { { 0, }, { { 0, } } } };
-
- if (initialized == 1) {
- return s;
- }
- initialized = 1;
-
- /*
- * TODO: don't use the structs use plain buffer offsets
- * and PUSH_U8(), PUSH_U16() and PUSH_U32()
- *
- * for now make sure we disable PCAP support
- * if the struct has alignment!
- */
- if (sizeof(h) != SWRAP_FILE_HDR_SIZE) {
- return NULL;
- }
- if (sizeof(p) != SWRAP_PACKET_SIZE) {
- return NULL;
- }
- if (sizeof(p.frame) != SWRAP_PACKET__FRAME_SIZE) {
- return NULL;
- }
- if (sizeof(p.ip.hdr) != SWRAP_PACKET__IP_HDR_SIZE) {
- return NULL;
- }
- if (sizeof(p.ip.p.tcp) != SWRAP_PACKET__IP_P_TCP_SIZE) {
- return NULL;
- }
- if (sizeof(p.ip.p.udp) != SWRAP_PACKET__IP_P_UDP_SIZE) {
- return NULL;
- }
- if (sizeof(p.ip.p.icmp) != SWRAP_PACKET__IP_P_ICMP_SIZE) {
- return NULL;
- }
-
- s = getenv("SOCKET_WRAPPER_PCAP_FILE");
- if (s == NULL) {
- return NULL;
- }
- if (strncmp(s, "./", 2) == 0) {
- s += 2;
- }
- return s;
-}
-
-static struct swrap_packet *swrap_packet_init(struct timeval *tval,
- const struct sockaddr_in *src_addr,
- const struct sockaddr_in *dest_addr,
- int socket_type,
- const unsigned char *payload,
- size_t payload_len,
- unsigned long tcp_seqno,
- unsigned long tcp_ack,
- unsigned char tcp_ctl,
- int unreachable,
- size_t *_packet_len)
-{
- struct swrap_packet *ret;
- struct swrap_packet *packet;
- size_t packet_len;
- size_t alloc_len;
- size_t nonwire_len = sizeof(packet->frame);
- size_t wire_hdr_len = 0;
- size_t wire_len = 0;
- size_t icmp_hdr_len = 0;
- size_t icmp_truncate_len = 0;
- unsigned char protocol = 0, icmp_protocol = 0;
- unsigned short src_port = src_addr->sin_port;
- unsigned short dest_port = dest_addr->sin_port;
-
- switch (socket_type) {
- case SOCK_STREAM:
- protocol = 0x06; /* TCP */
- wire_hdr_len = sizeof(packet->ip.hdr) + sizeof(packet->ip.p.tcp);
- wire_len = wire_hdr_len + payload_len;
- break;
-
- case SOCK_DGRAM:
- protocol = 0x11; /* UDP */
- wire_hdr_len = sizeof(packet->ip.hdr) + sizeof(packet->ip.p.udp);
- wire_len = wire_hdr_len + payload_len;
- break;
-
- default:
- return NULL;
- }
-
- if (unreachable) {
- icmp_protocol = protocol;
- protocol = 0x01; /* ICMP */
- if (wire_len > 64 ) {
- icmp_truncate_len = wire_len - 64;
- }
- icmp_hdr_len = sizeof(packet->ip.hdr) + sizeof(packet->ip.p.icmp);
- wire_hdr_len += icmp_hdr_len;
- wire_len += icmp_hdr_len;
- }
-
- packet_len = nonwire_len + wire_len;
- alloc_len = packet_len;
- if (alloc_len < sizeof(struct swrap_packet)) {
- alloc_len = sizeof(struct swrap_packet);
- }
- ret = (struct swrap_packet *)malloc(alloc_len);
- if (!ret) return NULL;
-
- packet = ret;
-
- packet->frame.seconds = tval->tv_sec;
- packet->frame.micro_seconds = tval->tv_usec;
- packet->frame.recorded_length = wire_len - icmp_truncate_len;
- packet->frame.full_length = wire_len - icmp_truncate_len;
-
- packet->ip.hdr.ver_hdrlen = 0x45; /* version 4 and 5 * 32 bit words */
- packet->ip.hdr.tos = 0x00;
- packet->ip.hdr.packet_length = htons(wire_len - icmp_truncate_len);
- packet->ip.hdr.identification = htons(0xFFFF);
- packet->ip.hdr.flags = 0x40; /* BIT 1 set - means don't fraqment */
- packet->ip.hdr.fragment = htons(0x0000);
- packet->ip.hdr.ttl = 0xFF;
- packet->ip.hdr.protocol = protocol;
- packet->ip.hdr.hdr_checksum = htons(0x0000);
- packet->ip.hdr.src_addr = src_addr->sin_addr.s_addr;
- packet->ip.hdr.dest_addr = dest_addr->sin_addr.s_addr;
-
- if (unreachable) {
- packet->ip.p.icmp.type = 0x03; /* destination unreachable */
- packet->ip.p.icmp.code = 0x01; /* host unreachable */
- packet->ip.p.icmp.checksum = htons(0x0000);
- packet->ip.p.icmp.unused = htonl(0x00000000);
-
- /* set the ip header in the ICMP payload */
- packet = (struct swrap_packet *)(((unsigned char *)ret) + icmp_hdr_len);
- packet->ip.hdr.ver_hdrlen = 0x45; /* version 4 and 5 * 32 bit words */
- packet->ip.hdr.tos = 0x00;
- packet->ip.hdr.packet_length = htons(wire_len - icmp_hdr_len);
- packet->ip.hdr.identification = htons(0xFFFF);
- packet->ip.hdr.flags = 0x40; /* BIT 1 set - means don't fraqment */
- packet->ip.hdr.fragment = htons(0x0000);
- packet->ip.hdr.ttl = 0xFF;
- packet->ip.hdr.protocol = icmp_protocol;
- packet->ip.hdr.hdr_checksum = htons(0x0000);
- packet->ip.hdr.src_addr = dest_addr->sin_addr.s_addr;
- packet->ip.hdr.dest_addr = src_addr->sin_addr.s_addr;
-
- src_port = dest_addr->sin_port;
- dest_port = src_addr->sin_port;
- }
-
- switch (socket_type) {
- case SOCK_STREAM:
- packet->ip.p.tcp.source_port = src_port;
- packet->ip.p.tcp.dest_port = dest_port;
- packet->ip.p.tcp.seq_num = htonl(tcp_seqno);
- packet->ip.p.tcp.ack_num = htonl(tcp_ack);
- packet->ip.p.tcp.hdr_length = 0x50; /* 5 * 32 bit words */
- packet->ip.p.tcp.control = tcp_ctl;
- packet->ip.p.tcp.window = htons(0x7FFF);
- packet->ip.p.tcp.checksum = htons(0x0000);
- packet->ip.p.tcp.urg = htons(0x0000);
-
- break;
-
- case SOCK_DGRAM:
- packet->ip.p.udp.source_port = src_addr->sin_port;
- packet->ip.p.udp.dest_port = dest_addr->sin_port;
- packet->ip.p.udp.length = htons(8 + payload_len);
- packet->ip.p.udp.checksum = htons(0x0000);
-
- break;
- }
-
- if (payload && payload_len > 0) {
- unsigned char *p = (unsigned char *)ret;
- p += nonwire_len;
- p += wire_hdr_len;
- memcpy(p, payload, payload_len);
- }
-
- *_packet_len = packet_len - icmp_truncate_len;
- return ret;
-}
-
-static int swrap_get_pcap_fd(const char *fname)
-{
- static int fd = -1;
-
- if (fd != -1) return fd;
-
- fd = open(fname, O_WRONLY|O_CREAT|O_EXCL|O_APPEND, 0644);
- if (fd != -1) {
- struct swrap_file_hdr file_hdr;
- file_hdr.magic = 0xA1B2C3D4;
- file_hdr.version_major = 0x0002;
- file_hdr.version_minor = 0x0004;
- file_hdr.timezone = 0x00000000;
- file_hdr.sigfigs = 0x00000000;
- file_hdr.frame_max_len = SWRAP_FRAME_LENGTH_MAX;
- file_hdr.link_type = 0x0065; /* 101 RAW IP */
-
- write(fd, &file_hdr, sizeof(file_hdr));
- return fd;
- }
-
- fd = open(fname, O_WRONLY|O_APPEND, 0644);
-
- return fd;
-}
-
-static struct swrap_packet *swrap_marshall_packet(struct socket_info *si,
- const struct sockaddr *addr,
- enum swrap_packet_type type,
- const void *buf, size_t len,
- size_t *packet_len)
-{
- const struct sockaddr_in *src_addr;
- const struct sockaddr_in *dest_addr;
- unsigned long tcp_seqno = 0;
- unsigned long tcp_ack = 0;
- unsigned char tcp_ctl = 0;
- int unreachable = 0;
-
- struct timeval tv;
-
- switch (si->family) {
- case AF_INET:
- break;
- default:
- return NULL;
- }
-
- switch (type) {
- case SWRAP_CONNECT_SEND:
- if (si->type != SOCK_STREAM) return NULL;
-
- src_addr = (const struct sockaddr_in *)si->myname;
- dest_addr = (const struct sockaddr_in *)addr;
-
- tcp_seqno = si->io.pck_snd;
- tcp_ack = si->io.pck_rcv;
- tcp_ctl = 0x02; /* SYN */
-
- si->io.pck_snd += 1;
-
- break;
-
- case SWRAP_CONNECT_RECV:
- if (si->type != SOCK_STREAM) return NULL;
-
- dest_addr = (const struct sockaddr_in *)si->myname;
- src_addr = (const struct sockaddr_in *)addr;
-
- tcp_seqno = si->io.pck_rcv;
- tcp_ack = si->io.pck_snd;
- tcp_ctl = 0x12; /** SYN,ACK */
-
- si->io.pck_rcv += 1;
-
- break;
-
- case SWRAP_CONNECT_UNREACH:
- if (si->type != SOCK_STREAM) return NULL;
-
- dest_addr = (const struct sockaddr_in *)si->myname;
- src_addr = (const struct sockaddr_in *)addr;
-
- /* Unreachable: resend the data of SWRAP_CONNECT_SEND */
- tcp_seqno = si->io.pck_snd - 1;
- tcp_ack = si->io.pck_rcv;
- tcp_ctl = 0x02; /* SYN */
- unreachable = 1;
-
- break;
-
- case SWRAP_CONNECT_ACK:
- if (si->type != SOCK_STREAM) return NULL;
-
- src_addr = (const struct sockaddr_in *)si->myname;
- dest_addr = (const struct sockaddr_in *)addr;
-
- tcp_seqno = si->io.pck_snd;
- tcp_ack = si->io.pck_rcv;
- tcp_ctl = 0x10; /* ACK */
-
- break;
-
- case SWRAP_ACCEPT_SEND:
- if (si->type != SOCK_STREAM) return NULL;
-
- dest_addr = (const struct sockaddr_in *)si->myname;
- src_addr = (const struct sockaddr_in *)addr;
-
- tcp_seqno = si->io.pck_rcv;
- tcp_ack = si->io.pck_snd;
- tcp_ctl = 0x02; /* SYN */
-
- si->io.pck_rcv += 1;
-
- break;
-
- case SWRAP_ACCEPT_RECV:
- if (si->type != SOCK_STREAM) return NULL;
-
- src_addr = (const struct sockaddr_in *)si->myname;
- dest_addr = (const struct sockaddr_in *)addr;
-
- tcp_seqno = si->io.pck_snd;
- tcp_ack = si->io.pck_rcv;
- tcp_ctl = 0x12; /* SYN,ACK */
-
- si->io.pck_snd += 1;
-
- break;
-
- case SWRAP_ACCEPT_ACK:
- if (si->type != SOCK_STREAM) return NULL;
-
- dest_addr = (const struct sockaddr_in *)si->myname;
- src_addr = (const struct sockaddr_in *)addr;
-
- tcp_seqno = si->io.pck_rcv;
- tcp_ack = si->io.pck_snd;
- tcp_ctl = 0x10; /* ACK */
-
- break;
-
- case SWRAP_SEND:
- src_addr = (const struct sockaddr_in *)si->myname;
- dest_addr = (const struct sockaddr_in *)si->peername;
-
- tcp_seqno = si->io.pck_snd;
- tcp_ack = si->io.pck_rcv;
- tcp_ctl = 0x18; /* PSH,ACK */
-
- si->io.pck_snd += len;
-
- break;
-
- case SWRAP_SEND_RST:
- dest_addr = (const struct sockaddr_in *)si->myname;
- src_addr = (const struct sockaddr_in *)si->peername;
-
- if (si->type == SOCK_DGRAM) {
- return swrap_marshall_packet(si, si->peername,
- SWRAP_SENDTO_UNREACH,
- buf, len, packet_len);
- }
-
- tcp_seqno = si->io.pck_rcv;
- tcp_ack = si->io.pck_snd;
- tcp_ctl = 0x14; /** RST,ACK */
-
- break;
-
- case SWRAP_PENDING_RST:
- dest_addr = (const struct sockaddr_in *)si->myname;
- src_addr = (const struct sockaddr_in *)si->peername;
-
- if (si->type == SOCK_DGRAM) {
- return NULL;
- }
-
- tcp_seqno = si->io.pck_rcv;
- tcp_ack = si->io.pck_snd;
- tcp_ctl = 0x14; /* RST,ACK */
-
- break;
-
- case SWRAP_RECV:
- dest_addr = (const struct sockaddr_in *)si->myname;
- src_addr = (const struct sockaddr_in *)si->peername;
-
- tcp_seqno = si->io.pck_rcv;
- tcp_ack = si->io.pck_snd;
- tcp_ctl = 0x18; /* PSH,ACK */
-
- si->io.pck_rcv += len;
-
- break;
-
- case SWRAP_RECV_RST:
- dest_addr = (const struct sockaddr_in *)si->myname;
- src_addr = (const struct sockaddr_in *)si->peername;
-
- if (si->type == SOCK_DGRAM) {
- return NULL;
- }
-
- tcp_seqno = si->io.pck_rcv;
- tcp_ack = si->io.pck_snd;
- tcp_ctl = 0x14; /* RST,ACK */
-
- break;
-
- case SWRAP_SENDTO:
- src_addr = (const struct sockaddr_in *)si->myname;
- dest_addr = (const struct sockaddr_in *)addr;
-
- si->io.pck_snd += len;
-
- break;
-
- case SWRAP_SENDTO_UNREACH:
- dest_addr = (const struct sockaddr_in *)si->myname;
- src_addr = (const struct sockaddr_in *)addr;
-
- unreachable = 1;
-
- break;
-
- case SWRAP_RECVFROM:
- dest_addr = (const struct sockaddr_in *)si->myname;
- src_addr = (const struct sockaddr_in *)addr;
-
- si->io.pck_rcv += len;
-
- break;
-
- case SWRAP_CLOSE_SEND:
- if (si->type != SOCK_STREAM) return NULL;
-
- src_addr = (const struct sockaddr_in *)si->myname;
- dest_addr = (const struct sockaddr_in *)si->peername;
-
- tcp_seqno = si->io.pck_snd;
- tcp_ack = si->io.pck_rcv;
- tcp_ctl = 0x11; /* FIN, ACK */
-
- si->io.pck_snd += 1;
-
- break;
-
- case SWRAP_CLOSE_RECV:
- if (si->type != SOCK_STREAM) return NULL;
-
- dest_addr = (const struct sockaddr_in *)si->myname;
- src_addr = (const struct sockaddr_in *)si->peername;
-
- tcp_seqno = si->io.pck_rcv;
- tcp_ack = si->io.pck_snd;
- tcp_ctl = 0x11; /* FIN,ACK */
-
- si->io.pck_rcv += 1;
-
- break;
-
- case SWRAP_CLOSE_ACK:
- if (si->type != SOCK_STREAM) return NULL;
-
- src_addr = (const struct sockaddr_in *)si->myname;
- dest_addr = (const struct sockaddr_in *)si->peername;
-
- tcp_seqno = si->io.pck_snd;
- tcp_ack = si->io.pck_rcv;
- tcp_ctl = 0x10; /* ACK */
-
- break;
- default:
- return NULL;
- }
-
- swrapGetTimeOfDay(&tv);
-
- return swrap_packet_init(&tv, src_addr, dest_addr, si->type,
- (const unsigned char *)buf, len,
- tcp_seqno, tcp_ack, tcp_ctl, unreachable,
- packet_len);
-}
-
-static void swrap_dump_packet(struct socket_info *si,
- const struct sockaddr *addr,
- enum swrap_packet_type type,
- const void *buf, size_t len)
-{
- const char *file_name;
- struct swrap_packet *packet;
- size_t packet_len = 0;
- int fd;
-
- file_name = socket_wrapper_pcap_file();
- if (!file_name) {
- return;
- }
-
- packet = swrap_marshall_packet(si, addr, type, buf, len, &packet_len);
- if (!packet) {
- return;
- }
-
- fd = swrap_get_pcap_fd(file_name);
- if (fd != -1) {
- write(fd, packet, packet_len);
- }
-
- free(packet);
-}
-
-_PUBLIC_ int swrap_socket(int family, int type, int protocol)
-{
- struct socket_info *si;
- int fd;
-
- if (!socket_wrapper_dir()) {
- return real_socket(family, type, protocol);
- }
-
- switch (family) {
- case AF_INET:
-#ifdef HAVE_IPV6
- case AF_INET6:
-#endif
- break;
- case AF_UNIX:
- return real_socket(family, type, protocol);
- default:
- errno = EAFNOSUPPORT;
- return -1;
- }
-
- switch (type) {
- case SOCK_STREAM:
- break;
- case SOCK_DGRAM:
- break;
- default:
- errno = EPROTONOSUPPORT;
- return -1;
- }
-
- switch (protocol) {
- case 0:
- break;
- case 6:
- if (type == SOCK_STREAM) {
- break;
- }
- /*fall through*/
- case 17:
- if (type == SOCK_DGRAM) {
- break;
- }
- /*fall through*/
- default:
- errno = EPROTONOSUPPORT;
- return -1;
- }
-
- fd = real_socket(AF_UNIX, type, 0);
-
- if (fd == -1) return -1;
-
- si = (struct socket_info *)calloc(1, sizeof(struct socket_info));
-
- si->family = family;
- si->type = type;
- si->protocol = protocol;
- si->fd = fd;
-
- SWRAP_DLIST_ADD(sockets, si);
-
- return si->fd;
-}
-
-_PUBLIC_ int swrap_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
-{
- struct socket_info *parent_si, *child_si;
- int fd;
- struct sockaddr_un un_addr;
- socklen_t un_addrlen = sizeof(un_addr);
- struct sockaddr_un un_my_addr;
- socklen_t un_my_addrlen = sizeof(un_my_addr);
- struct sockaddr *my_addr;
- socklen_t my_addrlen, len;
- int ret;
-
- parent_si = find_socket_info(s);
- if (!parent_si) {
- return real_accept(s, addr, addrlen);
- }
-
- /*
- * assume out sockaddr have the same size as the in parent
- * socket family
- */
- my_addrlen = socket_length(parent_si->family);
- if (my_addrlen <= 0) {
- errno = EINVAL;
- return -1;
- }
-
- my_addr = (struct sockaddr *)malloc(my_addrlen);
- if (my_addr == NULL) {
- return -1;
- }
-
- memset(&un_addr, 0, sizeof(un_addr));
- memset(&un_my_addr, 0, sizeof(un_my_addr));
-
- ret = real_accept(s, (struct sockaddr *)&un_addr, &un_addrlen);
- if (ret == -1) {
- free(my_addr);
- return ret;
- }
-
- fd = ret;
-
- len = my_addrlen;
- ret = sockaddr_convert_from_un(parent_si, &un_addr, un_addrlen,
- parent_si->family, my_addr, &len);
- if (ret == -1) {
- free(my_addr);
- close(fd);
- return ret;
- }
-
- child_si = (struct socket_info *)malloc(sizeof(struct socket_info));
- memset(child_si, 0, sizeof(*child_si));
-
- child_si->fd = fd;
- child_si->family = parent_si->family;
- child_si->type = parent_si->type;
- child_si->protocol = parent_si->protocol;
- child_si->bound = 1;
- child_si->is_server = 1;
-
- child_si->peername_len = len;
- child_si->peername = sockaddr_dup(my_addr, len);
-
- if (addr != NULL && addrlen != NULL) {
- *addrlen = len;
- if (*addrlen >= len)
- memcpy(addr, my_addr, len);
- *addrlen = 0;
- }
-
- ret = real_getsockname(fd, (struct sockaddr *)&un_my_addr, &un_my_addrlen);
- if (ret == -1) {
- free(child_si);
- close(fd);
- return ret;
- }
-
- len = my_addrlen;
- ret = sockaddr_convert_from_un(child_si, &un_my_addr, un_my_addrlen,
- child_si->family, my_addr, &len);
- if (ret == -1) {
- free(child_si);
- free(my_addr);
- close(fd);
- return ret;
- }
-
- child_si->myname_len = len;
- child_si->myname = sockaddr_dup(my_addr, len);
- free(my_addr);
-
- SWRAP_DLIST_ADD(sockets, child_si);
-
- swrap_dump_packet(child_si, addr, SWRAP_ACCEPT_SEND, NULL, 0);
- swrap_dump_packet(child_si, addr, SWRAP_ACCEPT_RECV, NULL, 0);
- swrap_dump_packet(child_si, addr, SWRAP_ACCEPT_ACK, NULL, 0);
-
- return fd;
-}
-
-static int autobind_start_init;
-static int autobind_start;
-
-/* using sendto() or connect() on an unbound socket would give the
- recipient no way to reply, as unlike UDP and TCP, a unix domain
- socket can't auto-assign emphemeral port numbers, so we need to
- assign it here */
-static int swrap_auto_bind(struct socket_info *si)
-{
- struct sockaddr_un un_addr;
- int i;
- char type;
- int ret;
- int port;
- struct stat st;
-
- if (autobind_start_init != 1) {
- autobind_start_init = 1;
- autobind_start = getpid();
- autobind_start %= 50000;
- autobind_start += 10000;
- }
-
- un_addr.sun_family = AF_UNIX;
-
- switch (si->family) {
- case AF_INET: {
- struct sockaddr_in in;
-
- switch (si->type) {
- case SOCK_STREAM:
- type = SOCKET_TYPE_CHAR_TCP;
- break;
- case SOCK_DGRAM:
- type = SOCKET_TYPE_CHAR_UDP;
- break;
- default:
- errno = ESOCKTNOSUPPORT;
- return -1;
- }
-
- memset(&in, 0, sizeof(in));
- in.sin_family = AF_INET;
- in.sin_addr.s_addr = htonl(127<<24 |
- socket_wrapper_default_iface());
-
- si->myname_len = sizeof(in);
- si->myname = sockaddr_dup(&in, si->myname_len);
- break;
- }
-#ifdef HAVE_IPV6
- case AF_INET6: {
- struct sockaddr_in6 in6;
-
- switch (si->type) {
- case SOCK_STREAM:
- type = SOCKET_TYPE_CHAR_TCP_V6;
- break;
- case SOCK_DGRAM:
- type = SOCKET_TYPE_CHAR_UDP_V6;
- break;
- default:
- errno = ESOCKTNOSUPPORT;
- return -1;
- }
-
- memset(&in6, 0, sizeof(in6));
- in6.sin6_family = AF_INET6;
- in6.sin6_addr.s6_addr[0] = SW_IPV6_ADDRESS;
- si->myname_len = sizeof(in6);
- si->myname = sockaddr_dup(&in6, si->myname_len);
- break;
- }
-#endif
- default:
- errno = ESOCKTNOSUPPORT;
- return -1;
- }
-
- if (autobind_start > 60000) {
- autobind_start = 10000;
- }
-
- for (i=0;i<1000;i++) {
- port = autobind_start + i;
- snprintf(un_addr.sun_path, sizeof(un_addr.sun_path),
- "%s/"SOCKET_FORMAT, socket_wrapper_dir(),
- type, socket_wrapper_default_iface(), port);
- if (stat(un_addr.sun_path, &st) == 0) continue;
-
- ret = real_bind(si->fd, (struct sockaddr *)&un_addr, sizeof(un_addr));
- if (ret == -1) return ret;
-
- si->tmp_path = strdup(un_addr.sun_path);
- si->bound = 1;
- autobind_start = port + 1;
- break;
- }
- if (i == 1000) {
- errno = ENFILE;
- return -1;
- }
-
- set_port(si->family, port, si->myname);
-
- return 0;
-}
-
-
-_PUBLIC_ int swrap_connect(int s, const struct sockaddr *serv_addr, socklen_t addrlen)
-{
- int ret;
- struct sockaddr_un un_addr;
- struct socket_info *si = find_socket_info(s);
-
- if (!si) {
- return real_connect(s, serv_addr, addrlen);
- }
-
- if (si->bound == 0) {
- ret = swrap_auto_bind(si);
- if (ret == -1) return -1;
- }
-
- if (si->family != serv_addr->sa_family) {
- errno = EINVAL;
- return -1;
- }
-
- ret = sockaddr_convert_to_un(si, (const struct sockaddr *)serv_addr, addrlen, &un_addr, 0, NULL);
- if (ret == -1) return -1;
-
- swrap_dump_packet(si, serv_addr, SWRAP_CONNECT_SEND, NULL, 0);
-
- ret = real_connect(s, (struct sockaddr *)&un_addr,
- sizeof(struct sockaddr_un));
-
- /* to give better errors */
- if (ret == -1 && errno == ENOENT) {
- errno = EHOSTUNREACH;
- }
-
- if (ret == 0) {
- si->peername_len = addrlen;
- si->peername = sockaddr_dup(serv_addr, addrlen);
-
- swrap_dump_packet(si, serv_addr, SWRAP_CONNECT_RECV, NULL, 0);
- swrap_dump_packet(si, serv_addr, SWRAP_CONNECT_ACK, NULL, 0);
- } else {
- swrap_dump_packet(si, serv_addr, SWRAP_CONNECT_UNREACH, NULL, 0);
- }
-
- return ret;
-}
-
-_PUBLIC_ int swrap_bind(int s, const struct sockaddr *myaddr, socklen_t addrlen)
-{
- int ret;
- struct sockaddr_un un_addr;
- struct socket_info *si = find_socket_info(s);
-
- if (!si) {
- return real_bind(s, myaddr, addrlen);
- }
-
- si->myname_len = addrlen;
- si->myname = sockaddr_dup(myaddr, addrlen);
-
- ret = sockaddr_convert_to_un(si, (const struct sockaddr *)myaddr, addrlen, &un_addr, 1, &si->bcast);
- if (ret == -1) return -1;
-
- unlink(un_addr.sun_path);
-
- ret = real_bind(s, (struct sockaddr *)&un_addr,
- sizeof(struct sockaddr_un));
-
- if (ret == 0) {
- si->bound = 1;
- }
-
- return ret;
-}
-
-_PUBLIC_ int swrap_listen(int s, int backlog)
-{
- int ret;
- struct socket_info *si = find_socket_info(s);
-
- if (!si) {
- return real_listen(s, backlog);
- }
-
- ret = real_listen(s, backlog);
-
- return ret;
-}
-
-_PUBLIC_ int swrap_getpeername(int s, struct sockaddr *name, socklen_t *addrlen)
-{
- struct socket_info *si = find_socket_info(s);
-
- if (!si) {
- return real_getpeername(s, name, addrlen);
- }
-
- if (!si->peername)
- {
- errno = ENOTCONN;
- return -1;
- }
-
- memcpy(name, si->peername, si->peername_len);
- *addrlen = si->peername_len;
-
- return 0;
-}
-
-_PUBLIC_ int swrap_getsockname(int s, struct sockaddr *name, socklen_t *addrlen)
-{
- struct socket_info *si = find_socket_info(s);
-
- if (!si) {
- return real_getsockname(s, name, addrlen);
- }
-
- memcpy(name, si->myname, si->myname_len);
- *addrlen = si->myname_len;
-
- return 0;
-}
-
-_PUBLIC_ int swrap_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen)
-{
- struct socket_info *si = find_socket_info(s);
-
- if (!si) {
- return real_getsockopt(s, level, optname, optval, optlen);
- }
-
- if (level == SOL_SOCKET) {
- return real_getsockopt(s, level, optname, optval, optlen);
- }
-
- errno = ENOPROTOOPT;
- return -1;
-}
-
-_PUBLIC_ int swrap_setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen)
-{
- struct socket_info *si = find_socket_info(s);
-
- if (!si) {
- return real_setsockopt(s, level, optname, optval, optlen);
- }
-
- if (level == SOL_SOCKET) {
- return real_setsockopt(s, level, optname, optval, optlen);
- }
-
- switch (si->family) {
- case AF_INET:
- return 0;
- default:
- errno = ENOPROTOOPT;
- return -1;
- }
-}
-
-_PUBLIC_ ssize_t swrap_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen)
-{
- struct sockaddr_un un_addr;
- socklen_t un_addrlen = sizeof(un_addr);
- int ret;
- struct socket_info *si = find_socket_info(s);
-
- if (!si) {
- return real_recvfrom(s, buf, len, flags, from, fromlen);
- }
-
- len = MIN(len, 1500);
-
- /* irix 6.4 forgets to null terminate the sun_path string :-( */
- memset(&un_addr, 0, sizeof(un_addr));
- ret = real_recvfrom(s, buf, len, flags, (struct sockaddr *)&un_addr, &un_addrlen);
- if (ret == -1)
- return ret;
-
- if (sockaddr_convert_from_un(si, &un_addr, un_addrlen,
- si->family, from, fromlen) == -1) {
- return -1;
- }
-
- swrap_dump_packet(si, from, SWRAP_RECVFROM, buf, ret);
-
- return ret;
-}
-
-
-_PUBLIC_ ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen)
-{
- struct sockaddr_un un_addr;
- int ret;
- struct socket_info *si = find_socket_info(s);
- int bcast = 0;
-
- if (!si) {
- return real_sendto(s, buf, len, flags, to, tolen);
- }
-
- len = MIN(len, 1500);
-
- switch (si->type) {
- case SOCK_STREAM:
- ret = real_send(s, buf, len, flags);
- break;
- case SOCK_DGRAM:
- if (si->bound == 0) {
- ret = swrap_auto_bind(si);
- if (ret == -1) return -1;
- }
-
- ret = sockaddr_convert_to_un(si, to, tolen, &un_addr, 0, &bcast);
- if (ret == -1) return -1;
-
- if (bcast) {
- struct stat st;
- unsigned int iface;
- unsigned int prt = ntohs(((const struct sockaddr_in *)to)->sin_port);
- char type;
-
- type = SOCKET_TYPE_CHAR_UDP;
-
- for(iface=0; iface <= MAX_WRAPPED_INTERFACES; iface++) {
- snprintf(un_addr.sun_path, sizeof(un_addr.sun_path), "%s/"SOCKET_FORMAT,
- socket_wrapper_dir(), type, iface, prt);
- if (stat(un_addr.sun_path, &st) != 0) continue;
-
- /* ignore the any errors in broadcast sends */
- real_sendto(s, buf, len, flags, (struct sockaddr *)&un_addr, sizeof(un_addr));
- }
-
- swrap_dump_packet(si, to, SWRAP_SENDTO, buf, len);
-
- return len;
- }
-
- ret = real_sendto(s, buf, len, flags, (struct sockaddr *)&un_addr, sizeof(un_addr));
- break;
- default:
- ret = -1;
- errno = EHOSTUNREACH;
- break;
- }
-
- /* to give better errors */
- if (ret == -1 && errno == ENOENT) {
- errno = EHOSTUNREACH;
- }
-
- if (ret == -1) {
- swrap_dump_packet(si, to, SWRAP_SENDTO, buf, len);
- swrap_dump_packet(si, to, SWRAP_SENDTO_UNREACH, buf, len);
- } else {
- swrap_dump_packet(si, to, SWRAP_SENDTO, buf, ret);
- }
-
- return ret;
-}
-
-_PUBLIC_ int swrap_ioctl(int s, int r, void *p)
-{
- int ret;
- struct socket_info *si = find_socket_info(s);
- int value;
-
- if (!si) {
- return real_ioctl(s, r, p);
- }
-
- ret = real_ioctl(s, r, p);
-
- switch (r) {
- case FIONREAD:
- value = *((int *)p);
- if (ret == -1 && errno != EAGAIN && errno != ENOBUFS) {
- swrap_dump_packet(si, NULL, SWRAP_PENDING_RST, NULL, 0);
- } else if (value == 0) { /* END OF FILE */
- swrap_dump_packet(si, NULL, SWRAP_PENDING_RST, NULL, 0);
- }
- break;
- }
-
- return ret;
-}
-
-_PUBLIC_ ssize_t swrap_recv(int s, void *buf, size_t len, int flags)
-{
- int ret;
- struct socket_info *si = find_socket_info(s);
-
- if (!si) {
- return real_recv(s, buf, len, flags);
- }
-
- len = MIN(len, 1500);
-
- ret = real_recv(s, buf, len, flags);
- if (ret == -1 && errno != EAGAIN && errno != ENOBUFS) {
- swrap_dump_packet(si, NULL, SWRAP_RECV_RST, NULL, 0);
- } else if (ret == 0) { /* END OF FILE */
- swrap_dump_packet(si, NULL, SWRAP_RECV_RST, NULL, 0);
- } else {
- swrap_dump_packet(si, NULL, SWRAP_RECV, buf, ret);
- }
-
- return ret;
-}
-
-
-_PUBLIC_ ssize_t swrap_send(int s, const void *buf, size_t len, int flags)
-{
- int ret;
- struct socket_info *si = find_socket_info(s);
-
- if (!si) {
- return real_send(s, buf, len, flags);
- }
-
- len = MIN(len, 1500);
-
- ret = real_send(s, buf, len, flags);
-
- if (ret == -1) {
- swrap_dump_packet(si, NULL, SWRAP_SEND, buf, len);
- swrap_dump_packet(si, NULL, SWRAP_SEND_RST, NULL, 0);
- } else {
- swrap_dump_packet(si, NULL, SWRAP_SEND, buf, ret);
- }
-
- return ret;
-}
-
-_PUBLIC_ int swrap_close(int fd)
-{
- struct socket_info *si = find_socket_info(fd);
- int ret;
-
- if (!si) {
- return real_close(fd);
- }
-
- SWRAP_DLIST_REMOVE(sockets, si);
-
- if (si->myname && si->peername) {
- swrap_dump_packet(si, NULL, SWRAP_CLOSE_SEND, NULL, 0);
- }
-
- ret = real_close(fd);
-
- if (si->myname && si->peername) {
- swrap_dump_packet(si, NULL, SWRAP_CLOSE_RECV, NULL, 0);
- swrap_dump_packet(si, NULL, SWRAP_CLOSE_ACK, NULL, 0);
- }
-
- if (si->path) free(si->path);
- if (si->myname) free(si->myname);
- if (si->peername) free(si->peername);
- if (si->tmp_path) {
- unlink(si->tmp_path);
- free(si->tmp_path);
- }
- free(si);
-
- return ret;
-}
diff --git a/source3/lib/socket_wrapper/socket_wrapper.h b/source3/lib/socket_wrapper/socket_wrapper.h
deleted file mode 100644
index cc8b937608..0000000000
--- a/source3/lib/socket_wrapper/socket_wrapper.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) Jelmer Vernooij 2005 <jelmer@samba.org>
- * Copyright (C) Stefan Metzmacher 2006 <metze@samba.org>
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the author nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#ifndef __SOCKET_WRAPPER_H__
-#define __SOCKET_WRAPPER_H__
-
-const char *socket_wrapper_dir(void);
-unsigned int socket_wrapper_default_iface(void);
-int swrap_socket(int family, int type, int protocol);
-int swrap_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
-int swrap_connect(int s, const struct sockaddr *serv_addr, socklen_t addrlen);
-int swrap_bind(int s, const struct sockaddr *myaddr, socklen_t addrlen);
-int swrap_listen(int s, int backlog);
-int swrap_getpeername(int s, struct sockaddr *name, socklen_t *addrlen);
-int swrap_getsockname(int s, struct sockaddr *name, socklen_t *addrlen);
-int swrap_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen);
-int swrap_setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen);
-ssize_t swrap_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen);
-ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen);
-int swrap_ioctl(int s, int req, void *ptr);
-ssize_t swrap_recv(int s, void *buf, size_t len, int flags);
-ssize_t swrap_send(int s, const void *buf, size_t len, int flags);
-int swrap_close(int);
-
-#ifdef SOCKET_WRAPPER_REPLACE
-
-#ifdef accept
-#undef accept
-#endif
-#define accept(s,addr,addrlen) swrap_accept(s,addr,addrlen)
-
-#ifdef connect
-#undef connect
-#endif
-#define connect(s,serv_addr,addrlen) swrap_connect(s,serv_addr,addrlen)
-
-#ifdef bind
-#undef bind
-#endif
-#define bind(s,myaddr,addrlen) swrap_bind(s,myaddr,addrlen)
-
-#ifdef listen
-#undef listen
-#endif
-#define listen(s,blog) swrap_listen(s,blog)
-
-#ifdef getpeername
-#undef getpeername
-#endif
-#define getpeername(s,name,addrlen) swrap_getpeername(s,name,addrlen)
-
-#ifdef getsockname
-#undef getsockname
-#endif
-#define getsockname(s,name,addrlen) swrap_getsockname(s,name,addrlen)
-
-#ifdef getsockopt
-#undef getsockopt
-#endif
-#define getsockopt(s,level,optname,optval,optlen) swrap_getsockopt(s,level,optname,optval,optlen)
-
-#ifdef setsockopt
-#undef setsockopt
-#endif
-#define setsockopt(s,level,optname,optval,optlen) swrap_setsockopt(s,level,optname,optval,optlen)
-
-#ifdef recvfrom
-#undef recvfrom
-#endif
-#define recvfrom(s,buf,len,flags,from,fromlen) swrap_recvfrom(s,buf,len,flags,from,fromlen)
-
-#ifdef sendto
-#undef sendto
-#endif
-#define sendto(s,buf,len,flags,to,tolen) swrap_sendto(s,buf,len,flags,to,tolen)
-
-#ifdef ioctl
-#undef ioctl
-#endif
-#define ioctl(s,req,ptr) swrap_ioctl(s,req,ptr)
-
-#ifdef recv
-#undef recv
-#endif
-#define recv(s,buf,len,flags) swrap_recv(s,buf,len,flags)
-
-#ifdef send
-#undef send
-#endif
-#define send(s,buf,len,flags) swrap_send(s,buf,len,flags)
-
-#ifdef socket
-#undef socket
-#endif
-#define socket(domain,type,protocol) swrap_socket(domain,type,protocol)
-
-#ifdef close
-#undef close
-#endif
-#define close(s) swrap_close(s)
-#endif
-
-
-#endif /* __SOCKET_WRAPPER_H__ */
diff --git a/source3/lib/socket_wrapper/testsuite.c b/source3/lib/socket_wrapper/testsuite.c
deleted file mode 100644
index 8877418e4c..0000000000
--- a/source3/lib/socket_wrapper/testsuite.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- local testing of the socket wrapper
-
- Copyright (C) Jelmer Vernooij 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 "system/network.h"
-#include "lib/socket_wrapper/socket_wrapper.h"
-#include "torture/torture.h"
-
-static char *old_dir = NULL;
-static char *old_iface = NULL;
-
-static void backup_env(void)
-{
- old_dir = getenv("SOCKET_WRAPPER_DIR");
- old_iface = getenv("SOCKET_WRAPPER_DEFAULT_IFACE");
-}
-
-static void restore_env(void)
-{
- if (old_dir == NULL)
- unsetenv("SOCKET_WRAPPER_DIR");
- else
- setenv("SOCKET_WRAPPER_DIR", old_dir, 1);
- if (old_iface == NULL)
- unsetenv("SOCKET_WRAPPER_DEFAULT_IFACE");
- else
- setenv("SOCKET_WRAPPER_DEFAULT_IFACE", old_iface, 1);
-}
-
-static bool test_socket_wrapper_dir(struct torture_context *tctx)
-{
- backup_env();
-
- setenv("SOCKET_WRAPPER_DIR", "foo", 1);
- torture_assert_str_equal(tctx, socket_wrapper_dir(), "foo", "setting failed");
- setenv("SOCKET_WRAPPER_DIR", "./foo", 1);
- torture_assert_str_equal(tctx, socket_wrapper_dir(), "foo", "setting failed");
- unsetenv("SOCKET_WRAPPER_DIR");
- torture_assert_str_equal(tctx, socket_wrapper_dir(), NULL, "resetting failed");
-
- restore_env();
-
- return true;
-}
-
-static bool test_swrap_socket(struct torture_context *tctx)
-{
- backup_env();
- setenv("SOCKET_WRAPPER_DIR", "foo", 1);
-
- torture_assert_int_equal(tctx, swrap_socket(1337, 1337, 0), -1, "unknown address family fails");
- torture_assert_int_equal(tctx, errno, EAFNOSUPPORT, "correct errno set");
- torture_assert_int_equal(tctx, swrap_socket(AF_INET, 1337, 0), -1, "unknown type fails");
- torture_assert_int_equal(tctx, errno, EPROTONOSUPPORT, "correct errno set");
- torture_assert_int_equal(tctx, swrap_socket(AF_INET, SOCK_DGRAM, 10), -1, "unknown protocol fails");
- torture_assert_int_equal(tctx, errno, EPROTONOSUPPORT, "correct errno set");
-
- restore_env();
-
- return true;
-}
-
-unsigned int socket_wrapper_default_iface(void);
-static bool test_socket_wrapper_default_iface(struct torture_context *tctx)
-{
- backup_env();
- unsetenv("SOCKET_WRAPPER_DEFAULT_IFACE");
- torture_assert_int_equal(tctx, socket_wrapper_default_iface(), 1, "unset");
- setenv("SOCKET_WRAPPER_DEFAULT_IFACE", "2", 1);
- torture_assert_int_equal(tctx, socket_wrapper_default_iface(), 2, "unset");
- setenv("SOCKET_WRAPPER_DEFAULT_IFACE", "bla", 1);
- torture_assert_int_equal(tctx, socket_wrapper_default_iface(), 1, "unset");
- restore_env();
- return true;
-}
-
-struct torture_suite *torture_local_socket_wrapper(TALLOC_CTX *mem_ctx)
-{
- struct torture_suite *suite = torture_suite_create(mem_ctx,
- "SOCKET-WRAPPER");
-
- torture_suite_add_simple_test(suite, "socket_wrapper_dir", test_socket_wrapper_dir);
- torture_suite_add_simple_test(suite, "socket", test_swrap_socket);
- torture_suite_add_simple_test(suite, "socket_wrapper_default_iface", test_socket_wrapper_default_iface);
-
- return suite;
-}
diff --git a/source3/lib/sysquotas.c b/source3/lib/sysquotas.c
index 4a2d88abdf..5ee199de22 100644
--- a/source3/lib/sysquotas.c
+++ b/source3/lib/sysquotas.c
@@ -295,7 +295,7 @@ static int command_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t
dp->bsize = 1024;
}
- file_lines_free(lines);
+ TALLOC_FREE(lines);
lines = NULL;
DEBUG (3, ("Parsed output of get_quota, ...\n"));
@@ -331,7 +331,7 @@ static int command_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t
invalid_param:
- file_lines_free(lines);
+ TALLOC_FREE(lines);
DEBUG(0,("The output of get_quota_command is invalid!\n"));
return -1;
}
@@ -392,7 +392,7 @@ static int command_set_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t
DEBUG (3, ("Read output from set_quota, \"%s\"\n", line));
- file_lines_free(lines);
+ TALLOC_FREE(lines);
return 0;
}
diff --git a/source3/lib/sysquotas_4A.c b/source3/lib/sysquotas_4A.c
index f185bba6df..8a1b12238c 100644
--- a/source3/lib/sysquotas_4A.c
+++ b/source3/lib/sysquotas_4A.c
@@ -89,7 +89,7 @@ int sys_get_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
int ret = -1;
uint32 qflags = 0;
struct dqblk D;
- SMB_BIG_UINT bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE;
+ uint64_t bsize = (uint64_t)QUOTABLOCK_SIZE;
ZERO_STRUCT(D);
ZERO_STRUCT(*dp);
@@ -162,12 +162,12 @@ int sys_get_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
}
dp->bsize = bsize;
- dp->softlimit = (SMB_BIG_UINT)D.dqb_bsoftlimit;
- dp->hardlimit = (SMB_BIG_UINT)D.dqb_bhardlimit;
- dp->ihardlimit = (SMB_BIG_UINT)D.dqb_ihardlimit;
- dp->isoftlimit = (SMB_BIG_UINT)D.dqb_isoftlimit;
- dp->curinodes = (SMB_BIG_UINT)D.dqb_curinodes;
- dp->curblocks = (SMB_BIG_UINT)D.dqb_curblocks;
+ dp->softlimit = (uint64_t)D.dqb_bsoftlimit;
+ dp->hardlimit = (uint64_t)D.dqb_bhardlimit;
+ dp->ihardlimit = (uint64_t)D.dqb_ihardlimit;
+ dp->isoftlimit = (uint64_t)D.dqb_isoftlimit;
+ dp->curinodes = (uint64_t)D.dqb_curinodes;
+ dp->curblocks = (uint64_t)D.dqb_curblocks;
dp->qflags = qflags;
@@ -184,7 +184,7 @@ int sys_set_vfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
uint32 qflags = 0;
uint32 oldqflags = 0;
struct dqblk D;
- SMB_BIG_UINT bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE;
+ uint64_t bsize = (uint64_t)QUOTABLOCK_SIZE;
ZERO_STRUCT(D);
diff --git a/source3/lib/sysquotas_linux.c b/source3/lib/sysquotas_linux.c
index f9a0464086..5720328764 100644
--- a/source3/lib/sysquotas_linux.c
+++ b/source3/lib/sysquotas_linux.c
@@ -41,7 +41,7 @@ static int sys_get_linux_v1_quota(const char *path, const char *bdev, enum SMB_Q
int ret = -1;
uint32 qflags = 0;
struct v1_kern_dqblk D;
- SMB_BIG_UINT bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE;
+ uint64_t bsize = (uint64_t)QUOTABLOCK_SIZE;
ZERO_STRUCT(D);
@@ -88,12 +88,12 @@ static int sys_get_linux_v1_quota(const char *path, const char *bdev, enum SMB_Q
}
dp->bsize = bsize;
- dp->softlimit = (SMB_BIG_UINT)D.dqb_bsoftlimit;
- dp->hardlimit = (SMB_BIG_UINT)D.dqb_bhardlimit;
- dp->ihardlimit = (SMB_BIG_UINT)D.dqb_ihardlimit;
- dp->isoftlimit = (SMB_BIG_UINT)D.dqb_isoftlimit;
- dp->curinodes = (SMB_BIG_UINT)D.dqb_curinodes;
- dp->curblocks = (SMB_BIG_UINT)D.dqb_curblocks;
+ dp->softlimit = (uint64_t)D.dqb_bsoftlimit;
+ dp->hardlimit = (uint64_t)D.dqb_bhardlimit;
+ dp->ihardlimit = (uint64_t)D.dqb_ihardlimit;
+ dp->isoftlimit = (uint64_t)D.dqb_isoftlimit;
+ dp->curinodes = (uint64_t)D.dqb_curinodes;
+ dp->curblocks = (uint64_t)D.dqb_curblocks;
dp->qflags = qflags;
@@ -110,7 +110,7 @@ static int sys_set_linux_v1_quota(const char *path, const char *bdev, enum SMB_Q
uint32 qflags = 0;
uint32 oldqflags = 0;
struct v1_kern_dqblk D;
- SMB_BIG_UINT bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE;
+ uint64_t bsize = (uint64_t)QUOTABLOCK_SIZE;
ZERO_STRUCT(D);
@@ -175,7 +175,7 @@ static int sys_get_linux_v2_quota(const char *path, const char *bdev, enum SMB_Q
int ret = -1;
uint32 qflags = 0;
struct v2_kern_dqblk D;
- SMB_BIG_UINT bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE;
+ uint64_t bsize = (uint64_t)QUOTABLOCK_SIZE;
ZERO_STRUCT(D);
@@ -222,12 +222,12 @@ static int sys_get_linux_v2_quota(const char *path, const char *bdev, enum SMB_Q
}
dp->bsize = bsize;
- dp->softlimit = (SMB_BIG_UINT)D.dqb_bsoftlimit;
- dp->hardlimit = (SMB_BIG_UINT)D.dqb_bhardlimit;
- dp->ihardlimit = (SMB_BIG_UINT)D.dqb_ihardlimit;
- dp->isoftlimit = (SMB_BIG_UINT)D.dqb_isoftlimit;
- dp->curinodes = (SMB_BIG_UINT)D.dqb_curinodes;
- dp->curblocks = (SMB_BIG_UINT)D.dqb_curspace/bsize;
+ dp->softlimit = (uint64_t)D.dqb_bsoftlimit;
+ dp->hardlimit = (uint64_t)D.dqb_bhardlimit;
+ dp->ihardlimit = (uint64_t)D.dqb_ihardlimit;
+ dp->isoftlimit = (uint64_t)D.dqb_isoftlimit;
+ dp->curinodes = (uint64_t)D.dqb_curinodes;
+ dp->curblocks = (uint64_t)D.dqb_curspace/bsize;
dp->qflags = qflags;
@@ -244,7 +244,7 @@ static int sys_set_linux_v2_quota(const char *path, const char *bdev, enum SMB_Q
uint32 qflags = 0;
uint32 oldqflags = 0;
struct v2_kern_dqblk D;
- SMB_BIG_UINT bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE;
+ uint64_t bsize = (uint64_t)QUOTABLOCK_SIZE;
ZERO_STRUCT(D);
@@ -309,7 +309,7 @@ static int sys_get_linux_gen_quota(const char *path, const char *bdev, enum SMB_
int ret = -1;
uint32 qflags = 0;
struct if_dqblk D;
- SMB_BIG_UINT bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE;
+ uint64_t bsize = (uint64_t)QUOTABLOCK_SIZE;
ZERO_STRUCT(D);
@@ -356,12 +356,12 @@ static int sys_get_linux_gen_quota(const char *path, const char *bdev, enum SMB_
}
dp->bsize = bsize;
- dp->softlimit = (SMB_BIG_UINT)D.dqb_bsoftlimit;
- dp->hardlimit = (SMB_BIG_UINT)D.dqb_bhardlimit;
- dp->ihardlimit = (SMB_BIG_UINT)D.dqb_ihardlimit;
- dp->isoftlimit = (SMB_BIG_UINT)D.dqb_isoftlimit;
- dp->curinodes = (SMB_BIG_UINT)D.dqb_curinodes;
- dp->curblocks = (SMB_BIG_UINT)D.dqb_curspace/bsize;
+ dp->softlimit = (uint64_t)D.dqb_bsoftlimit;
+ dp->hardlimit = (uint64_t)D.dqb_bhardlimit;
+ dp->ihardlimit = (uint64_t)D.dqb_ihardlimit;
+ dp->isoftlimit = (uint64_t)D.dqb_isoftlimit;
+ dp->curinodes = (uint64_t)D.dqb_curinodes;
+ dp->curblocks = (uint64_t)D.dqb_curspace/bsize;
dp->qflags = qflags;
@@ -378,7 +378,7 @@ static int sys_set_linux_gen_quota(const char *path, const char *bdev, enum SMB_
uint32 qflags = 0;
uint32 oldqflags = 0;
struct if_dqblk D;
- SMB_BIG_UINT bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE;
+ uint64_t bsize = (uint64_t)QUOTABLOCK_SIZE;
ZERO_STRUCT(D);
diff --git a/source3/lib/sysquotas_xfs.c b/source3/lib/sysquotas_xfs.c
index 30538c167b..1e438e9a6d 100644
--- a/source3/lib/sysquotas_xfs.c
+++ b/source3/lib/sysquotas_xfs.c
@@ -76,7 +76,7 @@ int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
{
int ret = -1;
uint32 qflags = 0;
- SMB_BIG_UINT bsize = (SMB_BIG_UINT)BBSIZE;
+ uint64_t bsize = (uint64_t)BBSIZE;
struct fs_disk_quota D;
struct fs_quota_stat F;
ZERO_STRUCT(D);
@@ -145,12 +145,12 @@ int sys_get_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
}
dp->bsize = bsize;
- dp->softlimit = (SMB_BIG_UINT)D.d_blk_softlimit;
- dp->hardlimit = (SMB_BIG_UINT)D.d_blk_hardlimit;
- dp->ihardlimit = (SMB_BIG_UINT)D.d_ino_hardlimit;
- dp->isoftlimit = (SMB_BIG_UINT)D.d_ino_softlimit;
- dp->curinodes = (SMB_BIG_UINT)D.d_icount;
- dp->curblocks = (SMB_BIG_UINT)D.d_bcount;
+ dp->softlimit = (uint64_t)D.d_blk_softlimit;
+ dp->hardlimit = (uint64_t)D.d_blk_hardlimit;
+ dp->ihardlimit = (uint64_t)D.d_ino_hardlimit;
+ dp->isoftlimit = (uint64_t)D.d_ino_softlimit;
+ dp->curinodes = (uint64_t)D.d_icount;
+ dp->curblocks = (uint64_t)D.d_bcount;
dp->qflags = qflags;
return ret;
@@ -163,7 +163,7 @@ int sys_set_xfs_quota(const char *path, const char *bdev, enum SMB_QUOTA_TYPE qt
{
int ret = -1;
uint32 qflags = 0;
- SMB_BIG_UINT bsize = (SMB_BIG_UINT)BBSIZE;
+ uint64_t bsize = (uint64_t)BBSIZE;
struct fs_disk_quota D;
struct fs_quota_stat F;
int q_on = 0;
diff --git a/source3/lib/talloc/Makefile.in b/source3/lib/talloc/Makefile.in
deleted file mode 100644
index 07b8fd4ff0..0000000000
--- a/source3/lib/talloc/Makefile.in
+++ /dev/null
@@ -1,43 +0,0 @@
-#!gmake
-#
-prefix = @prefix@
-datarootdir = @datarootdir@
-exec_prefix = @exec_prefix@
-includedir = @includedir@
-libdir = @libdir@
-mandir = @mandir@
-VPATH = @srcdir@:@libreplacedir@
-srcdir = @srcdir@
-builddir = @builddir@
-XSLTPROC = @XSLTPROC@
-INSTALLCMD = @INSTALL@
-CC = @CC@
-CFLAGS = @CFLAGS@ -DHAVE_CONFIG_H= -I. -I@srcdir@
-EXTRA_TARGETS = @DOC_TARGET@
-PICFLAG = @PICFLAG@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-SHLIBEXT = @SHLIBEXT@
-SHLD = @SHLD@
-SHLD_FLAGS = @SHLD_FLAGS@
-tallocdir = @tallocdir@
-
-LIBOBJ = $(TALLOC_OBJ) @LIBREPLACEOBJ@
-
-all:: showflags $(EXTRA_TARGETS)
-
-include $(tallocdir)/rules.mk
-include $(tallocdir)/talloc.mk
-
-$(TALLOC_SOLIB): $(LIBOBJ)
- $(SHLD) $(SHLD_FLAGS) -o $@ $(LIBOBJ) @SONAMEFLAG@$(TALLOC_SONAME)
-
-check: test
-
-installcheck:: test install
-
-distclean:: clean
- rm -f Makefile
- rm -f config.log config.status config.h config.cache
-
-realdistclean:: distclean
- rm -f configure config.h.in
diff --git a/source3/lib/talloc/NEWS b/source3/lib/talloc/NEWS
deleted file mode 100644
index e5b3aa0731..0000000000
--- a/source3/lib/talloc/NEWS
+++ /dev/null
@@ -1,13 +0,0 @@
-1.0.1 26 May 2007
-
- BUGS
-
- * Set name of correctly when using talloc_append_string() (metze)
-
- LICENSE
-
- * Change license of files in lib/replace to LGPL (was GPL). (jelmer)
-
-1.0.0 30 April 2007
-
- Initial release.
diff --git a/source3/lib/talloc/aclocal.m4 b/source3/lib/talloc/aclocal.m4
deleted file mode 100644
index 5605e476ba..0000000000
--- a/source3/lib/talloc/aclocal.m4
+++ /dev/null
@@ -1 +0,0 @@
-m4_include(libreplace.m4)
diff --git a/source3/lib/talloc/autogen.sh b/source3/lib/talloc/autogen.sh
deleted file mode 100755
index bf84eeee19..0000000000
--- a/source3/lib/talloc/autogen.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-rm -rf autom4te.cache
-rm -f configure config.h.in
-
-IPATHS="-I libreplace -I lib/replace -I ../libreplace -I ../replace"
-autoconf $IPATHS || exit 1
-autoheader $IPATHS || exit 1
-
-rm -rf autom4te.cache
-
-echo "Now run ./configure and then make."
-exit 0
-
diff --git a/source3/lib/talloc/config.guess b/source3/lib/talloc/config.guess
deleted file mode 100755
index 354dbe175a..0000000000
--- a/source3/lib/talloc/config.guess
+++ /dev/null
@@ -1,1464 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-timestamp='2005-08-03'
-
-# This file 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/>.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner <per@bothner.com>.
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# This script attempts to guess a canonical system name similar to
-# config.sub. If it succeeds, it prints the system name on stdout, and
-# exits with 0. Otherwise, it exits with 1.
-#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help" >&2
- exit 1 ;;
- * )
- break ;;
- esac
-done
-
-if test $# != 0; then
- echo "$me: too many arguments$help" >&2
- exit 1
-fi
-
-trap 'exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
-# compiler to aid in system detection is discouraged as it requires
-# temporary files to be created and, as you can see below, it is a
-# headache to deal with in a portable fashion.
-
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-# Portable tmp directory creation inspired by the Autoconf team.
-
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,) echo "int x;" > $dummy.c ;
- for c in cc gcc c89 c99 ; do
- if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
- CC_FOR_BUILD="$c"; break ;
- fi ;
- done ;
- if test x"$CC_FOR_BUILD" = x ; then
- CC_FOR_BUILD=no_compiler_found ;
- fi
- ;;
- ,,*) CC_FOR_BUILD=$CC ;;
- ,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
- PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
- *:NetBSD:*:*)
- # NetBSD (nbsd) targets should (where applicable) match one or
- # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
- # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
- # switched to ELF, *-*-netbsd* would select the old
- # object file format. This provides both forward
- # compatibility and a consistent mechanism for selecting the
- # object file format.
- #
- # Note: NetBSD doesn't particularly care about the vendor
- # portion of the name. We always set it to "unknown".
- sysctl="sysctl -n hw.machine_arch"
- UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
- /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
- case "${UNAME_MACHINE_ARCH}" in
- armeb) machine=armeb-unknown ;;
- arm*) machine=arm-unknown ;;
- sh3el) machine=shl-unknown ;;
- sh3eb) machine=sh-unknown ;;
- *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
- esac
- # The Operating System including object format, if it has switched
- # to ELF recently, or will in the future.
- case "${UNAME_MACHINE_ARCH}" in
- arm*|i386|m68k|ns32k|sh3*|sparc|vax)
- eval $set_cc_for_build
- if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep __ELF__ >/dev/null
- then
- # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
- # Return netbsd for either. FIX?
- os=netbsd
- else
- os=netbsdelf
- fi
- ;;
- *)
- os=netbsd
- ;;
- esac
- # The OS release
- # Debian GNU/NetBSD machines have a different userland, and
- # thus, need a distinct triplet. However, they do not need
- # kernel version information, so it can be replaced with a
- # suitable tag, in the style of linux-gnu.
- case "${UNAME_VERSION}" in
- Debian*)
- release='-gnu'
- ;;
- *)
- release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- ;;
- esac
- # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
- # contains redundant information, the shorter form:
- # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "${machine}-${os}${release}"
- exit ;;
- *:OpenBSD:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
- exit ;;
- *:ekkoBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
- exit ;;
- macppc:MirBSD:*:*)
- echo powerppc-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- *:MirBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- alpha:OSF1:*:*)
- case $UNAME_RELEASE in
- *4.0)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- ;;
- *5.*)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
- ;;
- esac
- # According to Compaq, /usr/sbin/psrinfo has been available on
- # OSF/1 and Tru64 systems produced since 1995. I hope that
- # covers most systems running today. This code pipes the CPU
- # types through head -n 1, so we only detect the type of CPU 0.
- ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
- case "$ALPHA_CPU_TYPE" in
- "EV4 (21064)")
- UNAME_MACHINE="alpha" ;;
- "EV4.5 (21064)")
- UNAME_MACHINE="alpha" ;;
- "LCA4 (21066/21068)")
- UNAME_MACHINE="alpha" ;;
- "EV5 (21164)")
- UNAME_MACHINE="alphaev5" ;;
- "EV5.6 (21164A)")
- UNAME_MACHINE="alphaev56" ;;
- "EV5.6 (21164PC)")
- UNAME_MACHINE="alphapca56" ;;
- "EV5.7 (21164PC)")
- UNAME_MACHINE="alphapca57" ;;
- "EV6 (21264)")
- UNAME_MACHINE="alphaev6" ;;
- "EV6.7 (21264A)")
- UNAME_MACHINE="alphaev67" ;;
- "EV6.8CB (21264C)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8AL (21264B)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8CX (21264D)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.9A (21264/EV69A)")
- UNAME_MACHINE="alphaev69" ;;
- "EV7 (21364)")
- UNAME_MACHINE="alphaev7" ;;
- "EV7.9 (21364A)")
- UNAME_MACHINE="alphaev79" ;;
- esac
- # A Pn.n version is a patched version.
- # A Vn.n version is a released version.
- # A Tn.n version is a released field test version.
- # A Xn.n version is an unreleased experimental baselevel.
- # 1.2 uses "1.2" for uname -r.
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- exit ;;
- Alpha\ *:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # Should we change UNAME_MACHINE based on the output of uname instead
- # of the specific Alpha model?
- echo alpha-pc-interix
- exit ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit ;;
- Amiga*:UNIX_System_V:4.0:*)
- echo m68k-unknown-sysv4
- exit ;;
- *:[Aa]miga[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-amigaos
- exit ;;
- *:[Mm]orph[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-morphos
- exit ;;
- *:OS/390:*:*)
- echo i370-ibm-openedition
- exit ;;
- *:z/VM:*:*)
- echo s390-ibm-zvmoe
- exit ;;
- *:OS400:*:*)
- echo powerpc-ibm-os400
- exit ;;
- arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix${UNAME_RELEASE}
- exit ;;
- arm:riscos:*:*|arm:RISCOS:*:*)
- echo arm-unknown-riscos
- exit ;;
- SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit ;;
- Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
- # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit ;;
- NILE*:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit ;;
- DRS?6000:unix:4.0:6*)
- echo sparc-icl-nx6
- exit ;;
- DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
- case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7; exit ;;
- esac ;;
- sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- i86pc:SunOS:5.*:*)
- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:6*:*)
- # According to config.sub, this is the proper way to canonicalize
- # SunOS6. Hard to guess exactly what SunOS6 will be like, but
- # it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
- Series*|S4*)
- UNAME_RELEASE=`uname -v`
- ;;
- esac
- # Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit ;;
- sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit ;;
- sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
- case "`/bin/arch`" in
- sun3)
- echo m68k-sun-sunos${UNAME_RELEASE}
- ;;
- sun4)
- echo sparc-sun-sunos${UNAME_RELEASE}
- ;;
- esac
- exit ;;
- aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
- exit ;;
- # The situation for MiNT is a little confusing. The machine name
- # can be virtually everything (everything which is not
- # "atarist" or "atariste" at least should have a processor
- # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
- # to the lowercase version "mint" (or "freemint"). Finally
- # the system name "TOS" denotes a system which is actually not
- # MiNT. But MiNT is downward compatible to TOS, so this should
- # be no problem.
- atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit ;;
- hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit ;;
- *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit ;;
- m68k:machten:*:*)
- echo m68k-apple-machten${UNAME_RELEASE}
- exit ;;
- powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
- exit ;;
- RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit ;;
- RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit ;;
- VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit ;;
- 2020:CLIX:*:* | 2430:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit ;;
- mips:*:*:UMIPS | mips:*:*:RISCos)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h> /* for printf() prototype */
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
- #if defined (host_mips) && defined (MIPSEB)
- #if defined (SYSTYPE_SYSV)
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_SVR4)
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
- #endif
- #endif
- exit (-1);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c &&
- dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
- SYSTEM_NAME=`$dummy $dummyarg` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo mips-mips-riscos${UNAME_RELEASE}
- exit ;;
- Motorola:PowerMAX_OS:*:*)
- echo powerpc-motorola-powermax
- exit ;;
- Motorola:*:4.3:PL8-*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit ;;
- m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit ;;
- m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit ;;
- m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit ;;
- AViiON:dgux:*:*)
- # DG/UX returns AViiON for all architectures
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
- then
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
- [ ${TARGET_BINARY_INTERFACE}x = x ]
- then
- echo m88k-dg-dgux${UNAME_RELEASE}
- else
- echo m88k-dg-dguxbcs${UNAME_RELEASE}
- fi
- else
- echo i586-dg-dgux${UNAME_RELEASE}
- fi
- exit ;;
- M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit ;;
- M88*:*:R3*:*)
- # Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit ;;
- XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit ;;
- Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit ;;
- *:IRIX*:*:*)
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit ;;
- ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i*86:AIX:*:*)
- echo i386-ibm-aix
- exit ;;
- ia64:AIX:*:*)
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:2:3)
- if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <sys/systemcfg.h>
-
- main()
- {
- if (!__power_pc())
- exit(1);
- puts("powerpc-ibm-aix3.2.5");
- exit(0);
- }
-EOF
- if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
- then
- echo "$SYSTEM_NAME"
- else
- echo rs6000-ibm-aix3.2.5
- fi
- elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- echo rs6000-ibm-aix3.2.4
- else
- echo rs6000-ibm-aix3.2
- fi
- exit ;;
- *:AIX:*:[45])
- IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
- if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
- IBM_ARCH=rs6000
- else
- IBM_ARCH=powerpc
- fi
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:*:*)
- echo rs6000-ibm-aix
- exit ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- echo romp-ibm-bsd4.4
- exit ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit ;; # report: romp-ibm BSD 4.3
- *:BOSX:*:*)
- echo rs6000-bull-bosx
- exit ;;
- DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit ;;
- 9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit ;;
- hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit ;;
- 9000/[34678]??:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/[678][0-9][0-9])
- if [ -x /usr/bin/getconf ]; then
- sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "${sc_cpu_version}" in
- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
- 532) # CPU_PA_RISC2_0
- case "${sc_kernel_bits}" in
- 32) HP_ARCH="hppa2.0n" ;;
- 64) HP_ARCH="hppa2.0w" ;;
- '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
- esac ;;
- esac
- fi
- if [ "${HP_ARCH}" = "" ]; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-
- #define _HPUX_SOURCE
- #include <stdlib.h>
- #include <unistd.h>
-
- int main ()
- {
- #if defined(_SC_KERNEL_BITS)
- long bits = sysconf(_SC_KERNEL_BITS);
- #endif
- long cpu = sysconf (_SC_CPU_VERSION);
-
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
- case CPU_PA_RISC2_0:
- #if defined(_SC_KERNEL_BITS)
- switch (bits)
- {
- case 64: puts ("hppa2.0w"); break;
- case 32: puts ("hppa2.0n"); break;
- default: puts ("hppa2.0"); break;
- } break;
- #else /* !defined(_SC_KERNEL_BITS) */
- puts ("hppa2.0"); break;
- #endif
- default: puts ("hppa1.0"); break;
- }
- exit (0);
- }
-EOF
- (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
- test -z "$HP_ARCH" && HP_ARCH=hppa
- fi ;;
- esac
- if [ ${HP_ARCH} = "hppa2.0w" ]
- then
- eval $set_cc_for_build
-
- # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
- # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
- # generating 64-bit code. GNU and HP use different nomenclature:
- #
- # $ CC_FOR_BUILD=cc ./config.guess
- # => hppa2.0w-hp-hpux11.23
- # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
- # => hppa64-hp-hpux11.23
-
- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
- grep __LP64__ >/dev/null
- then
- HP_ARCH="hppa2.0w"
- else
- HP_ARCH="hppa64"
- fi
- fi
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit ;;
- ia64:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- echo ia64-hp-hpux${HPUX_REV}
- exit ;;
- 3050*:HI-UX:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <unistd.h>
- int
- main ()
- {
- long cpu = sysconf (_SC_CPU_VERSION);
- /* The order matters, because CPU_IS_HP_MC68K erroneously returns
- true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
- results, however. */
- if (CPU_IS_PA_RISC (cpu))
- {
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
- default: puts ("hppa-hitachi-hiuxwe2"); break;
- }
- }
- else if (CPU_IS_HP_MC68K (cpu))
- puts ("m68k-hitachi-hiuxwe2");
- else puts ("unknown-hitachi-hiuxwe2");
- exit (0);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo unknown-hitachi-hiuxwe2
- exit ;;
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
- echo hppa1.1-hp-bsd
- exit ;;
- 9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit ;;
- *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
- echo hppa1.0-hp-mpeix
- exit ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- echo hppa1.1-hp-osf
- exit ;;
- hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit ;;
- i*86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
- else
- echo ${UNAME_MACHINE}-unknown-osf1
- fi
- exit ;;
- parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit ;;
- C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit ;;
- C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit ;;
- C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit ;;
- C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit ;;
- CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
- | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
- -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*T3E:*:*:*)
- echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*SV1:*:*:*)
- echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- *:UNICOS/mp:*:*)
- echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
- FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- 5000:UNIX_System_V:4.*:*)
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit ;;
- sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:FreeBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit ;;
- i*:CYGWIN*:*)
- echo ${UNAME_MACHINE}-pc-cygwin
- exit ;;
- i*:MINGW*:*)
- echo ${UNAME_MACHINE}-pc-mingw32
- exit ;;
- i*:windows32*:*)
- # uname -m includes "-pc" on this system.
- echo ${UNAME_MACHINE}-mingw32
- exit ;;
- i*:PW*:*)
- echo ${UNAME_MACHINE}-pc-pw32
- exit ;;
- x86:Interix*:[34]*)
- echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
- exit ;;
- [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
- echo i${UNAME_MACHINE}-pc-mks
- exit ;;
- i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
- # UNAME_MACHINE based on the output of uname instead of i386?
- echo i586-pc-interix
- exit ;;
- i*:UWIN*:*)
- echo ${UNAME_MACHINE}-pc-uwin
- exit ;;
- amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
- echo x86_64-unknown-cygwin
- exit ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin
- exit ;;
- prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- *:GNU:*:*)
- # the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit ;;
- *:GNU/*:*:*)
- # other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
- exit ;;
- i*86:Minix:*:*)
- echo ${UNAME_MACHINE}-pc-minix
- exit ;;
- arm*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- cris:Linux:*:*)
- echo cris-axis-linux-gnu
- exit ;;
- crisv32:Linux:*:*)
- echo crisv32-axis-linux-gnu
- exit ;;
- frv:Linux:*:*)
- echo frv-unknown-linux-gnu
- exit ;;
- ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- mips:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef mips
- #undef mipsel
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=mipsel
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=mips
- #else
- CPU=
- #endif
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
- ;;
- mips64:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef mips64
- #undef mips64el
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=mips64el
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=mips64
- #else
- CPU=
- #endif
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
- ;;
- or32:Linux:*:*)
- echo or32-unknown-linux-gnu
- exit ;;
- ppc:Linux:*:*)
- echo powerpc-unknown-linux-gnu
- exit ;;
- ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-gnu
- exit ;;
- alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
- EV5) UNAME_MACHINE=alphaev5 ;;
- EV56) UNAME_MACHINE=alphaev56 ;;
- PCA56) UNAME_MACHINE=alphapca56 ;;
- PCA57) UNAME_MACHINE=alphapca56 ;;
- EV6) UNAME_MACHINE=alphaev6 ;;
- EV67) UNAME_MACHINE=alphaev67 ;;
- EV68*) UNAME_MACHINE=alphaev68 ;;
- esac
- objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
- exit ;;
- parisc:Linux:*:* | hppa:Linux:*:*)
- # Look for CPU level
- case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-gnu ;;
- PA8*) echo hppa2.0-unknown-linux-gnu ;;
- *) echo hppa-unknown-linux-gnu ;;
- esac
- exit ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-gnu
- exit ;;
- s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux
- exit ;;
- sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- x86_64:Linux:*:*)
- echo x86_64-unknown-linux-gnu
- exit ;;
- i*86:Linux:*:*)
- # The BFD linker knows what the default object file format is, so
- # first see if it will tell us. cd to the root directory to prevent
- # problems with other programs or directories called `ld' in the path.
- # Set LC_ALL=C to ensure ld outputs messages in English.
- ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
- | sed -ne '/supported targets:/!d
- s/[ ][ ]*/ /g
- s/.*supported targets: *//
- s/ .*//
- p'`
- case "$ld_supported_targets" in
- elf32-i386)
- TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
- ;;
- a.out-i386-linux)
- echo "${UNAME_MACHINE}-pc-linux-gnuaout"
- exit ;;
- coff-i386)
- echo "${UNAME_MACHINE}-pc-linux-gnucoff"
- exit ;;
- "")
- # Either a pre-BFD a.out linker (linux-gnuoldld) or
- # one that does not give us useful --help.
- echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
- exit ;;
- esac
- # Determine whether the default compiler is a.out or elf
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <features.h>
- #ifdef __ELF__
- # ifdef __GLIBC__
- # if __GLIBC__ >= 2
- LIBC=gnu
- # else
- LIBC=gnulibc1
- # endif
- # else
- LIBC=gnulibc1
- # endif
- #else
- #ifdef __INTEL_COMPILER
- LIBC=gnu
- #else
- LIBC=gnuaout
- #endif
- #endif
- #ifdef __dietlibc__
- LIBC=dietlibc
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
- test x"${LIBC}" != x && {
- echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
- exit
- }
- test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
- ;;
- i*86:DYNIX/ptx:4*:*)
- # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
- # earlier versions are messed up and put the nodename in both
- # sysname and nodename.
- echo i386-sequent-sysv4
- exit ;;
- i*86:UNIX_SV:4.2MP:2.*)
- # Unixware is an offshoot of SVR4, but it has its own version
- # number series starting with 2...
- # I am not positive that other SVR4 systems won't match this,
- # I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit ;;
- i*86:OS/2:*:*)
- # If we were able to find `uname', then EMX Unix compatibility
- # is probably installed.
- echo ${UNAME_MACHINE}-pc-os2-emx
- exit ;;
- i*86:XTS-300:*:STOP)
- echo ${UNAME_MACHINE}-unknown-stop
- exit ;;
- i*86:atheos:*:*)
- echo ${UNAME_MACHINE}-unknown-atheos
- exit ;;
- i*86:syllable:*:*)
- echo ${UNAME_MACHINE}-pc-syllable
- exit ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- i*86:*DOS:*:*)
- echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit ;;
- i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
- UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
- if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
- fi
- exit ;;
- i*86:*:5:[678]*)
- # UnixWare 7.x, OpenUNIX and OpenServer 6.
- case `/bin/uname -X | grep "^Machine"` in
- *486*) UNAME_MACHINE=i486 ;;
- *Pentium) UNAME_MACHINE=i586 ;;
- *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
- esac
- echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
- exit ;;
- i*86:*:3.2:*)
- if test -f /usr/options/cb.name; then
- UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
- elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
- (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
- (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
- && UNAME_MACHINE=i586
- (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
- && UNAME_MACHINE=i686
- (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
- && UNAME_MACHINE=i686
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
- else
- echo ${UNAME_MACHINE}-pc-sysv32
- fi
- exit ;;
- pc:*:*:*)
- # Left here for compatibility:
- # uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i386.
- echo i386-pc-msdosdjgpp
- exit ;;
- Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit ;;
- paragon:*:*:*)
- echo i860-intel-osf1
- exit ;;
- i860:*:4.*:*) # i860-SVR4
- if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
- else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
- fi
- exit ;;
- mini*:CTIX:SYS*5:*)
- # "miniframe"
- echo m68010-convergent-sysv
- exit ;;
- mc68k:UNIX:SYSTEM5:3.51m)
- echo m68k-convergent-sysv
- exit ;;
- M680?0:D-NIX:5.3:*)
- echo m68k-diab-dnix
- exit ;;
- M68*:*:R3V[5678]*:*)
- test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
- 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
- OS_REL=''
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
- 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4; exit; } ;;
- m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit ;;
- TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- rs6000:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
- echo powerpc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
- exit ;;
- RM*:ReliantUNIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- *:SINIX-*:*:*)
- if uname -p 2>/dev/null >/dev/null ; then
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo ${UNAME_MACHINE}-sni-sysv4
- else
- echo ns32k-sni-sysv
- fi
- exit ;;
- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit ;;
- *:UNIX_System_V:4*:FTX*)
- # From Gerald Hewes <hewes@openmarket.com>.
- # How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit ;;
- *:*:*:FTX*)
- # From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit ;;
- i*86:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo ${UNAME_MACHINE}-stratus-vos
- exit ;;
- *:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo hppa1.1-stratus-vos
- exit ;;
- mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit ;;
- news*:NEWS-OS:6*:*)
- echo mips-sony-newsos6
- exit ;;
- R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
- else
- echo mips-unknown-sysv${UNAME_RELEASE}
- fi
- exit ;;
- BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
- echo powerpc-be-beos
- exit ;;
- BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
- echo powerpc-apple-beos
- exit ;;
- BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
- echo i586-pc-beos
- exit ;;
- SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-6:SUPER-UX:*:*)
- echo sx6-nec-superux${UNAME_RELEASE}
- exit ;;
- Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Rhapsody:*:*)
- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Darwin:*:*)
- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- case $UNAME_PROCESSOR in
- *86) UNAME_PROCESSOR=i686 ;;
- unknown) UNAME_PROCESSOR=powerpc ;;
- esac
- echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
- exit ;;
- *:procnto*:*:* | *:QNX:[0123456789]*:*)
- UNAME_PROCESSOR=`uname -p`
- if test "$UNAME_PROCESSOR" = "x86"; then
- UNAME_PROCESSOR=i386
- UNAME_MACHINE=pc
- fi
- echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
- exit ;;
- *:QNX:*:4*)
- echo i386-pc-qnx
- exit ;;
- NSE-?:NONSTOP_KERNEL:*:*)
- echo nse-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSR-?:NONSTOP_KERNEL:*:*)
- echo nsr-tandem-nsk${UNAME_RELEASE}
- exit ;;
- *:NonStop-UX:*:*)
- echo mips-compaq-nonstopux
- exit ;;
- BS2000:POSIX*:*:*)
- echo bs2000-siemens-sysv
- exit ;;
- DS/*:UNIX_System_V:*:*)
- echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit ;;
- *:Plan9:*:*)
- # "uname -m" is not consistent, so use $cputype instead. 386
- # is converted to i386 for consistency with other x86
- # operating systems.
- if test "$cputype" = "386"; then
- UNAME_MACHINE=i386
- else
- UNAME_MACHINE="$cputype"
- fi
- echo ${UNAME_MACHINE}-unknown-plan9
- exit ;;
- *:TOPS-10:*:*)
- echo pdp10-unknown-tops10
- exit ;;
- *:TENEX:*:*)
- echo pdp10-unknown-tenex
- exit ;;
- KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
- echo pdp10-dec-tops20
- exit ;;
- XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
- echo pdp10-xkl-tops20
- exit ;;
- *:TOPS-20:*:*)
- echo pdp10-unknown-tops20
- exit ;;
- *:ITS:*:*)
- echo pdp10-unknown-its
- exit ;;
- SEI:*:*:SEIUX)
- echo mips-sei-seiux${UNAME_RELEASE}
- exit ;;
- *:DragonFly:*:*)
- echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit ;;
- *:*VMS:*:*)
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- case "${UNAME_MACHINE}" in
- A*) echo alpha-dec-vms ; exit ;;
- I*) echo ia64-dec-vms ; exit ;;
- V*) echo vax-dec-vms ; exit ;;
- esac ;;
- *:XENIX:*:SysV)
- echo i386-pc-xenix
- exit ;;
- i*86:skyos:*:*)
- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
- exit ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
- /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
- I don't know.... */
- printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
- printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
- "4"
-#else
- ""
-#endif
- ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
- printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
- printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
- int version;
- version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
- if (version < 4)
- printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
- else
- printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
- exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
- printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
- printf ("ns32k-encore-mach\n"); exit (0);
-#else
- printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
- printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
- printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
- printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
- struct utsname un;
-
- uname(&un);
-
- if (strncmp(un.version, "V2", 2) == 0) {
- printf ("i386-sequent-ptx2\n"); exit (0);
- }
- if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
- printf ("i386-sequent-ptx1\n"); exit (0);
- }
- printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-# include <sys/param.h>
-# if defined (BSD)
-# if BSD == 43
- printf ("vax-dec-bsd4.3\n"); exit (0);
-# else
-# if BSD == 199006
- printf ("vax-dec-bsd4.3reno\n"); exit (0);
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# endif
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# else
- printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
- printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
- exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
- case `getsysinfo -f cpu_type` in
- c1*)
- echo c1-convex-bsd
- exit ;;
- c2*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- c34*)
- echo c34-convex-bsd
- exit ;;
- c38*)
- echo c38-convex-bsd
- exit ;;
- c4*)
- echo c4-convex-bsd
- exit ;;
- esac
-fi
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
- http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
-and
- http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo = `(hostinfo) 2>/dev/null`
-/bin/universe = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/source3/lib/talloc/config.mk b/source3/lib/talloc/config.mk
deleted file mode 100644
index c13e1b79ab..0000000000
--- a/source3/lib/talloc/config.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-[LIBRARY::LIBTALLOC]
-OUTPUT_TYPE = MERGED_OBJ
-CFLAGS = -Ilib/talloc
-
-LIBTALLOC_OBJ_FILES = lib/talloc/talloc.o
-
-MANPAGES += $(tallocdir)/talloc.3
diff --git a/source3/lib/talloc/config.sub b/source3/lib/talloc/config.sub
deleted file mode 100755
index 23cd6fd75c..0000000000
--- a/source3/lib/talloc/config.sub
+++ /dev/null
@@ -1,1577 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-timestamp='2005-07-08'
-
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine. It does not imply ALL GNU software can.
-#
-# This file 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/>.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support. The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
- $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help"
- exit 1 ;;
-
- *local*)
- # First pass through any local machine types.
- echo $1
- exit ;;
-
- * )
- break ;;
- esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
- exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
- exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
- nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
- kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
- os=-$maybe_os
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
- ;;
- *)
- basic_machine=`echo $1 | sed 's/-[^-]*$//'`
- if [ $basic_machine != $1 ]
- then os=`echo $1 | sed 's/.*-/-/'`
- else os=; fi
- ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work. We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
- -sun*os*)
- # Prevent following clause from handling this invalid input.
- ;;
- -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
- -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
- -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
- -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
- -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
- -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray)
- os=
- basic_machine=$1
- ;;
- -sim | -cisco | -oki | -wec | -winbond)
- os=
- basic_machine=$1
- ;;
- -scout)
- ;;
- -wrs)
- os=-vxworks
- basic_machine=$1
- ;;
- -chorusos*)
- os=-chorusos
- basic_machine=$1
- ;;
- -chorusrdb)
- os=-chorusrdb
- basic_machine=$1
- ;;
- -hiux*)
- os=-hiuxwe2
- ;;
- -sco5)
- os=-sco3.2v5
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco4)
- os=-sco3.2v4
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2v[4-9]*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco*)
- os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -udk*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -isc)
- os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -clix*)
- basic_machine=clipper-intergraph
- ;;
- -isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -lynx*)
- os=-lynxos
- ;;
- -ptx*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
- ;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
- ;;
- -psos*)
- os=-psos
- ;;
- -mint | -mint[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
- # Recognize the basic CPU types without company name.
- # Some are omitted here because they have special meanings below.
- 1750a | 580 \
- | a29k \
- | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
- | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
- | am33_2.0 \
- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
- | bfin \
- | c4x | clipper \
- | d10v | d30v | dlx | dsp16xx \
- | fr30 | frv \
- | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
- | i370 | i860 | i960 | ia64 \
- | ip2k | iq2000 \
- | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
- | mips | mipsbe | mipseb | mipsel | mipsle \
- | mips16 \
- | mips64 | mips64el \
- | mips64vr | mips64vrel \
- | mips64orion | mips64orionel \
- | mips64vr4100 | mips64vr4100el \
- | mips64vr4300 | mips64vr4300el \
- | mips64vr5000 | mips64vr5000el \
- | mips64vr5900 | mips64vr5900el \
- | mipsisa32 | mipsisa32el \
- | mipsisa32r2 | mipsisa32r2el \
- | mipsisa64 | mipsisa64el \
- | mipsisa64r2 | mipsisa64r2el \
- | mipsisa64sb1 | mipsisa64sb1el \
- | mipsisa64sr71k | mipsisa64sr71kel \
- | mipstx39 | mipstx39el \
- | mn10200 | mn10300 \
- | ms1 \
- | msp430 \
- | ns16k | ns32k \
- | or32 \
- | pdp10 | pdp11 | pj | pjl \
- | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
- | pyramid \
- | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
- | sh64 | sh64le \
- | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
- | sparcv8 | sparcv9 | sparcv9b \
- | strongarm \
- | tahoe | thumb | tic4x | tic80 | tron \
- | v850 | v850e \
- | we32k \
- | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
- | z8k)
- basic_machine=$basic_machine-unknown
- ;;
- m32c)
- basic_machine=$basic_machine-unknown
- ;;
- m6811 | m68hc11 | m6812 | m68hc12)
- # Motorola 68HC11/12.
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
- ;;
-
- # We use `pc' rather than `unknown'
- # because (1) that's what they normally are, and
- # (2) the word "unknown" tends to confuse beginning users.
- i*86 | x86_64)
- basic_machine=$basic_machine-pc
- ;;
- # Object if more than one company name word.
- *-*-*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
- # Recognize the basic CPU types with company name.
- 580-* \
- | a29k-* \
- | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
- | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
- | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
- | avr-* \
- | bfin-* | bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
- | clipper-* | craynv-* | cydra-* \
- | d10v-* | d30v-* | dlx-* \
- | elxsi-* \
- | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
- | h8300-* | h8500-* \
- | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
- | i*86-* | i860-* | i960-* | ia64-* \
- | ip2k-* | iq2000-* \
- | m32r-* | m32rle-* \
- | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* \
- | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
- | mips16-* \
- | mips64-* | mips64el-* \
- | mips64vr-* | mips64vrel-* \
- | mips64orion-* | mips64orionel-* \
- | mips64vr4100-* | mips64vr4100el-* \
- | mips64vr4300-* | mips64vr4300el-* \
- | mips64vr5000-* | mips64vr5000el-* \
- | mips64vr5900-* | mips64vr5900el-* \
- | mipsisa32-* | mipsisa32el-* \
- | mipsisa32r2-* | mipsisa32r2el-* \
- | mipsisa64-* | mipsisa64el-* \
- | mipsisa64r2-* | mipsisa64r2el-* \
- | mipsisa64sb1-* | mipsisa64sb1el-* \
- | mipsisa64sr71k-* | mipsisa64sr71kel-* \
- | mipstx39-* | mipstx39el-* \
- | mmix-* \
- | ms1-* \
- | msp430-* \
- | none-* | np1-* | ns16k-* | ns32k-* \
- | orion-* \
- | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
- | pyramid-* \
- | romp-* | rs6000-* \
- | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
- | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
- | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
- | sparclite-* \
- | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
- | tahoe-* | thumb-* \
- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
- | tron-* \
- | v850-* | v850e-* | vax-* \
- | we32k-* \
- | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
- | xstormy16-* | xtensa-* \
- | ymp-* \
- | z8k-*)
- ;;
- m32c-*)
- ;;
- # Recognize the various machine names and aliases which stand
- # for a CPU type and a company and sometimes even an OS.
- 386bsd)
- basic_machine=i386-unknown
- os=-bsd
- ;;
- 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- basic_machine=m68000-att
- ;;
- 3b*)
- basic_machine=we32k-att
- ;;
- a29khif)
- basic_machine=a29k-amd
- os=-udi
- ;;
- abacus)
- basic_machine=abacus-unknown
- ;;
- adobe68k)
- basic_machine=m68010-adobe
- os=-scout
- ;;
- alliant | fx80)
- basic_machine=fx80-alliant
- ;;
- altos | altos3068)
- basic_machine=m68k-altos
- ;;
- am29k)
- basic_machine=a29k-none
- os=-bsd
- ;;
- amd64)
- basic_machine=x86_64-pc
- ;;
- amd64-*)
- basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- amdahl)
- basic_machine=580-amdahl
- os=-sysv
- ;;
- amiga | amiga-*)
- basic_machine=m68k-unknown
- ;;
- amigaos | amigados)
- basic_machine=m68k-unknown
- os=-amigaos
- ;;
- amigaunix | amix)
- basic_machine=m68k-unknown
- os=-sysv4
- ;;
- apollo68)
- basic_machine=m68k-apollo
- os=-sysv
- ;;
- apollo68bsd)
- basic_machine=m68k-apollo
- os=-bsd
- ;;
- aux)
- basic_machine=m68k-apple
- os=-aux
- ;;
- balance)
- basic_machine=ns32k-sequent
- os=-dynix
- ;;
- c90)
- basic_machine=c90-cray
- os=-unicos
- ;;
- convex-c1)
- basic_machine=c1-convex
- os=-bsd
- ;;
- convex-c2)
- basic_machine=c2-convex
- os=-bsd
- ;;
- convex-c32)
- basic_machine=c32-convex
- os=-bsd
- ;;
- convex-c34)
- basic_machine=c34-convex
- os=-bsd
- ;;
- convex-c38)
- basic_machine=c38-convex
- os=-bsd
- ;;
- cray | j90)
- basic_machine=j90-cray
- os=-unicos
- ;;
- craynv)
- basic_machine=craynv-cray
- os=-unicosmp
- ;;
- cr16c)
- basic_machine=cr16c-unknown
- os=-elf
- ;;
- crds | unos)
- basic_machine=m68k-crds
- ;;
- crisv32 | crisv32-* | etraxfs*)
- basic_machine=crisv32-axis
- ;;
- cris | cris-* | etrax*)
- basic_machine=cris-axis
- ;;
- crx)
- basic_machine=crx-unknown
- os=-elf
- ;;
- da30 | da30-*)
- basic_machine=m68k-da30
- ;;
- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
- basic_machine=mips-dec
- ;;
- decsystem10* | dec10*)
- basic_machine=pdp10-dec
- os=-tops10
- ;;
- decsystem20* | dec20*)
- basic_machine=pdp10-dec
- os=-tops20
- ;;
- delta | 3300 | motorola-3300 | motorola-delta \
- | 3300-motorola | delta-motorola)
- basic_machine=m68k-motorola
- ;;
- delta88)
- basic_machine=m88k-motorola
- os=-sysv3
- ;;
- djgpp)
- basic_machine=i586-pc
- os=-msdosdjgpp
- ;;
- dpx20 | dpx20-*)
- basic_machine=rs6000-bull
- os=-bosx
- ;;
- dpx2* | dpx2*-bull)
- basic_machine=m68k-bull
- os=-sysv3
- ;;
- ebmon29k)
- basic_machine=a29k-amd
- os=-ebmon
- ;;
- elxsi)
- basic_machine=elxsi-elxsi
- os=-bsd
- ;;
- encore | umax | mmax)
- basic_machine=ns32k-encore
- ;;
- es1800 | OSE68k | ose68k | ose | OSE)
- basic_machine=m68k-ericsson
- os=-ose
- ;;
- fx2800)
- basic_machine=i860-alliant
- ;;
- genix)
- basic_machine=ns32k-ns
- ;;
- gmicro)
- basic_machine=tron-gmicro
- os=-sysv
- ;;
- go32)
- basic_machine=i386-pc
- os=-go32
- ;;
- h3050r* | hiux*)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- h8300hms)
- basic_machine=h8300-hitachi
- os=-hms
- ;;
- h8300xray)
- basic_machine=h8300-hitachi
- os=-xray
- ;;
- h8500hms)
- basic_machine=h8500-hitachi
- os=-hms
- ;;
- harris)
- basic_machine=m88k-harris
- os=-sysv3
- ;;
- hp300-*)
- basic_machine=m68k-hp
- ;;
- hp300bsd)
- basic_machine=m68k-hp
- os=-bsd
- ;;
- hp300hpux)
- basic_machine=m68k-hp
- os=-hpux
- ;;
- hp3k9[0-9][0-9] | hp9[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k2[0-9][0-9] | hp9k31[0-9])
- basic_machine=m68000-hp
- ;;
- hp9k3[2-9][0-9])
- basic_machine=m68k-hp
- ;;
- hp9k6[0-9][0-9] | hp6[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k7[0-79][0-9] | hp7[0-79][0-9])
- basic_machine=hppa1.1-hp
- ;;
- hp9k78[0-9] | hp78[0-9])
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][13679] | hp8[0-9][13679])
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][0-9] | hp8[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hppa-next)
- os=-nextstep3
- ;;
- hppaosf)
- basic_machine=hppa1.1-hp
- os=-osf
- ;;
- hppro)
- basic_machine=hppa1.1-hp
- os=-proelf
- ;;
- i370-ibm* | ibm*)
- basic_machine=i370-ibm
- ;;
-# I'm not sure what "Sysv32" means. Should this be sysv3.2?
- i*86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv32
- ;;
- i*86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
- ;;
- i*86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
- ;;
- i*86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-solaris2
- ;;
- i386mach)
- basic_machine=i386-mach
- os=-mach
- ;;
- i386-vsta | vsta)
- basic_machine=i386-unknown
- os=-vsta
- ;;
- iris | iris4d)
- basic_machine=mips-sgi
- case $os in
- -irix*)
- ;;
- *)
- os=-irix4
- ;;
- esac
- ;;
- isi68 | isi)
- basic_machine=m68k-isi
- os=-sysv
- ;;
- m88k-omron*)
- basic_machine=m88k-omron
- ;;
- magnum | m3230)
- basic_machine=mips-mips
- os=-sysv
- ;;
- merlin)
- basic_machine=ns32k-utek
- os=-sysv
- ;;
- mingw32)
- basic_machine=i386-pc
- os=-mingw32
- ;;
- miniframe)
- basic_machine=m68000-convergent
- ;;
- *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- monitor)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- morphos)
- basic_machine=powerpc-unknown
- os=-morphos
- ;;
- msdos)
- basic_machine=i386-pc
- os=-msdos
- ;;
- mvs)
- basic_machine=i370-ibm
- os=-mvs
- ;;
- ncr3000)
- basic_machine=i486-ncr
- os=-sysv4
- ;;
- netbsd386)
- basic_machine=i386-unknown
- os=-netbsd
- ;;
- netwinder)
- basic_machine=armv4l-rebel
- os=-linux
- ;;
- news | news700 | news800 | news900)
- basic_machine=m68k-sony
- os=-newsos
- ;;
- news1000)
- basic_machine=m68030-sony
- os=-newsos
- ;;
- news-3600 | risc-news)
- basic_machine=mips-sony
- os=-newsos
- ;;
- necv70)
- basic_machine=v70-nec
- os=-sysv
- ;;
- next | m*-next )
- basic_machine=m68k-next
- case $os in
- -nextstep* )
- ;;
- -ns2*)
- os=-nextstep2
- ;;
- *)
- os=-nextstep3
- ;;
- esac
- ;;
- nh3000)
- basic_machine=m68k-harris
- os=-cxux
- ;;
- nh[45]000)
- basic_machine=m88k-harris
- os=-cxux
- ;;
- nindy960)
- basic_machine=i960-intel
- os=-nindy
- ;;
- mon960)
- basic_machine=i960-intel
- os=-mon960
- ;;
- nonstopux)
- basic_machine=mips-compaq
- os=-nonstopux
- ;;
- np1)
- basic_machine=np1-gould
- ;;
- nsr-tandem)
- basic_machine=nsr-tandem
- ;;
- op50n-* | op60c-*)
- basic_machine=hppa1.1-oki
- os=-proelf
- ;;
- openrisc | openrisc-*)
- basic_machine=or32-unknown
- ;;
- os400)
- basic_machine=powerpc-ibm
- os=-os400
- ;;
- OSE68000 | ose68000)
- basic_machine=m68000-ericsson
- os=-ose
- ;;
- os68k)
- basic_machine=m68k-none
- os=-os68k
- ;;
- pa-hitachi)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- paragon)
- basic_machine=i860-intel
- os=-osf
- ;;
- pbd)
- basic_machine=sparc-tti
- ;;
- pbb)
- basic_machine=m68k-tti
- ;;
- pc532 | pc532-*)
- basic_machine=ns32k-pc532
- ;;
- pentium | p5 | k5 | k6 | nexgen | viac3)
- basic_machine=i586-pc
- ;;
- pentiumpro | p6 | 6x86 | athlon | athlon_*)
- basic_machine=i686-pc
- ;;
- pentiumii | pentium2 | pentiumiii | pentium3)
- basic_machine=i686-pc
- ;;
- pentium4)
- basic_machine=i786-pc
- ;;
- pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-* | 6x86-* | athlon-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium4-*)
- basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pn)
- basic_machine=pn-gould
- ;;
- power) basic_machine=power-ibm
- ;;
- ppc) basic_machine=powerpc-unknown
- ;;
- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppcle | powerpclittle | ppc-le | powerpc-little)
- basic_machine=powerpcle-unknown
- ;;
- ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64) basic_machine=powerpc64-unknown
- ;;
- ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64le | powerpc64little | ppc64-le | powerpc64-little)
- basic_machine=powerpc64le-unknown
- ;;
- ppc64le-* | powerpc64little-*)
- basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ps2)
- basic_machine=i386-ibm
- ;;
- pw32)
- basic_machine=i586-unknown
- os=-pw32
- ;;
- rom68k)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- rm[46]00)
- basic_machine=mips-siemens
- ;;
- rtpc | rtpc-*)
- basic_machine=romp-ibm
- ;;
- s390 | s390-*)
- basic_machine=s390-ibm
- ;;
- s390x | s390x-*)
- basic_machine=s390x-ibm
- ;;
- sa29200)
- basic_machine=a29k-amd
- os=-udi
- ;;
- sb1)
- basic_machine=mipsisa64sb1-unknown
- ;;
- sb1el)
- basic_machine=mipsisa64sb1el-unknown
- ;;
- sei)
- basic_machine=mips-sei
- os=-seiux
- ;;
- sequent)
- basic_machine=i386-sequent
- ;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
- ;;
- sh64)
- basic_machine=sh64-unknown
- ;;
- sparclite-wrs | simso-wrs)
- basic_machine=sparclite-wrs
- os=-vxworks
- ;;
- sps7)
- basic_machine=m68k-bull
- os=-sysv2
- ;;
- spur)
- basic_machine=spur-unknown
- ;;
- st2000)
- basic_machine=m68k-tandem
- ;;
- stratus)
- basic_machine=i860-stratus
- os=-sysv4
- ;;
- sun2)
- basic_machine=m68000-sun
- ;;
- sun2os3)
- basic_machine=m68000-sun
- os=-sunos3
- ;;
- sun2os4)
- basic_machine=m68000-sun
- os=-sunos4
- ;;
- sun3os3)
- basic_machine=m68k-sun
- os=-sunos3
- ;;
- sun3os4)
- basic_machine=m68k-sun
- os=-sunos4
- ;;
- sun4os3)
- basic_machine=sparc-sun
- os=-sunos3
- ;;
- sun4os4)
- basic_machine=sparc-sun
- os=-sunos4
- ;;
- sun4sol2)
- basic_machine=sparc-sun
- os=-solaris2
- ;;
- sun3 | sun3-*)
- basic_machine=m68k-sun
- ;;
- sun4)
- basic_machine=sparc-sun
- ;;
- sun386 | sun386i | roadrunner)
- basic_machine=i386-sun
- ;;
- sv1)
- basic_machine=sv1-cray
- os=-unicos
- ;;
- symmetry)
- basic_machine=i386-sequent
- os=-dynix
- ;;
- t3e)
- basic_machine=alphaev5-cray
- os=-unicos
- ;;
- t90)
- basic_machine=t90-cray
- os=-unicos
- ;;
- tic54x | c54x*)
- basic_machine=tic54x-unknown
- os=-coff
- ;;
- tic55x | c55x*)
- basic_machine=tic55x-unknown
- os=-coff
- ;;
- tic6x | c6x*)
- basic_machine=tic6x-unknown
- os=-coff
- ;;
- tx39)
- basic_machine=mipstx39-unknown
- ;;
- tx39el)
- basic_machine=mipstx39el-unknown
- ;;
- toad1)
- basic_machine=pdp10-xkl
- os=-tops20
- ;;
- tower | tower-32)
- basic_machine=m68k-ncr
- ;;
- tpf)
- basic_machine=s390x-ibm
- os=-tpf
- ;;
- udi29k)
- basic_machine=a29k-amd
- os=-udi
- ;;
- ultra3)
- basic_machine=a29k-nyu
- os=-sym1
- ;;
- v810 | necv810)
- basic_machine=v810-nec
- os=-none
- ;;
- vaxv)
- basic_machine=vax-dec
- os=-sysv
- ;;
- vms)
- basic_machine=vax-dec
- os=-vms
- ;;
- vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
- ;;
- vxworks960)
- basic_machine=i960-wrs
- os=-vxworks
- ;;
- vxworks68)
- basic_machine=m68k-wrs
- os=-vxworks
- ;;
- vxworks29k)
- basic_machine=a29k-wrs
- os=-vxworks
- ;;
- w65*)
- basic_machine=w65-wdc
- os=-none
- ;;
- w89k-*)
- basic_machine=hppa1.1-winbond
- os=-proelf
- ;;
- xbox)
- basic_machine=i686-pc
- os=-mingw32
- ;;
- xps | xps100)
- basic_machine=xps100-honeywell
- ;;
- ymp)
- basic_machine=ymp-cray
- os=-unicos
- ;;
- z8k-*-coff)
- basic_machine=z8k-unknown
- os=-sim
- ;;
- none)
- basic_machine=none-none
- os=-none
- ;;
-
-# Here we handle the default manufacturer of certain CPU types. It is in
-# some cases the only manufacturer, in others, it is the most popular.
- w89k)
- basic_machine=hppa1.1-winbond
- ;;
- op50n)
- basic_machine=hppa1.1-oki
- ;;
- op60c)
- basic_machine=hppa1.1-oki
- ;;
- romp)
- basic_machine=romp-ibm
- ;;
- mmix)
- basic_machine=mmix-knuth
- ;;
- rs6000)
- basic_machine=rs6000-ibm
- ;;
- vax)
- basic_machine=vax-dec
- ;;
- pdp10)
- # there are many clones, so DEC is not a safe bet
- basic_machine=pdp10-unknown
- ;;
- pdp11)
- basic_machine=pdp11-dec
- ;;
- we32k)
- basic_machine=we32k-att
- ;;
- sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
- basic_machine=sh-unknown
- ;;
- sparc | sparcv8 | sparcv9 | sparcv9b)
- basic_machine=sparc-sun
- ;;
- cydra)
- basic_machine=cydra-cydrome
- ;;
- orion)
- basic_machine=orion-highlevel
- ;;
- orion105)
- basic_machine=clipper-highlevel
- ;;
- mac | mpw | mac-mpw)
- basic_machine=m68k-apple
- ;;
- pmac | pmac-mpw)
- basic_machine=powerpc-apple
- ;;
- *-unknown)
- # Make sure to match an already-canonicalized machine name.
- ;;
- *)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
- *-digital*)
- basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
- ;;
- *-commodore*)
- basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
- ;;
- *)
- ;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
- # -solaris* is a basic system type, with this one exception.
- -solaris1 | -solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
- ;;
- -solaris)
- os=-solaris2
- ;;
- -svr4*)
- os=-sysv4
- ;;
- -unixware*)
- os=-sysv4.2uw
- ;;
- -gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
- # First accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST END IN A *, to match a version number.
- # -sysv* is not here because it comes later, after sysvr4.
- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* \
- | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
- | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
- | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -chorusos* | -chorusrdb* \
- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
- | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
- | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
- | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -qnx*)
- case $basic_machine in
- x86-* | i*86-*)
- ;;
- *)
- os=-nto$os
- ;;
- esac
- ;;
- -nto-qnx*)
- ;;
- -nto*)
- os=`echo $os | sed -e 's|nto|nto-qnx|'`
- ;;
- -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
- | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
- ;;
- -mac*)
- os=`echo $os | sed -e 's|mac|macos|'`
- ;;
- -linux-dietlibc)
- os=-linux-dietlibc
- ;;
- -linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
- ;;
- -sunos5*)
- os=`echo $os | sed -e 's|sunos5|solaris2|'`
- ;;
- -sunos6*)
- os=`echo $os | sed -e 's|sunos6|solaris3|'`
- ;;
- -opened*)
- os=-openedition
- ;;
- -os400*)
- os=-os400
- ;;
- -wince*)
- os=-wince
- ;;
- -osfrose*)
- os=-osfrose
- ;;
- -osf*)
- os=-osf
- ;;
- -utek*)
- os=-bsd
- ;;
- -dynix*)
- os=-bsd
- ;;
- -acis*)
- os=-aos
- ;;
- -atheos*)
- os=-atheos
- ;;
- -syllable*)
- os=-syllable
- ;;
- -386bsd)
- os=-bsd
- ;;
- -ctix* | -uts*)
- os=-sysv
- ;;
- -nova*)
- os=-rtmk-nova
- ;;
- -ns2 )
- os=-nextstep2
- ;;
- -nsk*)
- os=-nsk
- ;;
- # Preserve the version number of sinix5.
- -sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
- ;;
- -sinix*)
- os=-sysv4
- ;;
- -tpf*)
- os=-tpf
- ;;
- -triton*)
- os=-sysv3
- ;;
- -oss*)
- os=-sysv3
- ;;
- -svr4)
- os=-sysv4
- ;;
- -svr3)
- os=-sysv3
- ;;
- -sysvr4)
- os=-sysv4
- ;;
- # This must come after -sysvr4.
- -sysv*)
- ;;
- -ose*)
- os=-ose
- ;;
- -es1800*)
- os=-ose
- ;;
- -xenix)
- os=-xenix
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- os=-mint
- ;;
- -aros*)
- os=-aros
- ;;
- -kaos*)
- os=-kaos
- ;;
- -zvmoe)
- os=-zvmoe
- ;;
- -none)
- ;;
- *)
- # Get rid of the `-' at the beginning of $os.
- os=`echo $os | sed 's/[^-]*-//'`
- echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
- exit 1
- ;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system. Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
- *-acorn)
- os=-riscix1.2
- ;;
- arm*-rebel)
- os=-linux
- ;;
- arm*-semi)
- os=-aout
- ;;
- c4x-* | tic4x-*)
- os=-coff
- ;;
- # This must come before the *-dec entry.
- pdp10-*)
- os=-tops20
- ;;
- pdp11-*)
- os=-none
- ;;
- *-dec | vax-*)
- os=-ultrix4.2
- ;;
- m68*-apollo)
- os=-domain
- ;;
- i386-sun)
- os=-sunos4.0.2
- ;;
- m68000-sun)
- os=-sunos3
- # This also exists in the configure program, but was not the
- # default.
- # os=-sunos4
- ;;
- m68*-cisco)
- os=-aout
- ;;
- mips*-cisco)
- os=-elf
- ;;
- mips*-*)
- os=-elf
- ;;
- or32-*)
- os=-coff
- ;;
- *-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
- ;;
- sparc-* | *-sun)
- os=-sunos4.1.1
- ;;
- *-be)
- os=-beos
- ;;
- *-haiku)
- os=-haiku
- ;;
- *-ibm)
- os=-aix
- ;;
- *-knuth)
- os=-mmixware
- ;;
- *-wec)
- os=-proelf
- ;;
- *-winbond)
- os=-proelf
- ;;
- *-oki)
- os=-proelf
- ;;
- *-hp)
- os=-hpux
- ;;
- *-hitachi)
- os=-hiux
- ;;
- i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- os=-sysv
- ;;
- *-cbm)
- os=-amigaos
- ;;
- *-dg)
- os=-dgux
- ;;
- *-dolphin)
- os=-sysv3
- ;;
- m68k-ccur)
- os=-rtu
- ;;
- m88k-omron*)
- os=-luna
- ;;
- *-next )
- os=-nextstep
- ;;
- *-sequent)
- os=-ptx
- ;;
- *-crds)
- os=-unos
- ;;
- *-ns)
- os=-genix
- ;;
- i370-*)
- os=-mvs
- ;;
- *-next)
- os=-nextstep3
- ;;
- *-gould)
- os=-sysv
- ;;
- *-highlevel)
- os=-bsd
- ;;
- *-encore)
- os=-bsd
- ;;
- *-sgi)
- os=-irix
- ;;
- *-siemens)
- os=-sysv4
- ;;
- *-masscomp)
- os=-rtu
- ;;
- f30[01]-fujitsu | f700-fujitsu)
- os=-uxpv
- ;;
- *-rom68k)
- os=-coff
- ;;
- *-*bug)
- os=-coff
- ;;
- *-apple)
- os=-macos
- ;;
- *-atari*)
- os=-mint
- ;;
- *)
- os=-none
- ;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer. We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
- *-unknown)
- case $os in
- -riscix*)
- vendor=acorn
- ;;
- -sunos*)
- vendor=sun
- ;;
- -aix*)
- vendor=ibm
- ;;
- -beos*)
- vendor=be
- ;;
- -hpux*)
- vendor=hp
- ;;
- -mpeix*)
- vendor=hp
- ;;
- -hiux*)
- vendor=hitachi
- ;;
- -unos*)
- vendor=crds
- ;;
- -dgux*)
- vendor=dg
- ;;
- -luna*)
- vendor=omron
- ;;
- -genix*)
- vendor=ns
- ;;
- -mvs* | -opened*)
- vendor=ibm
- ;;
- -os400*)
- vendor=ibm
- ;;
- -ptx*)
- vendor=sequent
- ;;
- -tpf*)
- vendor=ibm
- ;;
- -vxsim* | -vxworks* | -windiss*)
- vendor=wrs
- ;;
- -aux*)
- vendor=apple
- ;;
- -hms*)
- vendor=hitachi
- ;;
- -mpw* | -macos*)
- vendor=apple
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- vendor=atari
- ;;
- -vos*)
- vendor=stratus
- ;;
- esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- ;;
-esac
-
-echo $basic_machine$os
-exit
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/source3/lib/talloc/configure.ac b/source3/lib/talloc/configure.ac
deleted file mode 100644
index 4719aa04b5..0000000000
--- a/source3/lib/talloc/configure.ac
+++ /dev/null
@@ -1,24 +0,0 @@
-AC_PREREQ(2.50)
-AC_INIT(talloc, 1.2.0)
-AC_CONFIG_SRCDIR([talloc.c])
-AC_SUBST(datarootdir)
-AC_CONFIG_HEADER(config.h)
-
-AC_LIBREPLACE_ALL_CHECKS
-
-m4_include(libtalloc.m4)
-
-AC_PATH_PROG(XSLTPROC,xsltproc)
-DOC_TARGET=""
-if test -n "$XSLTPROC"; then
- DOC_TARGET=doc
-fi
-AC_SUBST(DOC_TARGET)
-
-AC_LD_PICFLAG
-AC_LD_SHLIBEXT
-AC_LD_SONAMEFLAG
-AC_LIBREPLACE_SHLD
-AC_LIBREPLACE_SHLD_FLAGS
-
-AC_OUTPUT(Makefile talloc.pc)
diff --git a/source3/lib/talloc/install-sh b/source3/lib/talloc/install-sh
deleted file mode 100755
index 58719246f0..0000000000
--- a/source3/lib/talloc/install-sh
+++ /dev/null
@@ -1,238 +0,0 @@
-#! /bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-#
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- true
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- else
- instcmd=mkdir
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f $src -o -d $src ]
- then
- true
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- true
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- true
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
-
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
-
- pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
-
-# Make a temp file name in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd $src $dsttmp &&
-
- trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
diff --git a/source3/lib/talloc/libtalloc.m4 b/source3/lib/talloc/libtalloc.m4
deleted file mode 100644
index fd2b4b22cd..0000000000
--- a/source3/lib/talloc/libtalloc.m4
+++ /dev/null
@@ -1,33 +0,0 @@
-dnl find the talloc sources. This is meant to work both for
-dnl talloc standalone builds, and builds of packages using talloc
-tallocdir=""
-tallocpaths=". lib/talloc talloc ../talloc"
-for d in $tallocpaths; do
- if test -f "$srcdir/$d/talloc.c"; then
- tallocdir="$d"
- AC_SUBST(tallocdir)
- break;
- fi
-done
-if test x"$tallocdir" = "x"; then
- AC_MSG_ERROR([cannot find talloc source in $tallocpaths])
-fi
-TALLOC_OBJ="talloc.o"
-AC_SUBST(TALLOC_OBJ)
-
-TALLOC_CFLAGS="-I$srcdir/$tallocdir"
-AC_SUBST(TALLOC_CFLAGS)
-
-TALLOC_LIBS=""
-AC_SUBST(TALLOC_LIBS)
-
-AC_CHECK_SIZEOF(size_t,cross)
-AC_CHECK_SIZEOF(void *,cross)
-
-if test $ac_cv_sizeof_size_t -lt $ac_cv_sizeof_void_p; then
- AC_WARN([size_t cannot represent the amount of used memory of a process])
- AC_WARN([please report this to <samba-technical@samba.org>])
- AC_WARN([sizeof(size_t) = $ac_cv_sizeof_size_t])
- AC_WARN([sizeof(void *) = $ac_cv_sizeof_void_p])
- AC_ERROR([sizeof(size_t) < sizeof(void *)])
-fi
diff --git a/source3/lib/talloc/rules.mk b/source3/lib/talloc/rules.mk
deleted file mode 100644
index 6cee126529..0000000000
--- a/source3/lib/talloc/rules.mk
+++ /dev/null
@@ -1,18 +0,0 @@
-.SUFFIXES: .c .o .3 .3.xml .xml .html
-
-showflags::
- @echo 'talloc will be compiled with flags:'
- @echo ' CFLAGS = $(CFLAGS)'
- @echo ' LIBS = $(LIBS)'
-
-.c.o:
- $(CC) $(PICFLAG) -o $@ -c $< $(CFLAGS)
-
-.3.xml.3:
- -test -z "$(XSLTPROC)" || $(XSLTPROC) --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
-
-.xml.html:
- -test -z "$(XSLTPROC)" || $(XSLTPROC) --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl $<
-
-distclean::
- rm -f *~ */*~
diff --git a/source3/lib/talloc/talloc.3.xml b/source3/lib/talloc/talloc.3.xml
deleted file mode 100644
index 67de15bfc8..0000000000
--- a/source3/lib/talloc/talloc.3.xml
+++ /dev/null
@@ -1,738 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
-<refentry>
- <refmeta>
- <refentrytitle>talloc</refentrytitle>
- <manvolnum>3</manvolnum>
- </refmeta>
- <refnamediv>
- <refname>talloc</refname>
-<refpurpose>hierarchical reference counted memory pool system with destructors</refpurpose>
- </refnamediv>
- <refsynopsisdiv>
-<synopsis>#include &lt;talloc/talloc.h&gt;</synopsis>
- </refsynopsisdiv>
- <refsect1><title>DESCRIPTION</title>
- <para>
- If you are used to talloc from Samba3 then please read this
- carefully, as talloc has changed a lot.
- </para>
- <para>
- The new talloc is a hierarchical, reference counted memory pool
- system with destructors. Quite a mouthful really, but not too bad
- once you get used to it.
- </para>
- <para>
- Perhaps the biggest change from Samba3 is that there is no
- distinction between a "talloc context" and a "talloc pointer". Any
- pointer returned from talloc() is itself a valid talloc context.
- This means you can do this:
- </para>
- <programlisting>
- struct foo *X = talloc(mem_ctx, struct foo);
- X->name = talloc_strdup(X, "foo");
- </programlisting>
- <para>
- and the pointer <literal role="code">X-&gt;name</literal>
- would be a "child" of the talloc context <literal
- role="code">X</literal> which is itself a child of
- <literal role="code">mem_ctx</literal>. So if you do
- <literal role="code">talloc_free(mem_ctx)</literal> then
- it is all destroyed, whereas if you do <literal
- role="code">talloc_free(X)</literal> then just <literal
- role="code">X</literal> and <literal
- role="code">X-&gt;name</literal> are destroyed, and if
- you do <literal
- role="code">talloc_free(X-&gt;name)</literal> then just
- the name element of <literal role="code">X</literal> is
- destroyed.
- </para>
- <para>
- If you think about this, then what this effectively gives you is an
- n-ary tree, where you can free any part of the tree with
- talloc_free().
- </para>
- <para>
- If you find this confusing, then I suggest you run the <literal
- role="code">testsuite</literal> program to watch talloc
- in action. You may also like to add your own tests to <literal
- role="code">testsuite.c</literal> to clarify how some
- particular situation is handled.
- </para>
- </refsect1>
- <refsect1><title>TALLOC API</title>
- <para>
- The following is a complete guide to the talloc API. Read it all at
- least twice.
- </para>
- <refsect2><title>(type *)talloc(const void *ctx, type);</title>
- <para>
- The talloc() macro is the core of the talloc library. It takes a
- memory <emphasis role="italic">ctx</emphasis> and a <emphasis
- role="italic">type</emphasis>, and returns a pointer to a new
- area of memory of the given <emphasis
- role="italic">type</emphasis>.
- </para>
- <para>
- The returned pointer is itself a talloc context, so you can use
- it as the <emphasis role="italic">ctx</emphasis> argument to more
- calls to talloc() if you wish.
- </para>
- <para>
- The returned pointer is a "child" of the supplied context. This
- means that if you talloc_free() the <emphasis
- role="italic">ctx</emphasis> then the new child disappears as
- well. Alternatively you can free just the child.
- </para>
- <para>
- The <emphasis role="italic">ctx</emphasis> argument to talloc()
- can be NULL, in which case a new top level context is created.
- </para>
- </refsect2>
- <refsect2><title>void *talloc_size(const void *ctx, size_t size);</title>
- <para>
- The function talloc_size() should be used when you don't have a
- convenient type to pass to talloc(). Unlike talloc(), it is not
- type safe (as it returns a void *), so you are on your own for
- type checking.
- </para>
- </refsect2>
- <refsect2><title>(typeof(ptr)) talloc_ptrtype(const void *ctx, ptr);</title>
- <para>
- The talloc_ptrtype() macro should be used when you have a pointer and
- want to allocate memory to point at with this pointer. When compiling
- with gcc >= 3 it is typesafe. Note this is a wrapper of talloc_size()
- and talloc_get_name() will return the current location in the source file.
- and not the type.
- </para>
- </refsect2>
- <refsect2><title>int talloc_free(void *ptr);</title>
- <para>
- The talloc_free() function frees a piece of talloc memory, and
- all its children. You can call talloc_free() on any pointer
- returned by talloc().
- </para>
- <para>
- The return value of talloc_free() indicates success or failure,
- with 0 returned for success and -1 for failure. The only
- possible failure condition is if <emphasis
- role="italic">ptr</emphasis> had a destructor attached to it and
- the destructor returned -1. See <link
- linkend="talloc_set_destructor"><quote>talloc_set_destructor()</quote></link>
- for details on destructors.
- </para>
- <para>
- If this pointer has an additional parent when talloc_free() is
- called then the memory is not actually released, but instead the
- most recently established parent is destroyed. See <link
- linkend="talloc_reference"><quote>talloc_reference()</quote></link>
- for details on establishing additional parents.
- </para>
- <para>
- For more control on which parent is removed, see <link
- linkend="talloc_unlink"><quote>talloc_unlink()</quote></link>.
- </para>
- <para>
- talloc_free() operates recursively on its children.
- </para>
- </refsect2>
- <refsect2 id="talloc_reference"><title>void *talloc_reference(const void *ctx, const void *ptr);</title>
- <para>
- The talloc_reference() function makes <emphasis
- role="italic">ctx</emphasis> an additional parent of <emphasis
- role="italic">ptr</emphasis>.
- </para>
- <para>
- The return value of talloc_reference() is always the original
- pointer <emphasis role="italic">ptr</emphasis>, unless talloc ran
- out of memory in creating the reference in which case it will
- return NULL (each additional reference consumes around 48 bytes
- of memory on intel x86 platforms).
- </para>
- <para>
- If <emphasis role="italic">ptr</emphasis> is NULL, then the
- function is a no-op, and simply returns NULL.
- </para>
- <para>
- After creating a reference you can free it in one of the
- following ways:
- </para>
- <para>
- <itemizedlist>
- <listitem>
- <para>
- you can talloc_free() any parent of the original pointer.
- That will reduce the number of parents of this pointer by 1,
- and will cause this pointer to be freed if it runs out of
- parents.
- </para>
- </listitem>
- <listitem>
- <para>
- you can talloc_free() the pointer itself. That will destroy
- the most recently established parent to the pointer and leave
- the pointer as a child of its current parent.
- </para>
- </listitem>
- </itemizedlist>
- </para>
- <para>
- For more control on which parent to remove, see <link
- linkend="talloc_unlink"><quote>talloc_unlink()</quote></link>.
- </para>
- </refsect2>
- <refsect2 id="talloc_unlink"><title>int talloc_unlink(const void *ctx, const void *ptr);</title>
- <para>
- The talloc_unlink() function removes a specific parent from
- <emphasis role="italic">ptr</emphasis>. The <emphasis
- role="italic">ctx</emphasis> passed must either be a context used
- in talloc_reference() with this pointer, or must be a direct
- parent of ptr.
- </para>
- <para>
- Note that if the parent has already been removed using
- talloc_free() then this function will fail and will return -1.
- Likewise, if <emphasis role="italic">ptr</emphasis> is NULL, then
- the function will make no modifications and return -1.
- </para>
- <para>
- Usually you can just use talloc_free() instead of
- talloc_unlink(), but sometimes it is useful to have the
- additional control on which parent is removed.
- </para>
- </refsect2>
- <refsect2 id="talloc_set_destructor"><title>void talloc_set_destructor(const void *ptr, int (*destructor)(void *));</title>
- <para>
- The function talloc_set_destructor() sets the <emphasis
- role="italic">destructor</emphasis> for the pointer <emphasis
- role="italic">ptr</emphasis>. A <emphasis
- role="italic">destructor</emphasis> is a function that is called
- when the memory used by a pointer is about to be released. The
- destructor receives <emphasis role="italic">ptr</emphasis> as an
- argument, and should return 0 for success and -1 for failure.
- </para>
- <para>
- The <emphasis role="italic">destructor</emphasis> can do anything
- it wants to, including freeing other pieces of memory. A common
- use for destructors is to clean up operating system resources
- (such as open file descriptors) contained in the structure the
- destructor is placed on.
- </para>
- <para>
- You can only place one destructor on a pointer. If you need more
- than one destructor then you can create a zero-length child of
- the pointer and place an additional destructor on that.
- </para>
- <para>
- To remove a destructor call talloc_set_destructor() with NULL for
- the destructor.
- </para>
- <para>
- If your destructor attempts to talloc_free() the pointer that it
- is the destructor for then talloc_free() will return -1 and the
- free will be ignored. This would be a pointless operation
- anyway, as the destructor is only called when the memory is just
- about to go away.
- </para>
- </refsect2>
- <refsect2><title>int talloc_increase_ref_count(const void *<emphasis role="italic">ptr</emphasis>);</title>
- <para>
- The talloc_increase_ref_count(<emphasis
- role="italic">ptr</emphasis>) function is exactly equivalent to:
- </para>
- <programlisting>talloc_reference(NULL, ptr);</programlisting>
- <para>
- You can use either syntax, depending on which you think is
- clearer in your code.
- </para>
- <para>
- It returns 0 on success and -1 on failure.
- </para>
- </refsect2>
- <refsect2><title>size_t talloc_reference_count(const void *<emphasis role="italic">ptr</emphasis>);</title>
- <para>
- Return the number of references to the pointer.
- </para>
- </refsect2>
- <refsect2 id="talloc_set_name"><title>void talloc_set_name(const void *ptr, const char *fmt, ...);</title>
- <para>
- Each talloc pointer has a "name". The name is used principally
- for debugging purposes, although it is also possible to set and
- get the name on a pointer in as a way of "marking" pointers in
- your code.
- </para>
- <para>
- The main use for names on pointer is for "talloc reports". See
- <link
- linkend="talloc_report"><quote>talloc_report_depth_cb()</quote></link>,
- <link
- linkend="talloc_report"><quote>talloc_report_depth_file()</quote></link>,
- <link
- linkend="talloc_report"><quote>talloc_report()</quote></link>
- <link
- linkend="talloc_report"><quote>talloc_report()</quote></link>
- and <link
- linkend="talloc_report_full"><quote>talloc_report_full()</quote></link>
- for details. Also see <link
- linkend="talloc_enable_leak_report"><quote>talloc_enable_leak_report()</quote></link>
- and <link
- linkend="talloc_enable_leak_report_full"><quote>talloc_enable_leak_report_full()</quote></link>.
- </para>
- <para>
- The talloc_set_name() function allocates memory as a child of the
- pointer. It is logically equivalent to:
- </para>
- <programlisting>talloc_set_name_const(ptr, talloc_asprintf(ptr, fmt, ...));</programlisting>
- <para>
- Note that multiple calls to talloc_set_name() will allocate more
- memory without releasing the name. All of the memory is released
- when the ptr is freed using talloc_free().
- </para>
- </refsect2>
- <refsect2><title>void talloc_set_name_const(const void *<emphasis role="italic">ptr</emphasis>, const char *<emphasis role="italic">name</emphasis>);</title>
- <para>
- The function talloc_set_name_const() is just like
- talloc_set_name(), but it takes a string constant, and is much
- faster. It is extensively used by the "auto naming" macros, such
- as talloc_p().
- </para>
- <para>
- This function does not allocate any memory. It just copies the
- supplied pointer into the internal representation of the talloc
- ptr. This means you must not pass a <emphasis
- role="italic">name</emphasis> pointer to memory that will
- disappear before <emphasis role="italic">ptr</emphasis> is freed
- with talloc_free().
- </para>
- </refsect2>
- <refsect2><title>void *talloc_named(const void *<emphasis role="italic">ctx</emphasis>, size_t <emphasis role="italic">size</emphasis>, const char *<emphasis role="italic">fmt</emphasis>, ...);</title>
- <para>
- The talloc_named() function creates a named talloc pointer. It
- is equivalent to:
- </para>
- <programlisting>ptr = talloc_size(ctx, size);
-talloc_set_name(ptr, fmt, ....);</programlisting>
- </refsect2>
- <refsect2><title>void *talloc_named_const(const void *<emphasis role="italic">ctx</emphasis>, size_t <emphasis role="italic">size</emphasis>, const char *<emphasis role="italic">name</emphasis>);</title>
- <para>
- This is equivalent to:
- </para>
- <programlisting>ptr = talloc_size(ctx, size);
-talloc_set_name_const(ptr, name);</programlisting>
- </refsect2>
- <refsect2><title>const char *talloc_get_name(const void *<emphasis role="italic">ptr</emphasis>);</title>
- <para>
- This returns the current name for the given talloc pointer,
- <emphasis role="italic">ptr</emphasis>. See <link
- linkend="talloc_set_name"><quote>talloc_set_name()</quote></link>
- for details.
- </para>
- </refsect2>
- <refsect2><title>void *talloc_init(const char *<emphasis role="italic">fmt</emphasis>, ...);</title>
- <para>
- This function creates a zero length named talloc context as a top
- level context. It is equivalent to:
- </para>
- <programlisting>talloc_named(NULL, 0, fmt, ...);</programlisting>
- </refsect2>
- <refsect2><title>void *talloc_new(void *<emphasis role="italic">ctx</emphasis>);</title>
- <para>
- This is a utility macro that creates a new memory context hanging
- off an exiting context, automatically naming it "talloc_new:
- __location__" where __location__ is the source line it is called
- from. It is particularly useful for creating a new temporary
- working context.
- </para>
- </refsect2>
- <refsect2><title>(<emphasis role="italic">type</emphasis> *)talloc_realloc(const void *<emphasis role="italic">ctx</emphasis>, void *<emphasis role="italic">ptr</emphasis>, <emphasis role="italic">type</emphasis>, <emphasis role="italic">count</emphasis>);</title>
- <para>
- The talloc_realloc() macro changes the size of a talloc pointer.
- It has the following equivalences:
- </para>
- <programlisting>talloc_realloc(ctx, NULL, type, 1) ==> talloc(ctx, type);
-talloc_realloc(ctx, ptr, type, 0) ==> talloc_free(ptr);</programlisting>
- <para>
- The <emphasis role="italic">ctx</emphasis> argument is only used
- if <emphasis role="italic">ptr</emphasis> is not NULL, otherwise
- it is ignored.
- </para>
- <para>
- talloc_realloc() returns the new pointer, or NULL on failure.
- The call will fail either due to a lack of memory, or because the
- pointer has more than one parent (see <link
- linkend="talloc_reference"><quote>talloc_reference()</quote></link>).
- </para>
- </refsect2>
- <refsect2><title>void *talloc_realloc_size(const void *ctx, void *ptr, size_t size);</title>
- <para>
- the talloc_realloc_size() function is useful when the type is not
- known so the type-safe talloc_realloc() cannot be used.
- </para>
- </refsect2>
- <refsect2><title>TYPE *talloc_steal(const void *<emphasis role="italic">new_ctx</emphasis>, const TYPE *<emphasis role="italic">ptr</emphasis>);</title>
- <para>
- The talloc_steal() function changes the parent context of a
- talloc pointer. It is typically used when the context that the
- pointer is currently a child of is going to be freed and you wish
- to keep the memory for a longer time.
- </para>
- <para>
- The talloc_steal() function returns the pointer that you pass it.
- It does not have any failure modes.
- </para>
- <para>
- NOTE: It is possible to produce loops in the parent/child
- relationship if you are not careful with talloc_steal(). No
- guarantees are provided as to your sanity or the safety of your
- data if you do this.
- </para>
- </refsect2>
- <refsect2><title>TYPE *talloc_move(const void *<emphasis role="italic">new_ctx</emphasis>, TYPE **<emphasis role="italic">ptr</emphasis>);</title>
- <para>
- The talloc_move() function is a wrapper around
- talloc_steal() which zeros the source pointer after the
- move. This avoids a potential source of bugs where a
- programmer leaves a pointer in two structures, and uses the
- pointer from the old structure after it has been moved to a
- new one.
- </para>
- </refsect2>
- <refsect2><title>size_t talloc_total_size(const void *<emphasis role="italic">ptr</emphasis>);</title>
- <para>
- The talloc_total_size() function returns the total size in bytes
- used by this pointer and all child pointers. Mostly useful for
- debugging.
- </para>
- <para>
- Passing NULL is allowed, but it will only give a meaningful
- result if talloc_enable_leak_report() or
- talloc_enable_leak_report_full() has been called.
- </para>
- </refsect2>
- <refsect2><title>size_t talloc_total_blocks(const void *<emphasis role="italic">ptr</emphasis>);</title>
- <para>
- The talloc_total_blocks() function returns the total memory block
- count used by this pointer and all child pointers. Mostly useful
- for debugging.
- </para>
- <para>
- Passing NULL is allowed, but it will only give a meaningful
- result if talloc_enable_leak_report() or
- talloc_enable_leak_report_full() has been called.
- </para>
- </refsect2>
- <refsect2 id="talloc_report"><title>void talloc_report(const void *ptr, FILE *f);</title>
- <para>
- The talloc_report() function prints a summary report of all
- memory used by <emphasis role="italic">ptr</emphasis>. One line
- of report is printed for each immediate child of ptr, showing the
- total memory and number of blocks used by that child.
- </para>
- <para>
- You can pass NULL for the pointer, in which case a report is
- printed for the top level memory context, but only if
- talloc_enable_leak_report() or talloc_enable_leak_report_full()
- has been called.
- </para>
- </refsect2>
- <refsect2 id="talloc_report_full"><title>void talloc_report_full(const void *<emphasis role="italic">ptr</emphasis>, FILE *<emphasis role="italic">f</emphasis>);</title>
- <para>
- This provides a more detailed report than talloc_report(). It
- will recursively print the entire tree of memory referenced by
- the pointer. References in the tree are shown by giving the name
- of the pointer that is referenced.
- </para>
- <para>
- You can pass NULL for the pointer, in which case a report is
- printed for the top level memory context, but only if
- talloc_enable_leak_report() or talloc_enable_leak_report_full()
- has been called.
- </para>
- </refsect2>
- <refsect2 id="talloc_report_depth_cb">
- <funcsynopsis><funcprototype>
- <funcdef>void <function>talloc_report_depth_cb</function></funcdef>
- <paramdef><parameter>const void *ptr</parameter></paramdef>
- <paramdef><parameter>int depth</parameter></paramdef>
- <paramdef><parameter>int max_depth</parameter></paramdef>
- <paramdef><parameter>void (*callback)(const void *ptr, int depth, int max_depth, int is_ref, void *priv)</parameter></paramdef>
- <paramdef><parameter>void *priv</parameter></paramdef>
- </funcprototype></funcsynopsis>
- <para>
- This provides a more flexible reports than talloc_report(). It
- will recursively call the callback for the entire tree of memory
- referenced by the pointer. References in the tree are passed with
- <emphasis role="italic">is_ref = 1</emphasis> and the pointer that is referenced.
- </para>
- <para>
- You can pass NULL for the pointer, in which case a report is
- printed for the top level memory context, but only if
- talloc_enable_leak_report() or talloc_enable_leak_report_full()
- has been called.
- </para>
- <para>
- The recursion is stopped when depth >= max_depth.
- max_depth = -1 means only stop at leaf nodes.
- </para>
- </refsect2>
- <refsect2 id="talloc_report_depth_file">
- <funcsynopsis><funcprototype>
- <funcdef>void <function>talloc_report_depth_file</function></funcdef>
- <paramdef><parameter>const void *ptr</parameter></paramdef>
- <paramdef><parameter>int depth</parameter></paramdef>
- <paramdef><parameter>int max_depth</parameter></paramdef>
- <paramdef><parameter>FILE *f</parameter></paramdef>
- </funcprototype></funcsynopsis>
- <para>
- This provides a more flexible reports than talloc_report(). It
- will let you specify the depth and max_depth.
- </para>
- </refsect2>
- <refsect2 id="talloc_enable_leak_report"><title>void talloc_enable_leak_report(void);</title>
- <para>
- This enables calling of talloc_report(NULL, stderr) when the
- program exits. In Samba4 this is enabled by using the
- --leak-report command line option.
- </para>
- <para>
- For it to be useful, this function must be called before any
- other talloc function as it establishes a "null context" that
- acts as the top of the tree. If you don't call this function
- first then passing NULL to talloc_report() or
- talloc_report_full() won't give you the full tree printout.
- </para>
- <para>
- Here is a typical talloc report:
- </para>
- <screen format="linespecific">talloc report on 'null_context' (total 267 bytes in 15 blocks)
-libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks
-libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks
-iconv(UTF8,CP850) contains 42 bytes in 2 blocks
-libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks
-iconv(CP850,UTF8) contains 42 bytes in 2 blocks
-iconv(UTF8,UTF-16LE) contains 45 bytes in 2 blocks
-iconv(UTF-16LE,UTF8) contains 45 bytes in 2 blocks
- </screen>
- </refsect2>
- <refsect2 id="talloc_enable_leak_report_full"><title>void talloc_enable_leak_report_full(void);</title>
- <para>
- This enables calling of talloc_report_full(NULL, stderr) when the
- program exits. In Samba4 this is enabled by using the
- --leak-report-full command line option.
- </para>
- <para>
- For it to be useful, this function must be called before any
- other talloc function as it establishes a "null context" that
- acts as the top of the tree. If you don't call this function
- first then passing NULL to talloc_report() or
- talloc_report_full() won't give you the full tree printout.
- </para>
- <para>
- Here is a typical full report:
- </para>
- <screen format="linespecific">full talloc report on 'root' (total 18 bytes in 8 blocks)
-p1 contains 18 bytes in 7 blocks (ref 0)
- r1 contains 13 bytes in 2 blocks (ref 0)
- reference to: p2
- p2 contains 1 bytes in 1 blocks (ref 1)
- x3 contains 1 bytes in 1 blocks (ref 0)
- x2 contains 1 bytes in 1 blocks (ref 0)
- x1 contains 1 bytes in 1 blocks (ref 0)
- </screen>
- </refsect2>
- <refsect2><title>(<emphasis role="italic">type</emphasis> *)talloc_zero(const void *<emphasis role="italic">ctx</emphasis>, <emphasis role="italic">type</emphasis>);</title>
- <para>
- The talloc_zero() macro is equivalent to:
- </para>
- <programlisting>ptr = talloc(ctx, type);
-if (ptr) memset(ptr, 0, sizeof(type));</programlisting>
- </refsect2>
- <refsect2><title>void *talloc_zero_size(const void *<emphasis role="italic">ctx</emphasis>, size_t <emphasis role="italic">size</emphasis>)</title>
- <para>
- The talloc_zero_size() function is useful when you don't have a
- known type.
- </para>
- </refsect2>
- <refsect2><title>void *talloc_memdup(const void *<emphasis role="italic">ctx</emphasis>, const void *<emphasis role="italic">p</emphasis>, size_t size);</title>
- <para>
- The talloc_memdup() function is equivalent to:
- </para>
- <programlisting>ptr = talloc_size(ctx, size);
-if (ptr) memcpy(ptr, p, size);</programlisting>
- </refsect2>
- <refsect2><title>char *talloc_strdup(const void *<emphasis role="italic">ctx</emphasis>, const char *<emphasis role="italic">p</emphasis>);</title>
- <para>
- The talloc_strdup() function is equivalent to:
- </para>
- <programlisting>ptr = talloc_size(ctx, strlen(p)+1);
-if (ptr) memcpy(ptr, p, strlen(p)+1);</programlisting>
- <para>
- This function sets the name of the new pointer to the passed
- string. This is equivalent to:
- </para>
- <programlisting>talloc_set_name_const(ptr, ptr)</programlisting>
- </refsect2>
- <refsect2><title>char *talloc_strndup(const void *<emphasis role="italic">t</emphasis>, const char *<emphasis role="italic">p</emphasis>, size_t <emphasis role="italic">n</emphasis>);</title>
- <para>
- The talloc_strndup() function is the talloc equivalent of the C
- library function strndup(3).
- </para>
- <para>
- This function sets the name of the new pointer to the passed
- string. This is equivalent to:
- </para>
- <programlisting>talloc_set_name_const(ptr, ptr)</programlisting>
- </refsect2>
- <refsect2><title>char *talloc_append_string(const void *<emphasis role="italic">t</emphasis>, char *<emphasis role="italic">orig</emphasis>, const char *<emphasis role="italic">append</emphasis>);</title>
- <para>
- The talloc_append_string() function appends the given formatted
- string to the given string.
- </para>
- <para>
- This function sets the name of the new pointer to the new
- string. This is equivalent to:
- </para>
- <programlisting>talloc_set_name_const(ptr, ptr)</programlisting>
- </refsect2>
- <refsect2><title>char *talloc_vasprintf(const void *<emphasis role="italic">t</emphasis>, const char *<emphasis role="italic">fmt</emphasis>, va_list <emphasis role="italic">ap</emphasis>);</title>
- <para>
- The talloc_vasprintf() function is the talloc equivalent of the C
- library function vasprintf(3).
- </para>
- <para>
- This function sets the name of the new pointer to the new
- string. This is equivalent to:
- </para>
- <programlisting>talloc_set_name_const(ptr, ptr)</programlisting>
- </refsect2>
- <refsect2><title>char *talloc_asprintf(const void *<emphasis role="italic">t</emphasis>, const char *<emphasis role="italic">fmt</emphasis>, ...);</title>
- <para>
- The talloc_asprintf() function is the talloc equivalent of the C
- library function asprintf(3).
- </para>
- <para>
- This function sets the name of the new pointer to the passed
- string. This is equivalent to:
- </para>
- <programlisting>talloc_set_name_const(ptr, ptr)</programlisting>
- </refsect2>
- <refsect2><title>char *talloc_asprintf_append(char *s, const char *fmt, ...);</title>
- <para>
- The talloc_asprintf_append() function appends the given formatted
- string to the given string.
- </para>
- <para>
- This function sets the name of the new pointer to the new
- string. This is equivalent to:
- </para>
- <programlisting>talloc_set_name_const(ptr, ptr)</programlisting>
- </refsect2>
- <refsect2><title>(type *)talloc_array(const void *ctx, type, uint_t count);</title>
- <para>
- The talloc_array() macro is equivalent to:
- </para>
- <programlisting>(type *)talloc_size(ctx, sizeof(type) * count);</programlisting>
- <para>
- except that it provides integer overflow protection for the
- multiply, returning NULL if the multiply overflows.
- </para>
- </refsect2>
- <refsect2><title>void *talloc_array_size(const void *ctx, size_t size, uint_t count);</title>
- <para>
- The talloc_array_size() function is useful when the type is not
- known. It operates in the same way as talloc_array(), but takes a
- size instead of a type.
- </para>
- </refsect2>
- <refsect2><title>(typeof(ptr)) talloc_array_ptrtype(const void *ctx, ptr, uint_t count);</title>
- <para>
- The talloc_ptrtype() macro should be used when you have a pointer to an array
- and want to allocate memory of an array to point at with this pointer. When compiling
- with gcc >= 3 it is typesafe. Note this is a wrapper of talloc_array_size()
- and talloc_get_name() will return the current location in the source file.
- and not the type.
- </para>
- </refsect2>
- <refsect2><title>void *talloc_realloc_fn(const void *ctx, void *ptr, size_t size)</title>
- <para>
- This is a non-macro version of talloc_realloc(), which is useful
- as libraries sometimes want a realloc function pointer. A
- realloc(3) implementation encapsulates the functionality of
- malloc(3), free(3) and realloc(3) in one call, which is why it is
- useful to be able to pass around a single function pointer.
- </para>
- </refsect2>
- <refsect2><title>void *talloc_autofree_context(void);</title>
- <para>
- This is a handy utility function that returns a talloc context
- which will be automatically freed on program exit. This can be
- used to reduce the noise in memory leak reports.
- </para>
- </refsect2>
- <refsect2><title>void *talloc_check_name(const void *ptr, const char *name);</title>
- <para>
- This function checks if a pointer has the specified <emphasis
- role="italic">name</emphasis>. If it does then the pointer is
- returned. It it doesn't then NULL is returned.
- </para>
- </refsect2>
- <refsect2><title>(type *)talloc_get_type(const void *ptr, type);</title>
- <para>
- This macro allows you to do type checking on talloc pointers. It
- is particularly useful for void* private pointers. It is
- equivalent to this:
- </para>
- <programlisting>(type *)talloc_check_name(ptr, #type)</programlisting>
- </refsect2>
- <refsect2><title>talloc_set_type(const void *ptr, type);</title>
- <para>
- This macro allows you to force the name of a pointer to be a
- particular <emphasis>type</emphasis>. This can be
- used in conjunction with talloc_get_type() to do type checking on
- void* pointers.
- </para>
- <para>
- It is equivalent to this:
- </para>
- <programlisting>talloc_set_name_const(ptr, #type)</programlisting>
- </refsect2>
- </refsect1>
- <refsect1><title>PERFORMANCE</title>
- <para>
- All the additional features of talloc(3) over malloc(3) do come at a
- price. We have a simple performance test in Samba4 that measures
- talloc() versus malloc() performance, and it seems that talloc() is
- about 10% slower than malloc() on my x86 Debian Linux box. For
- Samba, the great reduction in code complexity that we get by using
- talloc makes this worthwhile, especially as the total overhead of
- talloc/malloc in Samba is already quite small.
- </para>
- </refsect1>
- <refsect1><title>SEE ALSO</title>
- <para>
- malloc(3), strndup(3), vasprintf(3), asprintf(3),
- <ulink url="http://talloc.samba.org/"/>
- </para>
- </refsect1>
- <refsect1><title>COPYRIGHT/LICENSE</title>
- <para>
- Copyright (C) Andrew Tridgell 2004
- </para>
- <para>
- 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.
- </para>
- <para>
- 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.
- </para>
- <para>
- You should have received a copy of the GNU General Public License
- along with this program; if not, see http://www.gnu.org/licenses/.
- </para>
- </refsect1>
-</refentry>
diff --git a/source3/lib/talloc/talloc.c b/source3/lib/talloc/talloc.c
deleted file mode 100644
index 1f7e52439f..0000000000
--- a/source3/lib/talloc/talloc.c
+++ /dev/null
@@ -1,1732 +0,0 @@
-/*
- Samba Unix SMB/CIFS implementation.
-
- Samba trivial allocation library - new interface
-
- NOTE: Please read talloc_guide.txt for full documentation
-
- Copyright (C) Andrew Tridgell 2004
- Copyright (C) Stefan Metzmacher 2006
-
- ** NOTE! The following LGPL license applies to the talloc
- ** 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/>.
-*/
-
-/*
- inspired by http://swapped.cc/halloc/
-*/
-
-#ifdef _SAMBA_BUILD_
-#include "version.h"
-#if (SAMBA_VERSION_MAJOR<4)
-#include "includes.h"
-/* This is to circumvent SAMBA3's paranoid malloc checker. Here in this file
- * we trust ourselves... */
-#ifdef malloc
-#undef malloc
-#endif
-#ifdef realloc
-#undef realloc
-#endif
-#define _TALLOC_SAMBA3
-#endif /* (SAMBA_VERSION_MAJOR<4) */
-#endif /* _SAMBA_BUILD_ */
-
-#ifndef _TALLOC_SAMBA3
-#include "replace.h"
-#include "talloc.h"
-#endif /* not _TALLOC_SAMBA3 */
-
-/* use this to force every realloc to change the pointer, to stress test
- code that might not cope */
-#define ALWAYS_REALLOC 0
-
-
-#define MAX_TALLOC_SIZE 0x10000000
-#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
- on a pointer that came from malloc() */
-#ifndef TALLOC_ABORT
-#define TALLOC_ABORT(reason) abort()
-#endif
-
-#ifndef discard_const_p
-#if defined(__intptr_t_defined) || defined(HAVE_INTPTR_T)
-# define discard_const_p(type, ptr) ((type *)((intptr_t)(ptr)))
-#else
-# define discard_const_p(type, ptr) ((type *)(ptr))
-#endif
-#endif
-
-/* 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 */
-#ifndef likely
-#define likely(x) __builtin_expect(!!(x), 1)
-#endif
-#ifndef unlikely
-#define unlikely(x) __builtin_expect(!!(x), 0)
-#endif
-#else
-#ifndef likely
-#define likely(x) (x)
-#endif
-#ifndef unlikely
-#define unlikely(x) (x)
-#endif
-#endif
-
-/* this null_context is only used if talloc_enable_leak_report() or
- talloc_enable_leak_report_full() is called, otherwise it remains
- NULL
-*/
-static void *null_context;
-static void *autofree_context;
-
-struct talloc_reference_handle {
- struct talloc_reference_handle *next, *prev;
- void *ptr;
-};
-
-typedef int (*talloc_destructor_t)(void *);
-
-struct talloc_chunk {
- struct talloc_chunk *next, *prev;
- struct talloc_chunk *parent, *child;
- struct talloc_reference_handle *refs;
- talloc_destructor_t destructor;
- 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 */
-#define TC_HDR_SIZE ((sizeof(struct talloc_chunk)+15)&~15)
-#define TC_PTR_FROM_CHUNK(tc) ((void *)(TC_HDR_SIZE + (char*)tc))
-
-static void talloc_abort_double_free(void)
-{
- TALLOC_ABORT("Bad talloc magic value - double free");
-}
-
-static void talloc_abort_unknown_value(void)
-{
- TALLOC_ABORT("Bad talloc magic value - unknown value");
-}
-
-/* panic if we get a bad magic value */
-static inline struct talloc_chunk *talloc_chunk_from_ptr(const void *ptr)
-{
- const char *pp = (const char *)ptr;
- struct talloc_chunk *tc = discard_const_p(struct talloc_chunk, pp - TC_HDR_SIZE);
- if (unlikely((tc->flags & (TALLOC_FLAG_FREE | ~0xF)) != TALLOC_MAGIC)) {
- if (tc->flags & TALLOC_FLAG_FREE) {
- talloc_abort_double_free();
- } else {
- talloc_abort_unknown_value();
- }
- }
- return tc;
-}
-
-/* hook into the front of the list */
-#define _TLIST_ADD(list, p) \
-do { \
- if (!(list)) { \
- (list) = (p); \
- (p)->next = (p)->prev = NULL; \
- } else { \
- (list)->prev = (p); \
- (p)->next = (list); \
- (p)->prev = NULL; \
- (list) = (p); \
- }\
-} while (0)
-
-/* remove an element from a list - element doesn't have to be in list. */
-#define _TLIST_REMOVE(list, p) \
-do { \
- if ((p) == (list)) { \
- (list) = (p)->next; \
- if (list) (list)->prev = NULL; \
- } else { \
- if ((p)->prev) (p)->prev->next = (p)->next; \
- if ((p)->next) (p)->next->prev = (p)->prev; \
- } \
- if ((p) && ((p) != (list))) (p)->next = (p)->prev = NULL; \
-} while (0)
-
-
-/*
- return the parent chunk of a pointer
-*/
-static inline struct talloc_chunk *talloc_parent_chunk(const void *ptr)
-{
- struct talloc_chunk *tc;
-
- if (unlikely(ptr == NULL)) {
- return NULL;
- }
-
- tc = talloc_chunk_from_ptr(ptr);
- while (tc->prev) tc=tc->prev;
-
- return tc->parent;
-}
-
-void *talloc_parent(const void *ptr)
-{
- struct talloc_chunk *tc = talloc_parent_chunk(ptr);
- return tc? TC_PTR_FROM_CHUNK(tc) : NULL;
-}
-
-/*
- find parents name
-*/
-const char *talloc_parent_name(const void *ptr)
-{
- struct talloc_chunk *tc = talloc_parent_chunk(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 = NULL;
-
- if (unlikely(context == NULL)) {
- context = null_context;
- }
-
- if (unlikely(size >= MAX_TALLOC_SIZE)) {
- 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->destructor = NULL;
- tc->child = NULL;
- tc->name = NULL;
- tc->refs = NULL;
-
- if (likely(context)) {
- struct talloc_chunk *parent = talloc_chunk_from_ptr(context);
-
- if (parent->child) {
- parent->child->parent = NULL;
- tc->next = parent->child;
- tc->next->prev = tc;
- } else {
- tc->next = NULL;
- }
- tc->parent = parent;
- tc->prev = NULL;
- parent->child = tc;
- } else {
- tc->next = tc->prev = tc->parent = NULL;
- }
-
- 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.
- if the destructor fails then the free is failed, and the memory can
- be continued to be used
-*/
-void _talloc_set_destructor(const void *ptr, int (*destructor)(void *))
-{
- struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
- tc->destructor = destructor;
-}
-
-/*
- increase the reference count on a piece of memory.
-*/
-int talloc_increase_ref_count(const void *ptr)
-{
- if (unlikely(!talloc_reference(null_context, ptr))) {
- return -1;
- }
- return 0;
-}
-
-/*
- helper for talloc_reference()
-
- this is referenced by a function pointer and should not be inline
-*/
-static int talloc_reference_destructor(struct talloc_reference_handle *handle)
-{
- struct talloc_chunk *ptr_tc = talloc_chunk_from_ptr(handle->ptr);
- _TLIST_REMOVE(ptr_tc->refs, handle);
- return 0;
-}
-
-/*
- more efficient way to add a name to a pointer - the name must point to a
- true string constant
-*/
-static inline void _talloc_set_name_const(const void *ptr, const char *name)
-{
- struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
- tc->name = name;
-}
-
-/*
- internal talloc_named_const()
-*/
-static inline void *_talloc_named_const(const void *context, size_t size, const char *name)
-{
- void *ptr;
-
- ptr = __talloc(context, size);
- if (unlikely(ptr == NULL)) {
- return NULL;
- }
-
- _talloc_set_name_const(ptr, name);
-
- return ptr;
-}
-
-/*
- make a secondary reference to a pointer, hanging off the given context.
- the pointer remains valid until both the original caller and this given
- context are freed.
-
- the major use for this is when two different structures need to reference the
- same underlying data, and you want to be able to free the two instances separately,
- and in either order
-*/
-void *_talloc_reference(const void *context, const void *ptr)
-{
- struct talloc_chunk *tc;
- struct talloc_reference_handle *handle;
- if (unlikely(ptr == NULL)) return NULL;
-
- tc = talloc_chunk_from_ptr(ptr);
- handle = (struct talloc_reference_handle *)_talloc_named_const(context,
- sizeof(struct talloc_reference_handle),
- TALLOC_MAGIC_REFERENCE);
- if (unlikely(handle == NULL)) return NULL;
-
- /* note that we hang the destructor off the handle, not the
- main context as that allows the caller to still setup their
- own destructor on the context if they want to */
- talloc_set_destructor(handle, talloc_reference_destructor);
- handle->ptr = discard_const_p(void, ptr);
- _TLIST_ADD(tc->refs, handle);
- return handle->ptr;
-}
-
-
-/*
- internal talloc_free call
-*/
-static inline int _talloc_free(void *ptr)
-{
- struct talloc_chunk *tc;
-
- if (unlikely(ptr == NULL)) {
- return -1;
- }
-
- tc = talloc_chunk_from_ptr(ptr);
-
- if (unlikely(tc->refs)) {
- int is_child;
- /* check this is a reference from a child or grantchild
- * back to it's parent or grantparent
- *
- * in that case we need to remove the reference and
- * call another instance of talloc_free() on the current
- * pointer.
- */
- is_child = talloc_is_parent(tc->refs, ptr);
- _talloc_free(tc->refs);
- if (is_child) {
- return _talloc_free(ptr);
- }
- return -1;
- }
-
- if (unlikely(tc->flags & TALLOC_FLAG_LOOP)) {
- /* we have a free loop - stop looping */
- return 0;
- }
-
- if (unlikely(tc->destructor)) {
- talloc_destructor_t d = tc->destructor;
- if (d == (talloc_destructor_t)-1) {
- return -1;
- }
- tc->destructor = (talloc_destructor_t)-1;
- if (d(ptr) == -1) {
- tc->destructor = d;
- return -1;
- }
- tc->destructor = NULL;
- }
-
- if (tc->parent) {
- _TLIST_REMOVE(tc->parent->child, tc);
- if (tc->parent->child) {
- tc->parent->child->parent = tc->parent;
- }
- } else {
- if (tc->prev) tc->prev->next = tc->next;
- if (tc->next) tc->next->prev = tc->prev;
- }
-
- tc->flags |= TALLOC_FLAG_LOOP;
-
- while (tc->child) {
- /* we need to work out who will own an abandoned child
- if it cannot be freed. In priority order, the first
- choice is owner of any remaining reference to this
- pointer, the second choice is our parent, and the
- final choice is the null context. */
- void *child = TC_PTR_FROM_CHUNK(tc->child);
- const void *new_parent = null_context;
- if (unlikely(tc->child->refs)) {
- struct talloc_chunk *p = talloc_parent_chunk(tc->child->refs);
- if (p) new_parent = TC_PTR_FROM_CHUNK(p);
- }
- if (unlikely(_talloc_free(child) == -1)) {
- if (new_parent == null_context) {
- struct talloc_chunk *p = talloc_parent_chunk(ptr);
- if (p) new_parent = TC_PTR_FROM_CHUNK(p);
- }
- talloc_steal(new_parent, child);
- }
- }
-
- tc->flags |= TALLOC_FLAG_FREE;
-
- 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;
-}
-
-/*
- move a lump of memory from one talloc context to another return the
- ptr on success, or NULL if it could not be transferred.
- passing NULL as ptr will always return NULL with no side effects.
-*/
-void *_talloc_steal(const void *new_ctx, const void *ptr)
-{
- struct talloc_chunk *tc, *new_tc;
-
- if (unlikely(!ptr)) {
- return NULL;
- }
-
- if (unlikely(new_ctx == NULL)) {
- new_ctx = null_context;
- }
-
- tc = talloc_chunk_from_ptr(ptr);
-
- if (unlikely(new_ctx == NULL)) {
- if (tc->parent) {
- _TLIST_REMOVE(tc->parent->child, tc);
- if (tc->parent->child) {
- tc->parent->child->parent = tc->parent;
- }
- } else {
- if (tc->prev) tc->prev->next = tc->next;
- if (tc->next) tc->next->prev = tc->prev;
- }
-
- tc->parent = tc->next = tc->prev = NULL;
- return discard_const_p(void, ptr);
- }
-
- new_tc = talloc_chunk_from_ptr(new_ctx);
-
- if (unlikely(tc == new_tc || tc->parent == new_tc)) {
- return discard_const_p(void, ptr);
- }
-
- if (tc->parent) {
- _TLIST_REMOVE(tc->parent->child, tc);
- if (tc->parent->child) {
- tc->parent->child->parent = tc->parent;
- }
- } else {
- if (tc->prev) tc->prev->next = tc->next;
- if (tc->next) tc->next->prev = tc->prev;
- }
-
- tc->parent = new_tc;
- if (new_tc->child) new_tc->child->parent = NULL;
- _TLIST_ADD(new_tc->child, tc);
-
- return discard_const_p(void, ptr);
-}
-
-
-
-/*
- remove a secondary reference to a pointer. This undo's what
- talloc_reference() has done. The context and pointer arguments
- must match those given to a talloc_reference()
-*/
-static inline int talloc_unreference(const void *context, const void *ptr)
-{
- struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
- struct talloc_reference_handle *h;
-
- if (unlikely(context == NULL)) {
- context = null_context;
- }
-
- for (h=tc->refs;h;h=h->next) {
- struct talloc_chunk *p = talloc_parent_chunk(h);
- if (p == NULL) {
- if (context == NULL) break;
- } else if (TC_PTR_FROM_CHUNK(p) == context) {
- break;
- }
- }
- if (h == NULL) {
- return -1;
- }
-
- return _talloc_free(h);
-}
-
-/*
- remove a specific parent context from a pointer. This is a more
- controlled varient of talloc_free()
-*/
-int talloc_unlink(const void *context, void *ptr)
-{
- struct talloc_chunk *tc_p, *new_p;
- void *new_parent;
-
- if (ptr == NULL) {
- return -1;
- }
-
- if (context == NULL) {
- context = null_context;
- }
-
- if (talloc_unreference(context, ptr) == 0) {
- return 0;
- }
-
- if (context == NULL) {
- if (talloc_parent_chunk(ptr) != NULL) {
- return -1;
- }
- } else {
- if (talloc_chunk_from_ptr(context) != talloc_parent_chunk(ptr)) {
- return -1;
- }
- }
-
- tc_p = talloc_chunk_from_ptr(ptr);
-
- if (tc_p->refs == NULL) {
- return _talloc_free(ptr);
- }
-
- new_p = talloc_parent_chunk(tc_p->refs);
- if (new_p) {
- new_parent = TC_PTR_FROM_CHUNK(new_p);
- } else {
- new_parent = NULL;
- }
-
- if (talloc_unreference(new_parent, ptr) != 0) {
- return -1;
- }
-
- talloc_steal(new_parent, ptr);
-
- return 0;
-}
-
-/*
- add a name to an existing pointer - va_list version
-*/
-static inline const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0);
-
-static inline const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap)
-{
- struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
- tc->name = talloc_vasprintf(ptr, fmt, ap);
- if (likely(tc->name)) {
- _talloc_set_name_const(tc->name, ".name");
- }
- return tc->name;
-}
-
-/*
- add a name to an existing pointer
-*/
-const char *talloc_set_name(const void *ptr, const char *fmt, ...)
-{
- const char *name;
- va_list ap;
- va_start(ap, fmt);
- name = talloc_set_name_v(ptr, fmt, ap);
- va_end(ap);
- return name;
-}
-
-
-/*
- create a named talloc pointer. Any talloc pointer can be named, and
- talloc_named() operates just like talloc() except that it allows you
- to name the pointer.
-*/
-void *talloc_named(const void *context, size_t size, const char *fmt, ...)
-{
- va_list ap;
- void *ptr;
- const char *name;
-
- ptr = __talloc(context, size);
- if (unlikely(ptr == NULL)) return NULL;
-
- va_start(ap, fmt);
- name = talloc_set_name_v(ptr, fmt, ap);
- va_end(ap);
-
- if (unlikely(name == NULL)) {
- _talloc_free(ptr);
- return NULL;
- }
-
- return ptr;
-}
-
-/*
- return the name of a talloc ptr, or "UNNAMED"
-*/
-const char *talloc_get_name(const void *ptr)
-{
- struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
- if (unlikely(tc->name == TALLOC_MAGIC_REFERENCE)) {
- return ".reference";
- }
- if (likely(tc->name)) {
- return tc->name;
- }
- return "UNNAMED";
-}
-
-
-/*
- check if a pointer has the given name. If it does, return the pointer,
- otherwise return NULL
-*/
-void *talloc_check_name(const void *ptr, const char *name)
-{
- const char *pname;
- if (unlikely(ptr == NULL)) return NULL;
- pname = talloc_get_name(ptr);
- if (likely(pname == name || strcmp(pname, name) == 0)) {
- return discard_const_p(void, ptr);
- }
- return NULL;
-}
-
-
-/*
- this is for compatibility with older versions of talloc
-*/
-void *talloc_init(const char *fmt, ...)
-{
- va_list ap;
- void *ptr;
- const char *name;
-
- /*
- * samba3 expects talloc_report_depth_cb(NULL, ...)
- * reports all talloc'ed memory, so we need to enable
- * null_tracking
- */
- talloc_enable_null_tracking();
-
- ptr = __talloc(NULL, 0);
- if (unlikely(ptr == NULL)) return NULL;
-
- va_start(ap, fmt);
- name = talloc_set_name_v(ptr, fmt, ap);
- va_end(ap);
-
- if (unlikely(name == NULL)) {
- _talloc_free(ptr);
- return NULL;
- }
-
- return ptr;
-}
-
-/*
- this is a replacement for the Samba3 talloc_destroy_pool functionality. It
- should probably not be used in new code. It's in here to keep the talloc
- code consistent across Samba 3 and 4.
-*/
-void talloc_free_children(void *ptr)
-{
- struct talloc_chunk *tc;
-
- if (unlikely(ptr == NULL)) {
- return;
- }
-
- tc = talloc_chunk_from_ptr(ptr);
-
- while (tc->child) {
- /* we need to work out who will own an abandoned child
- if it cannot be freed. In priority order, the first
- choice is owner of any remaining reference to this
- pointer, the second choice is our parent, and the
- final choice is the null context. */
- void *child = TC_PTR_FROM_CHUNK(tc->child);
- const void *new_parent = null_context;
- if (unlikely(tc->child->refs)) {
- struct talloc_chunk *p = talloc_parent_chunk(tc->child->refs);
- if (p) new_parent = TC_PTR_FROM_CHUNK(p);
- }
- if (unlikely(_talloc_free(child) == -1)) {
- if (new_parent == null_context) {
- struct talloc_chunk *p = talloc_parent_chunk(ptr);
- if (p) new_parent = TC_PTR_FROM_CHUNK(p);
- }
- 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
- }
-}
-
-/*
- Allocate a bit of memory as a child of an existing pointer
-*/
-void *_talloc(const void *context, size_t size)
-{
- return __talloc(context, size);
-}
-
-/*
- externally callable talloc_set_name_const()
-*/
-void talloc_set_name_const(const void *ptr, const char *name)
-{
- _talloc_set_name_const(ptr, name);
-}
-
-/*
- create a named talloc pointer. Any talloc pointer can be named, and
- talloc_named() operates just like talloc() except that it allows you
- to name the pointer.
-*/
-void *talloc_named_const(const void *context, size_t size, const char *name)
-{
- return _talloc_named_const(context, size, name);
-}
-
-/*
- free a talloc pointer. This also frees all child pointers of this
- pointer recursively
-
- return 0 if the memory is actually freed, otherwise -1. The memory
- will not be freed if the ref_count is > 1 or the destructor (if
- any) returns non-zero
-*/
-int talloc_free(void *ptr)
-{
- return _talloc_free(ptr);
-}
-
-
-
-/*
- A talloc version of realloc. The context argument is only used if
- ptr is NULL
-*/
-void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *name)
-{
- struct talloc_chunk *tc;
- void *new_ptr;
- bool malloced = false;
-
- /* size zero is equivalent to free() */
- if (unlikely(size == 0)) {
- _talloc_free(ptr);
- return NULL;
- }
-
- if (unlikely(size >= MAX_TALLOC_SIZE)) {
- return NULL;
- }
-
- /* realloc(NULL) is equivalent to malloc() */
- if (ptr == NULL) {
- return _talloc_named_const(context, size, name);
- }
-
- tc = talloc_chunk_from_ptr(ptr);
-
- /* don't allow realloc on referenced pointers */
- if (unlikely(tc->refs)) {
- 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;
-
-#if ALWAYS_REALLOC
- new_ptr = malloc(size + TC_HDR_SIZE);
- if (new_ptr) {
- memcpy(new_ptr, tc, tc->size + TC_HDR_SIZE);
- free(tc);
- }
-#else
- 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;
- return NULL;
- }
-
- tc = (struct talloc_chunk *)new_ptr;
- tc->flags &= ~TALLOC_FLAG_FREE;
- if (malloced) {
- tc->flags &= ~TALLOC_FLAG_POOLMEM;
- }
- if (tc->parent) {
- tc->parent->child = tc;
- }
- if (tc->child) {
- tc->child->parent = tc;
- }
-
- if (tc->prev) {
- tc->prev->next = tc;
- }
- if (tc->next) {
- tc->next->prev = tc;
- }
-
- tc->size = size;
- _talloc_set_name_const(TC_PTR_FROM_CHUNK(tc), name);
-
- return TC_PTR_FROM_CHUNK(tc);
-}
-
-/*
- a wrapper around talloc_steal() for situations where you are moving a pointer
- between two structures, and want the old pointer to be set to NULL
-*/
-void *_talloc_move(const void *new_ctx, const void *_pptr)
-{
- const void **pptr = discard_const_p(const void *,_pptr);
- void *ret = _talloc_steal(new_ctx, *pptr);
- (*pptr) = NULL;
- return ret;
-}
-
-/*
- return the total size of a talloc pool (subtree)
-*/
-size_t talloc_total_size(const void *ptr)
-{
- size_t total = 0;
- struct talloc_chunk *c, *tc;
-
- if (ptr == NULL) {
- ptr = null_context;
- }
- if (ptr == NULL) {
- return 0;
- }
-
- tc = talloc_chunk_from_ptr(ptr);
-
- if (tc->flags & TALLOC_FLAG_LOOP) {
- return 0;
- }
-
- tc->flags |= TALLOC_FLAG_LOOP;
-
- total = tc->size;
- for (c=tc->child;c;c=c->next) {
- total += talloc_total_size(TC_PTR_FROM_CHUNK(c));
- }
-
- tc->flags &= ~TALLOC_FLAG_LOOP;
-
- return total;
-}
-
-/*
- return the total number of blocks in a talloc pool (subtree)
-*/
-size_t talloc_total_blocks(const void *ptr)
-{
- size_t total = 0;
- struct talloc_chunk *c, *tc = talloc_chunk_from_ptr(ptr);
-
- if (tc->flags & TALLOC_FLAG_LOOP) {
- return 0;
- }
-
- tc->flags |= TALLOC_FLAG_LOOP;
-
- total++;
- for (c=tc->child;c;c=c->next) {
- total += talloc_total_blocks(TC_PTR_FROM_CHUNK(c));
- }
-
- tc->flags &= ~TALLOC_FLAG_LOOP;
-
- return total;
-}
-
-/*
- return the number of external references to a pointer
-*/
-size_t talloc_reference_count(const void *ptr)
-{
- struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
- struct talloc_reference_handle *h;
- size_t ret = 0;
-
- for (h=tc->refs;h;h=h->next) {
- ret++;
- }
- return ret;
-}
-
-/*
- report on memory usage by all children of a pointer, giving a full tree view
-*/
-void talloc_report_depth_cb(const void *ptr, int depth, int max_depth,
- void (*callback)(const void *ptr,
- int depth, int max_depth,
- int is_ref,
- void *private_data),
- void *private_data)
-{
- struct talloc_chunk *c, *tc;
-
- if (ptr == NULL) {
- ptr = null_context;
- }
- if (ptr == NULL) return;
-
- tc = talloc_chunk_from_ptr(ptr);
-
- if (tc->flags & TALLOC_FLAG_LOOP) {
- return;
- }
-
- callback(ptr, depth, max_depth, 0, private_data);
-
- if (max_depth >= 0 && depth >= max_depth) {
- return;
- }
-
- tc->flags |= TALLOC_FLAG_LOOP;
- for (c=tc->child;c;c=c->next) {
- if (c->name == TALLOC_MAGIC_REFERENCE) {
- struct talloc_reference_handle *h = (struct talloc_reference_handle *)TC_PTR_FROM_CHUNK(c);
- callback(h->ptr, depth + 1, max_depth, 1, private_data);
- } else {
- talloc_report_depth_cb(TC_PTR_FROM_CHUNK(c), depth + 1, max_depth, callback, private_data);
- }
- }
- tc->flags &= ~TALLOC_FLAG_LOOP;
-}
-
-static void talloc_report_depth_FILE_helper(const void *ptr, int depth, int max_depth, int is_ref, void *_f)
-{
- const char *name = talloc_get_name(ptr);
- FILE *f = (FILE *)_f;
-
- if (is_ref) {
- fprintf(f, "%*sreference to: %s\n", depth*4, "", name);
- return;
- }
-
- if (depth == 0) {
- fprintf(f,"%stalloc report on '%s' (total %6lu bytes in %3lu blocks)\n",
- (max_depth < 0 ? "full " :""), name,
- (unsigned long)talloc_total_size(ptr),
- (unsigned long)talloc_total_blocks(ptr));
- return;
- }
-
- fprintf(f, "%*s%-30s contains %6lu bytes in %3lu blocks (ref %d) %p\n",
- depth*4, "",
- name,
- (unsigned long)talloc_total_size(ptr),
- (unsigned long)talloc_total_blocks(ptr),
- (int)talloc_reference_count(ptr), ptr);
-
-#if 0
- fprintf(f, "content: ");
- if (talloc_total_size(ptr)) {
- int tot = talloc_total_size(ptr);
- int i;
-
- for (i = 0; i < tot; i++) {
- if ((((char *)ptr)[i] > 31) && (((char *)ptr)[i] < 126)) {
- fprintf(f, "%c", ((char *)ptr)[i]);
- } else {
- fprintf(f, "~%02x", ((char *)ptr)[i]);
- }
- }
- }
- fprintf(f, "\n");
-#endif
-}
-
-/*
- report on memory usage by all children of a pointer, giving a full tree view
-*/
-void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f)
-{
- talloc_report_depth_cb(ptr, depth, max_depth, talloc_report_depth_FILE_helper, f);
- fflush(f);
-}
-
-/*
- report on memory usage by all children of a pointer, giving a full tree view
-*/
-void talloc_report_full(const void *ptr, FILE *f)
-{
- talloc_report_depth_file(ptr, 0, -1, f);
-}
-
-/*
- report on memory usage by all children of a pointer
-*/
-void talloc_report(const void *ptr, FILE *f)
-{
- talloc_report_depth_file(ptr, 0, 1, f);
-}
-
-/*
- report on any memory hanging off the null context
-*/
-static void talloc_report_null(void)
-{
- if (talloc_total_size(null_context) != 0) {
- talloc_report(null_context, stderr);
- }
-}
-
-/*
- report on any memory hanging off the null context
-*/
-static void talloc_report_null_full(void)
-{
- if (talloc_total_size(null_context) != 0) {
- talloc_report_full(null_context, stderr);
- }
-}
-
-/*
- enable tracking of the NULL context
-*/
-void talloc_enable_null_tracking(void)
-{
- if (null_context == NULL) {
- null_context = _talloc_named_const(NULL, 0, "null_context");
- }
-}
-
-/*
- disable tracking of the NULL context
-*/
-void talloc_disable_null_tracking(void)
-{
- _talloc_free(null_context);
- null_context = NULL;
-}
-
-/*
- enable leak reporting on exit
-*/
-void talloc_enable_leak_report(void)
-{
- talloc_enable_null_tracking();
- atexit(talloc_report_null);
-}
-
-/*
- enable full leak reporting on exit
-*/
-void talloc_enable_leak_report_full(void)
-{
- talloc_enable_null_tracking();
- atexit(talloc_report_null_full);
-}
-
-/*
- talloc and zero memory.
-*/
-void *_talloc_zero(const void *ctx, size_t size, const char *name)
-{
- void *p = _talloc_named_const(ctx, size, name);
-
- if (p) {
- memset(p, '\0', size);
- }
-
- return p;
-}
-
-/*
- memdup with a talloc.
-*/
-void *_talloc_memdup(const void *t, const void *p, size_t size, const char *name)
-{
- void *newp = _talloc_named_const(t, size, name);
-
- if (likely(newp)) {
- memcpy(newp, p, size);
- }
-
- return newp;
-}
-
-static inline char *__talloc_strlendup(const void *t, const char *p, size_t len)
-{
- char *ret;
-
- ret = (char *)__talloc(t, len + 1);
- if (unlikely(!ret)) return NULL;
-
- memcpy(ret, p, len);
- ret[len] = 0;
-
- _talloc_set_name_const(ret, ret);
- return ret;
-}
-
-/*
- strdup with a talloc
-*/
-char *talloc_strdup(const void *t, const char *p)
-{
- if (unlikely(!p)) return NULL;
- return __talloc_strlendup(t, p, strlen(p));
-}
-
-/*
- strndup with a talloc
-*/
-char *talloc_strndup(const void *t, const char *p, size_t n)
-{
- if (unlikely(!p)) return NULL;
- return __talloc_strlendup(t, p, strnlen(p, n));
-}
-
-static inline char *__talloc_strlendup_append(char *s, size_t slen,
- const char *a, size_t alen)
-{
- char *ret;
-
- ret = talloc_realloc(NULL, s, char, slen + alen + 1);
- if (unlikely(!ret)) return NULL;
-
- /* append the string and the trailing \0 */
- memcpy(&ret[slen], a, alen);
- ret[slen+alen] = 0;
-
- _talloc_set_name_const(ret, ret);
- return ret;
-}
-
-/*
- * Appends at the end of the string.
- */
-char *talloc_strdup_append(char *s, const char *a)
-{
- if (unlikely(!s)) {
- return talloc_strdup(NULL, a);
- }
-
- if (unlikely(!a)) {
- return s;
- }
-
- return __talloc_strlendup_append(s, strlen(s), a, strlen(a));
-}
-
-/*
- * Appends at the end of the talloc'ed buffer,
- * not the end of the string.
- */
-char *talloc_strdup_append_buffer(char *s, const char *a)
-{
- size_t slen;
-
- if (unlikely(!s)) {
- return talloc_strdup(NULL, a);
- }
-
- if (unlikely(!a)) {
- return s;
- }
-
- slen = talloc_get_size(s);
- if (likely(slen > 0)) {
- slen--;
- }
-
- return __talloc_strlendup_append(s, slen, a, strlen(a));
-}
-
-/*
- * Appends at the end of the string.
- */
-char *talloc_strndup_append(char *s, const char *a, size_t n)
-{
- if (unlikely(!s)) {
- return talloc_strdup(NULL, a);
- }
-
- if (unlikely(!a)) {
- return s;
- }
-
- return __talloc_strlendup_append(s, strlen(s), a, strnlen(a, n));
-}
-
-/*
- * Appends at the end of the talloc'ed buffer,
- * not the end of the string.
- */
-char *talloc_strndup_append_buffer(char *s, const char *a, size_t n)
-{
- size_t slen;
-
- if (unlikely(!s)) {
- return talloc_strdup(NULL, a);
- }
-
- if (unlikely(!a)) {
- return s;
- }
-
- slen = talloc_get_size(s);
- if (likely(slen > 0)) {
- slen--;
- }
-
- return __talloc_strlendup_append(s, slen, a, strnlen(a, n));
-}
-
-#ifndef HAVE_VA_COPY
-#ifdef HAVE___VA_COPY
-#define va_copy(dest, src) __va_copy(dest, src)
-#else
-#define va_copy(dest, src) (dest) = (src)
-#endif
-#endif
-
-char *talloc_vasprintf(const void *t, const char *fmt, va_list ap)
-{
- int len;
- char *ret;
- va_list ap2;
- char c;
-
- /* this call looks strange, but it makes it work on older solaris boxes */
- va_copy(ap2, ap);
- len = vsnprintf(&c, 1, fmt, ap2);
- va_end(ap2);
- if (unlikely(len < 0)) {
- return NULL;
- }
-
- ret = (char *)__talloc(t, len+1);
- if (unlikely(!ret)) return NULL;
-
- va_copy(ap2, ap);
- vsnprintf(ret, len+1, fmt, ap2);
- va_end(ap2);
-
- _talloc_set_name_const(ret, ret);
- return ret;
-}
-
-
-/*
- Perform string formatting, and return a pointer to newly allocated
- memory holding the result, inside a memory pool.
- */
-char *talloc_asprintf(const void *t, const char *fmt, ...)
-{
- va_list ap;
- char *ret;
-
- va_start(ap, fmt);
- ret = talloc_vasprintf(t, fmt, ap);
- va_end(ap);
- return ret;
-}
-
-static inline char *__talloc_vaslenprintf_append(char *s, size_t slen,
- const char *fmt, va_list ap)
- PRINTF_ATTRIBUTE(3,0);
-
-static inline char *__talloc_vaslenprintf_append(char *s, size_t slen,
- const char *fmt, va_list ap)
-{
- ssize_t alen;
- va_list ap2;
- char c;
-
- va_copy(ap2, ap);
- alen = vsnprintf(&c, 1, fmt, ap2);
- va_end(ap2);
-
- if (alen <= 0) {
- /* Either the vsnprintf failed or the format resulted in
- * no characters being formatted. In the former case, we
- * ought to return NULL, in the latter we ought to return
- * the original string. Most current callers of this
- * function expect it to never return NULL.
- */
- return s;
- }
-
- s = talloc_realloc(NULL, s, char, slen + alen + 1);
- if (!s) return NULL;
-
- va_copy(ap2, ap);
- vsnprintf(s + slen, alen + 1, fmt, ap2);
- va_end(ap2);
-
- _talloc_set_name_const(s, s);
- return s;
-}
-
-/**
- * Realloc @p s to append the formatted result of @p fmt and @p ap,
- * and return @p s, which may have moved. Good for gradually
- * accumulating output into a string buffer. Appends at the end
- * of the string.
- **/
-char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap)
-{
- if (unlikely(!s)) {
- return talloc_vasprintf(NULL, fmt, ap);
- }
-
- return __talloc_vaslenprintf_append(s, strlen(s), fmt, ap);
-}
-
-/**
- * Realloc @p s to append the formatted result of @p fmt and @p ap,
- * and return @p s, which may have moved. Always appends at the
- * end of the talloc'ed buffer, not the end of the string.
- **/
-char *talloc_vasprintf_append_buffer(char *s, const char *fmt, va_list ap)
-{
- size_t slen;
-
- if (unlikely(!s)) {
- return talloc_vasprintf(NULL, fmt, ap);
- }
-
- slen = talloc_get_size(s);
- if (likely(slen > 0)) {
- slen--;
- }
-
- return __talloc_vaslenprintf_append(s, slen, fmt, ap);
-}
-
-/*
- Realloc @p s to append the formatted result of @p fmt and return @p
- s, which may have moved. Good for gradually accumulating output
- into a string buffer.
- */
-char *talloc_asprintf_append(char *s, const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- s = talloc_vasprintf_append(s, fmt, ap);
- va_end(ap);
- return s;
-}
-
-/*
- Realloc @p s to append the formatted result of @p fmt and return @p
- s, which may have moved. Good for gradually accumulating output
- into a buffer.
- */
-char *talloc_asprintf_append_buffer(char *s, const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- s = talloc_vasprintf_append_buffer(s, fmt, ap);
- va_end(ap);
- return s;
-}
-
-/*
- alloc an array, checking for integer overflow in the array size
-*/
-void *_talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name)
-{
- if (count >= MAX_TALLOC_SIZE/el_size) {
- return NULL;
- }
- return _talloc_named_const(ctx, el_size * count, name);
-}
-
-/*
- alloc an zero array, checking for integer overflow in the array size
-*/
-void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const char *name)
-{
- if (count >= MAX_TALLOC_SIZE/el_size) {
- return NULL;
- }
- return _talloc_zero(ctx, el_size * count, name);
-}
-
-/*
- realloc an array, checking for integer overflow in the array size
-*/
-void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name)
-{
- if (count >= MAX_TALLOC_SIZE/el_size) {
- return NULL;
- }
- return _talloc_realloc(ctx, ptr, el_size * count, name);
-}
-
-/*
- a function version of talloc_realloc(), so it can be passed as a function pointer
- to libraries that want a realloc function (a realloc function encapsulates
- all the basic capabilities of an allocation library, which is why this is useful)
-*/
-void *talloc_realloc_fn(const void *context, void *ptr, size_t size)
-{
- return _talloc_realloc(context, ptr, size, NULL);
-}
-
-
-static int talloc_autofree_destructor(void *ptr)
-{
- autofree_context = NULL;
- return 0;
-}
-
-static void talloc_autofree(void)
-{
- _talloc_free(autofree_context);
-}
-
-/*
- return a context which will be auto-freed on exit
- this is useful for reducing the noise in leak reports
-*/
-void *talloc_autofree_context(void)
-{
- if (autofree_context == NULL) {
- autofree_context = _talloc_named_const(NULL, 0, "autofree_context");
- talloc_set_destructor(autofree_context, talloc_autofree_destructor);
- atexit(talloc_autofree);
- }
- return autofree_context;
-}
-
-size_t talloc_get_size(const void *context)
-{
- struct talloc_chunk *tc;
-
- if (context == NULL)
- return 0;
-
- tc = talloc_chunk_from_ptr(context);
-
- return tc->size;
-}
-
-/*
- find a parent of this context that has the given name, if any
-*/
-void *talloc_find_parent_byname(const void *context, const char *name)
-{
- struct talloc_chunk *tc;
-
- if (context == NULL) {
- return NULL;
- }
-
- tc = talloc_chunk_from_ptr(context);
- while (tc) {
- if (tc->name && strcmp(tc->name, name) == 0) {
- return TC_PTR_FROM_CHUNK(tc);
- }
- while (tc && tc->prev) tc = tc->prev;
- if (tc) {
- tc = tc->parent;
- }
- }
- return NULL;
-}
-
-/*
- show the parentage of a context
-*/
-void talloc_show_parents(const void *context, FILE *file)
-{
- struct talloc_chunk *tc;
-
- if (context == NULL) {
- fprintf(file, "talloc no parents for NULL\n");
- return;
- }
-
- tc = talloc_chunk_from_ptr(context);
- fprintf(file, "talloc parents of '%s'\n", talloc_get_name(context));
- while (tc) {
- fprintf(file, "\t'%s'\n", talloc_get_name(TC_PTR_FROM_CHUNK(tc)));
- while (tc && tc->prev) tc = tc->prev;
- if (tc) {
- tc = tc->parent;
- }
- }
- fflush(file);
-}
-
-/*
- return 1 if ptr is a parent of context
-*/
-int talloc_is_parent(const void *context, const void *ptr)
-{
- struct talloc_chunk *tc;
-
- if (context == NULL) {
- return 0;
- }
-
- tc = talloc_chunk_from_ptr(context);
- while (tc) {
- if (TC_PTR_FROM_CHUNK(tc) == ptr) return 1;
- while (tc && tc->prev) tc = tc->prev;
- if (tc) {
- tc = tc->parent;
- }
- }
- return 0;
-}
diff --git a/source3/lib/talloc/talloc.h b/source3/lib/talloc/talloc.h
deleted file mode 100644
index 5431971655..0000000000
--- a/source3/lib/talloc/talloc.h
+++ /dev/null
@@ -1,183 +0,0 @@
-#ifndef _TALLOC_H_
-#define _TALLOC_H_
-/*
- Unix SMB/CIFS implementation.
- Samba temporary memory allocation functions
-
- Copyright (C) Andrew Tridgell 2004-2005
- Copyright (C) Stefan Metzmacher 2006
-
- ** NOTE! The following LGPL license applies to the talloc
- ** 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/>.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-
-/* this is only needed for compatibility with the old talloc */
-typedef void TALLOC_CTX;
-
-/*
- this uses a little trick to allow __LINE__ to be stringified
-*/
-#ifndef __location__
-#define __TALLOC_STRING_LINE1__(s) #s
-#define __TALLOC_STRING_LINE2__(s) __TALLOC_STRING_LINE1__(s)
-#define __TALLOC_STRING_LINE3__ __TALLOC_STRING_LINE2__(__LINE__)
-#define __location__ __FILE__ ":" __TALLOC_STRING_LINE3__
-#endif
-
-#ifndef TALLOC_DEPRECATED
-#define TALLOC_DEPRECATED 0
-#endif
-
-#ifndef PRINTF_ATTRIBUTE
-#if (__GNUC__ >= 3)
-/** Use gcc attribute to check printf fns. a1 is the 1-based index of
- * the parameter containing the format, and a2 the index of the first
- * argument. Note that some gcc 2.x versions don't handle this
- * properly **/
-#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2)))
-#else
-#define PRINTF_ATTRIBUTE(a1, a2)
-#endif
-#endif
-
-/* try to make talloc_set_destructor() and talloc_steal() type safe,
- if we have a recent gcc */
-#if (__GNUC__ >= 3)
-#define _TALLOC_TYPEOF(ptr) __typeof__(ptr)
-#define talloc_set_destructor(ptr, function) \
- do { \
- int (*_talloc_destructor_fn)(_TALLOC_TYPEOF(ptr)) = (function); \
- _talloc_set_destructor((ptr), (int (*)(void *))_talloc_destructor_fn); \
- } while(0)
-/* this extremely strange macro is to avoid some braindamaged warning
- stupidity in gcc 4.1.x */
-#define talloc_steal(ctx, ptr) ({ _TALLOC_TYPEOF(ptr) __talloc_steal_ret = (_TALLOC_TYPEOF(ptr))_talloc_steal((ctx),(ptr)); __talloc_steal_ret; })
-#else
-#define talloc_set_destructor(ptr, function) \
- _talloc_set_destructor((ptr), (int (*)(void *))(function))
-#define _TALLOC_TYPEOF(ptr) void *
-#define talloc_steal(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_steal((ctx),(ptr))
-#endif
-
-#define talloc_reference(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_reference((ctx),(ptr))
-#define talloc_move(ctx, ptr) (_TALLOC_TYPEOF(*(ptr)))_talloc_move((ctx),(void *)(ptr))
-
-/* useful macros for creating type checked pointers */
-#define talloc(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type)
-#define talloc_size(ctx, size) talloc_named_const(ctx, size, __location__)
-#define talloc_ptrtype(ctx, ptr) (_TALLOC_TYPEOF(ptr))talloc_size(ctx, sizeof(*(ptr)))
-
-#define talloc_new(ctx) talloc_named_const(ctx, 0, "talloc_new: " __location__)
-
-#define talloc_zero(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type)
-#define talloc_zero_size(ctx, size) _talloc_zero(ctx, size, __location__)
-
-#define talloc_zero_array(ctx, type, count) (type *)_talloc_zero_array(ctx, sizeof(type), count, #type)
-#define talloc_array(ctx, type, count) (type *)_talloc_array(ctx, sizeof(type), count, #type)
-#define talloc_array_size(ctx, size, count) _talloc_array(ctx, size, count, __location__)
-#define talloc_array_ptrtype(ctx, ptr, count) (_TALLOC_TYPEOF(ptr))talloc_array_size(ctx, sizeof(*(ptr)), count)
-
-#define talloc_realloc(ctx, p, type, count) (type *)_talloc_realloc_array(ctx, p, sizeof(type), count, #type)
-#define talloc_realloc_size(ctx, ptr, size) _talloc_realloc(ctx, ptr, size, __location__)
-
-#define talloc_memdup(t, p, size) _talloc_memdup(t, p, size, __location__)
-
-#define talloc_set_type(ptr, type) talloc_set_name_const(ptr, #type)
-#define talloc_get_type(ptr, type) (type *)talloc_check_name(ptr, #type)
-
-#define talloc_find_parent_bytype(ptr, type) (type *)talloc_find_parent_byname(ptr, #type)
-
-#if TALLOC_DEPRECATED
-#define talloc_zero_p(ctx, type) talloc_zero(ctx, type)
-#define talloc_p(ctx, type) talloc(ctx, type)
-#define talloc_array_p(ctx, type, count) talloc_array(ctx, type, count)
-#define talloc_realloc_p(ctx, p, type, count) talloc_realloc(ctx, p, type, count)
-#define talloc_destroy(ctx) talloc_free(ctx)
-#define talloc_append_string(c, s, a) (s?talloc_strdup_append(s,a):talloc_strdup(c, a))
-#endif
-
-/* 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);
-void *_talloc_reference(const void *context, const void *ptr);
-int talloc_unlink(const void *context, void *ptr);
-const char *talloc_set_name(const void *ptr, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
-void talloc_set_name_const(const void *ptr, const char *name);
-void *talloc_named(const void *context, size_t size,
- const char *fmt, ...) PRINTF_ATTRIBUTE(3,4);
-void *talloc_named_const(const void *context, size_t size, const char *name);
-const char *talloc_get_name(const void *ptr);
-void *talloc_check_name(const void *ptr, const char *name);
-void *talloc_parent(const void *ptr);
-const char *talloc_parent_name(const void *ptr);
-void *talloc_init(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2);
-int talloc_free(void *ptr);
-void talloc_free_children(void *ptr);
-void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *name);
-void *_talloc_steal(const void *new_ctx, const void *ptr);
-void *_talloc_move(const void *new_ctx, const void *pptr);
-size_t talloc_total_size(const void *ptr);
-size_t talloc_total_blocks(const void *ptr);
-void talloc_report_depth_cb(const void *ptr, int depth, int max_depth,
- void (*callback)(const void *ptr,
- int depth, int max_depth,
- int is_ref,
- void *private_data),
- void *private_data);
-void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f);
-void talloc_report_full(const void *ptr, FILE *f);
-void talloc_report(const void *ptr, FILE *f);
-void talloc_enable_null_tracking(void);
-void talloc_disable_null_tracking(void);
-void talloc_enable_leak_report(void);
-void talloc_enable_leak_report_full(void);
-void *_talloc_zero(const void *ctx, size_t size, const char *name);
-void *_talloc_memdup(const void *t, const void *p, size_t size, const char *name);
-void *_talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name);
-void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const char *name);
-void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name);
-void *talloc_realloc_fn(const void *context, void *ptr, size_t size);
-void *talloc_autofree_context(void);
-size_t talloc_get_size(const void *ctx);
-void *talloc_find_parent_byname(const void *ctx, const char *name);
-void talloc_show_parents(const void *context, FILE *file);
-int talloc_is_parent(const void *context, const void *ptr);
-
-char *talloc_strdup(const void *t, const char *p);
-char *talloc_strdup_append(char *s, const char *a);
-char *talloc_strdup_append_buffer(char *s, const char *a);
-
-char *talloc_strndup(const void *t, const char *p, size_t n);
-char *talloc_strndup_append(char *s, const char *a, size_t n);
-char *talloc_strndup_append_buffer(char *s, const char *a, size_t n);
-
-char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0);
-char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0);
-char *talloc_vasprintf_append_buffer(char *s, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0);
-
-char *talloc_asprintf(const void *t, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
-char *talloc_asprintf_append(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
-char *talloc_asprintf_append_buffer(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
-
-#endif
diff --git a/source3/lib/talloc/talloc.i b/source3/lib/talloc/talloc.i
deleted file mode 100644
index a9afb97ed7..0000000000
--- a/source3/lib/talloc/talloc.i
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Copyright (C) Jelmer Vernooij <jelmer@samba.org> 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/>.
-*/
-
-/* Don't expose talloc contexts in Python code. Python does reference
- counting for us, so just create a new top-level talloc context.
- */
-%typemap(in, numinputs=0, noblock=1) TALLOC_CTX * {
- $1 = NULL;
-}
-
-%define %talloctype(TYPE)
-%nodefaultctor TYPE;
-%extend TYPE {
- ~TYPE() { talloc_free($self); }
-}
-%enddef
diff --git a/source3/lib/talloc/talloc.mk b/source3/lib/talloc/talloc.mk
deleted file mode 100644
index e1fe88c84b..0000000000
--- a/source3/lib/talloc/talloc.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-TALLOC_OBJ = $(tallocdir)/talloc.o
-
-TALLOC_SOLIB = libtalloc.$(SHLIBEXT).$(PACKAGE_VERSION)
-TALLOC_SONAME = libtalloc.$(SHLIBEXT).1
-
-all:: libtalloc.a $(TALLOC_SOLIB) testsuite
-
-testsuite:: $(LIBOBJ) testsuite.o
- $(CC) $(CFLAGS) -o testsuite testsuite.o $(LIBOBJ) $(LIBS)
-
-libtalloc.a: $(LIBOBJ)
- ar -rv $@ $(LIBOBJ)
- @-ranlib $@
-
-install:: all
- ${INSTALLCMD} -d $(DESTDIR)$(libdir)
- ${INSTALLCMD} -d $(DESTDIR)$(libdir)/pkgconfig
- ${INSTALLCMD} -m 755 libtalloc.a $(DESTDIR)$(libdir)
- ${INSTALLCMD} -m 755 $(TALLOC_SOLIB) $(DESTDIR)$(libdir)
- ${INSTALLCMD} -d $(DESTDIR)${includedir}
- ${INSTALLCMD} -m 644 $(srcdir)/talloc.h $(DESTDIR)$(includedir)
- ${INSTALLCMD} -m 644 talloc.pc $(DESTDIR)$(libdir)/pkgconfig
- if [ -f talloc.3 ];then ${INSTALLCMD} -d $(DESTDIR)$(mandir)/man3; fi
- if [ -f talloc.3 ];then ${INSTALLCMD} -m 644 talloc.3 $(DESTDIR)$(mandir)/man3; fi
- which swig >/dev/null 2>&1 && ${INSTALLCMD} -d $(DESTDIR)`swig -swiglib` || true
- which swig >/dev/null 2>&1 && ${INSTALLCMD} -m 644 talloc.i $(DESTDIR)`swig -swiglib` || true
-
-doc:: talloc.3 talloc.3.html
-
-clean::
- rm -f *~ $(LIBOBJ) $(TALLOC_SOLIB) libtalloc.a testsuite testsuite.o *.gc?? talloc.3 talloc.3.html
-
-test:: testsuite
- ./testsuite
-
-gcov::
- gcov talloc.c
diff --git a/source3/lib/talloc/talloc.pc.in b/source3/lib/talloc/talloc.pc.in
deleted file mode 100644
index 459cce70b1..0000000000
--- a/source3/lib/talloc/talloc.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: talloc
-Description: A hierarchical pool based memory system with destructors
-Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -ltalloc
-Cflags: -I${includedir}
-URL: http://talloc.samba.org/
diff --git a/source3/lib/talloc/talloc_guide.txt b/source3/lib/talloc/talloc_guide.txt
deleted file mode 100644
index 18663b370d..0000000000
--- a/source3/lib/talloc/talloc_guide.txt
+++ /dev/null
@@ -1,685 +0,0 @@
-Using talloc in Samba4
-----------------------
-
-Andrew Tridgell
-September 2004
-
-The most current version of this document is available at
- http://samba.org/ftp/unpacked/samba4/source/lib/talloc/talloc_guide.txt
-
-If you are used to the "old" talloc from Samba3 before 3.0.20 then please read
-this carefully, as talloc has changed a lot. With 3.0.20 (or 3.0.14?) the
-Samba4 talloc has been ported back to Samba3, so this guide applies to both.
-
-The new talloc is a hierarchical, reference counted memory pool system
-with destructors. Quite a mouthful really, but not too bad once you
-get used to it.
-
-Perhaps the biggest change from Samba3 is that there is no distinction
-between a "talloc context" and a "talloc pointer". Any pointer
-returned from talloc() is itself a valid talloc context. This means
-you can do this:
-
- struct foo *X = talloc(mem_ctx, struct foo);
- X->name = talloc_strdup(X, "foo");
-
-and the pointer X->name would be a "child" of the talloc context "X"
-which is itself a child of mem_ctx. So if you do talloc_free(mem_ctx)
-then it is all destroyed, whereas if you do talloc_free(X) then just X
-and X->name are destroyed, and if you do talloc_free(X->name) then
-just the name element of X is destroyed.
-
-If you think about this, then what this effectively gives you is an
-n-ary tree, where you can free any part of the tree with
-talloc_free().
-
-If you find this confusing, then I suggest you run the testsuite to
-watch talloc in action. You may also like to add your own tests to
-testsuite.c to clarify how some particular situation is handled.
-
-
-Performance
------------
-
-All the additional features of talloc() over malloc() do come at a
-price. We have a simple performance test in Samba4 that measures
-talloc() versus malloc() performance, and it seems that talloc() is
-about 4% slower than malloc() on my x86 Debian Linux box. For Samba,
-the great reduction in code complexity that we get by using talloc
-makes this worthwhile, especially as the total overhead of
-talloc/malloc in Samba is already quite small.
-
-
-talloc API
-----------
-
-The following is a complete guide to the talloc API. Read it all at
-least twice.
-
-Multi-threading
----------------
-
-talloc itself does not deal with threads. It is thread-safe (assuming
-the underlying "malloc" is), as long as each thread uses different
-memory contexts.
-If two threads uses the same context then they need to synchronize in
-order to be safe. In particular:
-- when using talloc_enable_leak_report(), giving directly NULL as a
-parent context implicitly refers to a hidden "null context" global
-variable, so this should not be used in a multi-threaded environment
-without proper synchronization ;
-- the context returned by talloc_autofree_context() is also global so
-shouldn't be used by several threads simultaneously without
-synchronization.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-(type *)talloc(const void *context, type);
-
-The talloc() macro is the core of the talloc library. It takes a
-memory context and a type, and returns a pointer to a new area of
-memory of the given type.
-
-The returned pointer is itself a talloc context, so you can use it as
-the context argument to more calls to talloc if you wish.
-
-The returned pointer is a "child" of the supplied context. This means
-that if you talloc_free() the context then the new child disappears as
-well. Alternatively you can free just the child.
-
-The context argument to talloc() can be NULL, in which case a new top
-level context is created.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_size(const void *context, size_t size);
-
-The function talloc_size() should be used when you don't have a
-convenient type to pass to talloc(). Unlike talloc(), it is not type
-safe (as it returns a void *), so you are on your own for type checking.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-(typeof(ptr)) talloc_ptrtype(const void *ctx, ptr);
-
-The talloc_ptrtype() macro should be used when you have a pointer and
-want to allocate memory to point at with this pointer. When compiling
-with gcc >= 3 it is typesafe. Note this is a wrapper of talloc_size()
-and talloc_get_name() will return the current location in the source file.
-and not the type.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-int talloc_free(void *ptr);
-
-The talloc_free() function frees a piece of talloc memory, and all its
-children. You can call talloc_free() on any pointer returned by
-talloc().
-
-The return value of talloc_free() indicates success or failure, with 0
-returned for success and -1 for failure. The only possible failure
-condition is if the pointer had a destructor attached to it and the
-destructor returned -1. See talloc_set_destructor() for details on
-destructors.
-
-If this pointer has an additional parent when talloc_free() is called
-then the memory is not actually released, but instead the most
-recently established parent is destroyed. See talloc_reference() for
-details on establishing additional parents.
-
-For more control on which parent is removed, see talloc_unlink()
-
-talloc_free() operates recursively on its children.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-int talloc_free_children(void *ptr);
-
-The talloc_free_children() walks along the list of all children of a
-talloc context and talloc_free()s only the children, not the context
-itself.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_reference(const void *context, const void *ptr);
-
-The talloc_reference() function makes "context" an additional parent
-of "ptr".
-
-The return value of talloc_reference() is always the original pointer
-"ptr", unless talloc ran out of memory in creating the reference in
-which case it will return NULL (each additional reference consumes
-around 48 bytes of memory on intel x86 platforms).
-
-If "ptr" is NULL, then the function is a no-op, and simply returns NULL.
-
-After creating a reference you can free it in one of the following
-ways:
-
- - you can talloc_free() any parent of the original pointer. That
- will reduce the number of parents of this pointer by 1, and will
- cause this pointer to be freed if it runs out of parents.
-
- - you can talloc_free() the pointer itself. That will destroy the
- most recently established parent to the pointer and leave the
- pointer as a child of its current parent.
-
-For more control on which parent to remove, see talloc_unlink()
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-int talloc_unlink(const void *context, const void *ptr);
-
-The talloc_unlink() function removes a specific parent from ptr. The
-context passed must either be a context used in talloc_reference()
-with this pointer, or must be a direct parent of ptr.
-
-Note that if the parent has already been removed using talloc_free()
-then this function will fail and will return -1. Likewise, if "ptr"
-is NULL, then the function will make no modifications and return -1.
-
-Usually you can just use talloc_free() instead of talloc_unlink(), but
-sometimes it is useful to have the additional control on which parent
-is removed.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_set_destructor(const void *ptr, int (*destructor)(void *));
-
-The function talloc_set_destructor() sets the "destructor" for the
-pointer "ptr". A destructor is a function that is called when the
-memory used by a pointer is about to be released. The destructor
-receives the pointer as an argument, and should return 0 for success
-and -1 for failure.
-
-The destructor can do anything it wants to, including freeing other
-pieces of memory. A common use for destructors is to clean up
-operating system resources (such as open file descriptors) contained
-in the structure the destructor is placed on.
-
-You can only place one destructor on a pointer. If you need more than
-one destructor then you can create a zero-length child of the pointer
-and place an additional destructor on that.
-
-To remove a destructor call talloc_set_destructor() with NULL for the
-destructor.
-
-If your destructor attempts to talloc_free() the pointer that it is
-the destructor for then talloc_free() will return -1 and the free will
-be ignored. This would be a pointless operation anyway, as the
-destructor is only called when the memory is just about to go away.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-int talloc_increase_ref_count(const void *ptr);
-
-The talloc_increase_ref_count(ptr) function is exactly equivalent to:
-
- talloc_reference(NULL, ptr);
-
-You can use either syntax, depending on which you think is clearer in
-your code.
-
-It returns 0 on success and -1 on failure.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-size_t talloc_reference_count(const void *ptr);
-
-Return the number of references to the pointer.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_set_name(const void *ptr, const char *fmt, ...);
-
-Each talloc pointer has a "name". The name is used principally for
-debugging purposes, although it is also possible to set and get the
-name on a pointer in as a way of "marking" pointers in your code.
-
-The main use for names on pointer is for "talloc reports". See
-talloc_report() and talloc_report_full() for details. Also see
-talloc_enable_leak_report() and talloc_enable_leak_report_full().
-
-The talloc_set_name() function allocates memory as a child of the
-pointer. It is logically equivalent to:
- talloc_set_name_const(ptr, talloc_asprintf(ptr, fmt, ...));
-
-Note that multiple calls to talloc_set_name() will allocate more
-memory without releasing the name. All of the memory is released when
-the ptr is freed using talloc_free().
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_set_name_const(const void *ptr, const char *name);
-
-The function talloc_set_name_const() is just like talloc_set_name(),
-but it takes a string constant, and is much faster. It is extensively
-used by the "auto naming" macros, such as talloc_p().
-
-This function does not allocate any memory. It just copies the
-supplied pointer into the internal representation of the talloc
-ptr. This means you must not pass a name pointer to memory that will
-disappear before the ptr is freed with talloc_free().
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_named(const void *context, size_t size, const char *fmt, ...);
-
-The talloc_named() function creates a named talloc pointer. It is
-equivalent to:
-
- ptr = talloc_size(context, size);
- talloc_set_name(ptr, fmt, ....);
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_named_const(const void *context, size_t size, const char *name);
-
-This is equivalent to:
-
- ptr = talloc_size(context, size);
- talloc_set_name_const(ptr, name);
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-const char *talloc_get_name(const void *ptr);
-
-This returns the current name for the given talloc pointer. See
-talloc_set_name() for details.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_init(const char *fmt, ...);
-
-This function creates a zero length named talloc context as a top
-level context. It is equivalent to:
-
- talloc_named(NULL, 0, fmt, ...);
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_new(void *ctx);
-
-This is a utility macro that creates a new memory context hanging
-off an exiting context, automatically naming it "talloc_new: __location__"
-where __location__ is the source line it is called from. It is
-particularly useful for creating a new temporary working context.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-(type *)talloc_realloc(const void *context, void *ptr, type, count);
-
-The talloc_realloc() macro changes the size of a talloc
-pointer. The "count" argument is the number of elements of type "type"
-that you want the resulting pointer to hold.
-
-talloc_realloc() has the following equivalences:
-
- talloc_realloc(context, NULL, type, 1) ==> talloc(context, type);
- talloc_realloc(context, NULL, type, N) ==> talloc_array(context, type, N);
- talloc_realloc(context, ptr, type, 0) ==> talloc_free(ptr);
-
-The "context" argument is only used if "ptr" is NULL, otherwise it is
-ignored.
-
-talloc_realloc() returns the new pointer, or NULL on failure. The call
-will fail either due to a lack of memory, or because the pointer has
-more than one parent (see talloc_reference()).
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_realloc_size(const void *context, void *ptr, size_t size);
-
-the talloc_realloc_size() function is useful when the type is not
-known so the typesafe talloc_realloc() cannot be used.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_steal(const void *new_ctx, const void *ptr);
-
-The talloc_steal() function changes the parent context of a talloc
-pointer. It is typically used when the context that the pointer is
-currently a child of is going to be freed and you wish to keep the
-memory for a longer time.
-
-The talloc_steal() function returns the pointer that you pass it. It
-does not have any failure modes.
-
-NOTE: It is possible to produce loops in the parent/child relationship
-if you are not careful with talloc_steal(). No guarantees are provided
-as to your sanity or the safety of your data if you do this.
-
-talloc_steal (new_ctx, NULL) will return NULL with no sideeffects.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-size_t talloc_total_size(const void *ptr);
-
-The talloc_total_size() function returns the total size in bytes used
-by this pointer and all child pointers. Mostly useful for debugging.
-
-Passing NULL is allowed, but it will only give a meaningful result if
-talloc_enable_leak_report() or talloc_enable_leak_report_full() has
-been called.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-size_t talloc_total_blocks(const void *ptr);
-
-The talloc_total_blocks() function returns the total memory block
-count used by this pointer and all child pointers. Mostly useful for
-debugging.
-
-Passing NULL is allowed, but it will only give a meaningful result if
-talloc_enable_leak_report() or talloc_enable_leak_report_full() has
-been called.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_report_depth_cb(const void *ptr, int depth, int max_depth,
- void (*callback)(const void *ptr,
- int depth, int max_depth,
- int is_ref,
- void *priv),
- void *priv);
-
-This provides a more flexible reports than talloc_report(). It
-will recursively call the callback for the entire tree of memory
-referenced by the pointer. References in the tree are passed with
-is_ref = 1 and the pointer that is referenced.
-
-You can pass NULL for the pointer, in which case a report is
-printed for the top level memory context, but only if
-talloc_enable_leak_report() or talloc_enable_leak_report_full()
-has been called.
-
-The recursion is stopped when depth >= max_depth.
-max_depth = -1 means only stop at leaf nodes.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f);
-
-This provides a more flexible reports than talloc_report(). It
-will let you specify the depth and max_depth.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_report(const void *ptr, FILE *f);
-
-The talloc_report() function prints a summary report of all memory
-used by ptr. One line of report is printed for each immediate child of
-ptr, showing the total memory and number of blocks used by that child.
-
-You can pass NULL for the pointer, in which case a report is printed
-for the top level memory context, but only if
-talloc_enable_leak_report() or talloc_enable_leak_report_full() has
-been called.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_report_full(const void *ptr, FILE *f);
-
-This provides a more detailed report than talloc_report(). It will
-recursively print the ensire tree of memory referenced by the
-pointer. References in the tree are shown by giving the name of the
-pointer that is referenced.
-
-You can pass NULL for the pointer, in which case a report is printed
-for the top level memory context, but only if
-talloc_enable_leak_report() or talloc_enable_leak_report_full() has
-been called.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_enable_leak_report(void);
-
-This enables calling of talloc_report(NULL, stderr) when the program
-exits. In Samba4 this is enabled by using the --leak-report command
-line option.
-
-For it to be useful, this function must be called before any other
-talloc function as it establishes a "null context" that acts as the
-top of the tree. If you don't call this function first then passing
-NULL to talloc_report() or talloc_report_full() won't give you the
-full tree printout.
-
-Here is a typical talloc report:
-
-talloc report on 'null_context' (total 267 bytes in 15 blocks)
- libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks
- libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks
- iconv(UTF8,CP850) contains 42 bytes in 2 blocks
- libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks
- iconv(CP850,UTF8) contains 42 bytes in 2 blocks
- iconv(UTF8,UTF-16LE) contains 45 bytes in 2 blocks
- iconv(UTF-16LE,UTF8) contains 45 bytes in 2 blocks
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_enable_leak_report_full(void);
-
-This enables calling of talloc_report_full(NULL, stderr) when the
-program exits. In Samba4 this is enabled by using the
---leak-report-full command line option.
-
-For it to be useful, this function must be called before any other
-talloc function as it establishes a "null context" that acts as the
-top of the tree. If you don't call this function first then passing
-NULL to talloc_report() or talloc_report_full() won't give you the
-full tree printout.
-
-Here is a typical full report:
-
-full talloc report on 'root' (total 18 bytes in 8 blocks)
- p1 contains 18 bytes in 7 blocks (ref 0)
- r1 contains 13 bytes in 2 blocks (ref 0)
- reference to: p2
- p2 contains 1 bytes in 1 blocks (ref 1)
- x3 contains 1 bytes in 1 blocks (ref 0)
- x2 contains 1 bytes in 1 blocks (ref 0)
- x1 contains 1 bytes in 1 blocks (ref 0)
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_enable_null_tracking(void);
-
-This enables tracking of the NULL memory context without enabling leak
-reporting on exit. Useful for when you want to do your own leak
-reporting call via talloc_report_null_full();
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void talloc_disable_null_tracking(void);
-
-This disables tracking of the NULL memory context.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-(type *)talloc_zero(const void *ctx, type);
-
-The talloc_zero() macro is equivalent to:
-
- ptr = talloc(ctx, type);
- if (ptr) memset(ptr, 0, sizeof(type));
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_zero_size(const void *ctx, size_t size)
-
-The talloc_zero_size() function is useful when you don't have a known type
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_memdup(const void *ctx, const void *p, size_t size);
-
-The talloc_memdup() function is equivalent to:
-
- ptr = talloc_size(ctx, size);
- if (ptr) memcpy(ptr, p, size);
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-char *talloc_strdup(const void *ctx, const char *p);
-
-The talloc_strdup() function is equivalent to:
-
- ptr = talloc_size(ctx, strlen(p)+1);
- if (ptr) memcpy(ptr, p, strlen(p)+1);
-
-This functions sets the name of the new pointer to the passed
-string. This is equivalent to:
- talloc_set_name_const(ptr, ptr)
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-char *talloc_strndup(const void *t, const char *p, size_t n);
-
-The talloc_strndup() function is the talloc equivalent of the C
-library function strndup()
-
-This functions sets the name of the new pointer to the passed
-string. This is equivalent to:
- talloc_set_name_const(ptr, ptr)
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-char *talloc_append_string(const void *t, char *orig, const char *append);
-
-The talloc_append_string() function appends the given formatted
-string to the given string.
-
-This function sets the name of the new pointer to the new
-string. This is equivalent to:
- talloc_set_name_const(ptr, ptr)
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-char *talloc_vasprintf(const void *t, const char *fmt, va_list ap);
-
-The talloc_vasprintf() function is the talloc equivalent of the C
-library function vasprintf()
-
-This functions sets the name of the new pointer to the new
-string. This is equivalent to:
- talloc_set_name_const(ptr, ptr)
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-char *talloc_asprintf(const void *t, const char *fmt, ...);
-
-The talloc_asprintf() function is the talloc equivalent of the C
-library function asprintf()
-
-This functions sets the name of the new pointer to the new
-string. This is equivalent to:
- talloc_set_name_const(ptr, ptr)
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-char *talloc_asprintf_append(char *s, const char *fmt, ...);
-
-The talloc_asprintf_append() function appends the given formatted
-string to the given string.
-Use this varient when the string in the current talloc buffer may
-have been truncated in length.
-
-This functions sets the name of the new pointer to the new
-string. This is equivalent to:
- talloc_set_name_const(ptr, ptr)
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-char *talloc_asprintf_append_buffer(char *s, const char *fmt, ...);
-
-The talloc_asprintf_append() function appends the given formatted
-string to the end of the currently allocated talloc buffer.
-Use this varient when the string in the current talloc buffer has
-not been changed.
-
-This functions sets the name of the new pointer to the new
-string. This is equivalent to:
- talloc_set_name_const(ptr, ptr)
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-((type *)talloc_array(const void *ctx, type, uint_t count);
-
-The talloc_array() macro is equivalent to:
-
- (type *)talloc_size(ctx, sizeof(type) * count);
-
-except that it provides integer overflow protection for the multiply,
-returning NULL if the multiply overflows.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_array_size(const void *ctx, size_t size, uint_t count);
-
-The talloc_array_size() function is useful when the type is not
-known. It operates in the same way as talloc_array(), but takes a size
-instead of a type.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-(typeof(ptr)) talloc_array_ptrtype(const void *ctx, ptr, uint_t count);
-
-The talloc_ptrtype() macro should be used when you have a pointer to an array
-and want to allocate memory of an array to point at with this pointer. When compiling
-with gcc >= 3 it is typesafe. Note this is a wrapper of talloc_array_size()
-and talloc_get_name() will return the current location in the source file.
-and not the type.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_realloc_fn(const void *ctx, void *ptr, size_t size);
-
-This is a non-macro version of talloc_realloc(), which is useful
-as libraries sometimes want a ralloc function pointer. A realloc()
-implementation encapsulates the functionality of malloc(), free() and
-realloc() in one call, which is why it is useful to be able to pass
-around a single function pointer.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_autofree_context(void);
-
-This is a handy utility function that returns a talloc context
-which will be automatically freed on program exit. This can be used
-to reduce the noise in memory leak reports.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_check_name(const void *ptr, const char *name);
-
-This function checks if a pointer has the specified name. If it does
-then the pointer is returned. It it doesn't then NULL is returned.
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-(type *)talloc_get_type(const void *ptr, type);
-
-This macro allows you to do type checking on talloc pointers. It is
-particularly useful for void* private pointers. It is equivalent to
-this:
-
- (type *)talloc_check_name(ptr, #type)
-
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-talloc_set_type(const void *ptr, type);
-
-This macro allows you to force the name of a pointer to be a
-particular type. This can be used in conjunction with
-talloc_get_type() to do type checking on void* pointers.
-
-It is equivalent to this:
- talloc_set_name_const(ptr, #type)
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-talloc_get_size(const void *ctx);
-
-This function lets you know the amount of memory alloced so far by
-this context. It does NOT account for subcontext memory.
-This can be used to calculate the size of an array.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_find_parent_byname(const void *ctx, const char *name);
-
-Find a parent memory context of the current context that has the given
-name. This can be very useful in complex programs where it may be
-difficult to pass all information down to the level you need, but you
-know the structure you want is a parent of another context.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-(type *)talloc_find_parent_bytype(ctx, type);
-
-Like talloc_find_parent_byname() but takes a type, making it typesafe.
-
diff --git a/source3/lib/talloc/testsuite.c b/source3/lib/talloc/testsuite.c
deleted file mode 100644
index 3f06eee566..0000000000
--- a/source3/lib/talloc/testsuite.c
+++ /dev/null
@@ -1,1152 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- local testing of talloc routines.
-
- Copyright (C) Andrew Tridgell 2004
-
- ** NOTE! The following LGPL license applies to the talloc
- ** 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/>.
-*/
-
-#include "replace.h"
-#include "system/time.h"
-#include "talloc.h"
-
-static struct timeval timeval_current(void)
-{
- struct timeval tv;
- gettimeofday(&tv, NULL);
- return tv;
-}
-
-static double timeval_elapsed(struct timeval *tv)
-{
- struct timeval tv2 = timeval_current();
- return (tv2.tv_sec - tv->tv_sec) +
- (tv2.tv_usec - tv->tv_usec)*1.0e-6;
-}
-
-#define torture_assert(test, expr, str) if (!(expr)) { \
- printf("failure: %s [\n%s: Expression %s failed: %s\n]\n", \
- test, __location__, #expr, str); \
- return false; \
-}
-
-#define torture_assert_str_equal(test, arg1, arg2, desc) \
- if (arg1 == NULL && arg2 == NULL) { \
- } else if (strcmp(arg1, arg2)) { \
- printf("failure: %s [\n%s: Expected %s, got %s: %s\n]\n", \
- test, __location__, arg1, arg2, desc); \
- return false; \
- }
-
-#if _SAMBA_BUILD_==3
-#ifdef malloc
-#undef malloc
-#endif
-#ifdef strdup
-#undef strdup
-#endif
-#endif
-
-#define CHECK_SIZE(test, ptr, tsize) do { \
- if (talloc_total_size(ptr) != (tsize)) { \
- printf("failed: %s [\nwrong '%s' tree size: got %u expected %u\n]\n", \
- test, #ptr, \
- (unsigned)talloc_total_size(ptr), \
- (unsigned)tsize); \
- talloc_report_full(ptr, stdout); \
- return false; \
- } \
-} while (0)
-
-#define CHECK_BLOCKS(test, ptr, tblocks) do { \
- if (talloc_total_blocks(ptr) != (tblocks)) { \
- printf("failed: %s [\nwrong '%s' tree blocks: got %u expected %u\n]\n", \
- test, #ptr, \
- (unsigned)talloc_total_blocks(ptr), \
- (unsigned)tblocks); \
- talloc_report_full(ptr, stdout); \
- return false; \
- } \
-} while (0)
-
-#define CHECK_PARENT(test, ptr, parent) do { \
- if (talloc_parent(ptr) != (parent)) { \
- printf("failed: %s [\n'%s' has wrong parent: got %p expected %p\n]\n", \
- test, #ptr, \
- talloc_parent(ptr), \
- (parent)); \
- talloc_report_full(ptr, stdout); \
- talloc_report_full(parent, stdout); \
- talloc_report_full(NULL, stdout); \
- return false; \
- } \
-} while (0)
-
-
-/*
- test references
-*/
-static bool test_ref1(void)
-{
- void *root, *p1, *p2, *ref, *r1;
-
- printf("test: ref1\n# SINGLE REFERENCE FREE\n");
-
- root = talloc_named_const(NULL, 0, "root");
- p1 = talloc_named_const(root, 1, "p1");
- p2 = talloc_named_const(p1, 1, "p2");
- talloc_named_const(p1, 1, "x1");
- talloc_named_const(p1, 2, "x2");
- talloc_named_const(p1, 3, "x3");
-
- r1 = talloc_named_const(root, 1, "r1");
- ref = talloc_reference(r1, p2);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref1", p1, 5);
- CHECK_BLOCKS("ref1", p2, 1);
- CHECK_BLOCKS("ref1", r1, 2);
-
- fprintf(stderr, "Freeing p2\n");
- talloc_free(p2);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref1", p1, 5);
- CHECK_BLOCKS("ref1", p2, 1);
- CHECK_BLOCKS("ref1", r1, 1);
-
- fprintf(stderr, "Freeing p1\n");
- talloc_free(p1);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref1", r1, 1);
-
- fprintf(stderr, "Freeing r1\n");
- talloc_free(r1);
- talloc_report_full(NULL, stderr);
-
- fprintf(stderr, "Testing NULL\n");
- if (talloc_reference(root, NULL)) {
- return false;
- }
-
- CHECK_BLOCKS("ref1", root, 1);
-
- CHECK_SIZE("ref1", root, 0);
-
- talloc_free(root);
- printf("success: ref1\n");
- return true;
-}
-
-/*
- test references
-*/
-static bool test_ref2(void)
-{
- void *root, *p1, *p2, *ref, *r1;
-
- printf("test: ref2\n# DOUBLE REFERENCE FREE\n");
- root = talloc_named_const(NULL, 0, "root");
- p1 = talloc_named_const(root, 1, "p1");
- talloc_named_const(p1, 1, "x1");
- talloc_named_const(p1, 1, "x2");
- talloc_named_const(p1, 1, "x3");
- p2 = talloc_named_const(p1, 1, "p2");
-
- r1 = talloc_named_const(root, 1, "r1");
- ref = talloc_reference(r1, p2);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref2", p1, 5);
- CHECK_BLOCKS("ref2", p2, 1);
- CHECK_BLOCKS("ref2", r1, 2);
-
- fprintf(stderr, "Freeing ref\n");
- talloc_free(ref);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref2", p1, 5);
- CHECK_BLOCKS("ref2", p2, 1);
- CHECK_BLOCKS("ref2", r1, 1);
-
- fprintf(stderr, "Freeing p2\n");
- talloc_free(p2);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref2", p1, 4);
- CHECK_BLOCKS("ref2", r1, 1);
-
- fprintf(stderr, "Freeing p1\n");
- talloc_free(p1);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref2", r1, 1);
-
- fprintf(stderr, "Freeing r1\n");
- talloc_free(r1);
- talloc_report_full(root, stderr);
-
- CHECK_SIZE("ref2", root, 0);
-
- talloc_free(root);
- printf("success: ref2\n");
- return true;
-}
-
-/*
- test references
-*/
-static bool test_ref3(void)
-{
- void *root, *p1, *p2, *ref, *r1;
-
- printf("test: ref3\n# PARENT REFERENCE FREE\n");
-
- root = talloc_named_const(NULL, 0, "root");
- p1 = talloc_named_const(root, 1, "p1");
- p2 = talloc_named_const(root, 1, "p2");
- r1 = talloc_named_const(p1, 1, "r1");
- ref = talloc_reference(p2, r1);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref3", p1, 2);
- CHECK_BLOCKS("ref3", p2, 2);
- CHECK_BLOCKS("ref3", r1, 1);
-
- fprintf(stderr, "Freeing p1\n");
- talloc_free(p1);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref3", p2, 2);
- CHECK_BLOCKS("ref3", r1, 1);
-
- fprintf(stderr, "Freeing p2\n");
- talloc_free(p2);
- talloc_report_full(root, stderr);
-
- CHECK_SIZE("ref3", root, 0);
-
- talloc_free(root);
-
- printf("success: ref3\n");
- return true;
-}
-
-/*
- test references
-*/
-static bool test_ref4(void)
-{
- void *root, *p1, *p2, *ref, *r1;
-
- printf("test: ref4\n# REFERRER REFERENCE FREE\n");
-
- root = talloc_named_const(NULL, 0, "root");
- p1 = talloc_named_const(root, 1, "p1");
- talloc_named_const(p1, 1, "x1");
- talloc_named_const(p1, 1, "x2");
- talloc_named_const(p1, 1, "x3");
- p2 = talloc_named_const(p1, 1, "p2");
-
- r1 = talloc_named_const(root, 1, "r1");
- ref = talloc_reference(r1, p2);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref4", p1, 5);
- CHECK_BLOCKS("ref4", p2, 1);
- CHECK_BLOCKS("ref4", r1, 2);
-
- fprintf(stderr, "Freeing r1\n");
- talloc_free(r1);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref4", p1, 5);
- CHECK_BLOCKS("ref4", p2, 1);
-
- fprintf(stderr, "Freeing p2\n");
- talloc_free(p2);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("ref4", p1, 4);
-
- fprintf(stderr, "Freeing p1\n");
- talloc_free(p1);
- talloc_report_full(root, stderr);
-
- CHECK_SIZE("ref4", root, 0);
-
- talloc_free(root);
-
- printf("success: ref4\n");
- return true;
-}
-
-
-/*
- test references
-*/
-static bool test_unlink1(void)
-{
- void *root, *p1, *p2, *ref, *r1;
-
- printf("test: unlink\n# UNLINK\n");
-
- root = talloc_named_const(NULL, 0, "root");
- p1 = talloc_named_const(root, 1, "p1");
- talloc_named_const(p1, 1, "x1");
- talloc_named_const(p1, 1, "x2");
- talloc_named_const(p1, 1, "x3");
- p2 = talloc_named_const(p1, 1, "p2");
-
- r1 = talloc_named_const(p1, 1, "r1");
- ref = talloc_reference(r1, p2);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("unlink", p1, 7);
- CHECK_BLOCKS("unlink", p2, 1);
- CHECK_BLOCKS("unlink", r1, 2);
-
- fprintf(stderr, "Unreferencing r1\n");
- talloc_unlink(r1, p2);
- talloc_report_full(root, stderr);
-
- CHECK_BLOCKS("unlink", p1, 6);
- CHECK_BLOCKS("unlink", p2, 1);
- CHECK_BLOCKS("unlink", r1, 1);
-
- fprintf(stderr, "Freeing p1\n");
- talloc_free(p1);
- talloc_report_full(root, stderr);
-
- CHECK_SIZE("unlink", root, 0);
-
- talloc_free(root);
-
- printf("success: unlink\n");
- return true;
-}
-
-static int fail_destructor(void *ptr)
-{
- return -1;
-}
-
-/*
- miscellaneous tests to try to get a higher test coverage percentage
-*/
-static bool test_misc(void)
-{
- void *root, *p1;
- char *p2;
- double *d;
- const char *name;
-
- printf("test: misc\n# MISCELLANEOUS\n");
-
- root = talloc_new(NULL);
-
- p1 = talloc_size(root, 0x7fffffff);
- torture_assert("misc", !p1, "failed: large talloc allowed\n");
-
- p1 = talloc_strdup(root, "foo");
- talloc_increase_ref_count(p1);
- talloc_increase_ref_count(p1);
- talloc_increase_ref_count(p1);
- CHECK_BLOCKS("misc", p1, 1);
- CHECK_BLOCKS("misc", root, 2);
- talloc_free(p1);
- CHECK_BLOCKS("misc", p1, 1);
- CHECK_BLOCKS("misc", root, 2);
- talloc_unlink(NULL, p1);
- CHECK_BLOCKS("misc", p1, 1);
- CHECK_BLOCKS("misc", root, 2);
- p2 = talloc_strdup(p1, "foo");
- torture_assert("misc", talloc_unlink(root, p2) == -1,
- "failed: talloc_unlink() of non-reference context should return -1\n");
- torture_assert("misc", talloc_unlink(p1, p2) == 0,
- "failed: talloc_unlink() of parent should succeed\n");
- talloc_free(p1);
- CHECK_BLOCKS("misc", p1, 1);
- CHECK_BLOCKS("misc", root, 2);
-
- name = talloc_set_name(p1, "my name is %s", "foo");
- torture_assert_str_equal("misc", talloc_get_name(p1), "my name is foo",
- "failed: wrong name after talloc_set_name(my name is foo)");
- CHECK_BLOCKS("misc", p1, 2);
- CHECK_BLOCKS("misc", root, 3);
-
- talloc_set_name_const(p1, NULL);
- torture_assert_str_equal ("misc", talloc_get_name(p1), "UNNAMED",
- "failed: wrong name after talloc_set_name(NULL)");
- CHECK_BLOCKS("misc", p1, 2);
- CHECK_BLOCKS("misc", root, 3);
-
- torture_assert("misc", talloc_free(NULL) == -1,
- "talloc_free(NULL) should give -1\n");
-
- talloc_set_destructor(p1, fail_destructor);
- torture_assert("misc", talloc_free(p1) == -1,
- "Failed destructor should cause talloc_free to fail\n");
- talloc_set_destructor(p1, NULL);
-
- talloc_report(root, stderr);
-
-
- p2 = (char *)talloc_zero_size(p1, 20);
- torture_assert("misc", p2[19] == 0, "Failed to give zero memory\n");
- talloc_free(p2);
-
- torture_assert("misc", talloc_strdup(root, NULL) == NULL,
- "failed: strdup on NULL should give NULL\n");
-
- p2 = talloc_strndup(p1, "foo", 2);
- torture_assert("misc", strcmp("fo", p2) == 0,
- "strndup doesn't work\n");
- p2 = talloc_asprintf_append_buffer(p2, "o%c", 'd');
- torture_assert("misc", strcmp("food", p2) == 0,
- "talloc_asprintf_append_buffer doesn't work\n");
- CHECK_BLOCKS("misc", p2, 1);
- CHECK_BLOCKS("misc", p1, 3);
-
- p2 = talloc_asprintf_append_buffer(NULL, "hello %s", "world");
- torture_assert("misc", strcmp("hello world", p2) == 0,
- "talloc_asprintf_append_buffer doesn't work\n");
- CHECK_BLOCKS("misc", p2, 1);
- CHECK_BLOCKS("misc", p1, 3);
- talloc_free(p2);
-
- d = talloc_array(p1, double, 0x20000000);
- torture_assert("misc", !d, "failed: integer overflow not detected\n");
-
- d = talloc_realloc(p1, d, double, 0x20000000);
- torture_assert("misc", !d, "failed: integer overflow not detected\n");
-
- talloc_free(p1);
- CHECK_BLOCKS("misc", root, 1);
-
- p1 = talloc_named(root, 100, "%d bytes", 100);
- CHECK_BLOCKS("misc", p1, 2);
- CHECK_BLOCKS("misc", root, 3);
- talloc_unlink(root, p1);
-
- p1 = talloc_init("%d bytes", 200);
- p2 = talloc_asprintf(p1, "my test '%s'", "string");
- torture_assert_str_equal("misc", p2, "my test 'string'",
- "failed: talloc_asprintf(\"my test '%%s'\", \"string\") gave: \"%s\"");
- CHECK_BLOCKS("misc", p1, 3);
- CHECK_SIZE("misc", p2, 17);
- CHECK_BLOCKS("misc", root, 1);
- talloc_unlink(NULL, p1);
-
- p1 = talloc_named_const(root, 10, "p1");
- p2 = (char *)talloc_named_const(root, 20, "p2");
- (void)talloc_reference(p1, p2);
- talloc_report_full(root, stderr);
- talloc_unlink(root, p2);
- talloc_report_full(root, stderr);
- CHECK_BLOCKS("misc", p2, 1);
- CHECK_BLOCKS("misc", p1, 2);
- CHECK_BLOCKS("misc", root, 3);
- talloc_unlink(p1, p2);
- talloc_unlink(root, p1);
-
- p1 = talloc_named_const(root, 10, "p1");
- p2 = (char *)talloc_named_const(root, 20, "p2");
- (void)talloc_reference(NULL, p2);
- talloc_report_full(root, stderr);
- talloc_unlink(root, p2);
- talloc_report_full(root, stderr);
- CHECK_BLOCKS("misc", p2, 1);
- CHECK_BLOCKS("misc", p1, 1);
- CHECK_BLOCKS("misc", root, 2);
- talloc_unlink(NULL, p2);
- talloc_unlink(root, p1);
-
- /* Test that talloc_unlink is a no-op */
-
- torture_assert("misc", talloc_unlink(root, NULL) == -1,
- "failed: talloc_unlink(root, NULL) == -1\n");
-
- talloc_report(root, stderr);
- talloc_report(NULL, stderr);
-
- CHECK_SIZE("misc", root, 0);
-
- talloc_free(root);
-
- CHECK_SIZE("misc", NULL, 0);
-
- talloc_enable_leak_report();
- talloc_enable_leak_report_full();
-
- printf("success: misc\n");
-
- return true;
-}
-
-
-/*
- test realloc
-*/
-static bool test_realloc(void)
-{
- void *root, *p1, *p2;
-
- printf("test: realloc\n# REALLOC\n");
-
- root = talloc_new(NULL);
-
- p1 = talloc_size(root, 10);
- CHECK_SIZE("realloc", p1, 10);
-
- p1 = talloc_realloc_size(NULL, p1, 20);
- CHECK_SIZE("realloc", p1, 20);
-
- talloc_new(p1);
-
- p2 = talloc_realloc_size(p1, NULL, 30);
-
- talloc_new(p1);
-
- p2 = talloc_realloc_size(p1, p2, 40);
-
- CHECK_SIZE("realloc", p2, 40);
- CHECK_SIZE("realloc", root, 60);
- CHECK_BLOCKS("realloc", p1, 4);
-
- p1 = talloc_realloc_size(NULL, p1, 20);
- CHECK_SIZE("realloc", p1, 60);
-
- talloc_increase_ref_count(p2);
- torture_assert("realloc", talloc_realloc_size(NULL, p2, 5) == NULL,
- "failed: talloc_realloc() on a referenced pointer should fail\n");
- CHECK_BLOCKS("realloc", p1, 4);
-
- talloc_realloc_size(NULL, p2, 0);
- talloc_realloc_size(NULL, p2, 0);
- CHECK_BLOCKS("realloc", p1, 3);
-
- torture_assert("realloc", talloc_realloc_size(NULL, p1, 0x7fffffff) == NULL,
- "failed: oversize talloc should fail\n");
-
- talloc_realloc_size(NULL, p1, 0);
-
- CHECK_BLOCKS("realloc", root, 1);
- CHECK_SIZE("realloc", root, 0);
-
- talloc_free(root);
-
- printf("success: realloc\n");
-
- return true;
-}
-
-/*
- test realloc with a child
-*/
-static bool test_realloc_child(void)
-{
- void *root;
- struct el2 {
- const char *name;
- } *el2;
- struct el1 {
- int count;
- struct el2 **list, **list2, **list3;
- } *el1;
-
- printf("test: REALLOC WITH CHILD\n");
-
- root = talloc_new(NULL);
-
- el1 = talloc(root, struct el1);
- el1->list = talloc(el1, struct el2 *);
- el1->list[0] = talloc(el1->list, struct el2);
- el1->list[0]->name = talloc_strdup(el1->list[0], "testing");
-
- el1->list2 = talloc(el1, struct el2 *);
- el1->list2[0] = talloc(el1->list2, struct el2);
- el1->list2[0]->name = talloc_strdup(el1->list2[0], "testing2");
-
- el1->list3 = talloc(el1, struct el2 *);
- el1->list3[0] = talloc(el1->list3, struct el2);
- el1->list3[0]->name = talloc_strdup(el1->list3[0], "testing2");
-
- el2 = talloc(el1->list, struct el2);
- el2 = talloc(el1->list2, struct el2);
- el2 = talloc(el1->list3, struct el2);
-
- el1->list = talloc_realloc(el1, el1->list, struct el2 *, 100);
- el1->list2 = talloc_realloc(el1, el1->list2, struct el2 *, 200);
- el1->list3 = talloc_realloc(el1, el1->list3, struct el2 *, 300);
-
- talloc_free(root);
-
- printf("success: REALLOC WITH CHILD\n");
- return true;
-}
-
-/*
- test type checking
-*/
-static bool test_type(void)
-{
- void *root;
- struct el1 {
- int count;
- };
- struct el2 {
- int count;
- };
- struct el1 *el1;
-
- printf("test: type\n# talloc type checking\n");
-
- root = talloc_new(NULL);
-
- el1 = talloc(root, struct el1);
-
- el1->count = 1;
-
- torture_assert("type", talloc_get_type(el1, struct el1) == el1,
- "type check failed on el1\n");
- torture_assert("type", talloc_get_type(el1, struct el2) == NULL,
- "type check failed on el1 with el2\n");
- talloc_set_type(el1, struct el2);
- torture_assert("type", talloc_get_type(el1, struct el2) == (struct el2 *)el1,
- "type set failed on el1 with el2\n");
-
- talloc_free(root);
-
- printf("success: type\n");
- return true;
-}
-
-/*
- test steal
-*/
-static bool test_steal(void)
-{
- void *root, *p1, *p2;
-
- printf("test: steal\n# STEAL\n");
-
- root = talloc_new(NULL);
-
- p1 = talloc_array(root, char, 10);
- CHECK_SIZE("steal", p1, 10);
-
- p2 = talloc_realloc(root, NULL, char, 20);
- CHECK_SIZE("steal", p1, 10);
- CHECK_SIZE("steal", root, 30);
-
- torture_assert("steal", talloc_steal(p1, NULL) == NULL,
- "failed: stealing NULL should give NULL\n");
-
- torture_assert("steal", talloc_steal(p1, p1) == p1,
- "failed: stealing to ourselves is a nop\n");
- CHECK_BLOCKS("steal", root, 3);
- CHECK_SIZE("steal", root, 30);
-
- talloc_steal(NULL, p1);
- talloc_steal(NULL, p2);
- CHECK_BLOCKS("steal", root, 1);
- CHECK_SIZE("steal", root, 0);
-
- talloc_free(p1);
- talloc_steal(root, p2);
- CHECK_BLOCKS("steal", root, 2);
- CHECK_SIZE("steal", root, 20);
-
- talloc_free(p2);
-
- CHECK_BLOCKS("steal", root, 1);
- CHECK_SIZE("steal", root, 0);
-
- talloc_free(root);
-
- p1 = talloc_size(NULL, 3);
- talloc_report_full(NULL, stderr);
- CHECK_SIZE("steal", NULL, 3);
- talloc_free(p1);
-
- printf("success: steal\n");
- return true;
-}
-
-/*
- test move
-*/
-static bool test_move(void)
-{
- void *root;
- struct t_move {
- char *p;
- int *x;
- } *t1, *t2;
-
- printf("test: move\n# MOVE\n");
-
- root = talloc_new(NULL);
-
- t1 = talloc(root, struct t_move);
- t2 = talloc(root, struct t_move);
- t1->p = talloc_strdup(t1, "foo");
- t1->x = talloc(t1, int);
- *t1->x = 42;
-
- t2->p = talloc_move(t2, &t1->p);
- t2->x = talloc_move(t2, &t1->x);
- torture_assert("move", t1->p == NULL && t1->x == NULL &&
- strcmp(t2->p, "foo") == 0 && *t2->x == 42,
- "talloc move failed");
-
- talloc_free(root);
-
- printf("success: move\n");
-
- return true;
-}
-
-/*
- test talloc_realloc_fn
-*/
-static bool test_realloc_fn(void)
-{
- void *root, *p1;
-
- printf("test: realloc_fn\n# talloc_realloc_fn\n");
-
- root = talloc_new(NULL);
-
- p1 = talloc_realloc_fn(root, NULL, 10);
- CHECK_BLOCKS("realloc_fn", root, 2);
- CHECK_SIZE("realloc_fn", root, 10);
- p1 = talloc_realloc_fn(root, p1, 20);
- CHECK_BLOCKS("realloc_fn", root, 2);
- CHECK_SIZE("realloc_fn", root, 20);
- p1 = talloc_realloc_fn(root, p1, 0);
- CHECK_BLOCKS("realloc_fn", root, 1);
- CHECK_SIZE("realloc_fn", root, 0);
-
- talloc_free(root);
-
- printf("success: realloc_fn\n");
- return true;
-}
-
-
-static bool test_unref_reparent(void)
-{
- void *root, *p1, *p2, *c1;
-
- printf("test: unref_reparent\n# UNREFERENCE AFTER PARENT FREED\n");
-
- root = talloc_named_const(NULL, 0, "root");
- p1 = talloc_named_const(root, 1, "orig parent");
- p2 = talloc_named_const(root, 1, "parent by reference");
-
- c1 = talloc_named_const(p1, 1, "child");
- talloc_reference(p2, c1);
-
- CHECK_PARENT("unref_reparent", c1, p1);
-
- talloc_free(p1);
-
- CHECK_PARENT("unref_reparent", c1, p2);
-
- talloc_unlink(p2, c1);
-
- CHECK_SIZE("unref_reparent", root, 1);
-
- talloc_free(p2);
- talloc_free(root);
-
- printf("success: unref_reparent\n");
- return true;
-}
-
-/*
- measure the speed of talloc versus malloc
-*/
-static bool test_speed(void)
-{
- void *ctx = talloc_new(NULL);
- unsigned count;
- const int loop = 1000;
- int i;
- struct timeval tv;
-
- printf("test: speed\n# TALLOC VS MALLOC SPEED\n");
-
- 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(p1);
- }
- count += 3 * loop;
- } while (timeval_elapsed(&tv) < 5.0);
-
- fprintf(stderr, "talloc: %.0f ops/sec\n", count/timeval_elapsed(&tv));
-
- 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 {
- void *p1, *p2, *p3;
- for (i=0;i<loop;i++) {
- p1 = malloc(loop % 100);
- p2 = strdup("foo bar");
- p3 = malloc(300);
- free(p1);
- free(p2);
- free(p3);
- }
- count += 3 * loop;
- } while (timeval_elapsed(&tv) < 5.0);
- fprintf(stderr, "malloc: %.0f ops/sec\n", count/timeval_elapsed(&tv));
-
- printf("success: speed\n");
-
- return true;
-}
-
-static bool test_lifeless(void)
-{
- void *top = talloc_new(NULL);
- char *parent, *child;
- void *child_owner = talloc_new(NULL);
-
- printf("test: lifeless\n# TALLOC_UNLINK LOOP\n");
-
- parent = talloc_strdup(top, "parent");
- child = talloc_strdup(parent, "child");
- (void)talloc_reference(child, parent);
- (void)talloc_reference(child_owner, child);
- talloc_report_full(top, stderr);
- talloc_unlink(top, parent);
- talloc_free(child);
- talloc_report_full(top, stderr);
- talloc_free(top);
- talloc_free(child_owner);
- talloc_free(child);
-
- printf("success: lifeless\n");
- return true;
-}
-
-static int loop_destructor_count;
-
-static int test_loop_destructor(char *ptr)
-{
- loop_destructor_count++;
- return 0;
-}
-
-static bool test_loop(void)
-{
- void *top = talloc_new(NULL);
- char *parent;
- struct req1 {
- char *req2, *req3;
- } *req1;
-
- printf("test: loop\n# TALLOC LOOP DESTRUCTION\n");
-
- parent = talloc_strdup(top, "parent");
- req1 = talloc(parent, struct req1);
- req1->req2 = talloc_strdup(req1, "req2");
- talloc_set_destructor(req1->req2, test_loop_destructor);
- req1->req3 = talloc_strdup(req1, "req3");
- (void)talloc_reference(req1->req3, req1);
- talloc_report_full(top, stderr);
- talloc_free(parent);
- talloc_report_full(top, stderr);
- talloc_report_full(NULL, stderr);
- talloc_free(top);
-
- torture_assert("loop", loop_destructor_count == 1,
- "FAILED TO FIRE LOOP DESTRUCTOR\n");
- loop_destructor_count = 0;
-
- printf("success: loop\n");
- return true;
-}
-
-static int fail_destructor_str(char *ptr)
-{
- return -1;
-}
-
-static bool test_free_parent_deny_child(void)
-{
- void *top = talloc_new(NULL);
- char *level1;
- char *level2;
- char *level3;
-
- printf("test: free_parent_deny_child\n# TALLOC FREE PARENT DENY CHILD\n");
-
- level1 = talloc_strdup(top, "level1");
- level2 = talloc_strdup(level1, "level2");
- level3 = talloc_strdup(level2, "level3");
-
- talloc_set_destructor(level3, fail_destructor_str);
- talloc_free(level1);
- talloc_set_destructor(level3, NULL);
-
- CHECK_PARENT("free_parent_deny_child", level3, top);
-
- talloc_free(top);
-
- printf("success: free_parent_deny_child\n");
- return true;
-}
-
-static bool test_talloc_ptrtype(void)
-{
- void *top = talloc_new(NULL);
- struct struct1 {
- int foo;
- int bar;
- } *s1, *s2, **s3, ***s4;
- const char *location1;
- const char *location2;
- const char *location3;
- const char *location4;
-
- printf("test: ptrtype\n# TALLOC PTRTYPE\n");
-
- s1 = talloc_ptrtype(top, s1);location1 = __location__;
-
- if (talloc_get_size(s1) != sizeof(struct struct1)) {
- printf("failure: ptrtype [\n"
- "talloc_ptrtype() allocated the wrong size %lu (should be %lu)\n"
- "]\n", (unsigned long)talloc_get_size(s1),
- (unsigned long)sizeof(struct struct1));
- return false;
- }
-
- if (strcmp(location1, talloc_get_name(s1)) != 0) {
- printf("failure: ptrtype [\n"
- "talloc_ptrtype() sets the wrong name '%s' (should be '%s')\n]\n",
- talloc_get_name(s1), location1);
- return false;
- }
-
- s2 = talloc_array_ptrtype(top, s2, 10);location2 = __location__;
-
- if (talloc_get_size(s2) != (sizeof(struct struct1) * 10)) {
- printf("failure: ptrtype [\n"
- "talloc_array_ptrtype() allocated the wrong size "
- "%lu (should be %lu)\n]\n",
- (unsigned long)talloc_get_size(s2),
- (unsigned long)(sizeof(struct struct1)*10));
- return false;
- }
-
- if (strcmp(location2, talloc_get_name(s2)) != 0) {
- printf("failure: ptrtype [\n"
- "talloc_array_ptrtype() sets the wrong name '%s' (should be '%s')\n]\n",
- talloc_get_name(s2), location2);
- return false;
- }
-
- s3 = talloc_array_ptrtype(top, s3, 10);location3 = __location__;
-
- if (talloc_get_size(s3) != (sizeof(struct struct1 *) * 10)) {
- printf("failure: ptrtype [\n"
- "talloc_array_ptrtype() allocated the wrong size "
- "%lu (should be %lu)\n]\n",
- (unsigned long)talloc_get_size(s3),
- (unsigned long)(sizeof(struct struct1 *)*10));
- return false;
- }
-
- torture_assert_str_equal("ptrtype", location3, talloc_get_name(s3),
- "talloc_array_ptrtype() sets the wrong name");
-
- s4 = talloc_array_ptrtype(top, s4, 10);location4 = __location__;
-
- if (talloc_get_size(s4) != (sizeof(struct struct1 **) * 10)) {
- printf("failure: ptrtype [\n"
- "talloc_array_ptrtype() allocated the wrong size "
- "%lu (should be %lu)\n]\n",
- (unsigned long)talloc_get_size(s4),
- (unsigned long)(sizeof(struct struct1 **)*10));
- return false;
- }
-
- torture_assert_str_equal("ptrtype", location4, talloc_get_name(s4),
- "talloc_array_ptrtype() sets the wrong name");
-
- talloc_free(top);
-
- printf("success: ptrtype\n");
- return true;
-}
-
-static int _test_talloc_free_in_destructor(void **ptr)
-{
- talloc_free(*ptr);
- return 0;
-}
-
-static bool test_talloc_free_in_destructor(void)
-{
- void *level0;
- void *level1;
- void *level2;
- void *level3;
- void *level4;
- void **level5;
-
- printf("test: free_in_destructor\n# TALLOC FREE IN DESTRUCTOR\n");
-
- level0 = talloc_new(NULL);
- level1 = talloc_new(level0);
- level2 = talloc_new(level1);
- level3 = talloc_new(level2);
- level4 = talloc_new(level3);
- level5 = talloc(level4, void *);
-
- *level5 = level3;
- (void)talloc_reference(level0, level3);
- (void)talloc_reference(level3, level3);
- (void)talloc_reference(level5, level3);
-
- talloc_set_destructor(level5, _test_talloc_free_in_destructor);
-
- talloc_free(level1);
-
- talloc_free(level0);
-
- printf("success: free_in_destructor\n");
- return true;
-}
-
-static bool test_autofree(void)
-{
-#if _SAMBA_BUILD_ < 4
- /* autofree test would kill smbtorture */
- void *p;
- printf("test: autofree\n# TALLOC AUTOFREE CONTEXT\n");
-
- p = talloc_autofree_context();
- talloc_free(p);
-
- p = talloc_autofree_context();
- talloc_free(p);
-
- printf("success: autofree\n");
-#endif
- 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)
-{
- bool ret = true;
-
- setlinebuf(stdout);
-
- talloc_disable_null_tracking();
- talloc_enable_null_tracking();
-
- ret &= test_ref1();
- ret &= test_ref2();
- ret &= test_ref3();
- ret &= test_ref4();
- ret &= test_unlink1();
- ret &= test_misc();
- ret &= test_realloc();
- ret &= test_realloc_child();
- ret &= test_steal();
- ret &= test_move();
- ret &= test_unref_reparent();
- ret &= test_realloc_fn();
- ret &= test_type();
- ret &= test_lifeless();
- ret &= test_loop();
- ret &= test_free_parent_deny_child();
- ret &= test_talloc_ptrtype();
- ret &= test_talloc_free_in_destructor();
- ret &= test_pool();
-
- if (ret) {
- ret &= test_speed();
- }
- ret &= test_autofree();
-
- return ret;
-}
-
-#if _SAMBA_BUILD_ < 4
-int main(void)
-{
- bool ret = torture_local_talloc(NULL);
- if (!ret)
- return -1;
- return 0;
-}
-#endif
diff --git a/source3/lib/talloc/web/index.html b/source3/lib/talloc/web/index.html
deleted file mode 100644
index 5deab93665..0000000000
--- a/source3/lib/talloc/web/index.html
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<TITLE>talloc</TITLE>
-</HEAD>
-<BODY BGCOLOR="#ffffff" TEXT="#000000" VLINK="#292555" LINK="#292555" ALINK="#cc0033">
-
-<h1>talloc</h1>
-
-talloc is a hierarchical pool based memory allocator with
-destructors. It is the core memory allocator used in Samba4, and has
-made a huge difference in many aspects of Samba4 development.<p>
-
-To get started with talloc, I would recommend you read the <a
-href="http://samba.org/ftp/unpacked/talloc/talloc_guide.txt">talloc guide</a>.
-
-<h2>Discussion and bug reports</h2>
-
-talloc does not currently have its own mailing list or bug tracking
-system. For now, please use the <a
-href="https://lists.samba.org/mailman/listinfo/samba-technical">samba-technical</a>
-mailing list, and the <a href="http://bugzilla.samba.org/">Samba
-bugzilla</a> bug tracking system.
-
-<h2>Download</h2>
-
-You can download the latest release either via rsync or git.<br>
-<br>
-To fetch via git see the following guide:<br>
-<a href="http://wiki.samba.org/index.php/Using_Git_for_Samba_Development">Using Git for Samba Development</a><br>
-Once you have cloned the tree switch to the v4-0-test branch and cd into the source/lib/talloc directory.<br>
-<br>
-To fetch via rsync use this command:
-
-<pre>
- rsync -Pavz samba.org::ftp/unpacked/talloc .
-</pre>
-
-<hr>
-<tiny>
-<a href="http://samba.org/~tridge/">Andrew Tridgell</a><br>
-talloc AT tridgell.net
-</tiny>
-
-</BODY>
-</HTML>
diff --git a/source3/lib/tdb/Makefile.in b/source3/lib/tdb/Makefile.in
deleted file mode 100644
index 090bb6e2dc..0000000000
--- a/source3/lib/tdb/Makefile.in
+++ /dev/null
@@ -1,59 +0,0 @@
-#!gmake
-#
-# Makefile for tdb directory
-#
-
-CC = @CC@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-bindir = @bindir@
-includedir = @includedir@
-libdir = @libdir@
-VPATH = @srcdir@:@libreplacedir@
-srcdir = @srcdir@
-builddir = @builddir@
-CPPFLAGS = @CPPFLAGS@ -I$(srcdir)/include -Iinclude
-CFLAGS = $(CPPFLAGS) @CFLAGS@
-LDFLAGS = @LDFLAGS@
-EXEEXT = @EXEEXT@
-SHLD = @SHLD@
-SHLD_FLAGS = @SHLD_FLAGS@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PICFLAG = @PICFLAG@
-SHLIBEXT = @SHLIBEXT@
-SWIG = swig
-PYTHON = @PYTHON@
-PYTHON_CONFIG = @PYTHON_CONFIG@
-PYTHON_BUILD_TARGET = @PYTHON_BUILD_TARGET@
-PYTHON_INSTALL_TARGET = @PYTHON_INSTALL_TARGET@
-PYTHON_CHECK_TARGET = @PYTHON_CHECK_TARGET@
-LIB_PATH_VAR = @LIB_PATH_VAR@
-tdbdir = @tdbdir@
-
-TDB_OBJ = @TDB_OBJ@ @LIBREPLACEOBJ@
-
-default: all
-
-include $(tdbdir)/tdb.mk
-include $(tdbdir)/rules.mk
-
-all:: showflags dirs $(PROGS) $(TDB_SOLIB) libtdb.a $(PYTHON_BUILD_TARGET)
-
-install:: all
-$(TDB_SOLIB): $(TDB_OBJ)
- $(SHLD) $(SHLD_FLAGS) -o $@ $(TDB_OBJ) @SONAMEFLAG@$(TDB_SONAME)
-
-check: test
-
-test:: $(PYTHON_CHECK_TARGET)
-installcheck:: test install
-
-clean::
- rm -f *.o *.a */*.o
-
-distclean:: clean
- rm -f config.log config.status include/config.h config.cache
- rm -f Makefile
-
-realdistclean:: distclean
- rm -f configure include/config.h.in
diff --git a/source3/lib/tdb/aclocal.m4 b/source3/lib/tdb/aclocal.m4
deleted file mode 100644
index 5605e476ba..0000000000
--- a/source3/lib/tdb/aclocal.m4
+++ /dev/null
@@ -1 +0,0 @@
-m4_include(libreplace.m4)
diff --git a/source3/lib/tdb/autogen.sh b/source3/lib/tdb/autogen.sh
deleted file mode 100755
index 88ac4cfcf7..0000000000
--- a/source3/lib/tdb/autogen.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-rm -rf autom4te.cache
-rm -f configure config.h.in
-
-IPATHS="-I libreplace -I lib/replace -I ../libreplace -I ../replace"
-autoconf $IPATHS || exit 1
-autoheader $IPATHS || exit 1
-
-rm -rf autom4te.cache
-
-swig -O -Wall -python -keyword tdb.i # Ignore errors for now
-
-echo "Now run ./configure and then make."
-exit 0
-
diff --git a/source3/lib/tdb/common/dump.c b/source3/lib/tdb/common/dump.c
deleted file mode 100644
index d1c902ddfd..0000000000
--- a/source3/lib/tdb/common/dump.c
+++ /dev/null
@@ -1,137 +0,0 @@
- /*
- Unix SMB/CIFS implementation.
-
- trivial database library
-
- Copyright (C) Andrew Tridgell 1999-2005
- Copyright (C) Paul `Rusty' Russell 2000
- Copyright (C) Jeremy Allison 2000-2003
-
- ** NOTE! The following LGPL license applies to the tdb
- ** 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/>.
-*/
-
-#include "tdb_private.h"
-
-static tdb_off_t tdb_dump_record(struct tdb_context *tdb, int hash,
- tdb_off_t offset)
-{
- struct list_struct rec;
- tdb_off_t tailer_ofs, tailer;
-
- if (tdb->methods->tdb_read(tdb, offset, (char *)&rec,
- sizeof(rec), DOCONV()) == -1) {
- printf("ERROR: failed to read record at %u\n", offset);
- return 0;
- }
-
- printf(" rec: hash=%d offset=0x%08x next=0x%08x rec_len=%d "
- "key_len=%d data_len=%d full_hash=0x%x magic=0x%x\n",
- hash, offset, rec.next, rec.rec_len, rec.key_len, rec.data_len,
- rec.full_hash, rec.magic);
-
- tailer_ofs = offset + sizeof(rec) + rec.rec_len - sizeof(tdb_off_t);
-
- if (tdb_ofs_read(tdb, tailer_ofs, &tailer) == -1) {
- printf("ERROR: failed to read tailer at %u\n", tailer_ofs);
- return rec.next;
- }
-
- if (tailer != rec.rec_len + sizeof(rec)) {
- printf("ERROR: tailer does not match record! tailer=%u totalsize=%u\n",
- (unsigned int)tailer, (unsigned int)(rec.rec_len + sizeof(rec)));
- }
- return rec.next;
-}
-
-static int tdb_dump_chain(struct tdb_context *tdb, int i)
-{
- tdb_off_t rec_ptr, top;
-
- top = TDB_HASH_TOP(i);
-
- if (tdb_lock(tdb, i, F_WRLCK) != 0)
- return -1;
-
- if (tdb_ofs_read(tdb, top, &rec_ptr) == -1)
- return tdb_unlock(tdb, i, F_WRLCK);
-
- if (rec_ptr)
- printf("hash=%d\n", i);
-
- while (rec_ptr) {
- rec_ptr = tdb_dump_record(tdb, i, rec_ptr);
- }
-
- return tdb_unlock(tdb, i, F_WRLCK);
-}
-
-void tdb_dump_all(struct tdb_context *tdb)
-{
- int i;
- for (i=0;i<tdb->header.hash_size;i++) {
- tdb_dump_chain(tdb, i);
- }
- printf("freelist:\n");
- tdb_dump_chain(tdb, -1);
-}
-
-int tdb_printfreelist(struct tdb_context *tdb)
-{
- int ret;
- long total_free = 0;
- tdb_off_t offset, rec_ptr;
- struct list_struct rec;
-
- if ((ret = tdb_lock(tdb, -1, F_WRLCK)) != 0)
- return ret;
-
- offset = FREELIST_TOP;
-
- /* read in the freelist top */
- if (tdb_ofs_read(tdb, offset, &rec_ptr) == -1) {
- tdb_unlock(tdb, -1, F_WRLCK);
- return 0;
- }
-
- printf("freelist top=[0x%08x]\n", rec_ptr );
- while (rec_ptr) {
- if (tdb->methods->tdb_read(tdb, rec_ptr, (char *)&rec,
- sizeof(rec), DOCONV()) == -1) {
- tdb_unlock(tdb, -1, F_WRLCK);
- return -1;
- }
-
- if (rec.magic != TDB_FREE_MAGIC) {
- printf("bad magic 0x%08x in free list\n", rec.magic);
- tdb_unlock(tdb, -1, F_WRLCK);
- return -1;
- }
-
- printf("entry offset=[0x%08x], rec.rec_len = [0x%08x (%d)] (end = 0x%08x)\n",
- rec_ptr, rec.rec_len, rec.rec_len, rec_ptr + rec.rec_len);
- total_free += rec.rec_len;
-
- /* move to the next record */
- rec_ptr = rec.next;
- }
- printf("total rec_len = [0x%08x (%d)]\n", (int)total_free,
- (int)total_free);
-
- return tdb_unlock(tdb, -1, F_WRLCK);
-}
-
diff --git a/source3/lib/tdb/common/error.c b/source3/lib/tdb/common/error.c
deleted file mode 100644
index 195ab23815..0000000000
--- a/source3/lib/tdb/common/error.c
+++ /dev/null
@@ -1,57 +0,0 @@
- /*
- Unix SMB/CIFS implementation.
-
- trivial database library
-
- Copyright (C) Andrew Tridgell 1999-2005
- Copyright (C) Paul `Rusty' Russell 2000
- Copyright (C) Jeremy Allison 2000-2003
-
- ** NOTE! The following LGPL license applies to the tdb
- ** 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/>.
-*/
-
-#include "tdb_private.h"
-
-enum TDB_ERROR tdb_error(struct tdb_context *tdb)
-{
- return tdb->ecode;
-}
-
-static struct tdb_errname {
- enum TDB_ERROR ecode; const char *estring;
-} emap[] = { {TDB_SUCCESS, "Success"},
- {TDB_ERR_CORRUPT, "Corrupt database"},
- {TDB_ERR_IO, "IO Error"},
- {TDB_ERR_LOCK, "Locking error"},
- {TDB_ERR_OOM, "Out of memory"},
- {TDB_ERR_EXISTS, "Record exists"},
- {TDB_ERR_NOLOCK, "Lock exists on other keys"},
- {TDB_ERR_EINVAL, "Invalid parameter"},
- {TDB_ERR_NOEXIST, "Record does not exist"},
- {TDB_ERR_RDONLY, "write not permitted"} };
-
-/* Error string for the last tdb error */
-const char *tdb_errorstr(struct tdb_context *tdb)
-{
- uint32_t i;
- for (i = 0; i < sizeof(emap) / sizeof(struct tdb_errname); i++)
- if (tdb->ecode == emap[i].ecode)
- return emap[i].estring;
- return "Invalid error code";
-}
-
diff --git a/source3/lib/tdb/common/freelist.c b/source3/lib/tdb/common/freelist.c
deleted file mode 100644
index 2f2a4c379b..0000000000
--- a/source3/lib/tdb/common/freelist.c
+++ /dev/null
@@ -1,382 +0,0 @@
- /*
- Unix SMB/CIFS implementation.
-
- trivial database library
-
- Copyright (C) Andrew Tridgell 1999-2005
- Copyright (C) Paul `Rusty' Russell 2000
- Copyright (C) Jeremy Allison 2000-2003
-
- ** NOTE! The following LGPL license applies to the tdb
- ** 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/>.
-*/
-
-#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)
-{
- if (tdb->methods->tdb_read(tdb, off, rec, sizeof(*rec),DOCONV()) == -1)
- return -1;
-
- if (rec->magic == TDB_MAGIC) {
- /* this happens when a app is showdown while deleting a record - we should
- not completely fail when this happens */
- TDB_LOG((tdb, TDB_DEBUG_WARNING, "tdb_rec_free_read non-free magic 0x%x at offset=%d - fixing\n",
- rec->magic, off));
- rec->magic = TDB_FREE_MAGIC;
- if (tdb->methods->tdb_write(tdb, off, rec, sizeof(*rec)) == -1)
- return -1;
- }
-
- if (rec->magic != TDB_FREE_MAGIC) {
- /* Ensure ecode is set for log fn. */
- tdb->ecode = TDB_ERR_CORRUPT;
- TDB_LOG((tdb, TDB_DEBUG_WARNING, "tdb_rec_free_read bad magic 0x%x at offset=%d\n",
- rec->magic, off));
- return TDB_ERRCODE(TDB_ERR_CORRUPT, -1);
- }
- if (tdb->methods->tdb_oob(tdb, rec->next+sizeof(*rec), 0) != 0)
- return -1;
- return 0;
-}
-
-
-#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)
-{
- tdb_off_t last_ptr, i;
-
- /* read in the freelist top */
- last_ptr = FREELIST_TOP;
- while (tdb_ofs_read(tdb, last_ptr, &i) != -1 && i != 0) {
- if (i == off) {
- /* We've found it! */
- return tdb_ofs_write(tdb, last_ptr, &next);
- }
- /* Follow chain (next offset is at start of record) */
- last_ptr = i;
- }
- 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) */
-static int update_tailer(struct tdb_context *tdb, tdb_off_t offset,
- const struct list_struct *rec)
-{
- tdb_off_t totalsize;
-
- /* Offset of tailer from record header */
- totalsize = sizeof(*rec) + rec->rec_len;
- return tdb_ofs_write(tdb, offset + totalsize - sizeof(tdb_off_t),
- &totalsize);
-}
-
-/* Add an element into the freelist. Merge adjacent records if
- neccessary. */
-int tdb_free(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec)
-{
- /* Allocation and tailer lock */
- if (tdb_lock(tdb, -1, F_WRLCK) != 0)
- return -1;
-
- /* set an initial tailer, so if we fail we don't leave a bogus record */
- if (update_tailer(tdb, offset, rec) != 0) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: update_tailer failed!\n"));
- goto fail;
- }
-
-#if USE_RIGHT_MERGES
- /* Look right first (I'm an Australian, dammit) */
- 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) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: right read failed at %u\n", right));
- goto left;
- }
-
- /* If it's free, expand to include it. */
- if (r.magic == TDB_FREE_MAGIC) {
- if (remove_from_freelist(tdb, right, r.next) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: right free failed at %u\n", right));
- 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 */
- 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;
-
- /* Read in tailer and jump back to header */
- if (tdb_ofs_read(tdb, left, &leftsize) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free: left offset read failed at %u\n", left));
- goto update;
- }
-
- /* it could be uninitialised data */
- if (leftsize == 0 || leftsize == TDB_PAD_U32) {
- goto update;
- }
-
- left = offset - leftsize;
-
- 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;
- }
-
- /* If it's free, expand to include it. */
- if (l.magic == TDB_FREE_MAGIC) {
- /* 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:
-
- /* Now, prepend to free list */
- rec->magic = TDB_FREE_MAGIC;
-
- if (tdb_ofs_read(tdb, FREELIST_TOP, &rec->next) == -1 ||
- tdb_rec_write(tdb, offset, rec) == -1 ||
- tdb_ofs_write(tdb, FREELIST_TOP, &offset) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_free record write failed at offset=%d\n", offset));
- goto fail;
- }
-
- /* And we're done. */
- tdb_unlock(tdb, -1, F_WRLCK);
- return 0;
-
- fail:
- tdb_unlock(tdb, -1, F_WRLCK);
- return -1;
-}
-
-
-
-/*
- 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)
-{
-#define MIN_REC_SIZE (sizeof(struct list_struct) + sizeof(tdb_off_t) + 8)
-
- if (rec->rec_len < length + MIN_REC_SIZE) {
- /* we have to grab the whole record */
-
- /* 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;
- }
- if (update_tailer(tdb, rec_ptr, rec) == -1) {
- return 0;
- }
-
- /* 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;
- }
-
- if (update_tailer(tdb, rec_ptr, rec) == -1) {
- return 0;
- }
-
- return rec_ptr;
-}
-
-/* allocate some space from the free list. The offset returned points
- to a unconnected list_struct within the database with room for at
- least length bytes of total data
-
- 0 is returned if the space could not be allocated
- */
-tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct list_struct *rec)
-{
- tdb_off_t rec_ptr, last_ptr, newrec_ptr;
- struct {
- 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;
-
- /* read in the freelist top */
- if (tdb_ofs_read(tdb, FREELIST_TOP, &rec_ptr) == -1)
- goto fail;
-
- bestfit.rec_ptr = 0;
- bestfit.last_ptr = 0;
- bestfit.rec_len = 0;
-
- /*
- this is a best fit allocation strategy. Originally we used
- a first fit strategy, but it suffered from massive fragmentation
- issues when faced with a slowly increasing record size.
- */
- while (rec_ptr) {
- if (tdb_rec_free_read(tdb, rec_ptr, rec) == -1) {
- goto fail;
- }
-
- if (rec->rec_len >= length) {
- if (bestfit.rec_ptr == 0 ||
- rec->rec_len < bestfit.rec_len) {
- bestfit.rec_len = rec->rec_len;
- bestfit.rec_ptr = rec_ptr;
- bestfit.last_ptr = last_ptr;
- }
- }
-
- /* 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) {
- if (tdb_rec_free_read(tdb, bestfit.rec_ptr, rec) == -1) {
- goto fail;
- }
-
- newrec_ptr = tdb_allocate_ofs(tdb, length, bestfit.rec_ptr,
- rec, bestfit.last_ptr);
- tdb_unlock(tdb, -1, F_WRLCK);
- return newrec_ptr;
- }
-
- /* we didn't find enough space. See if we can expand the
- database and if we can then try again */
- if (tdb_expand(tdb, length + sizeof(*rec)) == 0)
- goto again;
- fail:
- tdb_unlock(tdb, -1, F_WRLCK);
- 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;
-}
diff --git a/source3/lib/tdb/common/freelistcheck.c b/source3/lib/tdb/common/freelistcheck.c
deleted file mode 100644
index efc050df9c..0000000000
--- a/source3/lib/tdb/common/freelistcheck.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- trivial database library
-
- Copyright (C) Jeremy Allison 2006
-
- ** NOTE! The following LGPL license applies to the tdb
- ** 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/>.
-*/
-
-#include "tdb_private.h"
-
-/* Check the freelist is good and contains no loops.
- Very memory intensive - only do this as a consistency
- checker. Heh heh - uses an in memory tdb as the storage
- for the "seen" record list. For some reason this strikes
- me as extremely clever as I don't have to write another tree
- data structure implementation :-).
- */
-
-static int seen_insert(struct tdb_context *mem_tdb, tdb_off_t rec_ptr)
-{
- TDB_DATA key, data;
-
- memset(&data, '\0', sizeof(data));
- key.dptr = (unsigned char *)&rec_ptr;
- key.dsize = sizeof(rec_ptr);
- return tdb_store(mem_tdb, key, data, TDB_INSERT);
-}
-
-int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries)
-{
- struct tdb_context *mem_tdb = NULL;
- struct list_struct rec;
- tdb_off_t rec_ptr, last_ptr;
- int ret = -1;
-
- *pnum_entries = 0;
-
- mem_tdb = tdb_open("flval", tdb->header.hash_size,
- TDB_INTERNAL, O_RDWR, 0600);
- if (!mem_tdb) {
- return -1;
- }
-
- if (tdb_lock(tdb, -1, F_WRLCK) == -1) {
- tdb_close(mem_tdb);
- return 0;
- }
-
- last_ptr = FREELIST_TOP;
-
- /* Store the FREELIST_TOP record. */
- if (seen_insert(mem_tdb, last_ptr) == -1) {
- ret = TDB_ERRCODE(TDB_ERR_CORRUPT, -1);
- goto fail;
- }
-
- /* read in the freelist top */
- if (tdb_ofs_read(tdb, FREELIST_TOP, &rec_ptr) == -1) {
- goto fail;
- }
-
- while (rec_ptr) {
-
- /* If we can't store this record (we've seen it
- before) then the free list has a loop and must
- be corrupt. */
-
- if (seen_insert(mem_tdb, rec_ptr)) {
- ret = TDB_ERRCODE(TDB_ERR_CORRUPT, -1);
- goto fail;
- }
-
- if (tdb_rec_free_read(tdb, rec_ptr, &rec) == -1) {
- goto fail;
- }
-
- /* move to the next record */
- last_ptr = rec_ptr;
- rec_ptr = rec.next;
- *pnum_entries += 1;
- }
-
- ret = 0;
-
- fail:
-
- tdb_close(mem_tdb);
- tdb_unlock(tdb, -1, F_WRLCK);
- return ret;
-}
diff --git a/source3/lib/tdb/common/io.c b/source3/lib/tdb/common/io.c
deleted file mode 100644
index 661f761489..0000000000
--- a/source3/lib/tdb/common/io.c
+++ /dev/null
@@ -1,473 +0,0 @@
- /*
- Unix SMB/CIFS implementation.
-
- trivial database library
-
- Copyright (C) Andrew Tridgell 1999-2005
- Copyright (C) Paul `Rusty' Russell 2000
- Copyright (C) Jeremy Allison 2000-2003
-
- ** NOTE! The following LGPL license applies to the tdb
- ** 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/>.
-*/
-
-
-#include "tdb_private.h"
-
-/* check for an out of bounds access - if it is out of bounds then
- see if the database has been expanded by someone else and expand
- if necessary
- note that "len" is the minimum length needed for the db
-*/
-static int tdb_oob(struct tdb_context *tdb, tdb_off_t len, int probe)
-{
- struct stat st;
- if (len <= tdb->map_size)
- return 0;
- if (tdb->flags & TDB_INTERNAL) {
- if (!probe) {
- /* Ensure ecode is set for log fn. */
- tdb->ecode = TDB_ERR_IO;
- TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_oob len %d beyond internal malloc size %d\n",
- (int)len, (int)tdb->map_size));
- }
- return TDB_ERRCODE(TDB_ERR_IO, -1);
- }
-
- if (fstat(tdb->fd, &st) == -1) {
- return TDB_ERRCODE(TDB_ERR_IO, -1);
- }
-
- if (st.st_size < (size_t)len) {
- if (!probe) {
- /* Ensure ecode is set for log fn. */
- tdb->ecode = TDB_ERR_IO;
- TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_oob len %d beyond eof at %d\n",
- (int)len, (int)st.st_size));
- }
- return TDB_ERRCODE(TDB_ERR_IO, -1);
- }
-
- /* Unmap, update size, remap */
- if (tdb_munmap(tdb) == -1)
- return TDB_ERRCODE(TDB_ERR_IO, -1);
- tdb->map_size = st.st_size;
- tdb_mmap(tdb);
- return 0;
-}
-
-/* write a lump of data at a specified offset */
-static int tdb_write(struct tdb_context *tdb, tdb_off_t off,
- const void *buf, tdb_len_t len)
-{
- if (len == 0) {
- return 0;
- }
-
- if (tdb->read_only || tdb->traverse_read) {
- tdb->ecode = TDB_ERR_RDONLY;
- return -1;
- }
-
- if (tdb->methods->tdb_oob(tdb, off + len, 0) != 0)
- return -1;
-
- if (tdb->map_ptr) {
- memcpy(off + (char *)tdb->map_ptr, buf, len);
- } else {
- ssize_t written = pwrite(tdb->fd, buf, len, off);
- if ((written != (ssize_t)len) && (written != -1)) {
- /* try once more */
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_write: wrote only "
- "%d of %d bytes at %d, trying once more\n",
- (int)written, len, off));
- errno = ENOSPC;
- written = pwrite(tdb->fd, (const void *)((const char *)buf+written),
- len-written,
- off+written);
- }
- if (written == -1) {
- /* 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);
- } else if (written != (ssize_t)len) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_write: failed to "
- "write %d bytes at %d in two attempts\n",
- len, off));
- errno = ENOSPC;
- return TDB_ERRCODE(TDB_ERR_IO, -1);
- }
- }
- return 0;
-}
-
-/* Endian conversion: we only ever deal with 4 byte quantities */
-void *tdb_convert(void *buf, uint32_t size)
-{
- uint32_t i, *p = (uint32_t *)buf;
- for (i = 0; i < size / 4; i++)
- p[i] = TDB_BYTEREV(p[i]);
- return buf;
-}
-
-
-/* read a lump of data at a specified offset, maybe convert */
-static int tdb_read(struct tdb_context *tdb, tdb_off_t off, void *buf,
- tdb_len_t len, int cv)
-{
- if (tdb->methods->tdb_oob(tdb, off + len, 0) != 0) {
- return -1;
- }
-
- if (tdb->map_ptr) {
- memcpy(buf, off + (char *)tdb->map_ptr, len);
- } else {
- ssize_t ret = pread(tdb->fd, buf, len, off);
- if (ret != (ssize_t)len) {
- /* Ensure ecode is set for log fn. */
- tdb->ecode = TDB_ERR_IO;
- TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_read failed at %d "
- "len=%d ret=%d (%s) map_size=%d\n",
- (int)off, (int)len, (int)ret, strerror(errno),
- (int)tdb->map_size));
- return TDB_ERRCODE(TDB_ERR_IO, -1);
- }
- }
- if (cv) {
- tdb_convert(buf, len);
- }
- return 0;
-}
-
-
-
-/*
- do an unlocked scan of the hash table heads to find the next non-zero head. The value
- will then be confirmed with the lock held
-*/
-static void tdb_next_hash_chain(struct tdb_context *tdb, uint32_t *chain)
-{
- uint32_t h = *chain;
- if (tdb->map_ptr) {
- for (;h < tdb->header.hash_size;h++) {
- if (0 != *(uint32_t *)(TDB_HASH_TOP(h) + (unsigned char *)tdb->map_ptr)) {
- break;
- }
- }
- } else {
- uint32_t off=0;
- for (;h < tdb->header.hash_size;h++) {
- if (tdb_ofs_read(tdb, TDB_HASH_TOP(h), &off) != 0 || off != 0) {
- break;
- }
- }
- }
- (*chain) = h;
-}
-
-
-int tdb_munmap(struct tdb_context *tdb)
-{
- if (tdb->flags & TDB_INTERNAL)
- return 0;
-
-#ifdef HAVE_MMAP
- if (tdb->map_ptr) {
- int ret;
-
- ret = munmap(tdb->map_ptr, tdb->map_size);
- if (ret != 0)
- return ret;
- }
-#endif
- tdb->map_ptr = NULL;
- return 0;
-}
-
-void tdb_mmap(struct tdb_context *tdb)
-{
- if (tdb->flags & TDB_INTERNAL)
- return;
-
-#ifdef HAVE_MMAP
- if (!(tdb->flags & TDB_NOMMAP)) {
- tdb->map_ptr = mmap(NULL, tdb->map_size,
- PROT_READ|(tdb->read_only? 0:PROT_WRITE),
- MAP_SHARED|MAP_FILE, tdb->fd, 0);
-
- /*
- * NB. When mmap fails it returns MAP_FAILED *NOT* NULL !!!!
- */
-
- if (tdb->map_ptr == MAP_FAILED) {
- tdb->map_ptr = NULL;
- TDB_LOG((tdb, TDB_DEBUG_WARNING, "tdb_mmap failed for size %d (%s)\n",
- tdb->map_size, strerror(errno)));
- }
- } else {
- tdb->map_ptr = NULL;
- }
-#else
- tdb->map_ptr = NULL;
-#endif
-}
-
-/* expand a file. we prefer to use ftruncate, as that is what posix
- 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[8192];
-
- if (tdb->read_only || tdb->traverse_read) {
- tdb->ecode = TDB_ERR_RDONLY;
- return -1;
- }
-
- if (ftruncate(tdb->fd, size+addition) == -1) {
- char b = 0;
- ssize_t written = pwrite(tdb->fd, &b, 1, (size+addition) - 1);
- if (written == 0) {
- /* try once more, potentially revealing errno */
- written = pwrite(tdb->fd, &b, 1, (size+addition) - 1);
- }
- if (written == 0) {
- /* again - give up, guessing errno */
- errno = ENOSPC;
- }
- if (written != 1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "expand_file to %d failed (%s)\n",
- size+addition, strerror(errno)));
- return -1;
- }
- }
-
- /* now fill the file with something. This ensures that the
- file isn't sparse, which would be very bad if we ran out of
- disk. This must be done with write, not via mmap */
- memset(buf, TDB_PAD_BYTE, sizeof(buf));
- while (addition) {
- size_t n = addition>sizeof(buf)?sizeof(buf):addition;
- ssize_t written = pwrite(tdb->fd, buf, n, size);
- if (written == 0) {
- /* prevent infinite loops: try _once_ more */
- written = pwrite(tdb->fd, buf, n, size);
- }
- if (written == 0) {
- /* give up, trying to provide a useful errno */
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "expand_file write "
- "returned 0 twice: giving up!\n"));
- errno = ENOSPC;
- return -1;
- } else if (written == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "expand_file write of "
- "%d bytes failed (%s)\n", (int)n,
- strerror(errno)));
- return -1;
- } else if (written != n) {
- TDB_LOG((tdb, TDB_DEBUG_WARNING, "expand_file: wrote "
- "only %d of %d bytes - retrying\n", (int)written,
- (int)n));
- }
- addition -= written;
- size += written;
- }
- return 0;
-}
-
-
-/* expand the database at least size bytes by expanding the underlying
- file and doing the mmap again if necessary */
-int tdb_expand(struct tdb_context *tdb, tdb_off_t size)
-{
- struct list_struct rec;
- 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"));
- return -1;
- }
-
- /* 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 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);
-
- /*
- * We must ensure the file is unmapped before doing this
- * to ensure consistency with systems like OpenBSD where
- * writes and mmaps are not consistent.
- */
-
- /* expand the file itself */
- if (!(tdb->flags & TDB_INTERNAL)) {
- if (tdb->methods->tdb_expand_file(tdb, tdb->map_size, size) != 0)
- goto fail;
- }
-
- tdb->map_size += size;
-
- if (tdb->flags & TDB_INTERNAL) {
- char *new_map_ptr = (char *)realloc(tdb->map_ptr,
- tdb->map_size);
- if (!new_map_ptr) {
- tdb->map_size -= size;
- goto fail;
- }
- tdb->map_ptr = new_map_ptr;
- } else {
- /*
- * We must ensure the file is remapped before adding the space
- * to ensure consistency with systems like OpenBSD where
- * writes and mmaps are not consistent.
- */
-
- /* We're ok if the mmap fails as we'll fallback to read/write */
- tdb_mmap(tdb);
- }
-
- /* form a new freelist record */
- memset(&rec,'\0',sizeof(rec));
- rec.rec_len = size - sizeof(rec);
-
- /* link it into the free list */
- offset = tdb->map_size - size;
- if (tdb_free(tdb, offset, &rec) == -1)
- goto fail;
-
- tdb_unlock(tdb, -1, F_WRLCK);
- return 0;
- fail:
- tdb_unlock(tdb, -1, F_WRLCK);
- return -1;
-}
-
-/* read/write a tdb_off_t */
-int tdb_ofs_read(struct tdb_context *tdb, tdb_off_t offset, tdb_off_t *d)
-{
- return tdb->methods->tdb_read(tdb, offset, (char*)d, sizeof(*d), DOCONV());
-}
-
-int tdb_ofs_write(struct tdb_context *tdb, tdb_off_t offset, tdb_off_t *d)
-{
- tdb_off_t off = *d;
- return tdb->methods->tdb_write(tdb, offset, CONVERT(off), sizeof(*d));
-}
-
-
-/* read a lump of data, allocating the space for it */
-unsigned char *tdb_alloc_read(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t len)
-{
- unsigned char *buf;
-
- /* some systems don't like zero length malloc */
- if (len == 0) {
- len = 1;
- }
-
- if (!(buf = (unsigned char *)malloc(len))) {
- /* Ensure ecode is set for log fn. */
- tdb->ecode = TDB_ERR_OOM;
- TDB_LOG((tdb, TDB_DEBUG_ERROR,"tdb_alloc_read malloc failed len=%d (%s)\n",
- len, strerror(errno)));
- return TDB_ERRCODE(TDB_ERR_OOM, buf);
- }
- if (tdb->methods->tdb_read(tdb, offset, buf, len, 0) == -1) {
- SAFE_FREE(buf);
- return NULL;
- }
- return buf;
-}
-
-/* Give a piece of tdb data to a parser */
-
-int tdb_parse_data(struct tdb_context *tdb, TDB_DATA key,
- tdb_off_t offset, tdb_len_t len,
- int (*parser)(TDB_DATA key, TDB_DATA data,
- void *private_data),
- void *private_data)
-{
- TDB_DATA data;
- int result;
-
- data.dsize = len;
-
- if ((tdb->transaction == NULL) && (tdb->map_ptr != NULL)) {
- /*
- * Optimize by avoiding the malloc/memcpy/free, point the
- * parser directly at the mmap area.
- */
- if (tdb->methods->tdb_oob(tdb, offset+len, 0) != 0) {
- return -1;
- }
- data.dptr = offset + (unsigned char *)tdb->map_ptr;
- return parser(key, data, private_data);
- }
-
- if (!(data.dptr = tdb_alloc_read(tdb, offset, len))) {
- return -1;
- }
-
- result = parser(key, data, private_data);
- free(data.dptr);
- return result;
-}
-
-/* read/write a record */
-int tdb_rec_read(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec)
-{
- if (tdb->methods->tdb_read(tdb, offset, rec, sizeof(*rec),DOCONV()) == -1)
- return -1;
- if (TDB_BAD_MAGIC(rec)) {
- /* Ensure ecode is set for log fn. */
- tdb->ecode = TDB_ERR_CORRUPT;
- TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_rec_read bad magic 0x%x at offset=%d\n", rec->magic, offset));
- return TDB_ERRCODE(TDB_ERR_CORRUPT, -1);
- }
- return tdb->methods->tdb_oob(tdb, rec->next+sizeof(*rec), 0);
-}
-
-int tdb_rec_write(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec)
-{
- struct list_struct r = *rec;
- return tdb->methods->tdb_write(tdb, offset, CONVERT(r), sizeof(r));
-}
-
-static const struct tdb_methods io_methods = {
- tdb_read,
- tdb_write,
- tdb_next_hash_chain,
- tdb_oob,
- tdb_expand_file,
- tdb_brlock
-};
-
-/*
- initialise the default methods table
-*/
-void tdb_io_init(struct tdb_context *tdb)
-{
- tdb->methods = &io_methods;
-}
diff --git a/source3/lib/tdb/common/lock.c b/source3/lib/tdb/common/lock.c
deleted file mode 100644
index f156c0fa7b..0000000000
--- a/source3/lib/tdb/common/lock.c
+++ /dev/null
@@ -1,553 +0,0 @@
- /*
- Unix SMB/CIFS implementation.
-
- trivial database library
-
- Copyright (C) Andrew Tridgell 1999-2005
- Copyright (C) Paul `Rusty' Russell 2000
- Copyright (C) Jeremy Allison 2000-2003
-
- ** NOTE! The following LGPL license applies to the tdb
- ** 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/>.
-*/
-
-#include "tdb_private.h"
-
-#define TDB_MARK_LOCK 0x80000000
-
-void tdb_setalarm_sigptr(struct tdb_context *tdb, volatile sig_atomic_t *ptr)
-{
- tdb->interrupt_sig_ptr = ptr;
-}
-
-/* a byte range locking function - return 0 on success
- this functions locks/unlocks 1 byte at the specified offset.
-
- On error, errno is also set so that errors are passed back properly
- through tdb_open().
-
- note that a len of zero means lock to end of file
-*/
-int tdb_brlock(struct tdb_context *tdb, tdb_off_t offset,
- int rw_type, int lck_type, int probe, size_t len)
-{
- struct flock fl;
- int ret;
-
- if (tdb->flags & TDB_NOLOCK) {
- return 0;
- }
-
- if ((rw_type == F_WRLCK) && (tdb->read_only || tdb->traverse_read)) {
- tdb->ecode = TDB_ERR_RDONLY;
- return -1;
- }
-
- fl.l_type = rw_type;
- fl.l_whence = SEEK_SET;
- fl.l_start = offset;
- fl.l_len = len;
- fl.l_pid = 0;
-
- do {
- ret = fcntl(tdb->fd,lck_type,&fl);
-
- /* Check for a sigalarm break. */
- if (ret == -1 && errno == EINTR &&
- tdb->interrupt_sig_ptr &&
- *tdb->interrupt_sig_ptr) {
- break;
- }
- } while (ret == -1 && errno == EINTR);
-
- if (ret == -1) {
- /* Generic lock error. errno set by fcntl.
- * EAGAIN is an expected return from non-blocking
- * locks. */
- if (!probe && lck_type != F_SETLK) {
- /* Ensure error code is set for log fun to examine. */
- tdb->ecode = TDB_ERR_LOCK;
- TDB_LOG((tdb, TDB_DEBUG_TRACE,"tdb_brlock failed (fd=%d) at offset %d rw_type=%d lck_type=%d len=%d\n",
- tdb->fd, offset, rw_type, lck_type, (int)len));
- }
- return TDB_ERRCODE(TDB_ERR_LOCK, -1);
- }
- return 0;
-}
-
-
-/*
- upgrade a read lock to a write lock. This needs to be handled in a
- special way as some OSes (such as solaris) have too conservative
- deadlock detection and claim a deadlock when progress can be
- made. For those OSes we may loop for a while.
-*/
-int tdb_brlock_upgrade(struct tdb_context *tdb, tdb_off_t offset, size_t len)
-{
- int count = 1000;
- while (count--) {
- struct timeval tv;
- if (tdb_brlock(tdb, offset, F_WRLCK, F_SETLKW, 1, len) == 0) {
- return 0;
- }
- if (errno != EDEADLK) {
- break;
- }
- /* sleep for as short a time as we can - more portable than usleep() */
- tv.tv_sec = 0;
- tv.tv_usec = 1;
- select(0, NULL, NULL, NULL, &tv);
- }
- TDB_LOG((tdb, TDB_DEBUG_TRACE,"tdb_brlock_upgrade failed at offset %d\n", offset));
- return -1;
-}
-
-
-/* lock a list in the database. list -1 is the alloc list */
-static int _tdb_lock(struct tdb_context *tdb, int list, int ltype, int op)
-{
- struct tdb_lock_type *new_lck;
- int i;
- bool mark_lock = ((ltype & TDB_MARK_LOCK) == TDB_MARK_LOCK);
-
- ltype &= ~TDB_MARK_LOCK;
-
- /* a global lock allows us to avoid per chain locks */
- if (tdb->global_lock.count &&
- (ltype == tdb->global_lock.ltype || ltype == F_RDLCK)) {
- return 0;
- }
-
- if (tdb->global_lock.count) {
- return TDB_ERRCODE(TDB_ERR_LOCK, -1);
- }
-
- if (list < -1 || list >= (int)tdb->header.hash_size) {
- TDB_LOG((tdb, TDB_DEBUG_ERROR,"tdb_lock: invalid list %d for ltype=%d\n",
- list, ltype));
- return -1;
- }
- if (tdb->flags & TDB_NOLOCK)
- return 0;
-
- for (i=0; i<tdb->num_lockrecs; i++) {
- if (tdb->lockrecs[i].list == list) {
- if (tdb->lockrecs[i].count == 0) {
- /*
- * Can't happen, see tdb_unlock(). It should
- * be an assert.
- */
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_lock: "
- "lck->count == 0 for list %d", list));
- }
- /*
- * Just increment the in-memory struct, posix locks
- * don't stack.
- */
- tdb->lockrecs[i].count++;
- return 0;
- }
- }
-
- new_lck = (struct tdb_lock_type *)realloc(
- tdb->lockrecs,
- sizeof(*tdb->lockrecs) * (tdb->num_lockrecs+1));
- if (new_lck == NULL) {
- errno = ENOMEM;
- return -1;
- }
- tdb->lockrecs = new_lck;
-
- /* Since fcntl locks don't nest, we do a lock for the first one,
- and simply bump the count for future ones */
- if (!mark_lock &&
- tdb->methods->tdb_brlock(tdb,FREELIST_TOP+4*list, ltype, op,
- 0, 1)) {
- return -1;
- }
-
- tdb->num_locks++;
-
- tdb->lockrecs[tdb->num_lockrecs].list = list;
- tdb->lockrecs[tdb->num_lockrecs].count = 1;
- tdb->lockrecs[tdb->num_lockrecs].ltype = ltype;
- tdb->num_lockrecs += 1;
-
- return 0;
-}
-
-/* lock a list in the database. list -1 is the alloc list */
-int tdb_lock(struct tdb_context *tdb, int list, int ltype)
-{
- int ret;
- ret = _tdb_lock(tdb, list, ltype, F_SETLKW);
- if (ret) {
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_lock failed on list %d "
- "ltype=%d (%s)\n", list, ltype, strerror(errno)));
- }
- return ret;
-}
-
-/* lock a list in the database. list -1 is the alloc list. non-blocking lock */
-int tdb_lock_nonblock(struct tdb_context *tdb, int list, int ltype)
-{
- return _tdb_lock(tdb, list, ltype, F_SETLK);
-}
-
-
-/* unlock the database: returns void because it's too late for errors. */
- /* changed to return int it may be interesting to know there
- has been an error --simo */
-int tdb_unlock(struct tdb_context *tdb, int list, int ltype)
-{
- int ret = -1;
- int i;
- struct tdb_lock_type *lck = NULL;
- bool mark_lock = ((ltype & TDB_MARK_LOCK) == TDB_MARK_LOCK);
-
- ltype &= ~TDB_MARK_LOCK;
-
- /* a global lock allows us to avoid per chain locks */
- if (tdb->global_lock.count &&
- (ltype == tdb->global_lock.ltype || ltype == F_RDLCK)) {
- return 0;
- }
-
- if (tdb->global_lock.count) {
- return TDB_ERRCODE(TDB_ERR_LOCK, -1);
- }
-
- if (tdb->flags & TDB_NOLOCK)
- return 0;
-
- /* Sanity checks */
- if (list < -1 || list >= (int)tdb->header.hash_size) {
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_unlock: list %d invalid (%d)\n", list, tdb->header.hash_size));
- return ret;
- }
-
- for (i=0; i<tdb->num_lockrecs; i++) {
- if (tdb->lockrecs[i].list == list) {
- lck = &tdb->lockrecs[i];
- break;
- }
- }
-
- if ((lck == NULL) || (lck->count == 0)) {
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_unlock: count is 0\n"));
- return -1;
- }
-
- if (lck->count > 1) {
- lck->count--;
- return 0;
- }
-
- /*
- * This lock has count==1 left, so we need to unlock it in the
- * kernel. We don't bother with decrementing the in-memory array
- * element, we're about to overwrite it with the last array element
- * anyway.
- */
-
- if (mark_lock) {
- ret = 0;
- } else {
- ret = tdb->methods->tdb_brlock(tdb, FREELIST_TOP+4*list, F_UNLCK,
- F_SETLKW, 0, 1);
- }
- tdb->num_locks--;
-
- /*
- * Shrink the array by overwriting the element just unlocked with the
- * last array element.
- */
-
- if (tdb->num_lockrecs > 1) {
- *lck = tdb->lockrecs[tdb->num_lockrecs-1];
- }
- tdb->num_lockrecs -= 1;
-
- /*
- * We don't bother with realloc when the array shrinks, but if we have
- * a completely idle tdb we should get rid of the locked array.
- */
-
- if (tdb->num_lockrecs == 0) {
- SAFE_FREE(tdb->lockrecs);
- }
-
- if (ret)
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_unlock: An error occurred unlocking!\n"));
- return ret;
-}
-
-/*
- get the transaction lock
- */
-int tdb_transaction_lock(struct tdb_context *tdb, int ltype)
-{
- if (tdb->have_transaction_lock || tdb->global_lock.count) {
- return 0;
- }
- if (tdb->methods->tdb_brlock(tdb, TRANSACTION_LOCK, ltype,
- F_SETLKW, 0, 1) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_lock: failed to get transaction lock\n"));
- tdb->ecode = TDB_ERR_LOCK;
- return -1;
- }
- tdb->have_transaction_lock = 1;
- return 0;
-}
-
-/*
- release the transaction lock
- */
-int tdb_transaction_unlock(struct tdb_context *tdb)
-{
- int ret;
- if (!tdb->have_transaction_lock) {
- return 0;
- }
- ret = tdb->methods->tdb_brlock(tdb, TRANSACTION_LOCK, F_UNLCK, F_SETLKW, 0, 1);
- if (ret == 0) {
- tdb->have_transaction_lock = 0;
- }
- return ret;
-}
-
-
-
-
-/* lock/unlock entire database */
-static int _tdb_lockall(struct tdb_context *tdb, int ltype, int op)
-{
- bool mark_lock = ((ltype & TDB_MARK_LOCK) == TDB_MARK_LOCK);
-
- ltype &= ~TDB_MARK_LOCK;
-
- /* There are no locks on read-only dbs */
- if (tdb->read_only || tdb->traverse_read)
- return TDB_ERRCODE(TDB_ERR_LOCK, -1);
-
- if (tdb->global_lock.count && tdb->global_lock.ltype == ltype) {
- tdb->global_lock.count++;
- return 0;
- }
-
- if (tdb->global_lock.count) {
- /* a global lock of a different type exists */
- return TDB_ERRCODE(TDB_ERR_LOCK, -1);
- }
-
- if (tdb->num_locks != 0) {
- /* can't combine global and chain locks */
- return TDB_ERRCODE(TDB_ERR_LOCK, -1);
- }
-
- if (!mark_lock &&
- tdb->methods->tdb_brlock(tdb, FREELIST_TOP, ltype, op,
- 0, 4*tdb->header.hash_size)) {
- if (op == F_SETLKW) {
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_lockall failed (%s)\n", strerror(errno)));
- }
- return -1;
- }
-
- tdb->global_lock.count = 1;
- tdb->global_lock.ltype = ltype;
-
- return 0;
-}
-
-
-
-/* unlock entire db */
-static int _tdb_unlockall(struct tdb_context *tdb, int ltype)
-{
- bool mark_lock = ((ltype & TDB_MARK_LOCK) == TDB_MARK_LOCK);
-
- ltype &= ~TDB_MARK_LOCK;
-
- /* There are no locks on read-only dbs */
- if (tdb->read_only || tdb->traverse_read) {
- return TDB_ERRCODE(TDB_ERR_LOCK, -1);
- }
-
- if (tdb->global_lock.ltype != ltype || tdb->global_lock.count == 0) {
- return TDB_ERRCODE(TDB_ERR_LOCK, -1);
- }
-
- if (tdb->global_lock.count > 1) {
- tdb->global_lock.count--;
- return 0;
- }
-
- if (!mark_lock &&
- tdb->methods->tdb_brlock(tdb, FREELIST_TOP, F_UNLCK, F_SETLKW,
- 0, 4*tdb->header.hash_size)) {
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_unlockall failed (%s)\n", strerror(errno)));
- return -1;
- }
-
- tdb->global_lock.count = 0;
- tdb->global_lock.ltype = 0;
-
- return 0;
-}
-
-/* lock entire database with write lock */
-int tdb_lockall(struct tdb_context *tdb)
-{
- return _tdb_lockall(tdb, F_WRLCK, F_SETLKW);
-}
-
-/* lock entire database with write lock - mark only */
-int tdb_lockall_mark(struct tdb_context *tdb)
-{
- return _tdb_lockall(tdb, F_WRLCK | TDB_MARK_LOCK, F_SETLKW);
-}
-
-/* unlock entire database with write lock - unmark only */
-int tdb_lockall_unmark(struct tdb_context *tdb)
-{
- return _tdb_unlockall(tdb, F_WRLCK | TDB_MARK_LOCK);
-}
-
-/* lock entire database with write lock - nonblocking varient */
-int tdb_lockall_nonblock(struct tdb_context *tdb)
-{
- return _tdb_lockall(tdb, F_WRLCK, F_SETLK);
-}
-
-/* unlock entire database with write lock */
-int tdb_unlockall(struct tdb_context *tdb)
-{
- return _tdb_unlockall(tdb, F_WRLCK);
-}
-
-/* lock entire database with read lock */
-int tdb_lockall_read(struct tdb_context *tdb)
-{
- return _tdb_lockall(tdb, F_RDLCK, F_SETLKW);
-}
-
-/* lock entire database with read lock - nonblock varient */
-int tdb_lockall_read_nonblock(struct tdb_context *tdb)
-{
- return _tdb_lockall(tdb, F_RDLCK, F_SETLK);
-}
-
-/* unlock entire database with read lock */
-int tdb_unlockall_read(struct tdb_context *tdb)
-{
- return _tdb_unlockall(tdb, F_RDLCK);
-}
-
-/* lock/unlock one hash chain. This is meant to be used to reduce
- contention - it cannot guarantee how many records will be locked */
-int tdb_chainlock(struct tdb_context *tdb, TDB_DATA key)
-{
- return tdb_lock(tdb, BUCKET(tdb->hash_fn(&key)), F_WRLCK);
-}
-
-/* lock/unlock one hash chain, non-blocking. This is meant to be used
- to reduce contention - it cannot guarantee how many records will be
- locked */
-int tdb_chainlock_nonblock(struct tdb_context *tdb, TDB_DATA key)
-{
- return tdb_lock_nonblock(tdb, BUCKET(tdb->hash_fn(&key)), F_WRLCK);
-}
-
-/* mark a chain as locked without actually locking it. Warning! use with great caution! */
-int tdb_chainlock_mark(struct tdb_context *tdb, TDB_DATA key)
-{
- return tdb_lock(tdb, BUCKET(tdb->hash_fn(&key)), F_WRLCK | TDB_MARK_LOCK);
-}
-
-/* unmark a chain as locked without actually locking it. Warning! use with great caution! */
-int tdb_chainlock_unmark(struct tdb_context *tdb, TDB_DATA key)
-{
- return tdb_unlock(tdb, BUCKET(tdb->hash_fn(&key)), F_WRLCK | TDB_MARK_LOCK);
-}
-
-int tdb_chainunlock(struct tdb_context *tdb, TDB_DATA key)
-{
- return tdb_unlock(tdb, BUCKET(tdb->hash_fn(&key)), F_WRLCK);
-}
-
-int tdb_chainlock_read(struct tdb_context *tdb, TDB_DATA key)
-{
- return tdb_lock(tdb, BUCKET(tdb->hash_fn(&key)), F_RDLCK);
-}
-
-int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key)
-{
- return tdb_unlock(tdb, BUCKET(tdb->hash_fn(&key)), F_RDLCK);
-}
-
-
-
-/* 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;
-}
-
-/*
- Write locks override our own fcntl readlocks, so check it here.
- Note this is meant to be F_SETLK, *not* F_SETLKW, as it's not
- an error to fail to get the lock here.
-*/
-int tdb_write_lock_record(struct tdb_context *tdb, tdb_off_t off)
-{
- struct tdb_traverse_lock *i;
- for (i = &tdb->travlocks; i; i = i->next)
- if (i->off == off)
- return -1;
- return tdb->methods->tdb_brlock(tdb, off, F_WRLCK, F_SETLK, 1, 1);
-}
-
-/*
- Note this is meant to be F_SETLK, *not* F_SETLKW, as it's not
- an error to fail to get the lock here.
-*/
-int tdb_write_unlock_record(struct tdb_context *tdb, tdb_off_t off)
-{
- return tdb->methods->tdb_brlock(tdb, off, F_UNLCK, F_SETLK, 0, 1);
-}
-
-/* fcntl locks don't stack: avoid unlocking someone else's */
-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)
- if (i->off == off)
- count++;
- return (count == 1 ? tdb->methods->tdb_brlock(tdb, off, F_UNLCK, F_SETLKW, 0, 1) : 0);
-}
diff --git a/source3/lib/tdb/common/open.c b/source3/lib/tdb/common/open.c
deleted file mode 100644
index b19e4cea29..0000000000
--- a/source3/lib/tdb/common/open.c
+++ /dev/null
@@ -1,488 +0,0 @@
- /*
- Unix SMB/CIFS implementation.
-
- trivial database library
-
- Copyright (C) Andrew Tridgell 1999-2005
- Copyright (C) Paul `Rusty' Russell 2000
- Copyright (C) Jeremy Allison 2000-2003
-
- ** NOTE! The following LGPL license applies to the tdb
- ** 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/>.
-*/
-
-#include "tdb_private.h"
-
-/* all contexts, to ensure no double-opens (fcntl locks don't nest!) */
-static struct tdb_context *tdbs = NULL;
-
-
-/* This is based on the hash algorithm from gdbm */
-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. */
-
- /* Set the initial value from the key size. */
- for (value = 0x238F13AF * key->dsize, i=0; i < key->dsize; i++)
- value = (value + (key->dptr[i] << (i*5 % 24)));
-
- return (1103515243 * value + 12345);
-}
-
-
-/* initialise a new database with a specified hash size */
-static int tdb_new_database(struct tdb_context *tdb, int hash_size)
-{
- struct tdb_header *newdb;
- size_t size;
- int ret = -1;
- ssize_t written;
-
- /* We make it up in memory, then write it out if not internal */
- size = sizeof(struct tdb_header) + (hash_size+1)*sizeof(tdb_off_t);
- if (!(newdb = (struct tdb_header *)calloc(size, 1)))
- return TDB_ERRCODE(TDB_ERR_OOM, -1);
-
- /* Fill in the header */
- newdb->version = TDB_VERSION;
- newdb->hash_size = hash_size;
- if (tdb->flags & TDB_INTERNAL) {
- tdb->map_size = size;
- tdb->map_ptr = (char *)newdb;
- memcpy(&tdb->header, newdb, sizeof(tdb->header));
- /* Convert the `ondisk' version if asked. */
- CONVERT(*newdb);
- return 0;
- }
- if (lseek(tdb->fd, 0, SEEK_SET) == -1)
- goto fail;
-
- if (ftruncate(tdb->fd, 0) == -1)
- goto fail;
-
- /* This creates an endian-converted header, as if read from disk */
- CONVERT(*newdb);
- memcpy(&tdb->header, newdb, sizeof(tdb->header));
- /* Don't endian-convert the magic food! */
- memcpy(newdb->magic_food, TDB_MAGIC_FOOD, strlen(TDB_MAGIC_FOOD)+1);
- /* we still have "ret == -1" here */
- written = write(tdb->fd, newdb, size);
- if (written == size) {
- ret = 0;
- } else if (written != -1) {
- /* call write once again, this usually should return -1 and
- * set errno appropriately */
- size -= written;
- written = write(tdb->fd, newdb+written, size);
- if (written == size) {
- ret = 0;
- } else if (written >= 0) {
- /* a second incomplete write - we give up.
- * guessing the errno... */
- errno = ENOSPC;
- }
- }
-
- fail:
- SAFE_FREE(newdb);
- return ret;
-}
-
-
-
-static int tdb_already_open(dev_t device,
- ino_t ino)
-{
- struct tdb_context *i;
-
- for (i = tdbs; i; i = i->next) {
- if (i->device == device && i->inode == ino) {
- return 1;
- }
- }
-
- return 0;
-}
-
-/* open the database, creating it if necessary
-
- The open_flags and mode are passed straight to the open call on the
- database file. A flags value of O_WRONLY is invalid. The hash size
- is advisory, use zero for a default value.
-
- Return is NULL on error, in which case errno is also set. Don't
- try to call tdb_error or tdb_errname, just do strerror(errno).
-
- @param name may be NULL for internal databases. */
-struct tdb_context *tdb_open(const char *name, int hash_size, int tdb_flags,
- int open_flags, mode_t mode)
-{
- return tdb_open_ex(name, hash_size, tdb_flags, open_flags, mode, NULL, NULL);
-}
-
-/* a default logging function */
-static void null_log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const char *fmt, ...) PRINTF_ATTRIBUTE(3, 4);
-static void null_log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const char *fmt, ...)
-{
-}
-
-
-struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
- int open_flags, mode_t mode,
- const struct tdb_logging_context *log_ctx,
- tdb_hash_func hash_fn)
-{
- struct tdb_context *tdb;
- struct stat st;
- 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 */
- errno = ENOMEM;
- goto fail;
- }
- tdb_io_init(tdb);
- tdb->fd = -1;
- tdb->name = NULL;
- tdb->map_ptr = NULL;
- tdb->flags = tdb_flags;
- tdb->open_flags = open_flags;
- if (log_ctx) {
- tdb->log = *log_ctx;
- } else {
- tdb->log.log_fn = null_log_fn;
- tdb->log.log_private = NULL;
- }
- tdb->hash_fn = hash_fn ? hash_fn : default_tdb_hash;
-
- /* cache the page size */
- tdb->page_size = getpagesize();
- if (tdb->page_size <= 0) {
- tdb->page_size = 0x2000;
- }
-
- 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",
- name));
- errno = EINVAL;
- goto fail;
- }
-
- if (hash_size == 0)
- hash_size = DEFAULT_HASH_SIZE;
- if ((open_flags & O_ACCMODE) == O_RDONLY) {
- tdb->read_only = 1;
- /* read only databases don't do locking or clear if first */
- tdb->flags |= TDB_NOLOCK;
- tdb->flags &= ~TDB_CLEAR_IF_FIRST;
- }
-
- /* internal databases don't mmap or lock, and start off cleared */
- if (tdb->flags & TDB_INTERNAL) {
- tdb->flags |= (TDB_NOLOCK | TDB_NOMMAP);
- tdb->flags &= ~TDB_CLEAR_IF_FIRST;
- if (tdb_new_database(tdb, hash_size) != 0) {
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: tdb_new_database failed!"));
- goto fail;
- }
- goto internal;
- }
-
- if ((tdb->fd = open(name, open_flags, mode)) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_WARNING, "tdb_open_ex: could not open file %s: %s\n",
- name, strerror(errno)));
- 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",
- name, strerror(errno)));
- goto fail; /* errno set by tdb_brlock */
- }
-
- /* 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) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: "
- "failed to truncate %s: %s\n",
- name, strerror(errno)));
- goto fail; /* errno set by ftruncate */
- }
- }
-
- errno = 0;
- if (read(tdb->fd, &tdb->header, sizeof(tdb->header)) != sizeof(tdb->header)
- || strcmp(tdb->header.magic_food, TDB_MAGIC_FOOD) != 0
- || (tdb->header.version != TDB_VERSION
- && !(rev = (tdb->header.version==TDB_BYTEREV(TDB_VERSION))))) {
- /* 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 */
- }
- goto fail;
- }
- rev = (tdb->flags & TDB_CONVERT);
- }
- vp = (unsigned char *)&tdb->header.version;
- vertest = (((uint32_t)vp[0]) << 24) | (((uint32_t)vp[1]) << 16) |
- (((uint32_t)vp[2]) << 8) | (uint32_t)vp[3];
- tdb->flags |= (vertest==TDB_VERSION) ? TDB_BIGENDIAN : 0;
- if (!rev)
- tdb->flags &= ~TDB_CONVERT;
- else {
- tdb->flags |= TDB_CONVERT;
- tdb_convert(&tdb->header, sizeof(tdb->header));
- }
- if (fstat(tdb->fd, &st) == -1)
- goto fail;
-
- if (tdb->header.rwlocks != 0) {
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: spinlocks no longer supported\n"));
- goto fail;
- }
-
- /* Is it already in the open list? If so, fail. */
- if (tdb_already_open(st.st_dev, st.st_ino)) {
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: "
- "%s (%d,%d) is already open in this process\n",
- name, (int)st.st_dev, (int)st.st_ino));
- errno = EBUSY;
- goto fail;
- }
-
- if (!(tdb->name = (char *)strdup(name))) {
- errno = ENOMEM;
- goto fail;
- }
-
- tdb->map_size = st.st_size;
- tdb->device = st.st_dev;
- tdb->inode = st.st_ino;
- tdb_mmap(tdb);
- if (locked) {
- if (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_UNLCK, F_SETLK, 0, 1) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: "
- "failed to take ACTIVE_LOCK on %s: %s\n",
- name, strerror(errno)));
- goto fail;
- }
-
- }
-
- /* We always need to do this if the CLEAR_IF_FIRST flag is set, even if
- we didn't get the initial exclusive lock as we need to let all other
- users know we're using it. */
-
- if (tdb_flags & TDB_CLEAR_IF_FIRST) {
- /* leave this lock in place to indicate it's in use */
- if (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_RDLCK, F_SETLKW, 0, 1) == -1)
- goto fail;
- }
-
- /* if needed, run recovery */
- if (tdb_transaction_recover(tdb) == -1) {
- goto fail;
- }
-
- internal:
- /* Internal (memory-only) databases skip all the code above to
- * do with disk files, and resume here by releasing their
- * global lock and hooking into the active list. */
- if (tdb->methods->tdb_brlock(tdb, GLOBAL_LOCK, F_UNLCK, F_SETLKW, 0, 1) == -1)
- goto fail;
- tdb->next = tdbs;
- tdbs = tdb;
- return tdb;
-
- fail:
- { int save_errno = errno;
-
- if (!tdb)
- return NULL;
-
- if (tdb->map_ptr) {
- if (tdb->flags & TDB_INTERNAL)
- SAFE_FREE(tdb->map_ptr);
- else
- tdb_munmap(tdb);
- }
- SAFE_FREE(tdb->name);
- if (tdb->fd != -1)
- if (close(tdb->fd) != 0)
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: failed to close tdb->fd on error!\n"));
- SAFE_FREE(tdb);
- errno = save_errno;
- return NULL;
- }
-}
-
-/*
- * Set the maximum number of dead records per hash chain
- */
-
-void tdb_set_max_dead(struct tdb_context *tdb, int max_dead)
-{
- tdb->max_dead_records = max_dead;
-}
-
-/**
- * Close a database.
- *
- * @returns -1 for error; 0 for success.
- **/
-int tdb_close(struct tdb_context *tdb)
-{
- struct tdb_context **i;
- int ret = 0;
-
- if (tdb->transaction) {
- tdb_transaction_cancel(tdb);
- }
-
- if (tdb->map_ptr) {
- if (tdb->flags & TDB_INTERNAL)
- SAFE_FREE(tdb->map_ptr);
- else
- tdb_munmap(tdb);
- }
- SAFE_FREE(tdb->name);
- if (tdb->fd != -1)
- ret = close(tdb->fd);
- SAFE_FREE(tdb->lockrecs);
-
- /* Remove from contexts list */
- for (i = &tdbs; *i; i = &(*i)->next) {
- if (*i == tdb) {
- *i = tdb->next;
- break;
- }
- }
-
- memset(tdb, 0, sizeof(*tdb));
- SAFE_FREE(tdb);
-
- return ret;
-}
-
-/* register a loging function */
-void tdb_set_logging_function(struct tdb_context *tdb,
- const struct tdb_logging_context *log_ctx)
-{
- tdb->log = *log_ctx;
-}
-
-void *tdb_get_logging_private(struct tdb_context *tdb)
-{
- return tdb->log.log_private;
-}
-
-/* reopen a tdb - this can be used after a fork to ensure that we have an independent
- seek pointer from our parent and to re-establish locks */
-int tdb_reopen(struct tdb_context *tdb)
-{
- struct stat st;
-
- if (tdb->flags & TDB_INTERNAL) {
- return 0; /* Nothing to do. */
- }
-
- if (tdb->num_locks != 0 || tdb->global_lock.count) {
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_reopen: reopen not allowed with locks held\n"));
- goto fail;
- }
-
- if (tdb->transaction != 0) {
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_reopen: reopen not allowed inside a transaction\n"));
- goto fail;
- }
-
- if (tdb_munmap(tdb) != 0) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_reopen: munmap failed (%s)\n", strerror(errno)));
- goto fail;
- }
- if (close(tdb->fd) != 0)
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_reopen: WARNING closing tdb->fd failed!\n"));
- tdb->fd = open(tdb->name, tdb->open_flags & ~(O_CREAT|O_TRUNC), 0);
- if (tdb->fd == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_reopen: open failed (%s)\n", strerror(errno)));
- goto fail;
- }
- if ((tdb->flags & TDB_CLEAR_IF_FIRST) &&
- (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_RDLCK, F_SETLKW, 0, 1) == -1)) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_reopen: failed to obtain active lock\n"));
- goto fail;
- }
- if (fstat(tdb->fd, &st) != 0) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_reopen: fstat failed (%s)\n", strerror(errno)));
- goto fail;
- }
- if (st.st_ino != tdb->inode || st.st_dev != tdb->device) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_reopen: file dev/inode has changed!\n"));
- goto fail;
- }
- tdb_mmap(tdb);
-
- return 0;
-
-fail:
- tdb_close(tdb);
- return -1;
-}
-
-/* reopen all tdb's */
-int tdb_reopen_all(int parent_longlived)
-{
- struct tdb_context *tdb;
-
- for (tdb=tdbs; tdb; tdb = tdb->next) {
- /*
- * If the parent is longlived (ie. a
- * parent daemon architecture), we know
- * it will keep it's active lock on a
- * tdb opened with CLEAR_IF_FIRST. Thus
- * for child processes we don't have to
- * add an active lock. This is essential
- * to improve performance on systems that
- * keep POSIX locks as a non-scalable data
- * structure in the kernel.
- */
- if (parent_longlived) {
- /* Ensure no clear-if-first. */
- tdb->flags &= ~TDB_CLEAR_IF_FIRST;
- }
-
- if (tdb_reopen(tdb) != 0)
- return -1;
- }
-
- return 0;
-}
diff --git a/source3/lib/tdb/common/tdb.c b/source3/lib/tdb/common/tdb.c
deleted file mode 100644
index c7cec297f6..0000000000
--- a/source3/lib/tdb/common/tdb.c
+++ /dev/null
@@ -1,802 +0,0 @@
- /*
- Unix SMB/CIFS implementation.
-
- trivial database library
-
- Copyright (C) Andrew Tridgell 1999-2005
- Copyright (C) Paul `Rusty' Russell 2000
- Copyright (C) Jeremy Allison 2000-2003
-
- ** NOTE! The following LGPL license applies to the tdb
- ** 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/>.
-*/
-
-#include "tdb_private.h"
-
-TDB_DATA tdb_null;
-
-/*
- non-blocking increment of the tdb sequence number if the tdb has been opened using
- the TDB_SEQNUM flag
-*/
-void tdb_increment_seqnum_nonblock(struct tdb_context *tdb)
-{
- tdb_off_t seqnum=0;
-
- if (!(tdb->flags & TDB_SEQNUM)) {
- return;
- }
-
- /* we ignore errors from this, as we have no sane way of
- dealing with them.
- */
- tdb_ofs_read(tdb, TDB_SEQNUM_OFS, &seqnum);
- seqnum++;
- tdb_ofs_write(tdb, TDB_SEQNUM_OFS, &seqnum);
-}
-
-/*
- increment the tdb sequence number if the tdb has been opened using
- the TDB_SEQNUM flag
-*/
-static void tdb_increment_seqnum(struct tdb_context *tdb)
-{
- if (!(tdb->flags & TDB_SEQNUM)) {
- return;
- }
-
- if (tdb_brlock(tdb, TDB_SEQNUM_OFS, F_WRLCK, F_SETLKW, 1, 1) != 0) {
- return;
- }
-
- tdb_increment_seqnum_nonblock(tdb);
-
- tdb_brlock(tdb, TDB_SEQNUM_OFS, F_UNLCK, F_SETLKW, 1, 1);
-}
-
-static int tdb_key_compare(TDB_DATA key, TDB_DATA data, void *private_data)
-{
- return memcmp(data.dptr, key.dptr, data.dsize);
-}
-
-/* Returns 0 on fail. On success, return offset of record, and fills
- in rec */
-static tdb_off_t tdb_find(struct tdb_context *tdb, TDB_DATA key, uint32_t hash,
- struct list_struct *r)
-{
- tdb_off_t rec_ptr;
-
- /* read in the hash top */
- if (tdb_ofs_read(tdb, TDB_HASH_TOP(hash), &rec_ptr) == -1)
- return 0;
-
- /* keep looking until we find the right record */
- while (rec_ptr) {
- if (tdb_rec_read(tdb, rec_ptr, r) == -1)
- return 0;
-
- if (!TDB_DEAD(r) && hash==r->full_hash
- && key.dsize==r->key_len
- && tdb_parse_data(tdb, key, rec_ptr + sizeof(*r),
- r->key_len, tdb_key_compare,
- NULL) == 0) {
- return rec_ptr;
- }
- rec_ptr = r->next;
- }
- return TDB_ERRCODE(TDB_ERR_NOEXIST, 0);
-}
-
-/* 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,
- struct list_struct *rec)
-{
- uint32_t rec_ptr;
-
- if (tdb_lock(tdb, BUCKET(hash), locktype) == -1)
- return 0;
- if (!(rec_ptr = tdb_find(tdb, key, hash, rec)))
- tdb_unlock(tdb, BUCKET(hash), locktype);
- return rec_ptr;
-}
-
-
-/* update an entry in place - this only works if the new data size
- is <= the old data size and the key exists.
- on failure return -1.
-*/
-static int tdb_update_hash(struct tdb_context *tdb, TDB_DATA key, uint32_t hash, TDB_DATA dbuf)
-{
- struct list_struct rec;
- tdb_off_t rec_ptr;
-
- /* find entry */
- if (!(rec_ptr = tdb_find(tdb, key, hash, &rec)))
- return -1;
-
- /* must be long enough key, data and tailer */
- if (rec.rec_len < key.dsize + dbuf.dsize + sizeof(tdb_off_t)) {
- tdb->ecode = TDB_SUCCESS; /* Not really an error */
- return -1;
- }
-
- if (tdb->methods->tdb_write(tdb, rec_ptr + sizeof(rec) + rec.key_len,
- dbuf.dptr, dbuf.dsize) == -1)
- return -1;
-
- if (dbuf.dsize != rec.data_len) {
- /* update size */
- rec.data_len = dbuf.dsize;
- return tdb_rec_write(tdb, rec_ptr, &rec);
- }
-
- return 0;
-}
-
-/* find an entry in the database given a key */
-/* If an entry doesn't exist tdb_err will be set to
- * TDB_ERR_NOEXIST. If a key has no data attached
- * then the TDB_DATA will have zero length but
- * a non-zero pointer
- */
-TDB_DATA tdb_fetch(struct tdb_context *tdb, TDB_DATA key)
-{
- tdb_off_t rec_ptr;
- struct list_struct rec;
- TDB_DATA ret;
- uint32_t hash;
-
- /* find which hash bucket it is in */
- hash = tdb->hash_fn(&key);
- if (!(rec_ptr = tdb_find_lock_hash(tdb,key,hash,F_RDLCK,&rec)))
- return tdb_null;
-
- ret.dptr = tdb_alloc_read(tdb, rec_ptr + sizeof(rec) + rec.key_len,
- rec.data_len);
- ret.dsize = rec.data_len;
- tdb_unlock(tdb, BUCKET(rec.full_hash), F_RDLCK);
- return ret;
-}
-
-/*
- * Find an entry in the database and hand the record's data to a parsing
- * function. The parsing function is executed under the chain read lock, so it
- * should be fast and should not block on other syscalls.
- *
- * DONT CALL OTHER TDB CALLS FROM THE PARSER, THIS MIGHT LEAD TO SEGFAULTS.
- *
- * For mmapped tdb's that do not have a transaction open it points the parsing
- * function directly at the mmap area, it avoids the malloc/memcpy in this
- * case. If a transaction is open or no mmap is available, it has to do
- * malloc/read/parse/free.
- *
- * This is interesting for all readers of potentially large data structures in
- * the tdb records, ldb indexes being one example.
- */
-
-int tdb_parse_record(struct tdb_context *tdb, TDB_DATA key,
- int (*parser)(TDB_DATA key, TDB_DATA data,
- void *private_data),
- void *private_data)
-{
- tdb_off_t rec_ptr;
- struct list_struct rec;
- int ret;
- uint32_t hash;
-
- /* find which hash bucket it is in */
- hash = tdb->hash_fn(&key);
-
- if (!(rec_ptr = tdb_find_lock_hash(tdb,key,hash,F_RDLCK,&rec))) {
- return TDB_ERRCODE(TDB_ERR_NOEXIST, 0);
- }
-
- ret = tdb_parse_data(tdb, key, rec_ptr + sizeof(rec) + rec.key_len,
- rec.data_len, parser, private_data);
-
- tdb_unlock(tdb, BUCKET(rec.full_hash), F_RDLCK);
-
- return ret;
-}
-
-/* check if an entry in the database exists
-
- note that 1 is returned if the key is found and 0 is returned if not found
- this doesn't match the conventions in the rest of this module, but is
- compatible with gdbm
-*/
-static int tdb_exists_hash(struct tdb_context *tdb, TDB_DATA key, uint32_t hash)
-{
- struct list_struct rec;
-
- if (tdb_find_lock_hash(tdb, key, hash, F_RDLCK, &rec) == 0)
- return 0;
- tdb_unlock(tdb, BUCKET(rec.full_hash), F_RDLCK);
- return 1;
-}
-
-int tdb_exists(struct tdb_context *tdb, TDB_DATA key)
-{
- uint32_t hash = tdb->hash_fn(&key);
- return tdb_exists_hash(tdb, key, hash);
-}
-
-/* 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)
-{
- tdb_off_t last_ptr, i;
- struct list_struct lastrec;
-
- if (tdb->read_only || tdb->traverse_read) return -1;
-
- if (((tdb->traverse_write != 0) && (!TDB_DEAD(rec))) ||
- 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);
- }
- if (tdb_write_unlock_record(tdb, rec_ptr) != 0)
- return -1;
-
- /* find previous record in hash chain */
- if (tdb_ofs_read(tdb, TDB_HASH_TOP(rec->full_hash), &i) == -1)
- return -1;
- for (last_ptr = 0; i != rec_ptr; last_ptr = i, i = lastrec.next)
- if (tdb_rec_read(tdb, i, &lastrec) == -1)
- return -1;
-
- /* unlink it: next ptr is at start of record. */
- if (last_ptr == 0)
- last_ptr = TDB_HASH_TOP(rec->full_hash);
- if (tdb_ofs_write(tdb, last_ptr, &rec->next) == -1)
- return -1;
-
- /* recover the space */
- if (tdb_free(tdb, rec_ptr, rec) == -1)
- return -1;
- return 0;
-}
-
-static int tdb_count_dead(struct tdb_context *tdb, uint32_t hash)
-{
- int res = 0;
- tdb_off_t rec_ptr;
- struct list_struct rec;
-
- /* read in the hash top */
- if (tdb_ofs_read(tdb, TDB_HASH_TOP(hash), &rec_ptr) == -1)
- return 0;
-
- while (rec_ptr) {
- if (tdb_rec_read(tdb, rec_ptr, &rec) == -1)
- return 0;
-
- if (rec.magic == TDB_DEAD_MAGIC) {
- res += 1;
- }
- rec_ptr = rec.next;
- }
- return res;
-}
-
-/*
- * Purge all DEAD records from a hash chain
- */
-static int tdb_purge_dead(struct tdb_context *tdb, uint32_t hash)
-{
- int res = -1;
- struct list_struct rec;
- tdb_off_t rec_ptr;
-
- if (tdb_lock(tdb, -1, F_WRLCK) == -1) {
- return -1;
- }
-
- /* read in the hash top */
- if (tdb_ofs_read(tdb, TDB_HASH_TOP(hash), &rec_ptr) == -1)
- goto fail;
-
- while (rec_ptr) {
- tdb_off_t next;
-
- if (tdb_rec_read(tdb, rec_ptr, &rec) == -1) {
- goto fail;
- }
-
- next = rec.next;
-
- if (rec.magic == TDB_DEAD_MAGIC
- && tdb_do_delete(tdb, rec_ptr, &rec) == -1) {
- goto fail;
- }
- rec_ptr = next;
- }
- res = 0;
- fail:
- tdb_unlock(tdb, -1, F_WRLCK);
- return res;
-}
-
-/* delete an entry in the database given a key */
-static int tdb_delete_hash(struct tdb_context *tdb, TDB_DATA key, uint32_t hash)
-{
- tdb_off_t rec_ptr;
- struct list_struct rec;
- int ret;
-
- if (tdb->max_dead_records != 0) {
-
- /*
- * Allow for some dead records per hash chain, mainly for
- * tdb's with a very high create/delete rate like locking.tdb.
- */
-
- if (tdb_lock(tdb, BUCKET(hash), F_WRLCK) == -1)
- return -1;
-
- if (tdb_count_dead(tdb, hash) >= tdb->max_dead_records) {
- /*
- * Don't let the per-chain freelist grow too large,
- * delete all existing dead records
- */
- tdb_purge_dead(tdb, hash);
- }
-
- if (!(rec_ptr = tdb_find(tdb, key, hash, &rec))) {
- tdb_unlock(tdb, BUCKET(hash), F_WRLCK);
- return -1;
- }
-
- /*
- * Just mark the record as dead.
- */
- rec.magic = TDB_DEAD_MAGIC;
- ret = tdb_rec_write(tdb, rec_ptr, &rec);
- }
- else {
- if (!(rec_ptr = tdb_find_lock_hash(tdb, key, hash, F_WRLCK,
- &rec)))
- return -1;
-
- ret = tdb_do_delete(tdb, rec_ptr, &rec);
- }
-
- if (ret == 0) {
- tdb_increment_seqnum(tdb);
- }
-
- if (tdb_unlock(tdb, BUCKET(rec.full_hash), F_WRLCK) != 0)
- TDB_LOG((tdb, TDB_DEBUG_WARNING, "tdb_delete: WARNING tdb_unlock failed!\n"));
- return ret;
-}
-
-int tdb_delete(struct tdb_context *tdb, TDB_DATA key)
-{
- uint32_t hash = tdb->hash_fn(&key);
- return tdb_delete_hash(tdb, key, hash);
-}
-
-/*
- * See if we have a dead record around with enough space
- */
-static tdb_off_t tdb_find_dead(struct tdb_context *tdb, uint32_t hash,
- struct list_struct *r, tdb_len_t length)
-{
- tdb_off_t rec_ptr;
-
- /* read in the hash top */
- if (tdb_ofs_read(tdb, TDB_HASH_TOP(hash), &rec_ptr) == -1)
- return 0;
-
- /* keep looking until we find the right record */
- while (rec_ptr) {
- if (tdb_rec_read(tdb, rec_ptr, r) == -1)
- return 0;
-
- if (TDB_DEAD(r) && r->rec_len >= length) {
- /*
- * First fit for simple coding, TODO: change to best
- * fit
- */
- return rec_ptr;
- }
- rec_ptr = r->next;
- }
- return 0;
-}
-
-/* store an element in the database, replacing any existing element
- with the same key
-
- return 0 on success, -1 on failure
-*/
-int tdb_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag)
-{
- struct list_struct rec;
- uint32_t hash;
- tdb_off_t rec_ptr;
- char *p = NULL;
- int ret = -1;
-
- if (tdb->read_only || tdb->traverse_read) {
- tdb->ecode = TDB_ERR_RDONLY;
- return -1;
- }
-
- /* find which hash bucket it is in */
- hash = tdb->hash_fn(&key);
- if (tdb_lock(tdb, BUCKET(hash), F_WRLCK) == -1)
- return -1;
-
- /* check for it existing, on insert. */
- if (flag == TDB_INSERT) {
- if (tdb_exists_hash(tdb, key, hash)) {
- tdb->ecode = TDB_ERR_EXISTS;
- goto fail;
- }
- } else {
- /* first try in-place update, on modify or replace. */
- if (tdb_update_hash(tdb, key, hash, dbuf) == 0) {
- goto done;
- }
- if (tdb->ecode == TDB_ERR_NOEXIST &&
- flag == TDB_MODIFY) {
- /* if the record doesn't exist and we are in TDB_MODIFY mode then
- we should fail the store */
- goto fail;
- }
- }
- /* reset the error code potentially set by the tdb_update() */
- tdb->ecode = TDB_SUCCESS;
-
- /* delete any existing record - if it doesn't exist we don't
- care. Doing this first reduces fragmentation, and avoids
- coalescing with `allocated' block before it's updated. */
- if (flag != TDB_INSERT)
- tdb_delete_hash(tdb, key, hash);
-
- /* Copy key+value *before* allocating free space in case malloc
- fails and we are left with a dead spot in the tdb. */
-
- if (!(p = (char *)malloc(key.dsize + dbuf.dsize))) {
- tdb->ecode = TDB_ERR_OOM;
- goto fail;
- }
-
- memcpy(p, key.dptr, key.dsize);
- if (dbuf.dsize)
- memcpy(p+key.dsize, dbuf.dptr, dbuf.dsize);
-
- if (tdb->max_dead_records != 0) {
- /*
- * Allow for some dead records per hash chain, look if we can
- * find one that can hold the new record. We need enough space
- * for key, data and tailer. If we find one, we don't have to
- * consult the central freelist.
- */
- rec_ptr = tdb_find_dead(
- tdb, hash, &rec,
- key.dsize + dbuf.dsize + sizeof(tdb_off_t));
-
- if (rec_ptr != 0) {
- rec.key_len = key.dsize;
- rec.data_len = dbuf.dsize;
- rec.full_hash = hash;
- rec.magic = TDB_MAGIC;
- if (tdb_rec_write(tdb, rec_ptr, &rec) == -1
- || tdb->methods->tdb_write(
- tdb, rec_ptr + sizeof(rec),
- p, key.dsize + dbuf.dsize) == -1) {
- goto fail;
- }
- goto done;
- }
- }
-
- /*
- * We have to allocate some space from the freelist, so this means we
- * have to lock it. Use the chance to purge all the DEAD records from
- * the hash chain under the freelist lock.
- */
-
- if (tdb_lock(tdb, -1, F_WRLCK) == -1) {
- goto fail;
- }
-
- if ((tdb->max_dead_records != 0)
- && (tdb_purge_dead(tdb, hash) == -1)) {
- tdb_unlock(tdb, -1, F_WRLCK);
- goto fail;
- }
-
- /* we have to allocate some space */
- rec_ptr = tdb_allocate(tdb, key.dsize + dbuf.dsize, &rec);
-
- tdb_unlock(tdb, -1, F_WRLCK);
-
- if (rec_ptr == 0) {
- goto fail;
- }
-
- /* Read hash top into next ptr */
- if (tdb_ofs_read(tdb, TDB_HASH_TOP(hash), &rec.next) == -1)
- goto fail;
-
- rec.key_len = key.dsize;
- rec.data_len = dbuf.dsize;
- rec.full_hash = hash;
- rec.magic = TDB_MAGIC;
-
- /* write out and point the top of the hash chain at it */
- if (tdb_rec_write(tdb, rec_ptr, &rec) == -1
- || tdb->methods->tdb_write(tdb, rec_ptr+sizeof(rec), p, key.dsize+dbuf.dsize)==-1
- || tdb_ofs_write(tdb, TDB_HASH_TOP(hash), &rec_ptr) == -1) {
- /* Need to tdb_unallocate() here */
- goto fail;
- }
-
- done:
- ret = 0;
- fail:
- if (ret == 0) {
- tdb_increment_seqnum(tdb);
- }
-
- SAFE_FREE(p);
- tdb_unlock(tdb, BUCKET(hash), F_WRLCK);
- return ret;
-}
-
-
-/* Append to an entry. Create if not exist. */
-int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf)
-{
- uint32_t hash;
- TDB_DATA dbuf;
- int ret = -1;
-
- /* find which hash bucket it is in */
- hash = tdb->hash_fn(&key);
- if (tdb_lock(tdb, BUCKET(hash), F_WRLCK) == -1)
- return -1;
-
- dbuf = tdb_fetch(tdb, key);
-
- if (dbuf.dptr == NULL) {
- dbuf.dptr = (unsigned char *)malloc(new_dbuf.dsize);
- } else {
- unsigned char *new_dptr = (unsigned char *)realloc(dbuf.dptr,
- dbuf.dsize + new_dbuf.dsize);
- if (new_dptr == NULL) {
- free(dbuf.dptr);
- }
- dbuf.dptr = new_dptr;
- }
-
- if (dbuf.dptr == NULL) {
- tdb->ecode = TDB_ERR_OOM;
- goto failed;
- }
-
- memcpy(dbuf.dptr + dbuf.dsize, new_dbuf.dptr, new_dbuf.dsize);
- dbuf.dsize += new_dbuf.dsize;
-
- ret = tdb_store(tdb, key, dbuf, 0);
-
-failed:
- tdb_unlock(tdb, BUCKET(hash), F_WRLCK);
- SAFE_FREE(dbuf.dptr);
- return ret;
-}
-
-
-/*
- return the name of the current tdb file
- useful for external logging functions
-*/
-const char *tdb_name(struct tdb_context *tdb)
-{
- return tdb->name;
-}
-
-/*
- return the underlying file descriptor being used by tdb, or -1
- useful for external routines that want to check the device/inode
- of the fd
-*/
-int tdb_fd(struct tdb_context *tdb)
-{
- return tdb->fd;
-}
-
-/*
- return the current logging function
- useful for external tdb routines that wish to log tdb errors
-*/
-tdb_log_func tdb_log_fn(struct tdb_context *tdb)
-{
- return tdb->log.log_fn;
-}
-
-
-/*
- get the tdb sequence number. Only makes sense if the writers opened
- with TDB_SEQNUM set. Note that this sequence number will wrap quite
- quickly, so it should only be used for a 'has something changed'
- test, not for code that relies on the count of the number of changes
- made. If you want a counter then use a tdb record.
-
- The aim of this sequence number is to allow for a very lightweight
- test of a possible tdb change.
-*/
-int tdb_get_seqnum(struct tdb_context *tdb)
-{
- tdb_off_t seqnum=0;
-
- tdb_ofs_read(tdb, TDB_SEQNUM_OFS, &seqnum);
- return seqnum;
-}
-
-int tdb_hash_size(struct tdb_context *tdb)
-{
- return tdb->header.hash_size;
-}
-
-size_t tdb_map_size(struct tdb_context *tdb)
-{
- return tdb->map_size;
-}
-
-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
-*/
-void tdb_enable_seqnum(struct tdb_context *tdb)
-{
- tdb->flags |= TDB_SEQNUM;
-}
-
-
-/*
- add a region of the file to the freelist. Length is the size of the region in bytes,
- which includes the free list header that needs to be added
- */
-static int tdb_free_region(struct tdb_context *tdb, tdb_off_t offset, ssize_t length)
-{
- struct list_struct rec;
- if (length <= sizeof(rec)) {
- /* the region is not worth adding */
- return 0;
- }
- if (length + offset > tdb->map_size) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_free_region: adding region beyond end of file\n"));
- return -1;
- }
- memset(&rec,'\0',sizeof(rec));
- rec.rec_len = length - sizeof(rec);
- if (tdb_free(tdb, offset, &rec) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_free_region: failed to add free record\n"));
- return -1;
- }
- return 0;
-}
-
-/*
- 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.
-
- This code carefully steps around the recovery area, leaving it alone
- */
-int tdb_wipe_all(struct tdb_context *tdb)
-{
- int i;
- tdb_off_t offset = 0;
- ssize_t data_len;
- tdb_off_t recovery_head;
- tdb_len_t recovery_size = 0;
-
- if (tdb_lockall(tdb) != 0) {
- return -1;
- }
-
- /* see if the tdb has a recovery area, and remember its size
- if so. We don't want to lose this as otherwise each
- tdb_wipe_all() in a transaction will increase the size of
- the tdb by the size of the recovery area */
- if (tdb_ofs_read(tdb, TDB_RECOVERY_HEAD, &recovery_head) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_wipe_all: failed to read recovery head\n"));
- goto failed;
- }
-
- if (recovery_head != 0) {
- struct list_struct rec;
- if (tdb->methods->tdb_read(tdb, recovery_head, &rec, sizeof(rec), DOCONV()) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_wipe_all: failed to read recovery record\n"));
- return -1;
- }
- recovery_size = rec.rec_len + sizeof(rec);
- }
-
- /* 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;
- }
-
- /* add all the rest of the file to the freelist, possibly leaving a gap
- for the recovery area */
- if (recovery_size == 0) {
- /* the simple case - the whole file can be used as a freelist */
- data_len = (tdb->map_size - TDB_DATA_START(tdb->header.hash_size));
- if (tdb_free_region(tdb, TDB_DATA_START(tdb->header.hash_size), data_len) != 0) {
- goto failed;
- }
- } else {
- /* we need to add two freelist entries - one on either
- side of the recovery area
-
- Note that we cannot shift the recovery area during
- this operation. Only the transaction.c code may
- move the recovery area or we risk subtle data
- corruption
- */
- data_len = (recovery_head - TDB_DATA_START(tdb->header.hash_size));
- if (tdb_free_region(tdb, TDB_DATA_START(tdb->header.hash_size), data_len) != 0) {
- goto failed;
- }
- /* and the 2nd free list entry after the recovery area - if any */
- data_len = tdb->map_size - (recovery_head+recovery_size);
- if (tdb_free_region(tdb, recovery_head+recovery_size, data_len) != 0) {
- 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;
-}
diff --git a/source3/lib/tdb/common/tdb_private.h b/source3/lib/tdb/common/tdb_private.h
deleted file mode 100644
index ffac89ff0e..0000000000
--- a/source3/lib/tdb/common/tdb_private.h
+++ /dev/null
@@ -1,213 +0,0 @@
- /*
- Unix SMB/CIFS implementation.
-
- trivial database library - private includes
-
- Copyright (C) Andrew Tridgell 2005
-
- ** NOTE! The following LGPL license applies to the tdb
- ** 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/>.
-*/
-
-#include "replace.h"
-#include "system/filesys.h"
-#include "system/time.h"
-#include "system/shmem.h"
-#include "system/select.h"
-#include "system/wait.h"
-#include "tdb.h"
-
-#ifndef HAVE_GETPAGESIZE
-#define getpagesize() 0x2000
-#endif
-
-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)
-#define TDB_FREE_MAGIC (~TDB_MAGIC)
-#define TDB_DEAD_MAGIC (0xFEE1DEAD)
-#define TDB_RECOVERY_MAGIC (0xf53bc0e7U)
-#define TDB_ALIGNMENT 4
-#define DEFAULT_HASH_SIZE 131
-#define FREELIST_TOP (sizeof(struct tdb_header))
-#define TDB_ALIGN(x,a) (((x) + (a)-1) & ~((a)-1))
-#define TDB_BYTEREV(x) (((((x)&0xff)<<24)|((x)&0xFF00)<<8)|(((x)>>8)&0xFF00)|((x)>>24))
-#define TDB_DEAD(r) ((r)->magic == TDB_DEAD_MAGIC)
-#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) + 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
-#define TDB_PAD_U32 0x42424242
-
-/* NB assumes there is a local variable called "tdb" that is the
- * current context, also takes doubly-parenthesized print-style
- * argument. */
-#define TDB_LOG(x) tdb->log.log_fn x
-
-/* lock offsets */
-#define GLOBAL_LOCK 0
-#define ACTIVE_LOCK 4
-#define TRANSACTION_LOCK 8
-
-/* free memory if the pointer is valid and zero the pointer */
-#ifndef SAFE_FREE
-#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); (x)=NULL;} } while(0)
-#endif
-
-#define BUCKET(hash) ((hash) % tdb->header.hash_size)
-
-#define DOCONV() (tdb->flags & TDB_CONVERT)
-#define CONVERT(x) (DOCONV() ? tdb_convert(&x, sizeof(x)) : &x)
-
-
-/* the body of the database is made of one list_struct for the free space
- plus a separate data list for each hash value */
-struct list_struct {
- tdb_off_t next; /* offset of the next record in the list */
- tdb_len_t rec_len; /* total byte length of record */
- tdb_len_t key_len; /* byte length of key */
- tdb_len_t data_len; /* byte length of data */
- uint32_t full_hash; /* the full 32 bit hash of the key */
- uint32_t magic; /* try to catch errors */
- /* the following union is implied:
- union {
- char record[rec_len];
- struct {
- char key[key_len];
- char data[data_len];
- }
- uint32_t totalsize; (tailer)
- }
- */
-};
-
-
-/* this is stored at the front of every database */
-struct tdb_header {
- char magic_food[32]; /* for /etc/magic */
- uint32_t version; /* version of the code */
- uint32_t hash_size; /* number of hash entries */
- tdb_off_t rwlocks; /* obsolete - kept to detect old formats */
- tdb_off_t recovery_start; /* offset of transaction recovery region */
- tdb_off_t sequence_number; /* used when TDB_SEQNUM is set */
- tdb_off_t reserved[29];
-};
-
-struct tdb_lock_type {
- int list;
- uint32_t count;
- uint32_t ltype;
-};
-
-struct tdb_traverse_lock {
- struct tdb_traverse_lock *next;
- uint32_t off;
- uint32_t hash;
- int lock_rw;
-};
-
-
-struct tdb_methods {
- int (*tdb_read)(struct tdb_context *, tdb_off_t , void *, tdb_len_t , int );
- int (*tdb_write)(struct tdb_context *, tdb_off_t, const void *, tdb_len_t);
- void (*next_hash_chain)(struct tdb_context *, uint32_t *);
- int (*tdb_oob)(struct tdb_context *, tdb_off_t , int );
- int (*tdb_expand_file)(struct tdb_context *, tdb_off_t , tdb_off_t );
- int (*tdb_brlock)(struct tdb_context *, tdb_off_t , int, int, int, size_t);
-};
-
-struct tdb_context {
- char *name; /* the name of the database */
- void *map_ptr; /* where it is currently mapped */
- int fd; /* open file descriptor for the database */
- 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 */
- enum TDB_ERROR ecode; /* error code for last tdb error */
- struct tdb_header header; /* a cached copy of the header */
- uint32_t flags; /* the flags passed to tdb_open */
- struct tdb_traverse_lock travlocks; /* current traversal locks */
- struct tdb_context *next; /* all tdbs to avoid multiple opens */
- dev_t device; /* uniquely identifies this tdb */
- ino_t inode; /* uniquely identifies this tdb */
- struct tdb_logging_context log;
- unsigned int (*hash_fn)(TDB_DATA *key);
- int open_flags; /* flags used in the open - needed by reopen */
- unsigned int num_locks; /* number of chain locks held */
- const struct tdb_methods *methods;
- struct tdb_transaction *transaction;
- int page_size;
- int max_dead_records;
- bool have_transaction_lock;
- volatile sig_atomic_t *interrupt_sig_ptr;
-};
-
-
-/*
- internal prototypes
-*/
-int tdb_munmap(struct tdb_context *tdb);
-void tdb_mmap(struct tdb_context *tdb);
-int tdb_lock(struct tdb_context *tdb, int list, int ltype);
-int tdb_lock_nonblock(struct tdb_context *tdb, int list, int ltype);
-int tdb_unlock(struct tdb_context *tdb, int list, int ltype);
-int tdb_brlock(struct tdb_context *tdb, tdb_off_t offset, int rw_type, int lck_type, int probe, size_t len);
-int tdb_transaction_lock(struct tdb_context *tdb, int ltype);
-int tdb_transaction_unlock(struct tdb_context *tdb);
-int tdb_brlock_upgrade(struct tdb_context *tdb, tdb_off_t offset, size_t len);
-int tdb_write_lock_record(struct tdb_context *tdb, tdb_off_t off);
-int tdb_write_unlock_record(struct tdb_context *tdb, tdb_off_t off);
-int tdb_ofs_read(struct tdb_context *tdb, tdb_off_t offset, tdb_off_t *d);
-int tdb_ofs_write(struct tdb_context *tdb, tdb_off_t offset, tdb_off_t *d);
-void *tdb_convert(void *buf, uint32_t size);
-int tdb_free(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec);
-tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct list_struct *rec);
-int tdb_ofs_read(struct tdb_context *tdb, tdb_off_t offset, tdb_off_t *d);
-int tdb_ofs_write(struct tdb_context *tdb, tdb_off_t offset, tdb_off_t *d);
-int tdb_lock_record(struct tdb_context *tdb, tdb_off_t off);
-int tdb_unlock_record(struct tdb_context *tdb, tdb_off_t off);
-int tdb_rec_read(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec);
-int tdb_rec_write(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec);
-int tdb_do_delete(struct tdb_context *tdb, tdb_off_t rec_ptr, struct list_struct *rec);
-unsigned char *tdb_alloc_read(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t len);
-int tdb_parse_data(struct tdb_context *tdb, TDB_DATA key,
- tdb_off_t offset, tdb_len_t len,
- int (*parser)(TDB_DATA key, TDB_DATA data,
- void *private_data),
- void *private_data);
-tdb_off_t tdb_find_lock_hash(struct tdb_context *tdb, TDB_DATA key, uint32_t hash, int locktype,
- struct list_struct *rec);
-void tdb_io_init(struct tdb_context *tdb);
-int tdb_expand(struct tdb_context *tdb, tdb_off_t size);
-int tdb_rec_free_read(struct tdb_context *tdb, tdb_off_t off,
- struct list_struct *rec);
-
-
diff --git a/source3/lib/tdb/common/transaction.c b/source3/lib/tdb/common/transaction.c
deleted file mode 100644
index 7acda640c8..0000000000
--- a/source3/lib/tdb/common/transaction.c
+++ /dev/null
@@ -1,1119 +0,0 @@
- /*
- Unix SMB/CIFS implementation.
-
- trivial database library
-
- Copyright (C) Andrew Tridgell 2005
-
- ** NOTE! The following LGPL license applies to the tdb
- ** 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/>.
-*/
-
-#include "tdb_private.h"
-
-/*
- transaction design:
-
- - only allow a single transaction at a time per database. This makes
- using the transaction API simpler, as otherwise the caller would
- have to cope with temporary failures in transactions that conflict
- with other current transactions
-
- - keep the transaction recovery information in the same file as the
- database, using a special 'transaction recovery' record pointed at
- by the header. This removes the need for extra journal files as
- used by some other databases
-
- - dynamically allocated the transaction recover record, re-using it
- for subsequent transactions. If a larger record is needed then
- tdb_free() the old record to place it on the normal tdb freelist
- before allocating the new record
-
- - during transactions, keep a linked list of writes all that have
- been performed by intercepting all tdb_write() calls. The hooked
- transaction versions of tdb_read() and tdb_write() check this
- linked list and try to use the elements of the list in preference
- to the real database.
-
- - don't allow any locks to be held when a transaction starts,
- otherwise we can end up with deadlock (plus lack of lock nesting
- in posix locks would mean the lock is lost)
-
- - if the caller gains a lock during the transaction but doesn't
- release it then fail the commit
-
- - allow for nested calls to tdb_transaction_start(), re-using the
- existing transaction record. If the inner transaction is cancelled
- then a subsequent commit will fail
-
- - keep a mirrored copy of the tdb hash chain heads to allow for the
- fast hash heads scan on traverse, updating the mirrored copy in
- the transaction version of tdb_write
-
- - allow callers to mix transaction and non-transaction use of tdb,
- although once a transaction is started then an exclusive lock is
- gained until the transaction is committed or cancelled
-
- - the commit stategy involves first saving away all modified data
- into a linearised buffer in the transaction recovery area, then
- marking the transaction recovery area with a magic value to
- indicate a valid recovery record. In total 4 fsync/msync calls are
- needed per commit to prevent race conditions. It might be possible
- to reduce this to 3 or even 2 with some more work.
-
- - check for a valid recovery record on open of the tdb, while the
- global lock is held. Automatically recover from the transaction
- recovery area if needed, then continue with the open as
- usual. This allows for smooth crash recovery with no administrator
- intervention.
-
- - if TDB_NOSYNC is passed to flags in tdb_open then transactions are
- still available, but no transaction recovery area is used and no
- fsync/msync calls are made.
-
-*/
-
-
-/*
- hold the context of any current transaction
-*/
-struct tdb_transaction {
- /* we keep a mirrored copy of the tdb hash heads here so
- tdb_next_hash_chain() can operate efficiently */
- uint32_t *hash_heads;
-
- /* the original io methods - used to do IOs to the real db */
- const struct tdb_methods *io_methods;
-
- /* 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
- transaction is ended */
- int transaction_error;
-
- /* when inside a transaction we need to keep track of any
- nested tdb_transaction_start() calls, as these are allowed,
- but don't create a new transaction */
- int nesting;
-
- /* old file size before transaction */
- tdb_len_t old_map_size;
-};
-
-
-/*
- read while in a transaction. We need to check first if the data is in our list
- of transaction elements, then if not do a real read
-*/
-static int transaction_read(struct tdb_context *tdb, tdb_off_t off, void *buf,
- tdb_len_t len, int cv)
-{
- uint32_t blk;
-
- /* 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);
- }
-
- 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;
- }
-
- /* 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));
- tdb->ecode = TDB_ERR_IO;
- tdb->transaction->transaction_error = 1;
- return -1;
-}
-
-
-/*
- write while in a transaction
-*/
-static int transaction_write(struct tdb_context *tdb, tdb_off_t off,
- const void *buf, tdb_len_t len)
-{
- uint32_t blk;
-
- /* if the write is to a hash head, then update the transaction
- hash heads */
- if (len == sizeof(tdb_off_t) && off >= FREELIST_TOP &&
- off < FREELIST_TOP+TDB_HASHTABLE_SIZE(tdb)) {
- uint32_t chain = (off-FREELIST_TOP) / sizeof(tdb_off_t);
- memcpy(&tdb->transaction->hash_heads[chain], buf, len);
- }
-
- /* 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;
- }
- 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) {
- uint8_t **new_blocks;
- /* expand the blocks array */
- if (tdb->transaction->blocks == NULL) {
- new_blocks = (uint8_t **)malloc(
- (blk+1)*sizeof(uint8_t *));
- } else {
- new_blocks = (uint8_t **)realloc(
- tdb->transaction->blocks,
- (blk+1)*sizeof(uint8_t *));
- }
- if (new_blocks == NULL) {
- tdb->ecode = TDB_ERR_OOM;
- goto fail;
- }
- 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;
- }
-
- /* 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;
- return -1;
- }
- 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;
- }
- }
- }
-
- /* overwrite part of an existing block */
- if (buf == NULL) {
- memset(tdb->transaction->blocks[blk] + off, 0, len);
- } else {
- memcpy(tdb->transaction->blocks[blk] + off, buf, len);
- }
- if (blk == tdb->transaction->num_blocks-1) {
- if (len + off > tdb->transaction->last_block_size) {
- tdb->transaction->last_block_size = len + off;
- }
- }
-
- return 0;
-
-fail:
- 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
-*/
-static void transaction_next_hash_chain(struct tdb_context *tdb, uint32_t *chain)
-{
- uint32_t h = *chain;
- for (;h < tdb->header.hash_size;h++) {
- /* the +1 takes account of the freelist */
- if (0 != tdb->transaction->hash_heads[h+1]) {
- break;
- }
- }
- (*chain) = h;
-}
-
-/*
- out of bounds check during a transaction
-*/
-static int transaction_oob(struct tdb_context *tdb, tdb_off_t len, int probe)
-{
- if (len <= tdb->map_size) {
- return 0;
- }
- return TDB_ERRCODE(TDB_ERR_IO, -1);
-}
-
-/*
- transaction version of tdb_expand().
-*/
-static int transaction_expand_file(struct tdb_context *tdb, tdb_off_t size,
- tdb_off_t addition)
-{
- /* add a write to the transaction elements, so subsequent
- reads see the zero data */
- if (transaction_write(tdb, size, NULL, addition) != 0) {
- return -1;
- }
-
- return 0;
-}
-
-/*
- brlock during a transaction - ignore them
-*/
-static int transaction_brlock(struct tdb_context *tdb, tdb_off_t offset,
- int rw_type, int lck_type, int probe, size_t len)
-{
- return 0;
-}
-
-static const struct tdb_methods transaction_methods = {
- transaction_read,
- transaction_write,
- transaction_next_hash_chain,
- transaction_oob,
- transaction_expand_file,
- transaction_brlock
-};
-
-
-/*
- start a tdb transaction. No token is returned, as only a single
- transaction is allowed to be pending per tdb_context
-*/
-int tdb_transaction_start(struct tdb_context *tdb)
-{
- /* some sanity checks */
- if (tdb->read_only || (tdb->flags & TDB_INTERNAL) || tdb->traverse_read) {
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_start: cannot start a transaction on a read-only or internal db\n"));
- tdb->ecode = TDB_ERR_EINVAL;
- return -1;
- }
-
- /* cope with nested tdb_transaction_start() calls */
- if (tdb->transaction != NULL) {
- tdb->transaction->nesting++;
- TDB_LOG((tdb, TDB_DEBUG_TRACE, "tdb_transaction_start: nesting %d\n",
- tdb->transaction->nesting));
- return 0;
- }
-
- if (tdb->num_locks != 0 || tdb->global_lock.count) {
- /* the caller must not have any locks when starting a
- transaction as otherwise we'll be screwed by lack
- of nested locks in posix */
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_start: cannot start a transaction with locks held\n"));
- tdb->ecode = TDB_ERR_LOCK;
- return -1;
- }
-
- if (tdb->travlocks.next != NULL) {
- /* you cannot use transactions inside a traverse (although you can use
- traverse inside a transaction) as otherwise you can end up with
- deadlock */
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_start: cannot start a transaction within a traverse\n"));
- tdb->ecode = TDB_ERR_LOCK;
- return -1;
- }
-
- tdb->transaction = (struct tdb_transaction *)
- calloc(sizeof(struct tdb_transaction), 1);
- if (tdb->transaction == NULL) {
- tdb->ecode = TDB_ERR_OOM;
- 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;
- }
-
- /* get a read lock from the freelist to the end of file. This
- is upgraded to a write lock during the commit */
- if (tdb_brlock(tdb, FREELIST_TOP, F_RDLCK, F_SETLKW, 0, 0) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_start: failed to get hash locks\n"));
- tdb->ecode = TDB_ERR_LOCK;
- goto fail;
- }
-
- /* setup a copy of the hash table heads so the hash scan in
- traverse can be fast */
- tdb->transaction->hash_heads = (uint32_t *)
- calloc(tdb->header.hash_size+1, sizeof(uint32_t));
- if (tdb->transaction->hash_heads == NULL) {
- tdb->ecode = TDB_ERR_OOM;
- goto fail;
- }
- if (tdb->methods->tdb_read(tdb, FREELIST_TOP, tdb->transaction->hash_heads,
- TDB_HASHTABLE_SIZE(tdb), 0) != 0) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_start: failed to read hash heads\n"));
- tdb->ecode = TDB_ERR_IO;
- goto fail;
- }
-
- /* make sure we know about any file expansions already done by
- anyone else */
- tdb->methods->tdb_oob(tdb, tdb->map_size + 1, 1);
- tdb->transaction->old_map_size = tdb->map_size;
-
- /* finally hook the io methods, replacing them with
- transaction specific methods */
- tdb->transaction->io_methods = tdb->methods;
- tdb->methods = &transaction_methods;
-
- 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;
-}
-
-
-/*
- cancel the current transaction
-*/
-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;
- }
-
- if (tdb->transaction->nesting != 0) {
- tdb->transaction->transaction_error = 1;
- tdb->transaction->nesting--;
- return 0;
- }
-
- tdb->map_size = tdb->transaction->old_map_size;
-
- /* 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) {
- tdb_brlock(tdb, FREELIST_TOP, F_UNLCK, F_SETLKW, 0, 4*tdb->header.hash_size);
- tdb->global_lock.count = 0;
- }
-
- /* remove any locks created during the transaction */
- if (tdb->num_locks != 0) {
- for (i=0;i<tdb->num_lockrecs;i++) {
- tdb_brlock(tdb,FREELIST_TOP+4*tdb->lockrecs[i].list,
- F_UNLCK,F_SETLKW, 0, 1);
- }
- tdb->num_locks = 0;
- tdb->num_lockrecs = 0;
- SAFE_FREE(tdb->lockrecs);
- }
-
- /* restore the normal io methods */
- tdb->methods = tdb->transaction->io_methods;
-
- tdb_brlock(tdb, FREELIST_TOP, F_UNLCK, F_SETLKW, 0, 0);
- tdb_transaction_unlock(tdb);
- SAFE_FREE(tdb->transaction->hash_heads);
- SAFE_FREE(tdb->transaction);
-
- return 0;
-}
-
-/*
- sync to disk
-*/
-static int transaction_sync(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t length)
-{
- if (fsync(tdb->fd) != 0) {
- tdb->ecode = TDB_ERR_IO;
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction: fsync failed\n"));
- return -1;
- }
-#ifdef HAVE_MMAP
- if (tdb->map_ptr) {
- tdb_off_t moffset = offset & ~(tdb->page_size-1);
- if (msync(moffset + (char *)tdb->map_ptr,
- length + (offset - moffset), MS_SYNC) != 0) {
- tdb->ecode = TDB_ERR_IO;
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction: msync failed - %s\n",
- strerror(errno)));
- return -1;
- }
- }
-#endif
- return 0;
-}
-
-
-/*
- work out how much space the linearised recovery data will consume
-*/
-static tdb_len_t tdb_recovery_size(struct tdb_context *tdb)
-{
- tdb_len_t recovery_size = 0;
- int i;
-
- recovery_size = sizeof(uint32_t);
- 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);
- if (i == tdb->transaction->num_blocks-1) {
- recovery_size += tdb->transaction->last_block_size;
- } else {
- recovery_size += tdb->transaction->block_size;
- }
- }
-
- return recovery_size;
-}
-
-/*
- allocate the recovery area, or use an existing recovery area if it is
- large enough
-*/
-static int tdb_recovery_allocate(struct tdb_context *tdb,
- tdb_len_t *recovery_size,
- tdb_off_t *recovery_offset,
- tdb_len_t *recovery_max_size)
-{
- struct list_struct rec;
- const struct tdb_methods *methods = tdb->transaction->io_methods;
- tdb_off_t recovery_head;
-
- if (tdb_ofs_read(tdb, TDB_RECOVERY_HEAD, &recovery_head) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_recovery_allocate: failed to read recovery head\n"));
- return -1;
- }
-
- rec.rec_len = 0;
-
- if (recovery_head != 0 &&
- methods->tdb_read(tdb, recovery_head, &rec, sizeof(rec), DOCONV()) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_recovery_allocate: failed to read recovery record\n"));
- return -1;
- }
-
- *recovery_size = tdb_recovery_size(tdb);
-
- if (recovery_head != 0 && *recovery_size <= rec.rec_len) {
- /* it fits in the existing area */
- *recovery_max_size = rec.rec_len;
- *recovery_offset = recovery_head;
- return 0;
- }
-
- /* we need to free up the old recovery area, then allocate a
- new one at the end of the file. Note that we cannot use
- tdb_allocate() to allocate the new one as that might return
- us an area that is being currently used (as of the start of
- the transaction) */
- if (recovery_head != 0) {
- if (tdb_free(tdb, recovery_head, &rec) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_recovery_allocate: failed to free previous recovery area\n"));
- return -1;
- }
- }
-
- /* the tdb_free() call might have increased the recovery size */
- *recovery_size = tdb_recovery_size(tdb);
-
- /* round up to a multiple of page size */
- *recovery_max_size = TDB_ALIGN(sizeof(rec) + *recovery_size, tdb->page_size) - sizeof(rec);
- *recovery_offset = tdb->map_size;
- recovery_head = *recovery_offset;
-
- if (methods->tdb_expand_file(tdb, tdb->transaction->old_map_size,
- (tdb->map_size - tdb->transaction->old_map_size) +
- sizeof(rec) + *recovery_max_size) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_recovery_allocate: failed to create recovery area\n"));
- return -1;
- }
-
- /* remap the file (if using mmap) */
- methods->tdb_oob(tdb, tdb->map_size + 1, 1);
-
- /* we have to reset the old map size so that we don't try to expand the file
- again in the transaction commit, which would destroy the recovery area */
- tdb->transaction->old_map_size = tdb->map_size;
-
- /* write the recovery header offset and sync - we can sync without a race here
- as the magic ptr in the recovery record has not been set */
- CONVERT(recovery_head);
- if (methods->tdb_write(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;
- }
- 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;
-}
-
-
-/*
- setup the recovery data that will be used on a crash during commit
-*/
-static int transaction_setup_recovery(struct tdb_context *tdb,
- tdb_off_t *magic_offset)
-{
- tdb_len_t recovery_size;
- unsigned char *data, *p;
- const struct tdb_methods *methods = tdb->transaction->io_methods;
- struct list_struct *rec;
- 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
- */
- if (tdb_recovery_allocate(tdb, &recovery_size,
- &recovery_offset, &recovery_max_size) == -1) {
- return -1;
- }
-
- data = (unsigned char *)malloc(recovery_size + sizeof(*rec));
- if (data == NULL) {
- tdb->ecode = TDB_ERR_OOM;
- return -1;
- }
-
- rec = (struct list_struct *)data;
- memset(rec, 0, sizeof(*rec));
-
- rec->magic = 0;
- rec->data_len = recovery_size;
- rec->rec_len = recovery_max_size;
- rec->key_len = old_map_size;
- CONVERT(rec);
-
- /* 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 (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 (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, &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, offset, p + 8, length, 0) != 0) {
- free(data);
- tdb->ecode = TDB_ERR_IO;
- return -1;
- }
- p += 8 + length;
- }
-
- /* and the tailer */
- tailer = sizeof(*rec) + recovery_max_size;
- memcpy(p, &tailer, 4);
- CONVERT(p);
-
- /* write the recovery data to the recovery area */
- if (methods->tdb_write(tdb, recovery_offset, data, sizeof(*rec) + recovery_size) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_setup_recovery: failed to write recovery data\n"));
- free(data);
- 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
- data is present */
- if (transaction_sync(tdb, recovery_offset, sizeof(*rec) + recovery_size) == -1) {
- free(data);
- return -1;
- }
-
- free(data);
-
- magic = TDB_RECOVERY_MAGIC;
- CONVERT(magic);
-
- *magic_offset = recovery_offset + offsetof(struct list_struct, magic);
-
- if (methods->tdb_write(tdb, *magic_offset, &magic, sizeof(magic)) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_setup_recovery: failed to write recovery magic\n"));
- 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) {
- return -1;
- }
-
- return 0;
-}
-
-/*
- commit the current transaction
-*/
-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"));
- return -1;
- }
-
- if (tdb->transaction->transaction_error) {
- tdb->ecode = TDB_ERR_IO;
- tdb_transaction_cancel(tdb);
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_commit: transaction error pending\n"));
- return -1;
- }
-
-
- if (tdb->transaction->nesting != 0) {
- tdb->transaction->nesting--;
- return 0;
- }
-
- /* check for a null transaction */
- if (tdb->transaction->blocks == NULL) {
- tdb_transaction_cancel(tdb);
- return 0;
- }
-
- methods = tdb->transaction->io_methods;
-
- /* if there are any locks pending then the caller has not
- nested their locks properly, so fail the transaction */
- if (tdb->num_locks || tdb->global_lock.count) {
- tdb->ecode = TDB_ERR_LOCK;
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_commit: locks pending on commit\n"));
- tdb_transaction_cancel(tdb);
- return -1;
- }
-
- /* upgrade the main transaction lock region to a write lock */
- if (tdb_brlock_upgrade(tdb, FREELIST_TOP, 0) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_start: failed to upgrade hash locks\n"));
- tdb->ecode = TDB_ERR_LOCK;
- tdb_transaction_cancel(tdb);
- return -1;
- }
-
- /* get the global lock - this prevents new users attaching to the database
- during the commit */
- if (tdb_brlock(tdb, GLOBAL_LOCK, F_WRLCK, F_SETLKW, 0, 1) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_commit: failed to get global lock\n"));
- tdb->ecode = TDB_ERR_LOCK;
- tdb_transaction_cancel(tdb);
- return -1;
- }
-
- if (!(tdb->flags & TDB_NOSYNC)) {
- /* write the recovery data to the end of the file */
- if (transaction_setup_recovery(tdb, &magic_offset) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_commit: failed to setup recovery data\n"));
- tdb_brlock(tdb, GLOBAL_LOCK, F_UNLCK, F_SETLKW, 0, 1);
- tdb_transaction_cancel(tdb);
- return -1;
- }
- }
-
- /* expand the file to the new size if needed */
- if (tdb->map_size != tdb->transaction->old_map_size) {
- if (methods->tdb_expand_file(tdb, tdb->transaction->old_map_size,
- tdb->map_size -
- tdb->transaction->old_map_size) == -1) {
- tdb->ecode = TDB_ERR_IO;
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_commit: expansion failed\n"));
- tdb_brlock(tdb, GLOBAL_LOCK, F_UNLCK, F_SETLKW, 0, 1);
- tdb_transaction_cancel(tdb);
- return -1;
- }
- tdb->map_size = tdb->transaction->old_map_size;
- methods->tdb_oob(tdb, tdb->map_size + 1, 1);
- }
-
- /* perform all the writes */
- 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 (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
- possibly expanded the file, so we need to
- run the crash recovery code */
- tdb->methods = methods;
- tdb_transaction_recover(tdb);
-
- tdb_transaction_cancel(tdb);
- tdb_brlock(tdb, GLOBAL_LOCK, F_UNLCK, F_SETLKW, 0, 1);
-
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_commit: write failed\n"));
- return -1;
- }
- 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) {
- return -1;
- }
-
- /* remove the recovery marker */
- if (methods->tdb_write(tdb, magic_offset, &zero, 4) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_commit: failed to remove recovery magic\n"));
- return -1;
- }
-
- /* ensure the recovery marker has been removed on disk */
- if (transaction_sync(tdb, magic_offset, 4) == -1) {
- return -1;
- }
- }
-
- tdb_brlock(tdb, GLOBAL_LOCK, F_UNLCK, F_SETLKW, 0, 1);
-
- /*
- TODO: maybe write to some dummy hdr field, or write to magic
- offset without mmap, before the last sync, instead of the
- utime() call
- */
-
- /* on some systems (like Linux 2.6.x) changes via mmap/msync
- don't change the mtime of the file, this means the file may
- not be backed up (as tdb rounding to block sizes means that
- file size changes are quite rare too). The following forces
- mtime changes when a transaction completes */
-#ifdef HAVE_UTIME
- utime(tdb->name, NULL);
-#endif
-
- /* use a transaction cancel to free memory and remove the
- transaction locks */
- tdb_transaction_cancel(tdb);
-
- return 0;
-}
-
-
-/*
- recover from an aborted transaction. Must be called with exclusive
- database write access already established (including the global
- lock to prevent new processes attaching)
-*/
-int tdb_transaction_recover(struct tdb_context *tdb)
-{
- tdb_off_t recovery_head, recovery_eof;
- unsigned char *data, *p;
- uint32_t zero = 0;
- struct list_struct rec;
-
- /* find the recovery area */
- if (tdb_ofs_read(tdb, TDB_RECOVERY_HEAD, &recovery_head) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to read recovery head\n"));
- tdb->ecode = TDB_ERR_IO;
- return -1;
- }
-
- if (recovery_head == 0) {
- /* we have never allocated a recovery record */
- return 0;
- }
-
- /* read the recovery record */
- if (tdb->methods->tdb_read(tdb, recovery_head, &rec,
- sizeof(rec), DOCONV()) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to read recovery record\n"));
- tdb->ecode = TDB_ERR_IO;
- return -1;
- }
-
- if (rec.magic != TDB_RECOVERY_MAGIC) {
- /* there is no valid recovery data */
- return 0;
- }
-
- if (tdb->read_only) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: attempt to recover read only database\n"));
- tdb->ecode = TDB_ERR_CORRUPT;
- return -1;
- }
-
- recovery_eof = rec.key_len;
-
- data = (unsigned char *)malloc(rec.data_len);
- if (data == NULL) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to allocate recovery data\n"));
- tdb->ecode = TDB_ERR_OOM;
- return -1;
- }
-
- /* read the full recovery data */
- if (tdb->methods->tdb_read(tdb, recovery_head + sizeof(rec), data,
- rec.data_len, 0) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to read recovery data\n"));
- tdb->ecode = TDB_ERR_IO;
- return -1;
- }
-
- /* recover the file data */
- p = data;
- while (p+8 < data + rec.data_len) {
- uint32_t ofs, len;
- if (DOCONV()) {
- tdb_convert(p, 8);
- }
- memcpy(&ofs, p, 4);
- memcpy(&len, p+4, 4);
-
- if (tdb->methods->tdb_write(tdb, ofs, p+8, len) == -1) {
- free(data);
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to recover %d bytes at offset %d\n", len, ofs));
- tdb->ecode = TDB_ERR_IO;
- return -1;
- }
- p += 8 + len;
- }
-
- free(data);
-
- if (transaction_sync(tdb, 0, tdb->map_size) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to sync recovery\n"));
- tdb->ecode = TDB_ERR_IO;
- return -1;
- }
-
- /* if the recovery area is after the recovered eof then remove it */
- if (recovery_eof <= recovery_head) {
- if (tdb_ofs_write(tdb, TDB_RECOVERY_HEAD, &zero) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to remove recovery head\n"));
- tdb->ecode = TDB_ERR_IO;
- return -1;
- }
- }
-
- /* remove the recovery magic */
- if (tdb_ofs_write(tdb, recovery_head + offsetof(struct list_struct, magic),
- &zero) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to remove recovery magic\n"));
- tdb->ecode = TDB_ERR_IO;
- return -1;
- }
-
- /* reduce the file size to the old size */
- tdb_munmap(tdb);
- if (ftruncate(tdb->fd, recovery_eof) != 0) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to reduce to recovery size\n"));
- tdb->ecode = TDB_ERR_IO;
- return -1;
- }
- tdb->map_size = recovery_eof;
- tdb_mmap(tdb);
-
- if (transaction_sync(tdb, 0, recovery_eof) == -1) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_recover: failed to sync2 recovery\n"));
- tdb->ecode = TDB_ERR_IO;
- return -1;
- }
-
- TDB_LOG((tdb, TDB_DEBUG_TRACE, "tdb_transaction_recover: recovered %d byte database\n",
- recovery_eof));
-
- /* all done */
- return 0;
-}
diff --git a/source3/lib/tdb/common/traverse.c b/source3/lib/tdb/common/traverse.c
deleted file mode 100644
index 69c81e6e98..0000000000
--- a/source3/lib/tdb/common/traverse.c
+++ /dev/null
@@ -1,348 +0,0 @@
- /*
- Unix SMB/CIFS implementation.
-
- trivial database library
-
- Copyright (C) Andrew Tridgell 1999-2005
- Copyright (C) Paul `Rusty' Russell 2000
- Copyright (C) Jeremy Allison 2000-2003
-
- ** NOTE! The following LGPL license applies to the tdb
- ** 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/>.
-*/
-
-#include "tdb_private.h"
-
-/* Uses traverse lock: 0 = finish, -1 = error, other = record offset */
-static int tdb_next_lock(struct tdb_context *tdb, struct tdb_traverse_lock *tlock,
- struct list_struct *rec)
-{
- int want_next = (tlock->off != 0);
-
- /* Lock each chain from the start one. */
- for (; tlock->hash < tdb->header.hash_size; tlock->hash++) {
- if (!tlock->off && tlock->hash != 0) {
- /* this is an optimisation for the common case where
- the hash chain is empty, which is particularly
- common for the use of tdb with ldb, where large
- hashes are used. In that case we spend most of our
- time in tdb_brlock(), locking empty hash chains.
-
- To avoid this, we do an unlocked pre-check to see
- if the hash chain is empty before starting to look
- inside it. If it is empty then we can avoid that
- hash chain. If it isn't empty then we can't believe
- the value we get back, as we read it without a
- lock, so instead we get the lock and re-fetch the
- value below.
-
- Notice that not doing this optimisation on the
- first hash chain is critical. We must guarantee
- that we have done at least one fcntl lock at the
- start of a search to guarantee that memory is
- coherent on SMP systems. If records are added by
- others during the search then thats OK, and we
- could possibly miss those with this trick, but we
- could miss them anyway without this trick, so the
- semantics don't change.
-
- With a non-indexed ldb search this trick gains us a
- factor of around 80 in speed on a linux 2.6.x
- system (testing using ldbtest).
- */
- tdb->methods->next_hash_chain(tdb, &tlock->hash);
- if (tlock->hash == tdb->header.hash_size) {
- continue;
- }
- }
-
- if (tdb_lock(tdb, tlock->hash, tlock->lock_rw) == -1)
- return -1;
-
- /* No previous record? Start at top of chain. */
- if (!tlock->off) {
- if (tdb_ofs_read(tdb, TDB_HASH_TOP(tlock->hash),
- &tlock->off) == -1)
- goto fail;
- } else {
- /* Otherwise unlock the previous record. */
- if (tdb_unlock_record(tdb, tlock->off) != 0)
- goto fail;
- }
-
- if (want_next) {
- /* We have offset of old record: grab next */
- if (tdb_rec_read(tdb, tlock->off, rec) == -1)
- goto fail;
- tlock->off = rec->next;
- }
-
- /* Iterate through chain */
- while( tlock->off) {
- tdb_off_t current;
- if (tdb_rec_read(tdb, tlock->off, rec) == -1)
- goto fail;
-
- /* Detect infinite loops. From "Shlomi Yaakobovich" <Shlomi@exanet.com>. */
- if (tlock->off == rec->next) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_next_lock: loop detected.\n"));
- goto fail;
- }
-
- if (!TDB_DEAD(rec)) {
- /* Woohoo: we found one! */
- if (tdb_lock_record(tdb, tlock->off) != 0)
- goto fail;
- return tlock->off;
- }
-
- /* Try to clean dead ones from old traverses */
- current = tlock->off;
- tlock->off = rec->next;
- if (!(tdb->read_only || tdb->traverse_read) &&
- tdb_do_delete(tdb, current, rec) != 0)
- goto fail;
- }
- tdb_unlock(tdb, tlock->hash, tlock->lock_rw);
- want_next = 0;
- }
- /* We finished iteration without finding anything */
- return TDB_ERRCODE(TDB_SUCCESS, 0);
-
- fail:
- tlock->off = 0;
- if (tdb_unlock(tdb, tlock->hash, tlock->lock_rw) != 0)
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_next_lock: On error unlock failed!\n"));
- return -1;
-}
-
-/* traverse the entire database - calling fn(tdb, key, data) on each element.
- return -1 on error or the record count traversed
- if fn is NULL then it is not called
- a non-zero return value from fn() indicates that the traversal should stop
- */
-static int tdb_traverse_internal(struct tdb_context *tdb,
- tdb_traverse_func fn, void *private_data,
- struct tdb_traverse_lock *tl)
-{
- TDB_DATA key, dbuf;
- struct list_struct rec;
- int ret, count = 0;
-
- /* This was in the initializaton, above, but the IRIX compiler
- * did not like it. crh
- */
- tl->next = tdb->travlocks.next;
-
- /* fcntl locks don't stack: beware traverse inside traverse */
- tdb->travlocks.next = tl;
-
- /* tdb_next_lock places locks on the record returned, and its chain */
- while ((ret = tdb_next_lock(tdb, tl, &rec)) > 0) {
- count++;
- /* now read the full record */
- key.dptr = tdb_alloc_read(tdb, tl->off + sizeof(rec),
- rec.key_len + rec.data_len);
- if (!key.dptr) {
- ret = -1;
- if (tdb_unlock(tdb, tl->hash, tl->lock_rw) != 0)
- goto out;
- if (tdb_unlock_record(tdb, tl->off) != 0)
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_traverse: key.dptr == NULL and unlock_record failed!\n"));
- goto out;
- }
- key.dsize = rec.key_len;
- dbuf.dptr = key.dptr + rec.key_len;
- dbuf.dsize = rec.data_len;
-
- /* Drop chain lock, call out */
- if (tdb_unlock(tdb, tl->hash, tl->lock_rw) != 0) {
- ret = -1;
- SAFE_FREE(key.dptr);
- goto out;
- }
- if (fn && fn(tdb, key, dbuf, private_data)) {
- /* They want us to terminate traversal */
- ret = count;
- if (tdb_unlock_record(tdb, tl->off) != 0) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_traverse: unlock_record failed!\n"));;
- ret = -1;
- }
- SAFE_FREE(key.dptr);
- goto out;
- }
- SAFE_FREE(key.dptr);
- }
-out:
- tdb->travlocks.next = tl->next;
- if (ret < 0)
- return -1;
- else
- return count;
-}
-
-
-/*
- a write style traverse - temporarily marks the db read only
-*/
-int tdb_traverse_read(struct tdb_context *tdb,
- tdb_traverse_func fn, void *private_data)
-{
- struct tdb_traverse_lock tl = { NULL, 0, 0, F_RDLCK };
- int ret;
- bool in_transaction = (tdb->transaction != NULL);
-
- /* we need to get a read lock on the transaction lock here to
- cope with the lock ordering semantics of solaris10 */
- if (!in_transaction) {
- if (tdb_transaction_lock(tdb, F_RDLCK)) {
- return -1;
- }
- }
-
- tdb->traverse_read++;
- ret = tdb_traverse_internal(tdb, fn, private_data, &tl);
- tdb->traverse_read--;
-
- if (!in_transaction) {
- tdb_transaction_unlock(tdb);
- }
-
- return ret;
-}
-
-/*
- a write style traverse - needs to get the transaction lock to
- prevent deadlocks
-
- WARNING: The data buffer given to the callback fn does NOT meet the
- alignment restrictions malloc gives you.
-*/
-int tdb_traverse(struct tdb_context *tdb,
- tdb_traverse_func fn, void *private_data)
-{
- struct tdb_traverse_lock tl = { NULL, 0, 0, F_WRLCK };
- int ret;
- bool in_transaction = (tdb->transaction != NULL);
-
- if (tdb->read_only || tdb->traverse_read) {
- return tdb_traverse_read(tdb, fn, private_data);
- }
-
- if (!in_transaction) {
- if (tdb_transaction_lock(tdb, F_WRLCK)) {
- return -1;
- }
- }
-
- tdb->traverse_write++;
- ret = tdb_traverse_internal(tdb, fn, private_data, &tl);
- tdb->traverse_write--;
-
- if (!in_transaction) {
- tdb_transaction_unlock(tdb);
- }
-
- return ret;
-}
-
-
-/* find the first entry in the database and return its key */
-TDB_DATA tdb_firstkey(struct tdb_context *tdb)
-{
- TDB_DATA key;
- struct list_struct rec;
-
- /* release any old lock */
- if (tdb_unlock_record(tdb, tdb->travlocks.off) != 0)
- return tdb_null;
- tdb->travlocks.off = tdb->travlocks.hash = 0;
- tdb->travlocks.lock_rw = F_RDLCK;
-
- /* Grab first record: locks chain and returned record. */
- if (tdb_next_lock(tdb, &tdb->travlocks, &rec) <= 0)
- return tdb_null;
- /* now read the key */
- key.dsize = rec.key_len;
- key.dptr =tdb_alloc_read(tdb,tdb->travlocks.off+sizeof(rec),key.dsize);
-
- /* Unlock the hash chain of the record we just read. */
- if (tdb_unlock(tdb, tdb->travlocks.hash, tdb->travlocks.lock_rw) != 0)
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_firstkey: error occurred while tdb_unlocking!\n"));
- return key;
-}
-
-/* find the next entry in the database, returning its key */
-TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA oldkey)
-{
- uint32_t oldhash;
- TDB_DATA key = tdb_null;
- struct list_struct rec;
- unsigned char *k = NULL;
-
- /* Is locked key the old key? If so, traverse will be reliable. */
- if (tdb->travlocks.off) {
- if (tdb_lock(tdb,tdb->travlocks.hash,tdb->travlocks.lock_rw))
- return tdb_null;
- if (tdb_rec_read(tdb, tdb->travlocks.off, &rec) == -1
- || !(k = tdb_alloc_read(tdb,tdb->travlocks.off+sizeof(rec),
- rec.key_len))
- || memcmp(k, oldkey.dptr, oldkey.dsize) != 0) {
- /* No, it wasn't: unlock it and start from scratch */
- if (tdb_unlock_record(tdb, tdb->travlocks.off) != 0) {
- SAFE_FREE(k);
- return tdb_null;
- }
- if (tdb_unlock(tdb, tdb->travlocks.hash, tdb->travlocks.lock_rw) != 0) {
- SAFE_FREE(k);
- return tdb_null;
- }
- tdb->travlocks.off = 0;
- }
-
- SAFE_FREE(k);
- }
-
- if (!tdb->travlocks.off) {
- /* No previous element: do normal find, and lock record */
- tdb->travlocks.off = tdb_find_lock_hash(tdb, oldkey, tdb->hash_fn(&oldkey), tdb->travlocks.lock_rw, &rec);
- if (!tdb->travlocks.off)
- return tdb_null;
- tdb->travlocks.hash = BUCKET(rec.full_hash);
- if (tdb_lock_record(tdb, tdb->travlocks.off) != 0) {
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_nextkey: lock_record failed (%s)!\n", strerror(errno)));
- return tdb_null;
- }
- }
- oldhash = tdb->travlocks.hash;
-
- /* Grab next record: locks chain and returned record,
- unlocks old record */
- if (tdb_next_lock(tdb, &tdb->travlocks, &rec) > 0) {
- key.dsize = rec.key_len;
- key.dptr = tdb_alloc_read(tdb, tdb->travlocks.off+sizeof(rec),
- key.dsize);
- /* Unlock the chain of this new record */
- if (tdb_unlock(tdb, tdb->travlocks.hash, tdb->travlocks.lock_rw) != 0)
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_nextkey: WARNING tdb_unlock failed!\n"));
- }
- /* Unlock the chain of old record */
- if (tdb_unlock(tdb, BUCKET(oldhash), tdb->travlocks.lock_rw) != 0)
- TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_nextkey: WARNING tdb_unlock failed!\n"));
- return key;
-}
-
diff --git a/source3/lib/tdb/config.guess b/source3/lib/tdb/config.guess
deleted file mode 100755
index 354dbe175a..0000000000
--- a/source3/lib/tdb/config.guess
+++ /dev/null
@@ -1,1464 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-timestamp='2005-08-03'
-
-# This file 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/>.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner <per@bothner.com>.
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# This script attempts to guess a canonical system name similar to
-# config.sub. If it succeeds, it prints the system name on stdout, and
-# exits with 0. Otherwise, it exits with 1.
-#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help" >&2
- exit 1 ;;
- * )
- break ;;
- esac
-done
-
-if test $# != 0; then
- echo "$me: too many arguments$help" >&2
- exit 1
-fi
-
-trap 'exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
-# compiler to aid in system detection is discouraged as it requires
-# temporary files to be created and, as you can see below, it is a
-# headache to deal with in a portable fashion.
-
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-# Portable tmp directory creation inspired by the Autoconf team.
-
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,) echo "int x;" > $dummy.c ;
- for c in cc gcc c89 c99 ; do
- if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
- CC_FOR_BUILD="$c"; break ;
- fi ;
- done ;
- if test x"$CC_FOR_BUILD" = x ; then
- CC_FOR_BUILD=no_compiler_found ;
- fi
- ;;
- ,,*) CC_FOR_BUILD=$CC ;;
- ,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
- PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
- *:NetBSD:*:*)
- # NetBSD (nbsd) targets should (where applicable) match one or
- # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
- # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
- # switched to ELF, *-*-netbsd* would select the old
- # object file format. This provides both forward
- # compatibility and a consistent mechanism for selecting the
- # object file format.
- #
- # Note: NetBSD doesn't particularly care about the vendor
- # portion of the name. We always set it to "unknown".
- sysctl="sysctl -n hw.machine_arch"
- UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
- /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
- case "${UNAME_MACHINE_ARCH}" in
- armeb) machine=armeb-unknown ;;
- arm*) machine=arm-unknown ;;
- sh3el) machine=shl-unknown ;;
- sh3eb) machine=sh-unknown ;;
- *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
- esac
- # The Operating System including object format, if it has switched
- # to ELF recently, or will in the future.
- case "${UNAME_MACHINE_ARCH}" in
- arm*|i386|m68k|ns32k|sh3*|sparc|vax)
- eval $set_cc_for_build
- if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep __ELF__ >/dev/null
- then
- # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
- # Return netbsd for either. FIX?
- os=netbsd
- else
- os=netbsdelf
- fi
- ;;
- *)
- os=netbsd
- ;;
- esac
- # The OS release
- # Debian GNU/NetBSD machines have a different userland, and
- # thus, need a distinct triplet. However, they do not need
- # kernel version information, so it can be replaced with a
- # suitable tag, in the style of linux-gnu.
- case "${UNAME_VERSION}" in
- Debian*)
- release='-gnu'
- ;;
- *)
- release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- ;;
- esac
- # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
- # contains redundant information, the shorter form:
- # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "${machine}-${os}${release}"
- exit ;;
- *:OpenBSD:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
- exit ;;
- *:ekkoBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
- exit ;;
- macppc:MirBSD:*:*)
- echo powerppc-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- *:MirBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- alpha:OSF1:*:*)
- case $UNAME_RELEASE in
- *4.0)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- ;;
- *5.*)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
- ;;
- esac
- # According to Compaq, /usr/sbin/psrinfo has been available on
- # OSF/1 and Tru64 systems produced since 1995. I hope that
- # covers most systems running today. This code pipes the CPU
- # types through head -n 1, so we only detect the type of CPU 0.
- ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
- case "$ALPHA_CPU_TYPE" in
- "EV4 (21064)")
- UNAME_MACHINE="alpha" ;;
- "EV4.5 (21064)")
- UNAME_MACHINE="alpha" ;;
- "LCA4 (21066/21068)")
- UNAME_MACHINE="alpha" ;;
- "EV5 (21164)")
- UNAME_MACHINE="alphaev5" ;;
- "EV5.6 (21164A)")
- UNAME_MACHINE="alphaev56" ;;
- "EV5.6 (21164PC)")
- UNAME_MACHINE="alphapca56" ;;
- "EV5.7 (21164PC)")
- UNAME_MACHINE="alphapca57" ;;
- "EV6 (21264)")
- UNAME_MACHINE="alphaev6" ;;
- "EV6.7 (21264A)")
- UNAME_MACHINE="alphaev67" ;;
- "EV6.8CB (21264C)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8AL (21264B)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8CX (21264D)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.9A (21264/EV69A)")
- UNAME_MACHINE="alphaev69" ;;
- "EV7 (21364)")
- UNAME_MACHINE="alphaev7" ;;
- "EV7.9 (21364A)")
- UNAME_MACHINE="alphaev79" ;;
- esac
- # A Pn.n version is a patched version.
- # A Vn.n version is a released version.
- # A Tn.n version is a released field test version.
- # A Xn.n version is an unreleased experimental baselevel.
- # 1.2 uses "1.2" for uname -r.
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- exit ;;
- Alpha\ *:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # Should we change UNAME_MACHINE based on the output of uname instead
- # of the specific Alpha model?
- echo alpha-pc-interix
- exit ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit ;;
- Amiga*:UNIX_System_V:4.0:*)
- echo m68k-unknown-sysv4
- exit ;;
- *:[Aa]miga[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-amigaos
- exit ;;
- *:[Mm]orph[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-morphos
- exit ;;
- *:OS/390:*:*)
- echo i370-ibm-openedition
- exit ;;
- *:z/VM:*:*)
- echo s390-ibm-zvmoe
- exit ;;
- *:OS400:*:*)
- echo powerpc-ibm-os400
- exit ;;
- arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix${UNAME_RELEASE}
- exit ;;
- arm:riscos:*:*|arm:RISCOS:*:*)
- echo arm-unknown-riscos
- exit ;;
- SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit ;;
- Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
- # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit ;;
- NILE*:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit ;;
- DRS?6000:unix:4.0:6*)
- echo sparc-icl-nx6
- exit ;;
- DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
- case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7; exit ;;
- esac ;;
- sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- i86pc:SunOS:5.*:*)
- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:6*:*)
- # According to config.sub, this is the proper way to canonicalize
- # SunOS6. Hard to guess exactly what SunOS6 will be like, but
- # it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
- Series*|S4*)
- UNAME_RELEASE=`uname -v`
- ;;
- esac
- # Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit ;;
- sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit ;;
- sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
- case "`/bin/arch`" in
- sun3)
- echo m68k-sun-sunos${UNAME_RELEASE}
- ;;
- sun4)
- echo sparc-sun-sunos${UNAME_RELEASE}
- ;;
- esac
- exit ;;
- aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
- exit ;;
- # The situation for MiNT is a little confusing. The machine name
- # can be virtually everything (everything which is not
- # "atarist" or "atariste" at least should have a processor
- # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
- # to the lowercase version "mint" (or "freemint"). Finally
- # the system name "TOS" denotes a system which is actually not
- # MiNT. But MiNT is downward compatible to TOS, so this should
- # be no problem.
- atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit ;;
- hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit ;;
- *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit ;;
- m68k:machten:*:*)
- echo m68k-apple-machten${UNAME_RELEASE}
- exit ;;
- powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
- exit ;;
- RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit ;;
- RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit ;;
- VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit ;;
- 2020:CLIX:*:* | 2430:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit ;;
- mips:*:*:UMIPS | mips:*:*:RISCos)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h> /* for printf() prototype */
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
- #if defined (host_mips) && defined (MIPSEB)
- #if defined (SYSTYPE_SYSV)
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_SVR4)
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
- #endif
- #endif
- exit (-1);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c &&
- dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
- SYSTEM_NAME=`$dummy $dummyarg` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo mips-mips-riscos${UNAME_RELEASE}
- exit ;;
- Motorola:PowerMAX_OS:*:*)
- echo powerpc-motorola-powermax
- exit ;;
- Motorola:*:4.3:PL8-*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit ;;
- m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit ;;
- m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit ;;
- m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit ;;
- AViiON:dgux:*:*)
- # DG/UX returns AViiON for all architectures
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
- then
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
- [ ${TARGET_BINARY_INTERFACE}x = x ]
- then
- echo m88k-dg-dgux${UNAME_RELEASE}
- else
- echo m88k-dg-dguxbcs${UNAME_RELEASE}
- fi
- else
- echo i586-dg-dgux${UNAME_RELEASE}
- fi
- exit ;;
- M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit ;;
- M88*:*:R3*:*)
- # Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit ;;
- XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit ;;
- Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit ;;
- *:IRIX*:*:*)
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit ;;
- ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i*86:AIX:*:*)
- echo i386-ibm-aix
- exit ;;
- ia64:AIX:*:*)
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:2:3)
- if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <sys/systemcfg.h>
-
- main()
- {
- if (!__power_pc())
- exit(1);
- puts("powerpc-ibm-aix3.2.5");
- exit(0);
- }
-EOF
- if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
- then
- echo "$SYSTEM_NAME"
- else
- echo rs6000-ibm-aix3.2.5
- fi
- elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- echo rs6000-ibm-aix3.2.4
- else
- echo rs6000-ibm-aix3.2
- fi
- exit ;;
- *:AIX:*:[45])
- IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
- if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
- IBM_ARCH=rs6000
- else
- IBM_ARCH=powerpc
- fi
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:*:*)
- echo rs6000-ibm-aix
- exit ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- echo romp-ibm-bsd4.4
- exit ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit ;; # report: romp-ibm BSD 4.3
- *:BOSX:*:*)
- echo rs6000-bull-bosx
- exit ;;
- DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit ;;
- 9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit ;;
- hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit ;;
- 9000/[34678]??:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/[678][0-9][0-9])
- if [ -x /usr/bin/getconf ]; then
- sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "${sc_cpu_version}" in
- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
- 532) # CPU_PA_RISC2_0
- case "${sc_kernel_bits}" in
- 32) HP_ARCH="hppa2.0n" ;;
- 64) HP_ARCH="hppa2.0w" ;;
- '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
- esac ;;
- esac
- fi
- if [ "${HP_ARCH}" = "" ]; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-
- #define _HPUX_SOURCE
- #include <stdlib.h>
- #include <unistd.h>
-
- int main ()
- {
- #if defined(_SC_KERNEL_BITS)
- long bits = sysconf(_SC_KERNEL_BITS);
- #endif
- long cpu = sysconf (_SC_CPU_VERSION);
-
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
- case CPU_PA_RISC2_0:
- #if defined(_SC_KERNEL_BITS)
- switch (bits)
- {
- case 64: puts ("hppa2.0w"); break;
- case 32: puts ("hppa2.0n"); break;
- default: puts ("hppa2.0"); break;
- } break;
- #else /* !defined(_SC_KERNEL_BITS) */
- puts ("hppa2.0"); break;
- #endif
- default: puts ("hppa1.0"); break;
- }
- exit (0);
- }
-EOF
- (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
- test -z "$HP_ARCH" && HP_ARCH=hppa
- fi ;;
- esac
- if [ ${HP_ARCH} = "hppa2.0w" ]
- then
- eval $set_cc_for_build
-
- # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
- # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
- # generating 64-bit code. GNU and HP use different nomenclature:
- #
- # $ CC_FOR_BUILD=cc ./config.guess
- # => hppa2.0w-hp-hpux11.23
- # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
- # => hppa64-hp-hpux11.23
-
- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
- grep __LP64__ >/dev/null
- then
- HP_ARCH="hppa2.0w"
- else
- HP_ARCH="hppa64"
- fi
- fi
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit ;;
- ia64:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- echo ia64-hp-hpux${HPUX_REV}
- exit ;;
- 3050*:HI-UX:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <unistd.h>
- int
- main ()
- {
- long cpu = sysconf (_SC_CPU_VERSION);
- /* The order matters, because CPU_IS_HP_MC68K erroneously returns
- true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
- results, however. */
- if (CPU_IS_PA_RISC (cpu))
- {
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
- default: puts ("hppa-hitachi-hiuxwe2"); break;
- }
- }
- else if (CPU_IS_HP_MC68K (cpu))
- puts ("m68k-hitachi-hiuxwe2");
- else puts ("unknown-hitachi-hiuxwe2");
- exit (0);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo unknown-hitachi-hiuxwe2
- exit ;;
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
- echo hppa1.1-hp-bsd
- exit ;;
- 9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit ;;
- *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
- echo hppa1.0-hp-mpeix
- exit ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- echo hppa1.1-hp-osf
- exit ;;
- hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit ;;
- i*86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
- else
- echo ${UNAME_MACHINE}-unknown-osf1
- fi
- exit ;;
- parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit ;;
- C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit ;;
- C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit ;;
- C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit ;;
- C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit ;;
- CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
- | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
- -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*T3E:*:*:*)
- echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*SV1:*:*:*)
- echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- *:UNICOS/mp:*:*)
- echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
- FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- 5000:UNIX_System_V:4.*:*)
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit ;;
- sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:FreeBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit ;;
- i*:CYGWIN*:*)
- echo ${UNAME_MACHINE}-pc-cygwin
- exit ;;
- i*:MINGW*:*)
- echo ${UNAME_MACHINE}-pc-mingw32
- exit ;;
- i*:windows32*:*)
- # uname -m includes "-pc" on this system.
- echo ${UNAME_MACHINE}-mingw32
- exit ;;
- i*:PW*:*)
- echo ${UNAME_MACHINE}-pc-pw32
- exit ;;
- x86:Interix*:[34]*)
- echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
- exit ;;
- [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
- echo i${UNAME_MACHINE}-pc-mks
- exit ;;
- i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
- # UNAME_MACHINE based on the output of uname instead of i386?
- echo i586-pc-interix
- exit ;;
- i*:UWIN*:*)
- echo ${UNAME_MACHINE}-pc-uwin
- exit ;;
- amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
- echo x86_64-unknown-cygwin
- exit ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin
- exit ;;
- prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- *:GNU:*:*)
- # the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit ;;
- *:GNU/*:*:*)
- # other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
- exit ;;
- i*86:Minix:*:*)
- echo ${UNAME_MACHINE}-pc-minix
- exit ;;
- arm*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- cris:Linux:*:*)
- echo cris-axis-linux-gnu
- exit ;;
- crisv32:Linux:*:*)
- echo crisv32-axis-linux-gnu
- exit ;;
- frv:Linux:*:*)
- echo frv-unknown-linux-gnu
- exit ;;
- ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- mips:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef mips
- #undef mipsel
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=mipsel
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=mips
- #else
- CPU=
- #endif
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
- ;;
- mips64:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef mips64
- #undef mips64el
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=mips64el
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=mips64
- #else
- CPU=
- #endif
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
- ;;
- or32:Linux:*:*)
- echo or32-unknown-linux-gnu
- exit ;;
- ppc:Linux:*:*)
- echo powerpc-unknown-linux-gnu
- exit ;;
- ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-gnu
- exit ;;
- alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
- EV5) UNAME_MACHINE=alphaev5 ;;
- EV56) UNAME_MACHINE=alphaev56 ;;
- PCA56) UNAME_MACHINE=alphapca56 ;;
- PCA57) UNAME_MACHINE=alphapca56 ;;
- EV6) UNAME_MACHINE=alphaev6 ;;
- EV67) UNAME_MACHINE=alphaev67 ;;
- EV68*) UNAME_MACHINE=alphaev68 ;;
- esac
- objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
- exit ;;
- parisc:Linux:*:* | hppa:Linux:*:*)
- # Look for CPU level
- case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-gnu ;;
- PA8*) echo hppa2.0-unknown-linux-gnu ;;
- *) echo hppa-unknown-linux-gnu ;;
- esac
- exit ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-gnu
- exit ;;
- s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux
- exit ;;
- sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- x86_64:Linux:*:*)
- echo x86_64-unknown-linux-gnu
- exit ;;
- i*86:Linux:*:*)
- # The BFD linker knows what the default object file format is, so
- # first see if it will tell us. cd to the root directory to prevent
- # problems with other programs or directories called `ld' in the path.
- # Set LC_ALL=C to ensure ld outputs messages in English.
- ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
- | sed -ne '/supported targets:/!d
- s/[ ][ ]*/ /g
- s/.*supported targets: *//
- s/ .*//
- p'`
- case "$ld_supported_targets" in
- elf32-i386)
- TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
- ;;
- a.out-i386-linux)
- echo "${UNAME_MACHINE}-pc-linux-gnuaout"
- exit ;;
- coff-i386)
- echo "${UNAME_MACHINE}-pc-linux-gnucoff"
- exit ;;
- "")
- # Either a pre-BFD a.out linker (linux-gnuoldld) or
- # one that does not give us useful --help.
- echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
- exit ;;
- esac
- # Determine whether the default compiler is a.out or elf
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <features.h>
- #ifdef __ELF__
- # ifdef __GLIBC__
- # if __GLIBC__ >= 2
- LIBC=gnu
- # else
- LIBC=gnulibc1
- # endif
- # else
- LIBC=gnulibc1
- # endif
- #else
- #ifdef __INTEL_COMPILER
- LIBC=gnu
- #else
- LIBC=gnuaout
- #endif
- #endif
- #ifdef __dietlibc__
- LIBC=dietlibc
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
- test x"${LIBC}" != x && {
- echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
- exit
- }
- test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
- ;;
- i*86:DYNIX/ptx:4*:*)
- # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
- # earlier versions are messed up and put the nodename in both
- # sysname and nodename.
- echo i386-sequent-sysv4
- exit ;;
- i*86:UNIX_SV:4.2MP:2.*)
- # Unixware is an offshoot of SVR4, but it has its own version
- # number series starting with 2...
- # I am not positive that other SVR4 systems won't match this,
- # I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit ;;
- i*86:OS/2:*:*)
- # If we were able to find `uname', then EMX Unix compatibility
- # is probably installed.
- echo ${UNAME_MACHINE}-pc-os2-emx
- exit ;;
- i*86:XTS-300:*:STOP)
- echo ${UNAME_MACHINE}-unknown-stop
- exit ;;
- i*86:atheos:*:*)
- echo ${UNAME_MACHINE}-unknown-atheos
- exit ;;
- i*86:syllable:*:*)
- echo ${UNAME_MACHINE}-pc-syllable
- exit ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- i*86:*DOS:*:*)
- echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit ;;
- i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
- UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
- if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
- fi
- exit ;;
- i*86:*:5:[678]*)
- # UnixWare 7.x, OpenUNIX and OpenServer 6.
- case `/bin/uname -X | grep "^Machine"` in
- *486*) UNAME_MACHINE=i486 ;;
- *Pentium) UNAME_MACHINE=i586 ;;
- *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
- esac
- echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
- exit ;;
- i*86:*:3.2:*)
- if test -f /usr/options/cb.name; then
- UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
- elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
- (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
- (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
- && UNAME_MACHINE=i586
- (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
- && UNAME_MACHINE=i686
- (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
- && UNAME_MACHINE=i686
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
- else
- echo ${UNAME_MACHINE}-pc-sysv32
- fi
- exit ;;
- pc:*:*:*)
- # Left here for compatibility:
- # uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i386.
- echo i386-pc-msdosdjgpp
- exit ;;
- Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit ;;
- paragon:*:*:*)
- echo i860-intel-osf1
- exit ;;
- i860:*:4.*:*) # i860-SVR4
- if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
- else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
- fi
- exit ;;
- mini*:CTIX:SYS*5:*)
- # "miniframe"
- echo m68010-convergent-sysv
- exit ;;
- mc68k:UNIX:SYSTEM5:3.51m)
- echo m68k-convergent-sysv
- exit ;;
- M680?0:D-NIX:5.3:*)
- echo m68k-diab-dnix
- exit ;;
- M68*:*:R3V[5678]*:*)
- test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
- 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
- OS_REL=''
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
- 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4; exit; } ;;
- m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit ;;
- TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- rs6000:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
- echo powerpc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
- exit ;;
- RM*:ReliantUNIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- *:SINIX-*:*:*)
- if uname -p 2>/dev/null >/dev/null ; then
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo ${UNAME_MACHINE}-sni-sysv4
- else
- echo ns32k-sni-sysv
- fi
- exit ;;
- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit ;;
- *:UNIX_System_V:4*:FTX*)
- # From Gerald Hewes <hewes@openmarket.com>.
- # How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit ;;
- *:*:*:FTX*)
- # From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit ;;
- i*86:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo ${UNAME_MACHINE}-stratus-vos
- exit ;;
- *:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo hppa1.1-stratus-vos
- exit ;;
- mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit ;;
- news*:NEWS-OS:6*:*)
- echo mips-sony-newsos6
- exit ;;
- R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
- else
- echo mips-unknown-sysv${UNAME_RELEASE}
- fi
- exit ;;
- BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
- echo powerpc-be-beos
- exit ;;
- BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
- echo powerpc-apple-beos
- exit ;;
- BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
- echo i586-pc-beos
- exit ;;
- SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-6:SUPER-UX:*:*)
- echo sx6-nec-superux${UNAME_RELEASE}
- exit ;;
- Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Rhapsody:*:*)
- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Darwin:*:*)
- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- case $UNAME_PROCESSOR in
- *86) UNAME_PROCESSOR=i686 ;;
- unknown) UNAME_PROCESSOR=powerpc ;;
- esac
- echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
- exit ;;
- *:procnto*:*:* | *:QNX:[0123456789]*:*)
- UNAME_PROCESSOR=`uname -p`
- if test "$UNAME_PROCESSOR" = "x86"; then
- UNAME_PROCESSOR=i386
- UNAME_MACHINE=pc
- fi
- echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
- exit ;;
- *:QNX:*:4*)
- echo i386-pc-qnx
- exit ;;
- NSE-?:NONSTOP_KERNEL:*:*)
- echo nse-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSR-?:NONSTOP_KERNEL:*:*)
- echo nsr-tandem-nsk${UNAME_RELEASE}
- exit ;;
- *:NonStop-UX:*:*)
- echo mips-compaq-nonstopux
- exit ;;
- BS2000:POSIX*:*:*)
- echo bs2000-siemens-sysv
- exit ;;
- DS/*:UNIX_System_V:*:*)
- echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit ;;
- *:Plan9:*:*)
- # "uname -m" is not consistent, so use $cputype instead. 386
- # is converted to i386 for consistency with other x86
- # operating systems.
- if test "$cputype" = "386"; then
- UNAME_MACHINE=i386
- else
- UNAME_MACHINE="$cputype"
- fi
- echo ${UNAME_MACHINE}-unknown-plan9
- exit ;;
- *:TOPS-10:*:*)
- echo pdp10-unknown-tops10
- exit ;;
- *:TENEX:*:*)
- echo pdp10-unknown-tenex
- exit ;;
- KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
- echo pdp10-dec-tops20
- exit ;;
- XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
- echo pdp10-xkl-tops20
- exit ;;
- *:TOPS-20:*:*)
- echo pdp10-unknown-tops20
- exit ;;
- *:ITS:*:*)
- echo pdp10-unknown-its
- exit ;;
- SEI:*:*:SEIUX)
- echo mips-sei-seiux${UNAME_RELEASE}
- exit ;;
- *:DragonFly:*:*)
- echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit ;;
- *:*VMS:*:*)
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- case "${UNAME_MACHINE}" in
- A*) echo alpha-dec-vms ; exit ;;
- I*) echo ia64-dec-vms ; exit ;;
- V*) echo vax-dec-vms ; exit ;;
- esac ;;
- *:XENIX:*:SysV)
- echo i386-pc-xenix
- exit ;;
- i*86:skyos:*:*)
- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
- exit ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
- /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
- I don't know.... */
- printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
- printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
- "4"
-#else
- ""
-#endif
- ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
- printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
- printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
- int version;
- version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
- if (version < 4)
- printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
- else
- printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
- exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
- printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
- printf ("ns32k-encore-mach\n"); exit (0);
-#else
- printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
- printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
- printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
- printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
- struct utsname un;
-
- uname(&un);
-
- if (strncmp(un.version, "V2", 2) == 0) {
- printf ("i386-sequent-ptx2\n"); exit (0);
- }
- if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
- printf ("i386-sequent-ptx1\n"); exit (0);
- }
- printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-# include <sys/param.h>
-# if defined (BSD)
-# if BSD == 43
- printf ("vax-dec-bsd4.3\n"); exit (0);
-# else
-# if BSD == 199006
- printf ("vax-dec-bsd4.3reno\n"); exit (0);
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# endif
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# else
- printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
- printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
- exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
- case `getsysinfo -f cpu_type` in
- c1*)
- echo c1-convex-bsd
- exit ;;
- c2*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- c34*)
- echo c34-convex-bsd
- exit ;;
- c38*)
- echo c38-convex-bsd
- exit ;;
- c4*)
- echo c4-convex-bsd
- exit ;;
- esac
-fi
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
- http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
-and
- http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo = `(hostinfo) 2>/dev/null`
-/bin/universe = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/source3/lib/tdb/config.mk b/source3/lib/tdb/config.mk
deleted file mode 100644
index b9a8f80dda..0000000000
--- a/source3/lib/tdb/config.mk
+++ /dev/null
@@ -1,57 +0,0 @@
-################################################
-# Start SUBSYSTEM LIBTDB
-[LIBRARY::LIBTDB]
-OUTPUT_TYPE = STATIC_LIBRARY
-CFLAGS = -Ilib/tdb/include
-#
-# End SUBSYSTEM ldb
-################################################
-
-LIBTDB_OBJ_FILES = $(addprefix lib/tdb/common/, \
- tdb.o dump.o io.o lock.o \
- open.o traverse.o freelist.o \
- error.o transaction.o)
-
-################################################
-# Start BINARY tdbtool
-[BINARY::tdbtool]
-INSTALLDIR = BINDIR
-PRIVATE_DEPENDENCIES = \
- LIBTDB
-# End BINARY tdbtool
-################################################
-
-tdbtool_OBJ_FILES = lib/tdb/tools/tdbtool.o
-
-################################################
-# Start BINARY tdbtorture
-[BINARY::tdbtorture]
-INSTALLDIR = BINDIR
-PRIVATE_DEPENDENCIES = \
- LIBTDB
-# End BINARY tdbtorture
-################################################
-
-tdbtorture_OBJ_FILES = lib/tdb/tools/tdbtorture.o
-
-################################################
-# Start BINARY tdbdump
-[BINARY::tdbdump]
-INSTALLDIR = BINDIR
-PRIVATE_DEPENDENCIES = \
- LIBTDB
-# End BINARY tdbdump
-################################################
-
-tdbdump_OBJ_FILES = lib/tdb/tools/tdbdump.o
-
-################################################
-# Start BINARY tdbbackup
-[BINARY::tdbbackup]
-INSTALLDIR = BINDIR
-PRIVATE_DEPENDENCIES = \
- LIBTDB
-# End BINARY tdbbackup
-################################################
-
-tdbbackup_OBJ_FILES = lib/tdb/tools/tdbbackup.o
diff --git a/source3/lib/tdb/config.sub b/source3/lib/tdb/config.sub
deleted file mode 100755
index 23cd6fd75c..0000000000
--- a/source3/lib/tdb/config.sub
+++ /dev/null
@@ -1,1577 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-timestamp='2005-07-08'
-
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine. It does not imply ALL GNU software can.
-#
-# This file 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/>.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support. The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
- $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help"
- exit 1 ;;
-
- *local*)
- # First pass through any local machine types.
- echo $1
- exit ;;
-
- * )
- break ;;
- esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
- exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
- exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
- nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
- kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
- os=-$maybe_os
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
- ;;
- *)
- basic_machine=`echo $1 | sed 's/-[^-]*$//'`
- if [ $basic_machine != $1 ]
- then os=`echo $1 | sed 's/.*-/-/'`
- else os=; fi
- ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work. We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
- -sun*os*)
- # Prevent following clause from handling this invalid input.
- ;;
- -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
- -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
- -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
- -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
- -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
- -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray)
- os=
- basic_machine=$1
- ;;
- -sim | -cisco | -oki | -wec | -winbond)
- os=
- basic_machine=$1
- ;;
- -scout)
- ;;
- -wrs)
- os=-vxworks
- basic_machine=$1
- ;;
- -chorusos*)
- os=-chorusos
- basic_machine=$1
- ;;
- -chorusrdb)
- os=-chorusrdb
- basic_machine=$1
- ;;
- -hiux*)
- os=-hiuxwe2
- ;;
- -sco5)
- os=-sco3.2v5
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco4)
- os=-sco3.2v4
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2v[4-9]*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco*)
- os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -udk*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -isc)
- os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -clix*)
- basic_machine=clipper-intergraph
- ;;
- -isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -lynx*)
- os=-lynxos
- ;;
- -ptx*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
- ;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
- ;;
- -psos*)
- os=-psos
- ;;
- -mint | -mint[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
- # Recognize the basic CPU types without company name.
- # Some are omitted here because they have special meanings below.
- 1750a | 580 \
- | a29k \
- | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
- | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
- | am33_2.0 \
- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
- | bfin \
- | c4x | clipper \
- | d10v | d30v | dlx | dsp16xx \
- | fr30 | frv \
- | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
- | i370 | i860 | i960 | ia64 \
- | ip2k | iq2000 \
- | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
- | mips | mipsbe | mipseb | mipsel | mipsle \
- | mips16 \
- | mips64 | mips64el \
- | mips64vr | mips64vrel \
- | mips64orion | mips64orionel \
- | mips64vr4100 | mips64vr4100el \
- | mips64vr4300 | mips64vr4300el \
- | mips64vr5000 | mips64vr5000el \
- | mips64vr5900 | mips64vr5900el \
- | mipsisa32 | mipsisa32el \
- | mipsisa32r2 | mipsisa32r2el \
- | mipsisa64 | mipsisa64el \
- | mipsisa64r2 | mipsisa64r2el \
- | mipsisa64sb1 | mipsisa64sb1el \
- | mipsisa64sr71k | mipsisa64sr71kel \
- | mipstx39 | mipstx39el \
- | mn10200 | mn10300 \
- | ms1 \
- | msp430 \
- | ns16k | ns32k \
- | or32 \
- | pdp10 | pdp11 | pj | pjl \
- | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
- | pyramid \
- | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
- | sh64 | sh64le \
- | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
- | sparcv8 | sparcv9 | sparcv9b \
- | strongarm \
- | tahoe | thumb | tic4x | tic80 | tron \
- | v850 | v850e \
- | we32k \
- | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
- | z8k)
- basic_machine=$basic_machine-unknown
- ;;
- m32c)
- basic_machine=$basic_machine-unknown
- ;;
- m6811 | m68hc11 | m6812 | m68hc12)
- # Motorola 68HC11/12.
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
- ;;
-
- # We use `pc' rather than `unknown'
- # because (1) that's what they normally are, and
- # (2) the word "unknown" tends to confuse beginning users.
- i*86 | x86_64)
- basic_machine=$basic_machine-pc
- ;;
- # Object if more than one company name word.
- *-*-*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
- # Recognize the basic CPU types with company name.
- 580-* \
- | a29k-* \
- | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
- | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
- | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
- | avr-* \
- | bfin-* | bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
- | clipper-* | craynv-* | cydra-* \
- | d10v-* | d30v-* | dlx-* \
- | elxsi-* \
- | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
- | h8300-* | h8500-* \
- | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
- | i*86-* | i860-* | i960-* | ia64-* \
- | ip2k-* | iq2000-* \
- | m32r-* | m32rle-* \
- | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* \
- | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
- | mips16-* \
- | mips64-* | mips64el-* \
- | mips64vr-* | mips64vrel-* \
- | mips64orion-* | mips64orionel-* \
- | mips64vr4100-* | mips64vr4100el-* \
- | mips64vr4300-* | mips64vr4300el-* \
- | mips64vr5000-* | mips64vr5000el-* \
- | mips64vr5900-* | mips64vr5900el-* \
- | mipsisa32-* | mipsisa32el-* \
- | mipsisa32r2-* | mipsisa32r2el-* \
- | mipsisa64-* | mipsisa64el-* \
- | mipsisa64r2-* | mipsisa64r2el-* \
- | mipsisa64sb1-* | mipsisa64sb1el-* \
- | mipsisa64sr71k-* | mipsisa64sr71kel-* \
- | mipstx39-* | mipstx39el-* \
- | mmix-* \
- | ms1-* \
- | msp430-* \
- | none-* | np1-* | ns16k-* | ns32k-* \
- | orion-* \
- | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
- | pyramid-* \
- | romp-* | rs6000-* \
- | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
- | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
- | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
- | sparclite-* \
- | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
- | tahoe-* | thumb-* \
- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
- | tron-* \
- | v850-* | v850e-* | vax-* \
- | we32k-* \
- | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
- | xstormy16-* | xtensa-* \
- | ymp-* \
- | z8k-*)
- ;;
- m32c-*)
- ;;
- # Recognize the various machine names and aliases which stand
- # for a CPU type and a company and sometimes even an OS.
- 386bsd)
- basic_machine=i386-unknown
- os=-bsd
- ;;
- 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- basic_machine=m68000-att
- ;;
- 3b*)
- basic_machine=we32k-att
- ;;
- a29khif)
- basic_machine=a29k-amd
- os=-udi
- ;;
- abacus)
- basic_machine=abacus-unknown
- ;;
- adobe68k)
- basic_machine=m68010-adobe
- os=-scout
- ;;
- alliant | fx80)
- basic_machine=fx80-alliant
- ;;
- altos | altos3068)
- basic_machine=m68k-altos
- ;;
- am29k)
- basic_machine=a29k-none
- os=-bsd
- ;;
- amd64)
- basic_machine=x86_64-pc
- ;;
- amd64-*)
- basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- amdahl)
- basic_machine=580-amdahl
- os=-sysv
- ;;
- amiga | amiga-*)
- basic_machine=m68k-unknown
- ;;
- amigaos | amigados)
- basic_machine=m68k-unknown
- os=-amigaos
- ;;
- amigaunix | amix)
- basic_machine=m68k-unknown
- os=-sysv4
- ;;
- apollo68)
- basic_machine=m68k-apollo
- os=-sysv
- ;;
- apollo68bsd)
- basic_machine=m68k-apollo
- os=-bsd
- ;;
- aux)
- basic_machine=m68k-apple
- os=-aux
- ;;
- balance)
- basic_machine=ns32k-sequent
- os=-dynix
- ;;
- c90)
- basic_machine=c90-cray
- os=-unicos
- ;;
- convex-c1)
- basic_machine=c1-convex
- os=-bsd
- ;;
- convex-c2)
- basic_machine=c2-convex
- os=-bsd
- ;;
- convex-c32)
- basic_machine=c32-convex
- os=-bsd
- ;;
- convex-c34)
- basic_machine=c34-convex
- os=-bsd
- ;;
- convex-c38)
- basic_machine=c38-convex
- os=-bsd
- ;;
- cray | j90)
- basic_machine=j90-cray
- os=-unicos
- ;;
- craynv)
- basic_machine=craynv-cray
- os=-unicosmp
- ;;
- cr16c)
- basic_machine=cr16c-unknown
- os=-elf
- ;;
- crds | unos)
- basic_machine=m68k-crds
- ;;
- crisv32 | crisv32-* | etraxfs*)
- basic_machine=crisv32-axis
- ;;
- cris | cris-* | etrax*)
- basic_machine=cris-axis
- ;;
- crx)
- basic_machine=crx-unknown
- os=-elf
- ;;
- da30 | da30-*)
- basic_machine=m68k-da30
- ;;
- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
- basic_machine=mips-dec
- ;;
- decsystem10* | dec10*)
- basic_machine=pdp10-dec
- os=-tops10
- ;;
- decsystem20* | dec20*)
- basic_machine=pdp10-dec
- os=-tops20
- ;;
- delta | 3300 | motorola-3300 | motorola-delta \
- | 3300-motorola | delta-motorola)
- basic_machine=m68k-motorola
- ;;
- delta88)
- basic_machine=m88k-motorola
- os=-sysv3
- ;;
- djgpp)
- basic_machine=i586-pc
- os=-msdosdjgpp
- ;;
- dpx20 | dpx20-*)
- basic_machine=rs6000-bull
- os=-bosx
- ;;
- dpx2* | dpx2*-bull)
- basic_machine=m68k-bull
- os=-sysv3
- ;;
- ebmon29k)
- basic_machine=a29k-amd
- os=-ebmon
- ;;
- elxsi)
- basic_machine=elxsi-elxsi
- os=-bsd
- ;;
- encore | umax | mmax)
- basic_machine=ns32k-encore
- ;;
- es1800 | OSE68k | ose68k | ose | OSE)
- basic_machine=m68k-ericsson
- os=-ose
- ;;
- fx2800)
- basic_machine=i860-alliant
- ;;
- genix)
- basic_machine=ns32k-ns
- ;;
- gmicro)
- basic_machine=tron-gmicro
- os=-sysv
- ;;
- go32)
- basic_machine=i386-pc
- os=-go32
- ;;
- h3050r* | hiux*)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- h8300hms)
- basic_machine=h8300-hitachi
- os=-hms
- ;;
- h8300xray)
- basic_machine=h8300-hitachi
- os=-xray
- ;;
- h8500hms)
- basic_machine=h8500-hitachi
- os=-hms
- ;;
- harris)
- basic_machine=m88k-harris
- os=-sysv3
- ;;
- hp300-*)
- basic_machine=m68k-hp
- ;;
- hp300bsd)
- basic_machine=m68k-hp
- os=-bsd
- ;;
- hp300hpux)
- basic_machine=m68k-hp
- os=-hpux
- ;;
- hp3k9[0-9][0-9] | hp9[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k2[0-9][0-9] | hp9k31[0-9])
- basic_machine=m68000-hp
- ;;
- hp9k3[2-9][0-9])
- basic_machine=m68k-hp
- ;;
- hp9k6[0-9][0-9] | hp6[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k7[0-79][0-9] | hp7[0-79][0-9])
- basic_machine=hppa1.1-hp
- ;;
- hp9k78[0-9] | hp78[0-9])
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][13679] | hp8[0-9][13679])
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][0-9] | hp8[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hppa-next)
- os=-nextstep3
- ;;
- hppaosf)
- basic_machine=hppa1.1-hp
- os=-osf
- ;;
- hppro)
- basic_machine=hppa1.1-hp
- os=-proelf
- ;;
- i370-ibm* | ibm*)
- basic_machine=i370-ibm
- ;;
-# I'm not sure what "Sysv32" means. Should this be sysv3.2?
- i*86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv32
- ;;
- i*86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
- ;;
- i*86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
- ;;
- i*86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-solaris2
- ;;
- i386mach)
- basic_machine=i386-mach
- os=-mach
- ;;
- i386-vsta | vsta)
- basic_machine=i386-unknown
- os=-vsta
- ;;
- iris | iris4d)
- basic_machine=mips-sgi
- case $os in
- -irix*)
- ;;
- *)
- os=-irix4
- ;;
- esac
- ;;
- isi68 | isi)
- basic_machine=m68k-isi
- os=-sysv
- ;;
- m88k-omron*)
- basic_machine=m88k-omron
- ;;
- magnum | m3230)
- basic_machine=mips-mips
- os=-sysv
- ;;
- merlin)
- basic_machine=ns32k-utek
- os=-sysv
- ;;
- mingw32)
- basic_machine=i386-pc
- os=-mingw32
- ;;
- miniframe)
- basic_machine=m68000-convergent
- ;;
- *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- monitor)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- morphos)
- basic_machine=powerpc-unknown
- os=-morphos
- ;;
- msdos)
- basic_machine=i386-pc
- os=-msdos
- ;;
- mvs)
- basic_machine=i370-ibm
- os=-mvs
- ;;
- ncr3000)
- basic_machine=i486-ncr
- os=-sysv4
- ;;
- netbsd386)
- basic_machine=i386-unknown
- os=-netbsd
- ;;
- netwinder)
- basic_machine=armv4l-rebel
- os=-linux
- ;;
- news | news700 | news800 | news900)
- basic_machine=m68k-sony
- os=-newsos
- ;;
- news1000)
- basic_machine=m68030-sony
- os=-newsos
- ;;
- news-3600 | risc-news)
- basic_machine=mips-sony
- os=-newsos
- ;;
- necv70)
- basic_machine=v70-nec
- os=-sysv
- ;;
- next | m*-next )
- basic_machine=m68k-next
- case $os in
- -nextstep* )
- ;;
- -ns2*)
- os=-nextstep2
- ;;
- *)
- os=-nextstep3
- ;;
- esac
- ;;
- nh3000)
- basic_machine=m68k-harris
- os=-cxux
- ;;
- nh[45]000)
- basic_machine=m88k-harris
- os=-cxux
- ;;
- nindy960)
- basic_machine=i960-intel
- os=-nindy
- ;;
- mon960)
- basic_machine=i960-intel
- os=-mon960
- ;;
- nonstopux)
- basic_machine=mips-compaq
- os=-nonstopux
- ;;
- np1)
- basic_machine=np1-gould
- ;;
- nsr-tandem)
- basic_machine=nsr-tandem
- ;;
- op50n-* | op60c-*)
- basic_machine=hppa1.1-oki
- os=-proelf
- ;;
- openrisc | openrisc-*)
- basic_machine=or32-unknown
- ;;
- os400)
- basic_machine=powerpc-ibm
- os=-os400
- ;;
- OSE68000 | ose68000)
- basic_machine=m68000-ericsson
- os=-ose
- ;;
- os68k)
- basic_machine=m68k-none
- os=-os68k
- ;;
- pa-hitachi)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- paragon)
- basic_machine=i860-intel
- os=-osf
- ;;
- pbd)
- basic_machine=sparc-tti
- ;;
- pbb)
- basic_machine=m68k-tti
- ;;
- pc532 | pc532-*)
- basic_machine=ns32k-pc532
- ;;
- pentium | p5 | k5 | k6 | nexgen | viac3)
- basic_machine=i586-pc
- ;;
- pentiumpro | p6 | 6x86 | athlon | athlon_*)
- basic_machine=i686-pc
- ;;
- pentiumii | pentium2 | pentiumiii | pentium3)
- basic_machine=i686-pc
- ;;
- pentium4)
- basic_machine=i786-pc
- ;;
- pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-* | 6x86-* | athlon-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium4-*)
- basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pn)
- basic_machine=pn-gould
- ;;
- power) basic_machine=power-ibm
- ;;
- ppc) basic_machine=powerpc-unknown
- ;;
- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppcle | powerpclittle | ppc-le | powerpc-little)
- basic_machine=powerpcle-unknown
- ;;
- ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64) basic_machine=powerpc64-unknown
- ;;
- ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64le | powerpc64little | ppc64-le | powerpc64-little)
- basic_machine=powerpc64le-unknown
- ;;
- ppc64le-* | powerpc64little-*)
- basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ps2)
- basic_machine=i386-ibm
- ;;
- pw32)
- basic_machine=i586-unknown
- os=-pw32
- ;;
- rom68k)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- rm[46]00)
- basic_machine=mips-siemens
- ;;
- rtpc | rtpc-*)
- basic_machine=romp-ibm
- ;;
- s390 | s390-*)
- basic_machine=s390-ibm
- ;;
- s390x | s390x-*)
- basic_machine=s390x-ibm
- ;;
- sa29200)
- basic_machine=a29k-amd
- os=-udi
- ;;
- sb1)
- basic_machine=mipsisa64sb1-unknown
- ;;
- sb1el)
- basic_machine=mipsisa64sb1el-unknown
- ;;
- sei)
- basic_machine=mips-sei
- os=-seiux
- ;;
- sequent)
- basic_machine=i386-sequent
- ;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
- ;;
- sh64)
- basic_machine=sh64-unknown
- ;;
- sparclite-wrs | simso-wrs)
- basic_machine=sparclite-wrs
- os=-vxworks
- ;;
- sps7)
- basic_machine=m68k-bull
- os=-sysv2
- ;;
- spur)
- basic_machine=spur-unknown
- ;;
- st2000)
- basic_machine=m68k-tandem
- ;;
- stratus)
- basic_machine=i860-stratus
- os=-sysv4
- ;;
- sun2)
- basic_machine=m68000-sun
- ;;
- sun2os3)
- basic_machine=m68000-sun
- os=-sunos3
- ;;
- sun2os4)
- basic_machine=m68000-sun
- os=-sunos4
- ;;
- sun3os3)
- basic_machine=m68k-sun
- os=-sunos3
- ;;
- sun3os4)
- basic_machine=m68k-sun
- os=-sunos4
- ;;
- sun4os3)
- basic_machine=sparc-sun
- os=-sunos3
- ;;
- sun4os4)
- basic_machine=sparc-sun
- os=-sunos4
- ;;
- sun4sol2)
- basic_machine=sparc-sun
- os=-solaris2
- ;;
- sun3 | sun3-*)
- basic_machine=m68k-sun
- ;;
- sun4)
- basic_machine=sparc-sun
- ;;
- sun386 | sun386i | roadrunner)
- basic_machine=i386-sun
- ;;
- sv1)
- basic_machine=sv1-cray
- os=-unicos
- ;;
- symmetry)
- basic_machine=i386-sequent
- os=-dynix
- ;;
- t3e)
- basic_machine=alphaev5-cray
- os=-unicos
- ;;
- t90)
- basic_machine=t90-cray
- os=-unicos
- ;;
- tic54x | c54x*)
- basic_machine=tic54x-unknown
- os=-coff
- ;;
- tic55x | c55x*)
- basic_machine=tic55x-unknown
- os=-coff
- ;;
- tic6x | c6x*)
- basic_machine=tic6x-unknown
- os=-coff
- ;;
- tx39)
- basic_machine=mipstx39-unknown
- ;;
- tx39el)
- basic_machine=mipstx39el-unknown
- ;;
- toad1)
- basic_machine=pdp10-xkl
- os=-tops20
- ;;
- tower | tower-32)
- basic_machine=m68k-ncr
- ;;
- tpf)
- basic_machine=s390x-ibm
- os=-tpf
- ;;
- udi29k)
- basic_machine=a29k-amd
- os=-udi
- ;;
- ultra3)
- basic_machine=a29k-nyu
- os=-sym1
- ;;
- v810 | necv810)
- basic_machine=v810-nec
- os=-none
- ;;
- vaxv)
- basic_machine=vax-dec
- os=-sysv
- ;;
- vms)
- basic_machine=vax-dec
- os=-vms
- ;;
- vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
- ;;
- vxworks960)
- basic_machine=i960-wrs
- os=-vxworks
- ;;
- vxworks68)
- basic_machine=m68k-wrs
- os=-vxworks
- ;;
- vxworks29k)
- basic_machine=a29k-wrs
- os=-vxworks
- ;;
- w65*)
- basic_machine=w65-wdc
- os=-none
- ;;
- w89k-*)
- basic_machine=hppa1.1-winbond
- os=-proelf
- ;;
- xbox)
- basic_machine=i686-pc
- os=-mingw32
- ;;
- xps | xps100)
- basic_machine=xps100-honeywell
- ;;
- ymp)
- basic_machine=ymp-cray
- os=-unicos
- ;;
- z8k-*-coff)
- basic_machine=z8k-unknown
- os=-sim
- ;;
- none)
- basic_machine=none-none
- os=-none
- ;;
-
-# Here we handle the default manufacturer of certain CPU types. It is in
-# some cases the only manufacturer, in others, it is the most popular.
- w89k)
- basic_machine=hppa1.1-winbond
- ;;
- op50n)
- basic_machine=hppa1.1-oki
- ;;
- op60c)
- basic_machine=hppa1.1-oki
- ;;
- romp)
- basic_machine=romp-ibm
- ;;
- mmix)
- basic_machine=mmix-knuth
- ;;
- rs6000)
- basic_machine=rs6000-ibm
- ;;
- vax)
- basic_machine=vax-dec
- ;;
- pdp10)
- # there are many clones, so DEC is not a safe bet
- basic_machine=pdp10-unknown
- ;;
- pdp11)
- basic_machine=pdp11-dec
- ;;
- we32k)
- basic_machine=we32k-att
- ;;
- sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
- basic_machine=sh-unknown
- ;;
- sparc | sparcv8 | sparcv9 | sparcv9b)
- basic_machine=sparc-sun
- ;;
- cydra)
- basic_machine=cydra-cydrome
- ;;
- orion)
- basic_machine=orion-highlevel
- ;;
- orion105)
- basic_machine=clipper-highlevel
- ;;
- mac | mpw | mac-mpw)
- basic_machine=m68k-apple
- ;;
- pmac | pmac-mpw)
- basic_machine=powerpc-apple
- ;;
- *-unknown)
- # Make sure to match an already-canonicalized machine name.
- ;;
- *)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
- *-digital*)
- basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
- ;;
- *-commodore*)
- basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
- ;;
- *)
- ;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
- # -solaris* is a basic system type, with this one exception.
- -solaris1 | -solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
- ;;
- -solaris)
- os=-solaris2
- ;;
- -svr4*)
- os=-sysv4
- ;;
- -unixware*)
- os=-sysv4.2uw
- ;;
- -gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
- # First accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST END IN A *, to match a version number.
- # -sysv* is not here because it comes later, after sysvr4.
- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* \
- | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
- | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
- | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -chorusos* | -chorusrdb* \
- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
- | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
- | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
- | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -qnx*)
- case $basic_machine in
- x86-* | i*86-*)
- ;;
- *)
- os=-nto$os
- ;;
- esac
- ;;
- -nto-qnx*)
- ;;
- -nto*)
- os=`echo $os | sed -e 's|nto|nto-qnx|'`
- ;;
- -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
- | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
- ;;
- -mac*)
- os=`echo $os | sed -e 's|mac|macos|'`
- ;;
- -linux-dietlibc)
- os=-linux-dietlibc
- ;;
- -linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
- ;;
- -sunos5*)
- os=`echo $os | sed -e 's|sunos5|solaris2|'`
- ;;
- -sunos6*)
- os=`echo $os | sed -e 's|sunos6|solaris3|'`
- ;;
- -opened*)
- os=-openedition
- ;;
- -os400*)
- os=-os400
- ;;
- -wince*)
- os=-wince
- ;;
- -osfrose*)
- os=-osfrose
- ;;
- -osf*)
- os=-osf
- ;;
- -utek*)
- os=-bsd
- ;;
- -dynix*)
- os=-bsd
- ;;
- -acis*)
- os=-aos
- ;;
- -atheos*)
- os=-atheos
- ;;
- -syllable*)
- os=-syllable
- ;;
- -386bsd)
- os=-bsd
- ;;
- -ctix* | -uts*)
- os=-sysv
- ;;
- -nova*)
- os=-rtmk-nova
- ;;
- -ns2 )
- os=-nextstep2
- ;;
- -nsk*)
- os=-nsk
- ;;
- # Preserve the version number of sinix5.
- -sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
- ;;
- -sinix*)
- os=-sysv4
- ;;
- -tpf*)
- os=-tpf
- ;;
- -triton*)
- os=-sysv3
- ;;
- -oss*)
- os=-sysv3
- ;;
- -svr4)
- os=-sysv4
- ;;
- -svr3)
- os=-sysv3
- ;;
- -sysvr4)
- os=-sysv4
- ;;
- # This must come after -sysvr4.
- -sysv*)
- ;;
- -ose*)
- os=-ose
- ;;
- -es1800*)
- os=-ose
- ;;
- -xenix)
- os=-xenix
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- os=-mint
- ;;
- -aros*)
- os=-aros
- ;;
- -kaos*)
- os=-kaos
- ;;
- -zvmoe)
- os=-zvmoe
- ;;
- -none)
- ;;
- *)
- # Get rid of the `-' at the beginning of $os.
- os=`echo $os | sed 's/[^-]*-//'`
- echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
- exit 1
- ;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system. Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
- *-acorn)
- os=-riscix1.2
- ;;
- arm*-rebel)
- os=-linux
- ;;
- arm*-semi)
- os=-aout
- ;;
- c4x-* | tic4x-*)
- os=-coff
- ;;
- # This must come before the *-dec entry.
- pdp10-*)
- os=-tops20
- ;;
- pdp11-*)
- os=-none
- ;;
- *-dec | vax-*)
- os=-ultrix4.2
- ;;
- m68*-apollo)
- os=-domain
- ;;
- i386-sun)
- os=-sunos4.0.2
- ;;
- m68000-sun)
- os=-sunos3
- # This also exists in the configure program, but was not the
- # default.
- # os=-sunos4
- ;;
- m68*-cisco)
- os=-aout
- ;;
- mips*-cisco)
- os=-elf
- ;;
- mips*-*)
- os=-elf
- ;;
- or32-*)
- os=-coff
- ;;
- *-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
- ;;
- sparc-* | *-sun)
- os=-sunos4.1.1
- ;;
- *-be)
- os=-beos
- ;;
- *-haiku)
- os=-haiku
- ;;
- *-ibm)
- os=-aix
- ;;
- *-knuth)
- os=-mmixware
- ;;
- *-wec)
- os=-proelf
- ;;
- *-winbond)
- os=-proelf
- ;;
- *-oki)
- os=-proelf
- ;;
- *-hp)
- os=-hpux
- ;;
- *-hitachi)
- os=-hiux
- ;;
- i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- os=-sysv
- ;;
- *-cbm)
- os=-amigaos
- ;;
- *-dg)
- os=-dgux
- ;;
- *-dolphin)
- os=-sysv3
- ;;
- m68k-ccur)
- os=-rtu
- ;;
- m88k-omron*)
- os=-luna
- ;;
- *-next )
- os=-nextstep
- ;;
- *-sequent)
- os=-ptx
- ;;
- *-crds)
- os=-unos
- ;;
- *-ns)
- os=-genix
- ;;
- i370-*)
- os=-mvs
- ;;
- *-next)
- os=-nextstep3
- ;;
- *-gould)
- os=-sysv
- ;;
- *-highlevel)
- os=-bsd
- ;;
- *-encore)
- os=-bsd
- ;;
- *-sgi)
- os=-irix
- ;;
- *-siemens)
- os=-sysv4
- ;;
- *-masscomp)
- os=-rtu
- ;;
- f30[01]-fujitsu | f700-fujitsu)
- os=-uxpv
- ;;
- *-rom68k)
- os=-coff
- ;;
- *-*bug)
- os=-coff
- ;;
- *-apple)
- os=-macos
- ;;
- *-atari*)
- os=-mint
- ;;
- *)
- os=-none
- ;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer. We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
- *-unknown)
- case $os in
- -riscix*)
- vendor=acorn
- ;;
- -sunos*)
- vendor=sun
- ;;
- -aix*)
- vendor=ibm
- ;;
- -beos*)
- vendor=be
- ;;
- -hpux*)
- vendor=hp
- ;;
- -mpeix*)
- vendor=hp
- ;;
- -hiux*)
- vendor=hitachi
- ;;
- -unos*)
- vendor=crds
- ;;
- -dgux*)
- vendor=dg
- ;;
- -luna*)
- vendor=omron
- ;;
- -genix*)
- vendor=ns
- ;;
- -mvs* | -opened*)
- vendor=ibm
- ;;
- -os400*)
- vendor=ibm
- ;;
- -ptx*)
- vendor=sequent
- ;;
- -tpf*)
- vendor=ibm
- ;;
- -vxsim* | -vxworks* | -windiss*)
- vendor=wrs
- ;;
- -aux*)
- vendor=apple
- ;;
- -hms*)
- vendor=hitachi
- ;;
- -mpw* | -macos*)
- vendor=apple
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- vendor=atari
- ;;
- -vos*)
- vendor=stratus
- ;;
- esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- ;;
-esac
-
-echo $basic_machine$os
-exit
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/source3/lib/tdb/configure.ac b/source3/lib/tdb/configure.ac
deleted file mode 100644
index eaf70d30b4..0000000000
--- a/source3/lib/tdb/configure.ac
+++ /dev/null
@@ -1,30 +0,0 @@
-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.2)
-AC_CONFIG_SRCDIR([common/tdb.c])
-AC_CONFIG_HEADER(include/config.h)
-AC_LIBREPLACE_ALL_CHECKS
-AC_LD_SONAMEFLAG
-AC_LD_PICFLAG
-AC_LD_SHLIBEXT
-AC_LIBREPLACE_SHLD
-AC_LIBREPLACE_SHLD_FLAGS
-AC_LIBREPLACE_RUNTIME_LIB_PATH_VAR
-m4_include(libtdb.m4)
-AC_PATH_PROGS([PYTHON_CONFIG], [python2.6-config python2.5-config python2.4-config python-config])
-AC_PATH_PROGS([PYTHON], [python2.6 python2.5 python2.4 python])
-
-PYTHON_BUILD_TARGET="build-python"
-PYTHON_INSTALL_TARGET="install-python"
-PYTHON_CHECK_TARGET="check-python"
-AC_SUBST(PYTHON_BUILD_TARGET)
-AC_SUBST(PYTHON_INSTALL_TARGET)
-AC_SUBST(PYTHON_CHECK_TARGET)
-if test -z "$PYTHON_CONFIG"; then
- PYTHON_BUILD_TARGET=""
- PYTHON_INSTALL_TARGET=""
- PYTHON_CHECK_TARGET=""
-fi
-AC_OUTPUT(Makefile tdb.pc)
diff --git a/source3/lib/tdb/docs/README b/source3/lib/tdb/docs/README
deleted file mode 100644
index 63fcf5e049..0000000000
--- a/source3/lib/tdb/docs/README
+++ /dev/null
@@ -1,238 +0,0 @@
-tdb - a trivial database system
-tridge@linuxcare.com December 1999
-==================================
-
-This is a simple database API. It was inspired by the realisation that
-in Samba we have several ad-hoc bits of code that essentially
-implement small databases for sharing structures between parts of
-Samba. As I was about to add another I realised that a generic
-database module was called for to replace all the ad-hoc bits.
-
-I based the interface on gdbm. I couldn't use gdbm as we need to be
-able to have multiple writers to the databases at one time.
-
-Compilation
------------
-
-add HAVE_MMAP=1 to use mmap instead of read/write
-add NOLOCK=1 to disable locking code
-
-Testing
--------
-
-Compile tdbtest.c and link with gdbm for testing. tdbtest will perform
-identical operations via tdb and gdbm then make sure the result is the
-same
-
-Also included is tdbtool, which allows simple database manipulation
-on the commandline.
-
-tdbtest and tdbtool are not built as part of Samba, but are included
-for completeness.
-
-Interface
----------
-
-The interface is very similar to gdbm except for the following:
-
-- different open interface. The tdb_open call is more similar to a
- traditional open()
-- no tdbm_reorganise() function
-- no tdbm_sync() function. No operations are cached in the library anyway
-- added a tdb_traverse() function for traversing the whole database
-- added transactions support
-
-A general rule for using tdb is that the caller frees any returned
-TDB_DATA structures. Just call free(p.dptr) to free a TDB_DATA
-return value called p. This is the same as gdbm.
-
-here is a full list of tdb functions with brief descriptions.
-
-
-----------------------------------------------------------------------
-TDB_CONTEXT *tdb_open(char *name, int hash_size, int tdb_flags,
- int open_flags, mode_t mode)
-
- open the database, creating it if necessary
-
- The open_flags and mode are passed straight to the open call on the database
- file. A flags value of O_WRONLY is invalid
-
- The hash size is advisory, use zero for a default value.
-
- return is NULL on error
-
- possible tdb_flags are:
- TDB_CLEAR_IF_FIRST - clear database if we are the only one with it open
- TDB_INTERNAL - don't use a file, instaed store the data in
- memory. The filename is ignored in this case.
- TDB_NOLOCK - don't do any locking
- TDB_NOMMAP - don't use mmap
- TDB_NOSYNC - don't synchronise transactions to disk
-
-----------------------------------------------------------------------
-TDB_CONTEXT *tdb_open_ex(char *name, int hash_size, int tdb_flags,
- int open_flags, mode_t mode,
- tdb_log_func log_fn,
- tdb_hash_func hash_fn)
-
-This is like tdb_open(), but allows you to pass an initial logging and
-hash function. Be careful when passing a hash function - all users of
-the database must use the same hash function or you will get data
-corruption.
-
-
-----------------------------------------------------------------------
-char *tdb_error(TDB_CONTEXT *tdb);
-
- return a error string for the last tdb error
-
-----------------------------------------------------------------------
-int tdb_close(TDB_CONTEXT *tdb);
-
- close a database
-
-----------------------------------------------------------------------
-int tdb_update(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf);
-
- update an entry in place - this only works if the new data size
- is <= the old data size and the key exists.
- on failure return -1
-
-----------------------------------------------------------------------
-TDB_DATA tdb_fetch(TDB_CONTEXT *tdb, TDB_DATA key);
-
- fetch an entry in the database given a key
- if the return value has a null dptr then a error occurred
-
- caller must free the resulting data
-
-----------------------------------------------------------------------
-int tdb_exists(TDB_CONTEXT *tdb, TDB_DATA key);
-
- check if an entry in the database exists
-
- note that 1 is returned if the key is found and 0 is returned if not found
- this doesn't match the conventions in the rest of this module, but is
- compatible with gdbm
-
-----------------------------------------------------------------------
-int tdb_traverse(TDB_CONTEXT *tdb, int (*fn)(TDB_CONTEXT *tdb,
- TDB_DATA key, TDB_DATA dbuf, void *state), void *state);
-
- traverse the entire database - calling fn(tdb, key, data, state) on each
- element.
-
- return -1 on error or the record count traversed
-
- if fn is NULL then it is not called
-
- a non-zero return value from fn() indicates that the traversal
- should stop. Traversal callbacks may not start transactions.
-
- WARNING: The data buffer given to the callback fn does NOT meet the
- alignment restrictions malloc gives you.
-
-----------------------------------------------------------------------
-int tdb_traverse_read(TDB_CONTEXT *tdb, int (*fn)(TDB_CONTEXT *tdb,
- TDB_DATA key, TDB_DATA dbuf, void *state), void *state);
-
- traverse the entire database - calling fn(tdb, key, data, state) on
- each element, but marking the database read only during the
- traversal, so any write operations will fail. This allows tdb to
- use read locks, which increases the parallelism possible during the
- traversal.
-
- return -1 on error or the record count traversed
-
- if fn is NULL then it is not called
-
- a non-zero return value from fn() indicates that the traversal
- should stop. Traversal callbacks may not start transactions.
-
-----------------------------------------------------------------------
-TDB_DATA tdb_firstkey(TDB_CONTEXT *tdb);
-
- find the first entry in the database and return its key
-
- the caller must free the returned data
-
-----------------------------------------------------------------------
-TDB_DATA tdb_nextkey(TDB_CONTEXT *tdb, TDB_DATA key);
-
- find the next entry in the database, returning its key
-
- the caller must free the returned data
-
-----------------------------------------------------------------------
-int tdb_delete(TDB_CONTEXT *tdb, TDB_DATA key);
-
- delete an entry in the database given a key
-
-----------------------------------------------------------------------
-int tdb_store(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, int flag);
-
- store an element in the database, replacing any existing element
- with the same key
-
- If flag==TDB_INSERT then don't overwrite an existing entry
- If flag==TDB_MODIFY then don't create a new entry
-
- return 0 on success, -1 on failure
-
-----------------------------------------------------------------------
-int tdb_writelock(TDB_CONTEXT *tdb);
-
- lock the database. If we already have it locked then don't do anything
-
-----------------------------------------------------------------------
-int tdb_writeunlock(TDB_CONTEXT *tdb);
- unlock the database
-
-----------------------------------------------------------------------
-int tdb_lockchain(TDB_CONTEXT *tdb, TDB_DATA key);
-
- lock one hash chain. This is meant to be used to reduce locking
- contention - it cannot guarantee how many records will be locked
-
-----------------------------------------------------------------------
-int tdb_unlockchain(TDB_CONTEXT *tdb, TDB_DATA key);
-
- unlock one hash chain
-
-----------------------------------------------------------------------
-int tdb_transaction_start(TDB_CONTEXT *tdb)
-
- start a transaction. All operations after the transaction start can
- either be committed with tdb_transaction_commit() or cancelled with
- tdb_transaction_cancel().
-
- If you call tdb_transaction_start() again on the same tdb context
- while a transaction is in progress, then the same transaction
- buffer is re-used. The number of tdb_transaction_{commit,cancel}
- operations must match the number of successful
- tdb_transaction_start() calls.
-
- Note that transactions are by default disk synchronous, and use a
- recover area in the database to automatically recover the database
- on the next open if the system crashes during a transaction. You
- can disable the synchronous transaction recovery setup using the
- TDB_NOSYNC flag, which will greatly speed up operations at the risk
- of corrupting your database if the system crashes.
-
- Operations made within a transaction are not visible to other users
- of the database until a successful commit.
-
-----------------------------------------------------------------------
-int tdb_transaction_cancel(TDB_CONTEXT *tdb)
-
- cancel a current transaction, discarding all write and lock
- operations that have been made since the transaction started.
-
-
-----------------------------------------------------------------------
-int tdb_transaction_commit(TDB_CONTEXT *tdb)
-
- commit a current transaction, updating the database and releasing
- the transaction locks.
-
diff --git a/source3/lib/tdb/docs/tdb.magic b/source3/lib/tdb/docs/tdb.magic
deleted file mode 100644
index f5619e7327..0000000000
--- a/source3/lib/tdb/docs/tdb.magic
+++ /dev/null
@@ -1,10 +0,0 @@
-# Magic file(1) information about tdb files.
-#
-# Install this into /etc/magic or the corresponding location for your
-# system, or pass as a -m argument to file(1).
-
-# You may use and redistribute this file without restriction.
-
-0 string TDB\ file TDB database
->32 lelong =0x2601196D version 6, little-endian
->>36 lelong x hash size %d bytes
diff --git a/source3/lib/tdb/include/tdb.h b/source3/lib/tdb/include/tdb.h
deleted file mode 100644
index 0008085de5..0000000000
--- a/source3/lib/tdb/include/tdb.h
+++ /dev/null
@@ -1,167 +0,0 @@
-#ifndef __TDB_H__
-#define __TDB_H__
-
-/*
- Unix SMB/CIFS implementation.
-
- trivial database library
-
- Copyright (C) Andrew Tridgell 1999-2004
-
- ** NOTE! The following LGPL license applies to the tdb
- ** 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 __cplusplus
-extern "C" {
-#endif
-
-
-/* flags to tdb_store() */
-#define TDB_REPLACE 1 /* Unused */
-#define TDB_INSERT 2 /* Don't overwrite an existing entry */
-#define TDB_MODIFY 3 /* Don't create an existing entry */
-
-/* flags for tdb_open() */
-#define TDB_DEFAULT 0 /* just a readability place holder */
-#define TDB_CLEAR_IF_FIRST 1
-#define TDB_INTERNAL 2 /* don't store on disk */
-#define TDB_NOLOCK 4 /* don't do any locking */
-#define TDB_NOMMAP 8 /* don't use mmap */
-#define TDB_CONVERT 16 /* convert endian (internal use) */
-#define TDB_BIGENDIAN 32 /* header is big-endian (internal use) */
-#define TDB_NOSYNC 64 /* don't use synchronous transactions */
-#define TDB_SEQNUM 128 /* maintain a sequence number */
-#define TDB_VOLATILE 256 /* Activate the per-hashchain freelist, default 5 */
-
-#define TDB_ERRCODE(code, ret) ((tdb->ecode = (code)), ret)
-
-/* error codes */
-enum TDB_ERROR {TDB_SUCCESS=0, TDB_ERR_CORRUPT, TDB_ERR_IO, TDB_ERR_LOCK,
- TDB_ERR_OOM, TDB_ERR_EXISTS, TDB_ERR_NOLOCK, TDB_ERR_LOCK_TIMEOUT,
- TDB_ERR_NOEXIST, TDB_ERR_EINVAL, TDB_ERR_RDONLY};
-
-/* debugging uses one of the following levels */
-enum tdb_debug_level {TDB_DEBUG_FATAL = 0, TDB_DEBUG_ERROR,
- TDB_DEBUG_WARNING, TDB_DEBUG_TRACE};
-
-typedef struct TDB_DATA {
- unsigned char *dptr;
- size_t dsize;
-} TDB_DATA;
-
-#ifndef PRINTF_ATTRIBUTE
-#if (__GNUC__ >= 3)
-/** Use gcc attribute to check printf fns. a1 is the 1-based index of
- * the parameter containing the format, and a2 the index of the first
- * argument. Note that some gcc 2.x versions don't handle this
- * properly **/
-#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2)))
-#else
-#define PRINTF_ATTRIBUTE(a1, a2)
-#endif
-#endif
-
-/* this is the context structure that is returned from a db open */
-typedef struct tdb_context TDB_CONTEXT;
-
-typedef int (*tdb_traverse_func)(struct tdb_context *, TDB_DATA, TDB_DATA, void *);
-typedef void (*tdb_log_func)(struct tdb_context *, enum tdb_debug_level, const char *, ...) PRINTF_ATTRIBUTE(3, 4);
-typedef unsigned int (*tdb_hash_func)(TDB_DATA *key);
-
-struct tdb_logging_context {
- tdb_log_func log_fn;
- void *log_private;
-};
-
-struct tdb_context *tdb_open(const char *name, int hash_size, int tdb_flags,
- int open_flags, mode_t mode);
-struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
- int open_flags, mode_t mode,
- const struct tdb_logging_context *log_ctx,
- tdb_hash_func hash_fn);
-void tdb_set_max_dead(struct tdb_context *tdb, int max_dead);
-
-int tdb_reopen(struct tdb_context *tdb);
-int tdb_reopen_all(int parent_longlived);
-void tdb_set_logging_function(struct tdb_context *tdb, const struct tdb_logging_context *log_ctx);
-enum TDB_ERROR tdb_error(struct tdb_context *tdb);
-const char *tdb_errorstr(struct tdb_context *tdb);
-TDB_DATA tdb_fetch(struct tdb_context *tdb, TDB_DATA key);
-int tdb_parse_record(struct tdb_context *tdb, TDB_DATA key,
- int (*parser)(TDB_DATA key, TDB_DATA data,
- void *private_data),
- void *private_data);
-int tdb_delete(struct tdb_context *tdb, TDB_DATA key);
-int tdb_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag);
-int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf);
-int tdb_close(struct tdb_context *tdb);
-TDB_DATA tdb_firstkey(struct tdb_context *tdb);
-TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA key);
-int tdb_traverse(struct tdb_context *tdb, tdb_traverse_func fn, void *);
-int tdb_traverse_read(struct tdb_context *tdb, tdb_traverse_func fn, void *);
-int tdb_exists(struct tdb_context *tdb, TDB_DATA key);
-int tdb_lockall(struct tdb_context *tdb);
-int tdb_lockall_nonblock(struct tdb_context *tdb);
-int tdb_unlockall(struct tdb_context *tdb);
-int tdb_lockall_read(struct tdb_context *tdb);
-int tdb_lockall_read_nonblock(struct tdb_context *tdb);
-int tdb_unlockall_read(struct tdb_context *tdb);
-int tdb_lockall_mark(struct tdb_context *tdb);
-int tdb_lockall_unmark(struct tdb_context *tdb);
-const char *tdb_name(struct tdb_context *tdb);
-int tdb_fd(struct tdb_context *tdb);
-tdb_log_func tdb_log_fn(struct tdb_context *tdb);
-void *tdb_get_logging_private(struct tdb_context *tdb);
-int tdb_transaction_start(struct tdb_context *tdb);
-int tdb_transaction_commit(struct tdb_context *tdb);
-int tdb_transaction_cancel(struct tdb_context *tdb);
-int tdb_transaction_recover(struct tdb_context *tdb);
-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);
-
-/* Low level locking functions: use with care */
-int tdb_chainlock(struct tdb_context *tdb, TDB_DATA key);
-int tdb_chainlock_nonblock(struct tdb_context *tdb, TDB_DATA key);
-int tdb_chainunlock(struct tdb_context *tdb, TDB_DATA key);
-int tdb_chainlock_read(struct tdb_context *tdb, TDB_DATA key);
-int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key);
-int tdb_chainlock_mark(struct tdb_context *tdb, TDB_DATA key);
-int tdb_chainlock_unmark(struct tdb_context *tdb, TDB_DATA key);
-
-void tdb_setalarm_sigptr(struct tdb_context *tdb, volatile sig_atomic_t *sigptr);
-
-/* Debug functions. Not used in production. */
-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;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* tdb.h */
diff --git a/source3/lib/tdb/install-sh b/source3/lib/tdb/install-sh
deleted file mode 100755
index 58719246f0..0000000000
--- a/source3/lib/tdb/install-sh
+++ /dev/null
@@ -1,238 +0,0 @@
-#! /bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-#
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- true
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- else
- instcmd=mkdir
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f $src -o -d $src ]
- then
- true
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- true
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- true
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
-
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
-
- pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
-
-# Make a temp file name in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd $src $dsttmp &&
-
- trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
diff --git a/source3/lib/tdb/libtdb.m4 b/source3/lib/tdb/libtdb.m4
deleted file mode 100644
index 1e17a7a4f2..0000000000
--- a/source3/lib/tdb/libtdb.m4
+++ /dev/null
@@ -1,30 +0,0 @@
-dnl find the tdb sources. This is meant to work both for
-dnl tdb standalone builds, and builds of packages using tdb
-tdbdir=""
-tdbpaths="$srcdir $srcdir/lib/tdb $srcdir/tdb $srcdir/../tdb"
-for d in $tdbpaths; do
- if test -f "$d/common/tdb.c"; then
- tdbdir="$d"
- AC_SUBST(tdbdir)
- break;
- fi
-done
-if test x"$tdbdir" = "x"; then
- AC_MSG_ERROR([cannot find tdb source in $tdbpaths])
-fi
-TDB_OBJ="common/tdb.o common/dump.o common/transaction.o common/error.o common/traverse.o"
-TDB_OBJ="$TDB_OBJ common/freelist.o common/freelistcheck.o common/io.o common/lock.o common/open.o"
-AC_SUBST(TDB_OBJ)
-AC_SUBST(LIBREPLACEOBJ)
-
-TDB_LIBS=""
-AC_SUBST(TDB_LIBS)
-
-TDB_CFLAGS="-I$tdbdir/include"
-AC_SUBST(TDB_CFLAGS)
-
-AC_CHECK_FUNCS(mmap pread pwrite getpagesize utime)
-AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h)
-
-AC_HAVE_DECL(pread, [#include <unistd.h>])
-AC_HAVE_DECL(pwrite, [#include <unistd.h>])
diff --git a/source3/lib/tdb/python.mk b/source3/lib/tdb/python.mk
deleted file mode 100644
index 12e8217df9..0000000000
--- a/source3/lib/tdb/python.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-[PYTHON::swig_tdb]
-LIBRARY_REALNAME = _tdb.$(SHLIBEXT)
-PUBLIC_DEPENDENCIES = LIBTDB DYNCONFIG
-
-swig_tdb_OBJ_FILES = $(tdbsrcdir)/tdb_wrap.o
-
-$(eval $(call python_py_module_template,tdb.py,$(tdbsrcdir)/tdb.py))
-
-$(swig_tdb_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
-
diff --git a/source3/lib/tdb/python/tdbdump.py b/source3/lib/tdb/python/tdbdump.py
deleted file mode 100644
index d759d771c8..0000000000
--- a/source3/lib/tdb/python/tdbdump.py
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/python
-# Trivial reimplementation of tdbdump in Python
-
-import tdb, sys
-
-if len(sys.argv) < 2:
- print "Usage: tdbdump.py <tdb-file>"
- sys.exit(1)
-
-db = tdb.Tdb(sys.argv[1])
-for (k, v) in db.iteritems():
- print "{\nkey(%d) = %r\ndata(%d) = %r\n}" % (len(k), k, len(v), v)
diff --git a/source3/lib/tdb/python/tests/simple.py b/source3/lib/tdb/python/tests/simple.py
deleted file mode 100644
index 7147718c91..0000000000
--- a/source3/lib/tdb/python/tests/simple.py
+++ /dev/null
@@ -1,152 +0,0 @@
-#!/usr/bin/python
-# Some simple tests for the Python bindings for TDB
-# Note that this tests the interface of the Python bindings
-# It does not test tdb itself.
-#
-# Copyright (C) 2007-2008 Jelmer Vernooij <jelmer@samba.org>
-# Published under the GNU LGPLv3 or later
-
-import tdb
-from unittest import TestCase
-import os, tempfile
-
-
-class OpenTdbTests(TestCase):
- def test_nonexistant_read(self):
- self.assertRaises(IOError, tdb.Tdb, "/some/nonexistant/file", 0, tdb.DEFAULT, os.O_RDWR)
-
-
-class SimpleTdbTests(TestCase):
- def setUp(self):
- super(SimpleTdbTests, self).setUp()
- self.tdb = tdb.Tdb(tempfile.mkstemp()[1], 0, tdb.DEFAULT, os.O_CREAT|os.O_RDWR)
- self.assertNotEqual(None, self.tdb)
-
- def tearDown(self):
- del self.tdb
-
- def test_repr(self):
- self.assertTrue(repr(self.tdb).startswith("Tdb('"))
-
- def test_lockall(self):
- self.tdb.lock_all()
-
- def test_max_dead(self):
- self.tdb.max_dead = 20
-
- def test_unlockall(self):
- self.tdb.lock_all()
- self.tdb.unlock_all()
-
- def test_lockall_read(self):
- self.tdb.read_lock_all()
- self.tdb.read_unlock_all()
-
- def test_reopen(self):
- self.tdb.reopen()
-
- def test_store(self):
- self.tdb.store("bar", "bla")
- self.assertEquals("bla", self.tdb.get("bar"))
-
- def test_getitem(self):
- self.tdb["bar"] = "foo"
- self.tdb.reopen()
- self.assertEquals("foo", self.tdb["bar"])
-
- def test_delete(self):
- self.tdb["bar"] = "foo"
- del self.tdb["bar"]
- self.assertRaises(KeyError, lambda: self.tdb["bar"])
-
- def test_contains(self):
- self.tdb["bla"] = "bloe"
- self.assertTrue("bla" in self.tdb)
-
- def test_keyerror(self):
- self.assertRaises(KeyError, lambda: self.tdb["bla"])
-
- def test_hash_size(self):
- self.tdb.hash_size
-
- def test_map_size(self):
- self.tdb.map_size
-
- def test_name(self):
- self.tdb.name
-
- def test_iterator(self):
- self.tdb["bla"] = "1"
- self.tdb["brainslug"] = "2"
- self.assertEquals(["bla", "brainslug"], list(self.tdb))
-
- def test_items(self):
- self.tdb["bla"] = "1"
- self.tdb["brainslug"] = "2"
- self.assertEquals([("bla", "1"), ("brainslug", "2")], self.tdb.items())
-
- def test_iteritems(self):
- self.tdb["bloe"] = "2"
- self.tdb["bla"] = "25"
- i = self.tdb.iteritems()
- self.assertEquals(set([("bla", "25"), ("bloe", "2")]),
- set([i.next(), i.next()]))
-
- def test_transaction_cancel(self):
- self.tdb["bloe"] = "2"
- self.tdb.transaction_start()
- self.tdb["bloe"] = "1"
- self.tdb.transaction_cancel()
- self.assertEquals("2", self.tdb["bloe"])
-
- def test_transaction_commit(self):
- self.tdb["bloe"] = "2"
- self.tdb.transaction_start()
- self.tdb["bloe"] = "1"
- self.tdb.transaction_commit()
- self.assertEquals("1", self.tdb["bloe"])
-
- def test_iterator(self):
- self.tdb["bloe"] = "2"
- self.tdb["bla"] = "hoi"
- i = iter(self.tdb)
- self.assertEquals(set(["bloe", "bla"]), set([i.next(), i.next()]))
-
- def test_keys(self):
- self.tdb["bloe"] = "2"
- self.tdb["bla"] = "25"
- self.assertEquals(["bla", "bloe"], self.tdb.keys())
-
- def test_iterkeys(self):
- self.tdb["bloe"] = "2"
- self.tdb["bla"] = "25"
- i = self.tdb.iterkeys()
- self.assertEquals(set(["bloe", "bla"]), set([i.next(), i.next()]))
-
- def test_values(self):
- self.tdb["bloe"] = "2"
- self.tdb["bla"] = "25"
- self.assertEquals(["25", "2"], self.tdb.values())
-
- def test_itervalues(self):
- self.tdb["bloe"] = "2"
- self.tdb["bla"] = "25"
- i = self.tdb.itervalues()
- self.assertEquals(set(["25", "2"]), set([i.next(), i.next()]))
-
- def test_clear(self):
- self.tdb["bloe"] = "2"
- self.tdb["bla"] = "25"
- self.assertEquals(2, len(self.tdb))
- self.tdb.clear()
- self.assertEquals(0, len(self.tdb))
-
- def test_len(self):
- self.assertEquals(0, len(self.tdb))
- self.tdb["entry"] = "value"
- self.assertEquals(1, len(self.tdb))
-
-
-if __name__ == '__main__':
- import unittest
- unittest.TestProgram()
diff --git a/source3/lib/tdb/rules.mk b/source3/lib/tdb/rules.mk
deleted file mode 100644
index 7b765625df..0000000000
--- a/source3/lib/tdb/rules.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-.SUFFIXES: .i _wrap.c
-
-.i_wrap.c:
- $(SWIG) -O -Wall -python -keyword $<
-
-showflags::
- @echo 'tdb will be compiled with flags:'
- @echo ' CFLAGS = $(CFLAGS)'
- @echo ' CPPFLAGS = $(CPPFLAGS)'
- @echo ' LDFLAGS = $(LDFLAGS)'
- @echo ' LIBS = $(LIBS)'
-
-.SUFFIXES: .c .o
-
-.c.o:
- @echo Compiling $*.c
- @mkdir -p `dirname $@`
- @$(CC) $(PICFLAG) $(CFLAGS) -c $< -o $@
-
-distclean::
- rm -f *~ */*~
diff --git a/source3/lib/tdb/tdb.i b/source3/lib/tdb/tdb.i
deleted file mode 100644
index 3d8b697732..0000000000
--- a/source3/lib/tdb/tdb.i
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- Swig interface to tdb.
-
- Copyright (C) 2004-2006 Tim Potter <tpot@samba.org>
- Copyright (C) 2007 Jelmer Vernooij <jelmer@samba.org>
-
- ** NOTE! The following LGPL license applies to the tdb
- ** 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/>.
-*/
-
-%define DOCSTRING
-"TDB is a simple key-value database similar to GDBM that supports multiple writers."
-%enddef
-
-%module(docstring=DOCSTRING) tdb
-
-%{
-
-/* This symbol is used in both includes.h and Python.h which causes an
- annoying compiler warning. */
-
-#ifdef HAVE_FSTAT
-#undef HAVE_FSTAT
-#endif
-
-/* Include tdb headers */
-#include <stdint.h>
-#include <signal.h>
-#include <tdb.h>
-#include <fcntl.h>
-
-typedef TDB_CONTEXT tdb;
-%}
-
-/* The tdb functions will crash if a NULL tdb context is passed */
-
-%import exception.i
-%import stdint.i
-
-%typemap(check,noblock=1) TDB_CONTEXT* {
- if ($1 == NULL)
- SWIG_exception(SWIG_ValueError,
- "tdb context must be non-NULL");
-}
-
-/* In and out typemaps for the TDB_DATA structure. This is converted to
- and from the Python string type which can contain arbitrary binary
- data.. */
-
-%typemap(in,noblock=1) TDB_DATA {
- if ($input == Py_None) {
- $1.dsize = 0;
- $1.dptr = NULL;
- } else if (!PyString_Check($input)) {
- PyErr_SetString(PyExc_TypeError, "string arg expected");
- return NULL;
- } else {
- $1.dsize = PyString_Size($input);
- $1.dptr = (uint8_t *)PyString_AsString($input);
- }
-}
-
-%typemap(out,noblock=1) TDB_DATA {
- if ($1.dptr == NULL && $1.dsize == 0) {
- $result = Py_None;
- } else {
- $result = PyString_FromStringAndSize((const char *)$1.dptr, $1.dsize);
- free($1.dptr);
- }
-}
-
-/* Treat a mode_t as an unsigned integer */
-typedef int mode_t;
-
-/* flags to tdb_store() */
-%constant int REPLACE = TDB_REPLACE;
-%constant int INSERT = TDB_INSERT;
-%constant int MODIFY = TDB_MODIFY;
-
-/* flags for tdb_open() */
-%constant int DEFAULT = TDB_DEFAULT;
-%constant int CLEAR_IF_FIRST = TDB_CLEAR_IF_FIRST;
-%constant int INTERNAL = TDB_INTERNAL;
-%constant int NOLOCK = TDB_NOLOCK;
-%constant int NOMMAP = TDB_NOMMAP;
-%constant int CONVERT = TDB_CONVERT;
-%constant int BIGENDIAN = TDB_BIGENDIAN;
-
-enum TDB_ERROR {
- TDB_SUCCESS=0,
- TDB_ERR_CORRUPT,
- TDB_ERR_IO,
- TDB_ERR_LOCK,
- TDB_ERR_OOM,
- TDB_ERR_EXISTS,
- TDB_ERR_NOLOCK,
- TDB_ERR_LOCK_TIMEOUT,
- TDB_ERR_NOEXIST,
- TDB_ERR_EINVAL,
- TDB_ERR_RDONLY
-};
-
-%rename(lock_all) tdb_context::lockall;
-%rename(unlock_all) tdb_context::unlockall;
-
-%rename(read_lock_all) tdb_context::lockall_read;
-%rename(read_unlock_all) tdb_context::unlockall_read;
-
-%typemap(default,noblock=1) int tdb_flags {
- $1 = TDB_DEFAULT;
-}
-
-%typemap(default,noblock=1) int flags {
- $1 = O_RDWR;
-}
-
-%typemap(default,noblock=1) int hash_size {
- $1 = 0;
-}
-
-%typemap(default,noblock=1) mode_t mode {
- $1 = 0600;
-}
-
-%typemap(default,noblock=1) int flag {
- $1 = TDB_REPLACE;
-}
-
-%rename(Tdb) tdb_context;
-%feature("docstring") tdb_context "A TDB file.";
-%typemap(out,noblock=1) tdb * {
- /* Throw an IOError exception from errno if tdb_open() returns NULL */
- if ($1 == NULL) {
- PyErr_SetFromErrno(PyExc_IOError);
- SWIG_fail;
- }
- $result = SWIG_NewPointerObj($1, $1_descriptor, 0);
-}
-
-typedef struct tdb_context {
- %extend {
- %feature("docstring") tdb "S.__init__(name,hash_size=0,tdb_flags=TDB_DEFAULT,flags=O_RDWR,mode=0600)\n"
- "Open a TDB file.";
- tdb(const char *name, int hash_size, int tdb_flags, int flags, mode_t mode) {
- return tdb_open(name, hash_size, tdb_flags, flags, mode);
- }
- %feature("docstring") error "S.error() -> int\n"
- "Find last error number returned by operation on this TDB.";
- enum TDB_ERROR error();
- ~tdb() { tdb_close($self); }
- %feature("docstring") close "S.close() -> None\n"
- "Close the TDB file.";
- int close();
- int append(TDB_DATA key, TDB_DATA new_dbuf);
- %feature("docstring") errorstr "S.errorstr() -> errorstring\n"
- "Obtain last error message.";
- const char *errorstr();
- %rename(get) fetch;
- %feature("docstring") fetch "S.fetch(key) -> value\n"
- "Fetch a value.";
- TDB_DATA fetch(TDB_DATA key);
- %feature("docstring") delete "S.delete(key) -> None\n"
- "Delete an entry.";
- int delete(TDB_DATA key);
- %feature("docstring") store "S.store(key, value, flag=TDB_REPLACE) -> None\n"
- "Store an entry.";
- int store(TDB_DATA key, TDB_DATA dbuf, int flag);
- %feature("docstring") exists "S.exists(key) -> bool\n"
- "Check whether key exists in this database.";
- int exists(TDB_DATA key);
- %feature("docstring") firstkey "S.firstkey() -> data\n"
- "Return the first key in this database.";
- TDB_DATA firstkey();
- %feature("docstring") nextkey "S.nextkey(prev) -> data\n"
- "Return the next key in this database.";
- TDB_DATA nextkey(TDB_DATA key);
- %feature("docstring") lockall "S.lockall() -> bool";
- int lockall();
- %feature("docstring") unlockall "S.unlockall() -> bool";
- int unlockall();
- %feature("docstring") unlockall "S.lockall_read() -> bool";
- int lockall_read();
- %feature("docstring") unlockall "S.unlockall_read() -> bool";
- int unlockall_read();
- %feature("docstring") reopen "S.reopen() -> bool\n"
- "Reopen this file.";
- int reopen();
- %feature("docstring") transaction_start "S.transaction_start() -> None\n"
- "Start a new transaction.";
- int transaction_start();
- %feature("docstring") transaction_commit "S.transaction_commit() -> None\n"
- "Commit the currently active transaction.";
- int transaction_commit();
- %feature("docstring") transaction_cancel "S.transaction_cancel() -> None\n"
- "Cancel the currently active transaction.";
- int transaction_cancel();
- int transaction_recover();
- %feature("docstring") hash_size "S.hash_size() -> int";
- int hash_size();
- %feature("docstring") map_size "S.map_size() -> int";
- size_t map_size();
- %feature("docstring") get_flags "S.get_flags() -> int";
- int get_flags();
- %feature("docstring") set_max_dead "S.set_max_dead(int) -> None";
- void set_max_dead(int max_dead);
- %feature("docstring") name "S.name() -> path\n" \
- "Return filename of this TDB file.";
- const char *name();
- }
-
- %pythoncode {
- def __repr__(self):
- return "Tdb('%s')" % self.name()
-
- # Random access to keys, values
- def __getitem__(self, key):
- result = self.get(key)
- if result is None:
- raise KeyError, '%s: %s' % (key, self.errorstr())
- return result
-
- def __setitem__(self, key, item):
- if self.store(key, item) == -1:
- raise IOError, self.errorstr()
-
- def __delitem__(self, key):
- if not self.exists(key):
- raise KeyError, '%s: %s' % (key, self.errorstr())
- self.delete(key)
-
- def __contains__(self, key):
- return self.exists(key) != 0
-
- def has_key(self, key):
- return self.exists(key) != 0
-
- def fetch_uint32(self, key):
- data = self.get(key)
- if data is None:
- return None
- import struct
- return struct.unpack("<L", data)[0]
-
- def fetch_int32(self, key):
- data = self.get(key)
- if data is None:
- return None
- import struct
- return struct.unpack("<l", data)[0]
-
- # Tdb iterator
- class TdbIterator:
- def __init__(self, tdb):
- self.tdb = tdb
- self.key = None
-
- def __iter__(self):
- return self
-
- def next(self):
- if self.key is None:
- self.key = self.tdb.firstkey()
- if self.key is None:
- raise StopIteration
- return self.key
- else:
- self.key = self.tdb.nextkey(self.key)
- if self.key is None:
- raise StopIteration
- return self.key
-
- def __iter__(self):
- return self.TdbIterator(self)
-
- # Implement other dict functions using TdbIterator
-
- def keys(self):
- return [k for k in iter(self)]
-
- def values(self):
- return [self[k] for k in iter(self)]
-
- def items(self):
- return [(k, self[k]) for k in iter(self)]
-
- def __len__(self):
- return len(self.keys())
-
- def clear(self):
- for k in iter(self):
- del(self[k])
-
- def iterkeys(self):
- for k in iter(self):
- yield k
-
- def itervalues(self):
- for k in iter(self):
- yield self[k]
-
- def iteritems(self):
- for k in iter(self):
- yield (k, self[k])
-
- # TODO: any other missing methods for container types
- }
-} tdb;
diff --git a/source3/lib/tdb/tdb.mk b/source3/lib/tdb/tdb.mk
deleted file mode 100644
index fa8db6d34c..0000000000
--- a/source3/lib/tdb/tdb.mk
+++ /dev/null
@@ -1,86 +0,0 @@
-dirs::
- @mkdir -p bin common tools
-
-PROGS = bin/tdbtool$(EXEEXT) bin/tdbdump$(EXEEXT) bin/tdbbackup$(EXEEXT)
-PROGS_NOINSTALL = bin/tdbtest$(EXEEXT) bin/tdbtorture$(EXEEXT)
-ALL_PROGS = $(PROGS) $(PROGS_NOINSTALL)
-
-TDB_SONAME = libtdb.$(SHLIBEXT).1
-TDB_SOLIB = libtdb.$(SHLIBEXT).$(PACKAGE_VERSION)
-
-TDB_LIB = libtdb.a
-
-bin/tdbtest$(EXEEXT): tools/tdbtest.o $(TDB_LIB)
- $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtest tools/tdbtest.o -L. -ltdb -lgdbm
-
-bin/tdbtool$(EXEEXT): tools/tdbtool.o $(TDB_LIB)
- $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtool tools/tdbtool.o -L. -ltdb
-
-bin/tdbtorture$(EXEEXT): tools/tdbtorture.o $(TDB_LIB)
- $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbtorture tools/tdbtorture.o -L. -ltdb
-
-bin/tdbdump$(EXEEXT): tools/tdbdump.o $(TDB_LIB)
- $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbdump tools/tdbdump.o -L. -ltdb
-
-bin/tdbbackup$(EXEEXT): tools/tdbbackup.o $(TDB_LIB)
- $(CC) $(CFLAGS) $(LDFLAGS) -o bin/tdbbackup tools/tdbbackup.o -L. -ltdb
-
-test:: bin/tdbtorture$(EXEEXT) $(TDB_SONAME)
- $(LIB_PATH_VAR)=. bin/tdbtorture$(EXEEXT)
-
-clean::
- rm -f test.db test.tdb torture.tdb test.gdbm
- rm -f $(TDB_SONAME) $(TDB_SOLIB) libtdb.a libtdb.$(SHLIBEXT)
- rm -f $(ALL_PROGS) tdb.pc
-
-build-python:: _tdb.$(SHLIBEXT)
-
-tdb_wrap.o: $(tdbdir)/tdb_wrap.c
- $(CC) $(PICFLAG) -c $(tdbdir)/tdb_wrap.c $(CFLAGS) `$(PYTHON_CONFIG) --cflags`
-
-_tdb.$(SHLIBEXT): libtdb.$(SHLIBEXT) tdb_wrap.o
- $(SHLD) $(SHLD_FLAGS) -o $@ tdb_wrap.o -L. -ltdb `$(PYTHON_CONFIG) --ldflags`
-
-install:: installdirs installbin installheaders installlibs \
- $(PYTHON_INSTALL_TARGET)
-
-install-python:: build-python
- mkdir -p $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(0, prefix='$(prefix)')"` \
- $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"`
- cp $(tdbdir)/tdb.py $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(0, prefix='$(prefix)')"`
- cp _tdb.$(SHLIBEXT) $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"`
-
-check-python:: build-python $(TDB_SONAME)
- $(LIB_PATH_VAR)=. PYTHONPATH=".:$(tdbdir)" $(PYTHON) $(tdbdir)/python/tests/simple.py
-
-install-swig::
- mkdir -p $(DESTDIR)`$(SWIG) -swiglib`
- cp tdb.i $(DESTDIR)`$(SWIG) -swiglib`
-
-clean::
- rm -f _tdb.$(SHLIBEXT)
-
-installdirs::
- mkdir -p $(DESTDIR)$(bindir)
- mkdir -p $(DESTDIR)$(includedir)
- mkdir -p $(DESTDIR)$(libdir)
- mkdir -p $(DESTDIR)$(libdir)/pkgconfig
-
-installbin:: all installdirs
- cp $(PROGS) $(DESTDIR)$(bindir)
-
-installheaders:: installdirs
- cp $(srcdir)/include/tdb.h $(DESTDIR)$(includedir)
-
-installlibs:: all installdirs
- cp tdb.pc $(DESTDIR)$(libdir)/pkgconfig
- cp libtdb.a $(TDB_SOLIB) $(DESTDIR)$(libdir)
-
-libtdb.a: $(TDB_OBJ)
- ar -rv libtdb.a $(TDB_OBJ)
-
-libtdb.$(SHLIBEXT): $(TDB_SOLIB)
- ln -fs $< $@
-
-$(TDB_SONAME): $(TDB_SOLIB)
- ln -fs $< $@
diff --git a/source3/lib/tdb/tdb.pc.in b/source3/lib/tdb/tdb.pc.in
deleted file mode 100644
index 6f8f553736..0000000000
--- a/source3/lib/tdb/tdb.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: tdb
-Description: A trivial database
-Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -ltdb
-Cflags: -I${includedir}
-URL: http://tdb.samba.org/
diff --git a/source3/lib/tdb/tdb.py b/source3/lib/tdb/tdb.py
deleted file mode 100644
index 9f306bab8c..0000000000
--- a/source3/lib/tdb/tdb.py
+++ /dev/null
@@ -1,341 +0,0 @@
-# This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.35
-#
-# Don't modify this file, modify the SWIG interface instead.
-
-"""
-TDB is a simple key-value database similar to GDBM that supports multiple writers.
-"""
-
-import _tdb
-import new
-new_instancemethod = new.instancemethod
-try:
- _swig_property = property
-except NameError:
- pass # Python < 2.2 doesn't have 'property'.
-def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
- if (name == "thisown"): return self.this.own(value)
- if (name == "this"):
- if type(value).__name__ == 'PySwigObject':
- self.__dict__[name] = value
- return
- method = class_type.__swig_setmethods__.get(name,None)
- if method: return method(self,value)
- if (not static) or hasattr(self,name):
- self.__dict__[name] = value
- else:
- raise AttributeError("You cannot add attributes to %s" % self)
-
-def _swig_setattr(self,class_type,name,value):
- return _swig_setattr_nondynamic(self,class_type,name,value,0)
-
-def _swig_getattr(self,class_type,name):
- if (name == "thisown"): return self.this.own()
- method = class_type.__swig_getmethods__.get(name,None)
- if method: return method(self)
- raise AttributeError,name
-
-def _swig_repr(self):
- try: strthis = "proxy of " + self.this.__repr__()
- except: strthis = ""
- return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
-
-import types
-try:
- _object = types.ObjectType
- _newclass = 1
-except AttributeError:
- class _object : pass
- _newclass = 0
-del types
-
-
-def _swig_setattr_nondynamic_method(set):
- def set_attr(self,name,value):
- if (name == "thisown"): return self.this.own(value)
- if hasattr(self,name) or (name == "this"):
- set(self,name,value)
- else:
- raise AttributeError("You cannot add attributes to %s" % self)
- return set_attr
-
-
-REPLACE = _tdb.REPLACE
-INSERT = _tdb.INSERT
-MODIFY = _tdb.MODIFY
-DEFAULT = _tdb.DEFAULT
-CLEAR_IF_FIRST = _tdb.CLEAR_IF_FIRST
-INTERNAL = _tdb.INTERNAL
-NOLOCK = _tdb.NOLOCK
-NOMMAP = _tdb.NOMMAP
-CONVERT = _tdb.CONVERT
-BIGENDIAN = _tdb.BIGENDIAN
-TDB_SUCCESS = _tdb.TDB_SUCCESS
-TDB_ERR_CORRUPT = _tdb.TDB_ERR_CORRUPT
-TDB_ERR_IO = _tdb.TDB_ERR_IO
-TDB_ERR_LOCK = _tdb.TDB_ERR_LOCK
-TDB_ERR_OOM = _tdb.TDB_ERR_OOM
-TDB_ERR_EXISTS = _tdb.TDB_ERR_EXISTS
-TDB_ERR_NOLOCK = _tdb.TDB_ERR_NOLOCK
-TDB_ERR_LOCK_TIMEOUT = _tdb.TDB_ERR_LOCK_TIMEOUT
-TDB_ERR_NOEXIST = _tdb.TDB_ERR_NOEXIST
-TDB_ERR_EINVAL = _tdb.TDB_ERR_EINVAL
-TDB_ERR_RDONLY = _tdb.TDB_ERR_RDONLY
-class Tdb(object):
- """A TDB file."""
- thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
- __repr__ = _swig_repr
- def __init__(self, *args, **kwargs):
- """
- S.__init__(name,hash_size=0,tdb_flags=TDB_DEFAULT,flags=O_RDWR,mode=0600)
- Open a TDB file.
- """
- _tdb.Tdb_swiginit(self,_tdb.new_Tdb(*args, **kwargs))
- def error(*args, **kwargs):
- """
- S.error() -> int
- Find last error number returned by operation on this TDB.
- """
- return _tdb.Tdb_error(*args, **kwargs)
-
- __swig_destroy__ = _tdb.delete_Tdb
- def close(*args, **kwargs):
- """
- S.close() -> None
- Close the TDB file.
- """
- return _tdb.Tdb_close(*args, **kwargs)
-
- def errorstr(*args, **kwargs):
- """
- S.errorstr() -> errorstring
- Obtain last error message.
- """
- return _tdb.Tdb_errorstr(*args, **kwargs)
-
- def get(*args, **kwargs):
- """
- S.fetch(key) -> value
- Fetch a value.
- """
- return _tdb.Tdb_get(*args, **kwargs)
-
- def delete(*args, **kwargs):
- """
- S.delete(key) -> None
- Delete an entry.
- """
- return _tdb.Tdb_delete(*args, **kwargs)
-
- def store(*args, **kwargs):
- """
- S.store(key, value, flag=TDB_REPLACE) -> None
- Store an entry.
- """
- return _tdb.Tdb_store(*args, **kwargs)
-
- def exists(*args, **kwargs):
- """
- S.exists(key) -> bool
- Check whether key exists in this database.
- """
- return _tdb.Tdb_exists(*args, **kwargs)
-
- def firstkey(*args, **kwargs):
- """
- S.firstkey() -> data
- Return the first key in this database.
- """
- return _tdb.Tdb_firstkey(*args, **kwargs)
-
- def nextkey(*args, **kwargs):
- """
- S.nextkey(prev) -> data
- Return the next key in this database.
- """
- return _tdb.Tdb_nextkey(*args, **kwargs)
-
- def lock_all(*args, **kwargs):
- """S.lockall() -> bool"""
- return _tdb.Tdb_lock_all(*args, **kwargs)
-
- def unlock_all(*args, **kwargs):
- """S.unlockall() -> bool"""
- return _tdb.Tdb_unlock_all(*args, **kwargs)
-
- def reopen(*args, **kwargs):
- """
- S.reopen() -> bool
- Reopen this file.
- """
- return _tdb.Tdb_reopen(*args, **kwargs)
-
- def transaction_start(*args, **kwargs):
- """
- S.transaction_start() -> None
- Start a new transaction.
- """
- return _tdb.Tdb_transaction_start(*args, **kwargs)
-
- def transaction_commit(*args, **kwargs):
- """
- S.transaction_commit() -> None
- Commit the currently active transaction.
- """
- return _tdb.Tdb_transaction_commit(*args, **kwargs)
-
- def transaction_cancel(*args, **kwargs):
- """
- S.transaction_cancel() -> None
- Cancel the currently active transaction.
- """
- return _tdb.Tdb_transaction_cancel(*args, **kwargs)
-
- def hash_size(*args, **kwargs):
- """S.hash_size() -> int"""
- return _tdb.Tdb_hash_size(*args, **kwargs)
-
- def map_size(*args, **kwargs):
- """S.map_size() -> int"""
- return _tdb.Tdb_map_size(*args, **kwargs)
-
- def get_flags(*args, **kwargs):
- """S.get_flags() -> int"""
- return _tdb.Tdb_get_flags(*args, **kwargs)
-
- def set_max_dead(*args, **kwargs):
- """S.set_max_dead(int) -> None"""
- return _tdb.Tdb_set_max_dead(*args, **kwargs)
-
- def name(*args, **kwargs):
- """
- S.name() -> path
- Return filename of this TDB file.
- """
- return _tdb.Tdb_name(*args, **kwargs)
-
- def __repr__(self):
- return "Tdb('%s')" % self.name()
-
-
- def __getitem__(self, key):
- result = self.get(key)
- if result is None:
- raise KeyError, '%s: %s' % (key, self.errorstr())
- return result
-
- def __setitem__(self, key, item):
- if self.store(key, item) == -1:
- raise IOError, self.errorstr()
-
- def __delitem__(self, key):
- if not self.exists(key):
- raise KeyError, '%s: %s' % (key, self.errorstr())
- self.delete(key)
-
- def __contains__(self, key):
- return self.exists(key) != 0
-
- def has_key(self, key):
- return self.exists(key) != 0
-
- def fetch_uint32(self, key):
- data = self.get(key)
- if data is None:
- return None
- import struct
- return struct.unpack("<L", data)[0]
-
- def fetch_int32(self, key):
- data = self.get(key)
- if data is None:
- return None
- import struct
- return struct.unpack("<l", data)[0]
-
-
- class TdbIterator:
- def __init__(self, tdb):
- self.tdb = tdb
- self.key = None
-
- def __iter__(self):
- return self
-
- def next(self):
- if self.key is None:
- self.key = self.tdb.firstkey()
- if self.key is None:
- raise StopIteration
- return self.key
- else:
- self.key = self.tdb.nextkey(self.key)
- if self.key is None:
- raise StopIteration
- return self.key
-
- def __iter__(self):
- return self.TdbIterator(self)
-
-
-
- def keys(self):
- return [k for k in iter(self)]
-
- def values(self):
- return [self[k] for k in iter(self)]
-
- def items(self):
- return [(k, self[k]) for k in iter(self)]
-
- def __len__(self):
- return len(self.keys())
-
- def clear(self):
- for k in iter(self):
- del(self[k])
-
- def iterkeys(self):
- for k in iter(self):
- yield k
-
- def itervalues(self):
- for k in iter(self):
- yield self[k]
-
- def iteritems(self):
- for k in iter(self):
- yield (k, self[k])
-
-
-
-Tdb.error = new_instancemethod(_tdb.Tdb_error,None,Tdb)
-Tdb.close = new_instancemethod(_tdb.Tdb_close,None,Tdb)
-Tdb.append = new_instancemethod(_tdb.Tdb_append,None,Tdb)
-Tdb.errorstr = new_instancemethod(_tdb.Tdb_errorstr,None,Tdb)
-Tdb.get = new_instancemethod(_tdb.Tdb_get,None,Tdb)
-Tdb.delete = new_instancemethod(_tdb.Tdb_delete,None,Tdb)
-Tdb.store = new_instancemethod(_tdb.Tdb_store,None,Tdb)
-Tdb.exists = new_instancemethod(_tdb.Tdb_exists,None,Tdb)
-Tdb.firstkey = new_instancemethod(_tdb.Tdb_firstkey,None,Tdb)
-Tdb.nextkey = new_instancemethod(_tdb.Tdb_nextkey,None,Tdb)
-Tdb.lock_all = new_instancemethod(_tdb.Tdb_lock_all,None,Tdb)
-Tdb.unlock_all = new_instancemethod(_tdb.Tdb_unlock_all,None,Tdb)
-Tdb.read_lock_all = new_instancemethod(_tdb.Tdb_read_lock_all,None,Tdb)
-Tdb.read_unlock_all = new_instancemethod(_tdb.Tdb_read_unlock_all,None,Tdb)
-Tdb.reopen = new_instancemethod(_tdb.Tdb_reopen,None,Tdb)
-Tdb.transaction_start = new_instancemethod(_tdb.Tdb_transaction_start,None,Tdb)
-Tdb.transaction_commit = new_instancemethod(_tdb.Tdb_transaction_commit,None,Tdb)
-Tdb.transaction_cancel = new_instancemethod(_tdb.Tdb_transaction_cancel,None,Tdb)
-Tdb.transaction_recover = new_instancemethod(_tdb.Tdb_transaction_recover,None,Tdb)
-Tdb.hash_size = new_instancemethod(_tdb.Tdb_hash_size,None,Tdb)
-Tdb.map_size = new_instancemethod(_tdb.Tdb_map_size,None,Tdb)
-Tdb.get_flags = new_instancemethod(_tdb.Tdb_get_flags,None,Tdb)
-Tdb.set_max_dead = new_instancemethod(_tdb.Tdb_set_max_dead,None,Tdb)
-Tdb.name = new_instancemethod(_tdb.Tdb_name,None,Tdb)
-Tdb_swigregister = _tdb.Tdb_swigregister
-Tdb_swigregister(Tdb)
-
-
-
diff --git a/source3/lib/tdb/tdb_wrap.c b/source3/lib/tdb/tdb_wrap.c
deleted file mode 100644
index 32665d79fd..0000000000
--- a/source3/lib/tdb/tdb_wrap.c
+++ /dev/null
@@ -1,4307 +0,0 @@
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * This file is not intended to be easily readable and contains a number of
- * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG
- * interface file instead.
- * ----------------------------------------------------------------------------- */
-
-#define SWIGPYTHON
-#define SWIG_PYTHON_NO_BUILD_NONE
-/* -----------------------------------------------------------------------------
- * This section contains generic SWIG labels for method/variable
- * declarations/attributes, and other compiler dependent labels.
- * ----------------------------------------------------------------------------- */
-
-/* template workaround for compilers that cannot correctly implement the C++ standard */
-#ifndef SWIGTEMPLATEDISAMBIGUATOR
-# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
-# define SWIGTEMPLATEDISAMBIGUATOR template
-# elif defined(__HP_aCC)
-/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
-/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
-# define SWIGTEMPLATEDISAMBIGUATOR template
-# else
-# define SWIGTEMPLATEDISAMBIGUATOR
-# endif
-#endif
-
-/* inline attribute */
-#ifndef SWIGINLINE
-# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
-# define SWIGINLINE inline
-# else
-# define SWIGINLINE
-# endif
-#endif
-
-/* attribute recognised by some compilers to avoid 'unused' warnings */
-#ifndef SWIGUNUSED
-# if defined(__GNUC__)
-# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-# define SWIGUNUSED __attribute__ ((__unused__))
-# else
-# define SWIGUNUSED
-# endif
-# elif defined(__ICC)
-# define SWIGUNUSED __attribute__ ((__unused__))
-# else
-# define SWIGUNUSED
-# endif
-#endif
-
-#ifndef SWIGUNUSEDPARM
-# ifdef __cplusplus
-# define SWIGUNUSEDPARM(p)
-# else
-# define SWIGUNUSEDPARM(p) p SWIGUNUSED
-# endif
-#endif
-
-/* internal SWIG method */
-#ifndef SWIGINTERN
-# define SWIGINTERN static SWIGUNUSED
-#endif
-
-/* internal inline SWIG method */
-#ifndef SWIGINTERNINLINE
-# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
-#endif
-
-/* exporting methods */
-#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
-# ifndef GCC_HASCLASSVISIBILITY
-# define GCC_HASCLASSVISIBILITY
-# endif
-#endif
-
-#ifndef SWIGEXPORT
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-# if defined(STATIC_LINKED)
-# define SWIGEXPORT
-# else
-# define SWIGEXPORT __declspec(dllexport)
-# endif
-# else
-# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
-# define SWIGEXPORT __attribute__ ((visibility("default")))
-# else
-# define SWIGEXPORT
-# endif
-# endif
-#endif
-
-/* calling conventions for Windows */
-#ifndef SWIGSTDCALL
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-# define SWIGSTDCALL __stdcall
-# else
-# define SWIGSTDCALL
-# endif
-#endif
-
-/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
-#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
-# define _CRT_SECURE_NO_DEPRECATE
-#endif
-
-/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
-#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
-# define _SCL_SECURE_NO_DEPRECATE
-#endif
-
-
-
-/* Python.h has to appear first */
-#include <Python.h>
-
-/* -----------------------------------------------------------------------------
- * swigrun.swg
- *
- * This file contains generic CAPI SWIG runtime support for pointer
- * type checking.
- * ----------------------------------------------------------------------------- */
-
-/* This should only be incremented when either the layout of swig_type_info changes,
- or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "4"
-
-/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
-#ifdef SWIG_TYPE_TABLE
-# define SWIG_QUOTE_STRING(x) #x
-# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
-# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
-#else
-# define SWIG_TYPE_TABLE_NAME
-#endif
-
-/*
- You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
- creating a static or dynamic library from the swig runtime code.
- In 99.9% of the cases, swig just needs to declare them as 'static'.
-
- But only do this if is strictly necessary, ie, if you have problems
- with your compiler or so.
-*/
-
-#ifndef SWIGRUNTIME
-# define SWIGRUNTIME SWIGINTERN
-#endif
-
-#ifndef SWIGRUNTIMEINLINE
-# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
-#endif
-
-/* Generic buffer size */
-#ifndef SWIG_BUFFER_SIZE
-# define SWIG_BUFFER_SIZE 1024
-#endif
-
-/* Flags for pointer conversions */
-#define SWIG_POINTER_DISOWN 0x1
-#define SWIG_CAST_NEW_MEMORY 0x2
-
-/* Flags for new pointer objects */
-#define SWIG_POINTER_OWN 0x1
-
-
-/*
- Flags/methods for returning states.
-
- The swig conversion methods, as ConvertPtr, return and integer
- that tells if the conversion was successful or not. And if not,
- an error code can be returned (see swigerrors.swg for the codes).
-
- Use the following macros/flags to set or process the returning
- states.
-
- In old swig versions, you usually write code as:
-
- if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
- // success code
- } else {
- //fail code
- }
-
- Now you can be more explicit as:
-
- int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
- if (SWIG_IsOK(res)) {
- // success code
- } else {
- // fail code
- }
-
- that seems to be the same, but now you can also do
-
- Type *ptr;
- int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
- if (SWIG_IsOK(res)) {
- // success code
- if (SWIG_IsNewObj(res) {
- ...
- delete *ptr;
- } else {
- ...
- }
- } else {
- // fail code
- }
-
- I.e., now SWIG_ConvertPtr can return new objects and you can
- identify the case and take care of the deallocation. Of course that
- requires also to SWIG_ConvertPtr to return new result values, as
-
- int SWIG_ConvertPtr(obj, ptr,...) {
- if (<obj is ok>) {
- if (<need new object>) {
- *ptr = <ptr to new allocated object>;
- return SWIG_NEWOBJ;
- } else {
- *ptr = <ptr to old object>;
- return SWIG_OLDOBJ;
- }
- } else {
- return SWIG_BADOBJ;
- }
- }
-
- Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
- more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
- swig errors code.
-
- Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
- allows to return the 'cast rank', for example, if you have this
-
- int food(double)
- int fooi(int);
-
- and you call
-
- food(1) // cast rank '1' (1 -> 1.0)
- fooi(1) // cast rank '0'
-
- just use the SWIG_AddCast()/SWIG_CheckState()
-
-
- */
-#define SWIG_OK (0)
-#define SWIG_ERROR (-1)
-#define SWIG_IsOK(r) (r >= 0)
-#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
-
-/* The CastRankLimit says how many bits are used for the cast rank */
-#define SWIG_CASTRANKLIMIT (1 << 8)
-/* The NewMask denotes the object was created (using new/malloc) */
-#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
-/* The TmpMask is for in/out typemaps that use temporal objects */
-#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
-/* Simple returning values */
-#define SWIG_BADOBJ (SWIG_ERROR)
-#define SWIG_OLDOBJ (SWIG_OK)
-#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
-#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
-/* Check, add and del mask methods */
-#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
-#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
-#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
-#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
-#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
-#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
-
-
-/* Cast-Rank Mode */
-#if defined(SWIG_CASTRANK_MODE)
-# ifndef SWIG_TypeRank
-# define SWIG_TypeRank unsigned long
-# endif
-# ifndef SWIG_MAXCASTRANK /* Default cast allowed */
-# define SWIG_MAXCASTRANK (2)
-# endif
-# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
-# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
-SWIGINTERNINLINE int SWIG_AddCast(int r) {
- return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
-}
-SWIGINTERNINLINE int SWIG_CheckState(int r) {
- return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
-}
-#else /* no cast-rank mode */
-# define SWIG_AddCast
-# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
-#endif
-
-
-
-
-#include <string.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void *(*swig_converter_func)(void *, int *);
-typedef struct swig_type_info *(*swig_dycast_func)(void **);
-
-/* Structure to store information on one type */
-typedef struct swig_type_info {
- const char *name; /* mangled name of this type */
- const char *str; /* human readable name of this type */
- swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
- struct swig_cast_info *cast; /* linked list of types that can cast into this type */
- void *clientdata; /* language specific type data */
- int owndata; /* flag if the structure owns the clientdata */
-} swig_type_info;
-
-/* Structure to store a type and conversion function used for casting */
-typedef struct swig_cast_info {
- swig_type_info *type; /* pointer to type that is equivalent to this type */
- swig_converter_func converter; /* function to cast the void pointers */
- struct swig_cast_info *next; /* pointer to next cast in linked list */
- struct swig_cast_info *prev; /* pointer to the previous cast */
-} swig_cast_info;
-
-/* Structure used to store module information
- * Each module generates one structure like this, and the runtime collects
- * all of these structures and stores them in a circularly linked list.*/
-typedef struct swig_module_info {
- swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
- size_t size; /* Number of types in this module */
- struct swig_module_info *next; /* Pointer to next element in circularly linked list */
- swig_type_info **type_initial; /* Array of initially generated type structures */
- swig_cast_info **cast_initial; /* Array of initially generated casting structures */
- void *clientdata; /* Language specific module data */
-} swig_module_info;
-
-/*
- Compare two type names skipping the space characters, therefore
- "char*" == "char *" and "Class<int>" == "Class<int >", etc.
-
- Return 0 when the two name types are equivalent, as in
- strncmp, but skipping ' '.
-*/
-SWIGRUNTIME int
-SWIG_TypeNameComp(const char *f1, const char *l1,
- const char *f2, const char *l2) {
- for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
- while ((*f1 == ' ') && (f1 != l1)) ++f1;
- while ((*f2 == ' ') && (f2 != l2)) ++f2;
- if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
- }
- return (int)((l1 - f1) - (l2 - f2));
-}
-
-/*
- Check type equivalence in a name list like <name1>|<name2>|...
- Return 0 if not equal, 1 if equal
-*/
-SWIGRUNTIME int
-SWIG_TypeEquiv(const char *nb, const char *tb) {
- int equiv = 0;
- const char* te = tb + strlen(tb);
- const char* ne = nb;
- while (!equiv && *ne) {
- for (nb = ne; *ne; ++ne) {
- if (*ne == '|') break;
- }
- equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
- if (*ne) ++ne;
- }
- return equiv;
-}
-
-/*
- Check type equivalence in a name list like <name1>|<name2>|...
- Return 0 if equal, -1 if nb < tb, 1 if nb > tb
-*/
-SWIGRUNTIME int
-SWIG_TypeCompare(const char *nb, const char *tb) {
- int equiv = 0;
- const char* te = tb + strlen(tb);
- const char* ne = nb;
- while (!equiv && *ne) {
- for (nb = ne; *ne; ++ne) {
- if (*ne == '|') break;
- }
- equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
- if (*ne) ++ne;
- }
- return equiv;
-}
-
-
-/* think of this as a c++ template<> or a scheme macro */
-#define SWIG_TypeCheck_Template(comparison, ty) \
- if (ty) { \
- swig_cast_info *iter = ty->cast; \
- while (iter) { \
- if (comparison) { \
- if (iter == ty->cast) return iter; \
- /* Move iter to the top of the linked list */ \
- iter->prev->next = iter->next; \
- if (iter->next) \
- iter->next->prev = iter->prev; \
- iter->next = ty->cast; \
- iter->prev = 0; \
- if (ty->cast) ty->cast->prev = iter; \
- ty->cast = iter; \
- return iter; \
- } \
- iter = iter->next; \
- } \
- } \
- return 0
-
-/*
- Check the typename
-*/
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheck(const char *c, swig_type_info *ty) {
- SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
-}
-
-/* Same as previous function, except strcmp is replaced with a pointer comparison */
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
- SWIG_TypeCheck_Template(iter->type == from, into);
-}
-
-/*
- Cast a pointer up an inheritance hierarchy
-*/
-SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
- return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
-}
-
-/*
- Dynamic pointer casting. Down an inheritance hierarchy
-*/
-SWIGRUNTIME swig_type_info *
-SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
- swig_type_info *lastty = ty;
- if (!ty || !ty->dcast) return ty;
- while (ty && (ty->dcast)) {
- ty = (*ty->dcast)(ptr);
- if (ty) lastty = ty;
- }
- return lastty;
-}
-
-/*
- Return the name associated with this type
-*/
-SWIGRUNTIMEINLINE const char *
-SWIG_TypeName(const swig_type_info *ty) {
- return ty->name;
-}
-
-/*
- Return the pretty name associated with this type,
- that is an unmangled type name in a form presentable to the user.
-*/
-SWIGRUNTIME const char *
-SWIG_TypePrettyName(const swig_type_info *type) {
- /* The "str" field contains the equivalent pretty names of the
- type, separated by vertical-bar characters. We choose
- to print the last name, as it is often (?) the most
- specific. */
- if (!type) return NULL;
- if (type->str != NULL) {
- const char *last_name = type->str;
- const char *s;
- for (s = type->str; *s; s++)
- if (*s == '|') last_name = s+1;
- return last_name;
- }
- else
- return type->name;
-}
-
-/*
- Set the clientdata field for a type
-*/
-SWIGRUNTIME void
-SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
- swig_cast_info *cast = ti->cast;
- /* if (ti->clientdata == clientdata) return; */
- ti->clientdata = clientdata;
-
- while (cast) {
- if (!cast->converter) {
- swig_type_info *tc = cast->type;
- if (!tc->clientdata) {
- SWIG_TypeClientData(tc, clientdata);
- }
- }
- cast = cast->next;
- }
-}
-SWIGRUNTIME void
-SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
- SWIG_TypeClientData(ti, clientdata);
- ti->owndata = 1;
-}
-
-/*
- Search for a swig_type_info structure only by mangled name
- Search is a O(log #types)
-
- We start searching at module start, and finish searching when start == end.
- Note: if start == end at the beginning of the function, we go all the way around
- the circular list.
-*/
-SWIGRUNTIME swig_type_info *
-SWIG_MangledTypeQueryModule(swig_module_info *start,
- swig_module_info *end,
- const char *name) {
- swig_module_info *iter = start;
- do {
- if (iter->size) {
- register size_t l = 0;
- register size_t r = iter->size - 1;
- do {
- /* since l+r >= 0, we can (>> 1) instead (/ 2) */
- register size_t i = (l + r) >> 1;
- const char *iname = iter->types[i]->name;
- if (iname) {
- register int compare = strcmp(name, iname);
- if (compare == 0) {
- return iter->types[i];
- } else if (compare < 0) {
- if (i) {
- r = i - 1;
- } else {
- break;
- }
- } else if (compare > 0) {
- l = i + 1;
- }
- } else {
- break; /* should never happen */
- }
- } while (l <= r);
- }
- iter = iter->next;
- } while (iter != end);
- return 0;
-}
-
-/*
- Search for a swig_type_info structure for either a mangled name or a human readable name.
- It first searches the mangled names of the types, which is a O(log #types)
- If a type is not found it then searches the human readable names, which is O(#types).
-
- We start searching at module start, and finish searching when start == end.
- Note: if start == end at the beginning of the function, we go all the way around
- the circular list.
-*/
-SWIGRUNTIME swig_type_info *
-SWIG_TypeQueryModule(swig_module_info *start,
- swig_module_info *end,
- const char *name) {
- /* STEP 1: Search the name field using binary search */
- swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
- if (ret) {
- return ret;
- } else {
- /* STEP 2: If the type hasn't been found, do a complete search
- of the str field (the human readable name) */
- swig_module_info *iter = start;
- do {
- register size_t i = 0;
- for (; i < iter->size; ++i) {
- if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
- return iter->types[i];
- }
- iter = iter->next;
- } while (iter != end);
- }
-
- /* neither found a match */
- return 0;
-}
-
-/*
- Pack binary data into a string
-*/
-SWIGRUNTIME char *
-SWIG_PackData(char *c, void *ptr, size_t sz) {
- static const char hex[17] = "0123456789abcdef";
- register const unsigned char *u = (unsigned char *) ptr;
- register const unsigned char *eu = u + sz;
- for (; u != eu; ++u) {
- register unsigned char uu = *u;
- *(c++) = hex[(uu & 0xf0) >> 4];
- *(c++) = hex[uu & 0xf];
- }
- return c;
-}
-
-/*
- Unpack binary data from a string
-*/
-SWIGRUNTIME const char *
-SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
- register unsigned char *u = (unsigned char *) ptr;
- register const unsigned char *eu = u + sz;
- for (; u != eu; ++u) {
- register char d = *(c++);
- register unsigned char uu;
- if ((d >= '0') && (d <= '9'))
- uu = ((d - '0') << 4);
- else if ((d >= 'a') && (d <= 'f'))
- uu = ((d - ('a'-10)) << 4);
- else
- return (char *) 0;
- d = *(c++);
- if ((d >= '0') && (d <= '9'))
- uu |= (d - '0');
- else if ((d >= 'a') && (d <= 'f'))
- uu |= (d - ('a'-10));
- else
- return (char *) 0;
- *u = uu;
- }
- return c;
-}
-
-/*
- Pack 'void *' into a string buffer.
-*/
-SWIGRUNTIME char *
-SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
- char *r = buff;
- if ((2*sizeof(void *) + 2) > bsz) return 0;
- *(r++) = '_';
- r = SWIG_PackData(r,&ptr,sizeof(void *));
- if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
- strcpy(r,name);
- return buff;
-}
-
-SWIGRUNTIME const char *
-SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
- if (*c != '_') {
- if (strcmp(c,"NULL") == 0) {
- *ptr = (void *) 0;
- return name;
- } else {
- return 0;
- }
- }
- return SWIG_UnpackData(++c,ptr,sizeof(void *));
-}
-
-SWIGRUNTIME char *
-SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
- char *r = buff;
- size_t lname = (name ? strlen(name) : 0);
- if ((2*sz + 2 + lname) > bsz) return 0;
- *(r++) = '_';
- r = SWIG_PackData(r,ptr,sz);
- if (lname) {
- strncpy(r,name,lname+1);
- } else {
- *r = 0;
- }
- return buff;
-}
-
-SWIGRUNTIME const char *
-SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
- if (*c != '_') {
- if (strcmp(c,"NULL") == 0) {
- memset(ptr,0,sz);
- return name;
- } else {
- return 0;
- }
- }
- return SWIG_UnpackData(++c,ptr,sz);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-/* Errors in SWIG */
-#define SWIG_UnknownError -1
-#define SWIG_IOError -2
-#define SWIG_RuntimeError -3
-#define SWIG_IndexError -4
-#define SWIG_TypeError -5
-#define SWIG_DivisionByZero -6
-#define SWIG_OverflowError -7
-#define SWIG_SyntaxError -8
-#define SWIG_ValueError -9
-#define SWIG_SystemError -10
-#define SWIG_AttributeError -11
-#define SWIG_MemoryError -12
-#define SWIG_NullReferenceError -13
-
-
-
-
-/* Add PyOS_snprintf for old Pythons */
-#if PY_VERSION_HEX < 0x02020000
-# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
-# define PyOS_snprintf _snprintf
-# else
-# define PyOS_snprintf snprintf
-# endif
-#endif
-
-/* A crude PyString_FromFormat implementation for old Pythons */
-#if PY_VERSION_HEX < 0x02020000
-
-#ifndef SWIG_PYBUFFER_SIZE
-# define SWIG_PYBUFFER_SIZE 1024
-#endif
-
-static PyObject *
-PyString_FromFormat(const char *fmt, ...) {
- va_list ap;
- char buf[SWIG_PYBUFFER_SIZE * 2];
- int res;
- va_start(ap, fmt);
- res = vsnprintf(buf, sizeof(buf), fmt, ap);
- va_end(ap);
- return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf);
-}
-#endif
-
-/* Add PyObject_Del for old Pythons */
-#if PY_VERSION_HEX < 0x01060000
-# define PyObject_Del(op) PyMem_DEL((op))
-#endif
-#ifndef PyObject_DEL
-# define PyObject_DEL PyObject_Del
-#endif
-
-/* A crude PyExc_StopIteration exception for old Pythons */
-#if PY_VERSION_HEX < 0x02020000
-# ifndef PyExc_StopIteration
-# define PyExc_StopIteration PyExc_RuntimeError
-# endif
-# ifndef PyObject_GenericGetAttr
-# define PyObject_GenericGetAttr 0
-# endif
-#endif
-/* Py_NotImplemented is defined in 2.1 and up. */
-#if PY_VERSION_HEX < 0x02010000
-# ifndef Py_NotImplemented
-# define Py_NotImplemented PyExc_RuntimeError
-# endif
-#endif
-
-
-/* A crude PyString_AsStringAndSize implementation for old Pythons */
-#if PY_VERSION_HEX < 0x02010000
-# ifndef PyString_AsStringAndSize
-# define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;}
-# endif
-#endif
-
-/* PySequence_Size for old Pythons */
-#if PY_VERSION_HEX < 0x02000000
-# ifndef PySequence_Size
-# define PySequence_Size PySequence_Length
-# endif
-#endif
-
-
-/* PyBool_FromLong for old Pythons */
-#if PY_VERSION_HEX < 0x02030000
-static
-PyObject *PyBool_FromLong(long ok)
-{
- PyObject *result = ok ? Py_True : Py_False;
- Py_INCREF(result);
- return result;
-}
-#endif
-
-/* Py_ssize_t for old Pythons */
-/* This code is as recommended by: */
-/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
-#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
-typedef int Py_ssize_t;
-# define PY_SSIZE_T_MAX INT_MAX
-# define PY_SSIZE_T_MIN INT_MIN
-#endif
-
-/* -----------------------------------------------------------------------------
- * error manipulation
- * ----------------------------------------------------------------------------- */
-
-SWIGRUNTIME PyObject*
-SWIG_Python_ErrorType(int code) {
- PyObject* type = 0;
- switch(code) {
- case SWIG_MemoryError:
- type = PyExc_MemoryError;
- break;
- case SWIG_IOError:
- type = PyExc_IOError;
- break;
- case SWIG_RuntimeError:
- type = PyExc_RuntimeError;
- break;
- case SWIG_IndexError:
- type = PyExc_IndexError;
- break;
- case SWIG_TypeError:
- type = PyExc_TypeError;
- break;
- case SWIG_DivisionByZero:
- type = PyExc_ZeroDivisionError;
- break;
- case SWIG_OverflowError:
- type = PyExc_OverflowError;
- break;
- case SWIG_SyntaxError:
- type = PyExc_SyntaxError;
- break;
- case SWIG_ValueError:
- type = PyExc_ValueError;
- break;
- case SWIG_SystemError:
- type = PyExc_SystemError;
- break;
- case SWIG_AttributeError:
- type = PyExc_AttributeError;
- break;
- default:
- type = PyExc_RuntimeError;
- }
- return type;
-}
-
-
-SWIGRUNTIME void
-SWIG_Python_AddErrorMsg(const char* mesg)
-{
- PyObject *type = 0;
- PyObject *value = 0;
- PyObject *traceback = 0;
-
- if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
- if (value) {
- PyObject *old_str = PyObject_Str(value);
- PyErr_Clear();
- Py_XINCREF(type);
- PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
- Py_DECREF(old_str);
- Py_DECREF(value);
- } else {
- PyErr_SetString(PyExc_RuntimeError, mesg);
- }
-}
-
-
-
-#if defined(SWIG_PYTHON_NO_THREADS)
-# if defined(SWIG_PYTHON_THREADS)
-# undef SWIG_PYTHON_THREADS
-# endif
-#endif
-#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
-# if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
-# if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */
-# define SWIG_PYTHON_USE_GIL
-# endif
-# endif
-# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
-# ifndef SWIG_PYTHON_INITIALIZE_THREADS
-# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
-# endif
-# ifdef __cplusplus /* C++ code */
- class SWIG_Python_Thread_Block {
- bool status;
- PyGILState_STATE state;
- public:
- void end() { if (status) { PyGILState_Release(state); status = false;} }
- SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
- ~SWIG_Python_Thread_Block() { end(); }
- };
- class SWIG_Python_Thread_Allow {
- bool status;
- PyThreadState *save;
- public:
- void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
- SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
- ~SWIG_Python_Thread_Allow() { end(); }
- };
-# define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block
-# define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end()
-# define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow
-# define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end()
-# else /* C code */
-# define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
-# define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block)
-# define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread()
-# define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow)
-# endif
-# else /* Old thread way, not implemented, user must provide it */
-# if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
-# define SWIG_PYTHON_INITIALIZE_THREADS
-# endif
-# if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
-# define SWIG_PYTHON_THREAD_BEGIN_BLOCK
-# endif
-# if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
-# define SWIG_PYTHON_THREAD_END_BLOCK
-# endif
-# if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
-# define SWIG_PYTHON_THREAD_BEGIN_ALLOW
-# endif
-# if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
-# define SWIG_PYTHON_THREAD_END_ALLOW
-# endif
-# endif
-#else /* No thread support */
-# define SWIG_PYTHON_INITIALIZE_THREADS
-# define SWIG_PYTHON_THREAD_BEGIN_BLOCK
-# define SWIG_PYTHON_THREAD_END_BLOCK
-# define SWIG_PYTHON_THREAD_BEGIN_ALLOW
-# define SWIG_PYTHON_THREAD_END_ALLOW
-#endif
-
-/* -----------------------------------------------------------------------------
- * Python API portion that goes into the runtime
- * ----------------------------------------------------------------------------- */
-
-#ifdef __cplusplus
-extern "C" {
-#if 0
-} /* cc-mode */
-#endif
-#endif
-
-/* -----------------------------------------------------------------------------
- * Constant declarations
- * ----------------------------------------------------------------------------- */
-
-/* Constant Types */
-#define SWIG_PY_POINTER 4
-#define SWIG_PY_BINARY 5
-
-/* Constant information structure */
-typedef struct swig_const_info {
- int type;
- char *name;
- long lvalue;
- double dvalue;
- void *pvalue;
- swig_type_info **ptype;
-} swig_const_info;
-
-#ifdef __cplusplus
-#if 0
-{ /* cc-mode */
-#endif
-}
-#endif
-
-
-/* -----------------------------------------------------------------------------
- * See the LICENSE file for information on copyright, usage and redistribution
- * of SWIG, and the README file for authors - http://www.swig.org/release.html.
- *
- * pyrun.swg
- *
- * This file contains the runtime support for Python modules
- * and includes code for managing global variables and pointer
- * type checking.
- *
- * ----------------------------------------------------------------------------- */
-
-/* Common SWIG API */
-
-/* for raw pointers */
-#define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
-#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
-#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
-#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags)
-#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
-#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
-#define swig_owntype int
-
-/* for raw packed data */
-#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
-#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
-
-/* for class or struct pointers */
-#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
-#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
-
-/* for C or C++ function pointers */
-#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
-#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(ptr, type, 0)
-
-/* for C++ member pointers, ie, member methods */
-#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
-#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
-
-
-/* Runtime API */
-
-#define SWIG_GetModule(clientdata) SWIG_Python_GetModule()
-#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
-#define SWIG_NewClientData(obj) PySwigClientData_New(obj)
-
-#define SWIG_SetErrorObj SWIG_Python_SetErrorObj
-#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
-#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
-#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
-#define SWIG_fail goto fail
-
-
-/* Runtime API implementation */
-
-/* Error manipulation */
-
-SWIGINTERN void
-SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
- SWIG_PYTHON_THREAD_BEGIN_BLOCK;
- PyErr_SetObject(errtype, obj);
- Py_DECREF(obj);
- SWIG_PYTHON_THREAD_END_BLOCK;
-}
-
-SWIGINTERN void
-SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
- SWIG_PYTHON_THREAD_BEGIN_BLOCK;
- PyErr_SetString(errtype, (char *) msg);
- SWIG_PYTHON_THREAD_END_BLOCK;
-}
-
-#define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
-
-/* Set a constant value */
-
-SWIGINTERN void
-SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
- PyDict_SetItemString(d, (char*) name, obj);
- Py_DECREF(obj);
-}
-
-/* Append a value to the result obj */
-
-SWIGINTERN PyObject*
-SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
-#if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
- if (!result) {
- result = obj;
- } else if (result == Py_None) {
- Py_DECREF(result);
- result = obj;
- } else {
- if (!PyList_Check(result)) {
- PyObject *o2 = result;
- result = PyList_New(1);
- PyList_SetItem(result, 0, o2);
- }
- PyList_Append(result,obj);
- Py_DECREF(obj);
- }
- return result;
-#else
- PyObject* o2;
- PyObject* o3;
- if (!result) {
- result = obj;
- } else if (result == Py_None) {
- Py_DECREF(result);
- result = obj;
- } else {
- if (!PyTuple_Check(result)) {
- o2 = result;
- result = PyTuple_New(1);
- PyTuple_SET_ITEM(result, 0, o2);
- }
- o3 = PyTuple_New(1);
- PyTuple_SET_ITEM(o3, 0, obj);
- o2 = result;
- result = PySequence_Concat(o2, o3);
- Py_DECREF(o2);
- Py_DECREF(o3);
- }
- return result;
-#endif
-}
-
-/* Unpack the argument tuple */
-
-SWIGINTERN int
-SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
-{
- if (!args) {
- if (!min && !max) {
- return 1;
- } else {
- PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none",
- name, (min == max ? "" : "at least "), (int)min);
- return 0;
- }
- }
- if (!PyTuple_Check(args)) {
- PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
- return 0;
- } else {
- register Py_ssize_t l = PyTuple_GET_SIZE(args);
- if (l < min) {
- PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
- name, (min == max ? "" : "at least "), (int)min, (int)l);
- return 0;
- } else if (l > max) {
- PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
- name, (min == max ? "" : "at most "), (int)max, (int)l);
- return 0;
- } else {
- register int i;
- for (i = 0; i < l; ++i) {
- objs[i] = PyTuple_GET_ITEM(args, i);
- }
- for (; l < max; ++l) {
- objs[l] = 0;
- }
- return i + 1;
- }
- }
-}
-
-/* A functor is a function object with one single object argument */
-#if PY_VERSION_HEX >= 0x02020000
-#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
-#else
-#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj);
-#endif
-
-/*
- Helper for static pointer initialization for both C and C++ code, for example
- static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
-*/
-#ifdef __cplusplus
-#define SWIG_STATIC_POINTER(var) var
-#else
-#define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
-#endif
-
-/* -----------------------------------------------------------------------------
- * Pointer declarations
- * ----------------------------------------------------------------------------- */
-
-/* Flags for new pointer objects */
-#define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
-#define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
-
-#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
-
-#ifdef __cplusplus
-extern "C" {
-#if 0
-} /* cc-mode */
-#endif
-#endif
-
-/* How to access Py_None */
-#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-# ifndef SWIG_PYTHON_NO_BUILD_NONE
-# ifndef SWIG_PYTHON_BUILD_NONE
-# define SWIG_PYTHON_BUILD_NONE
-# endif
-# endif
-#endif
-
-#ifdef SWIG_PYTHON_BUILD_NONE
-# ifdef Py_None
-# undef Py_None
-# define Py_None SWIG_Py_None()
-# endif
-SWIGRUNTIMEINLINE PyObject *
-_SWIG_Py_None(void)
-{
- PyObject *none = Py_BuildValue((char*)"");
- Py_DECREF(none);
- return none;
-}
-SWIGRUNTIME PyObject *
-SWIG_Py_None(void)
-{
- static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
- return none;
-}
-#endif
-
-/* The python void return value */
-
-SWIGRUNTIMEINLINE PyObject *
-SWIG_Py_Void(void)
-{
- PyObject *none = Py_None;
- Py_INCREF(none);
- return none;
-}
-
-/* PySwigClientData */
-
-typedef struct {
- PyObject *klass;
- PyObject *newraw;
- PyObject *newargs;
- PyObject *destroy;
- int delargs;
- int implicitconv;
-} PySwigClientData;
-
-SWIGRUNTIMEINLINE int
-SWIG_Python_CheckImplicit(swig_type_info *ty)
-{
- PySwigClientData *data = (PySwigClientData *)ty->clientdata;
- return data ? data->implicitconv : 0;
-}
-
-SWIGRUNTIMEINLINE PyObject *
-SWIG_Python_ExceptionType(swig_type_info *desc) {
- PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0;
- PyObject *klass = data ? data->klass : 0;
- return (klass ? klass : PyExc_RuntimeError);
-}
-
-
-SWIGRUNTIME PySwigClientData *
-PySwigClientData_New(PyObject* obj)
-{
- if (!obj) {
- return 0;
- } else {
- PySwigClientData *data = (PySwigClientData *)malloc(sizeof(PySwigClientData));
- /* the klass element */
- data->klass = obj;
- Py_INCREF(data->klass);
- /* the newraw method and newargs arguments used to create a new raw instance */
- if (PyClass_Check(obj)) {
- data->newraw = 0;
- data->newargs = obj;
- Py_INCREF(obj);
- } else {
-#if (PY_VERSION_HEX < 0x02020000)
- data->newraw = 0;
-#else
- data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
-#endif
- if (data->newraw) {
- Py_INCREF(data->newraw);
- data->newargs = PyTuple_New(1);
- PyTuple_SetItem(data->newargs, 0, obj);
- } else {
- data->newargs = obj;
- }
- Py_INCREF(data->newargs);
- }
- /* the destroy method, aka as the C++ delete method */
- data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__");
- if (PyErr_Occurred()) {
- PyErr_Clear();
- data->destroy = 0;
- }
- if (data->destroy) {
- int flags;
- Py_INCREF(data->destroy);
- flags = PyCFunction_GET_FLAGS(data->destroy);
-#ifdef METH_O
- data->delargs = !(flags & (METH_O));
-#else
- data->delargs = 0;
-#endif
- } else {
- data->delargs = 0;
- }
- data->implicitconv = 0;
- return data;
- }
-}
-
-SWIGRUNTIME void
-PySwigClientData_Del(PySwigClientData* data)
-{
- Py_XDECREF(data->newraw);
- Py_XDECREF(data->newargs);
- Py_XDECREF(data->destroy);
-}
-
-/* =============== PySwigObject =====================*/
-
-typedef struct {
- PyObject_HEAD
- void *ptr;
- swig_type_info *ty;
- int own;
- PyObject *next;
-} PySwigObject;
-
-SWIGRUNTIME PyObject *
-PySwigObject_long(PySwigObject *v)
-{
- return PyLong_FromVoidPtr(v->ptr);
-}
-
-SWIGRUNTIME PyObject *
-PySwigObject_format(const char* fmt, PySwigObject *v)
-{
- PyObject *res = NULL;
- PyObject *args = PyTuple_New(1);
- if (args) {
- if (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0) {
- PyObject *ofmt = PyString_FromString(fmt);
- if (ofmt) {
- res = PyString_Format(ofmt,args);
- Py_DECREF(ofmt);
- }
- Py_DECREF(args);
- }
- }
- return res;
-}
-
-SWIGRUNTIME PyObject *
-PySwigObject_oct(PySwigObject *v)
-{
- return PySwigObject_format("%o",v);
-}
-
-SWIGRUNTIME PyObject *
-PySwigObject_hex(PySwigObject *v)
-{
- return PySwigObject_format("%x",v);
-}
-
-SWIGRUNTIME PyObject *
-#ifdef METH_NOARGS
-PySwigObject_repr(PySwigObject *v)
-#else
-PySwigObject_repr(PySwigObject *v, PyObject *args)
-#endif
-{
- const char *name = SWIG_TypePrettyName(v->ty);
- PyObject *hex = PySwigObject_hex(v);
- PyObject *repr = PyString_FromFormat("<Swig Object of type '%s' at 0x%s>", name, PyString_AsString(hex));
- Py_DECREF(hex);
- if (v->next) {
-#ifdef METH_NOARGS
- PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next);
-#else
- PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next, args);
-#endif
- PyString_ConcatAndDel(&repr,nrep);
- }
- return repr;
-}
-
-SWIGRUNTIME int
-PySwigObject_print(PySwigObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
-{
-#ifdef METH_NOARGS
- PyObject *repr = PySwigObject_repr(v);
-#else
- PyObject *repr = PySwigObject_repr(v, NULL);
-#endif
- if (repr) {
- fputs(PyString_AsString(repr), fp);
- Py_DECREF(repr);
- return 0;
- } else {
- return 1;
- }
-}
-
-SWIGRUNTIME PyObject *
-PySwigObject_str(PySwigObject *v)
-{
- char result[SWIG_BUFFER_SIZE];
- return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ?
- PyString_FromString(result) : 0;
-}
-
-SWIGRUNTIME int
-PySwigObject_compare(PySwigObject *v, PySwigObject *w)
-{
- void *i = v->ptr;
- void *j = w->ptr;
- return (i < j) ? -1 : ((i > j) ? 1 : 0);
-}
-
-SWIGRUNTIME PyTypeObject* _PySwigObject_type(void);
-
-SWIGRUNTIME PyTypeObject*
-PySwigObject_type(void) {
- static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type();
- return type;
-}
-
-SWIGRUNTIMEINLINE int
-PySwigObject_Check(PyObject *op) {
- return ((op)->ob_type == PySwigObject_type())
- || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0);
-}
-
-SWIGRUNTIME PyObject *
-PySwigObject_New(void *ptr, swig_type_info *ty, int own);
-
-SWIGRUNTIME void
-PySwigObject_dealloc(PyObject *v)
-{
- PySwigObject *sobj = (PySwigObject *) v;
- PyObject *next = sobj->next;
- if (sobj->own == SWIG_POINTER_OWN) {
- swig_type_info *ty = sobj->ty;
- PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
- PyObject *destroy = data ? data->destroy : 0;
- if (destroy) {
- /* destroy is always a VARARGS method */
- PyObject *res;
- if (data->delargs) {
- /* we need to create a temporal object to carry the destroy operation */
- PyObject *tmp = PySwigObject_New(sobj->ptr, ty, 0);
- res = SWIG_Python_CallFunctor(destroy, tmp);
- Py_DECREF(tmp);
- } else {
- PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
- PyObject *mself = PyCFunction_GET_SELF(destroy);
- res = ((*meth)(mself, v));
- }
- Py_XDECREF(res);
- }
-#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
- else {
- const char *name = SWIG_TypePrettyName(ty);
- printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
- }
-#endif
- }
- Py_XDECREF(next);
- PyObject_DEL(v);
-}
-
-SWIGRUNTIME PyObject*
-PySwigObject_append(PyObject* v, PyObject* next)
-{
- PySwigObject *sobj = (PySwigObject *) v;
-#ifndef METH_O
- PyObject *tmp = 0;
- if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
- next = tmp;
-#endif
- if (!PySwigObject_Check(next)) {
- return NULL;
- }
- sobj->next = next;
- Py_INCREF(next);
- return SWIG_Py_Void();
-}
-
-SWIGRUNTIME PyObject*
-#ifdef METH_NOARGS
-PySwigObject_next(PyObject* v)
-#else
-PySwigObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
-#endif
-{
- PySwigObject *sobj = (PySwigObject *) v;
- if (sobj->next) {
- Py_INCREF(sobj->next);
- return sobj->next;
- } else {
- return SWIG_Py_Void();
- }
-}
-
-SWIGINTERN PyObject*
-#ifdef METH_NOARGS
-PySwigObject_disown(PyObject *v)
-#else
-PySwigObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
-#endif
-{
- PySwigObject *sobj = (PySwigObject *)v;
- sobj->own = 0;
- return SWIG_Py_Void();
-}
-
-SWIGINTERN PyObject*
-#ifdef METH_NOARGS
-PySwigObject_acquire(PyObject *v)
-#else
-PySwigObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
-#endif
-{
- PySwigObject *sobj = (PySwigObject *)v;
- sobj->own = SWIG_POINTER_OWN;
- return SWIG_Py_Void();
-}
-
-SWIGINTERN PyObject*
-PySwigObject_own(PyObject *v, PyObject *args)
-{
- PyObject *val = 0;
-#if (PY_VERSION_HEX < 0x02020000)
- if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
-#else
- if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val))
-#endif
- {
- return NULL;
- }
- else
- {
- PySwigObject *sobj = (PySwigObject *)v;
- PyObject *obj = PyBool_FromLong(sobj->own);
- if (val) {
-#ifdef METH_NOARGS
- if (PyObject_IsTrue(val)) {
- PySwigObject_acquire(v);
- } else {
- PySwigObject_disown(v);
- }
-#else
- if (PyObject_IsTrue(val)) {
- PySwigObject_acquire(v,args);
- } else {
- PySwigObject_disown(v,args);
- }
-#endif
- }
- return obj;
- }
-}
-
-#ifdef METH_O
-static PyMethodDef
-swigobject_methods[] = {
- {(char *)"disown", (PyCFunction)PySwigObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
- {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"},
- {(char *)"own", (PyCFunction)PySwigObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
- {(char *)"append", (PyCFunction)PySwigObject_append, METH_O, (char *)"appends another 'this' object"},
- {(char *)"next", (PyCFunction)PySwigObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
- {(char *)"__repr__",(PyCFunction)PySwigObject_repr, METH_NOARGS, (char *)"returns object representation"},
- {0, 0, 0, 0}
-};
-#else
-static PyMethodDef
-swigobject_methods[] = {
- {(char *)"disown", (PyCFunction)PySwigObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"},
- {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"},
- {(char *)"own", (PyCFunction)PySwigObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
- {(char *)"append", (PyCFunction)PySwigObject_append, METH_VARARGS, (char *)"appends another 'this' object"},
- {(char *)"next", (PyCFunction)PySwigObject_next, METH_VARARGS, (char *)"returns the next 'this' object"},
- {(char *)"__repr__",(PyCFunction)PySwigObject_repr, METH_VARARGS, (char *)"returns object representation"},
- {0, 0, 0, 0}
-};
-#endif
-
-#if PY_VERSION_HEX < 0x02020000
-SWIGINTERN PyObject *
-PySwigObject_getattr(PySwigObject *sobj,char *name)
-{
- return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
-}
-#endif
-
-SWIGRUNTIME PyTypeObject*
-_PySwigObject_type(void) {
- static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
-
- static PyNumberMethods PySwigObject_as_number = {
- (binaryfunc)0, /*nb_add*/
- (binaryfunc)0, /*nb_subtract*/
- (binaryfunc)0, /*nb_multiply*/
- (binaryfunc)0, /*nb_divide*/
- (binaryfunc)0, /*nb_remainder*/
- (binaryfunc)0, /*nb_divmod*/
- (ternaryfunc)0,/*nb_power*/
- (unaryfunc)0, /*nb_negative*/
- (unaryfunc)0, /*nb_positive*/
- (unaryfunc)0, /*nb_absolute*/
- (inquiry)0, /*nb_nonzero*/
- 0, /*nb_invert*/
- 0, /*nb_lshift*/
- 0, /*nb_rshift*/
- 0, /*nb_and*/
- 0, /*nb_xor*/
- 0, /*nb_or*/
- (coercion)0, /*nb_coerce*/
- (unaryfunc)PySwigObject_long, /*nb_int*/
- (unaryfunc)PySwigObject_long, /*nb_long*/
- (unaryfunc)0, /*nb_float*/
- (unaryfunc)PySwigObject_oct, /*nb_oct*/
- (unaryfunc)PySwigObject_hex, /*nb_hex*/
-#if PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
-#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
-#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
- 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
-#endif
- };
-
- static PyTypeObject pyswigobject_type;
- static int type_init = 0;
- if (!type_init) {
- const PyTypeObject tmp
- = {
- PyObject_HEAD_INIT(NULL)
- 0, /* ob_size */
- (char *)"PySwigObject", /* tp_name */
- sizeof(PySwigObject), /* tp_basicsize */
- 0, /* tp_itemsize */
- (destructor)PySwigObject_dealloc, /* tp_dealloc */
- (printfunc)PySwigObject_print, /* tp_print */
-#if PY_VERSION_HEX < 0x02020000
- (getattrfunc)PySwigObject_getattr, /* tp_getattr */
-#else
- (getattrfunc)0, /* tp_getattr */
-#endif
- (setattrfunc)0, /* tp_setattr */
- (cmpfunc)PySwigObject_compare, /* tp_compare */
- (reprfunc)PySwigObject_repr, /* tp_repr */
- &PySwigObject_as_number, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- (hashfunc)0, /* tp_hash */
- (ternaryfunc)0, /* tp_call */
- (reprfunc)PySwigObject_str, /* tp_str */
- PyObject_GenericGetAttr, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT, /* tp_flags */
- swigobject_doc, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
-#if PY_VERSION_HEX >= 0x02020000
- 0, /* tp_iter */
- 0, /* tp_iternext */
- swigobject_methods, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
- 0, /* tp_free */
- 0, /* tp_is_gc */
- 0, /* tp_bases */
- 0, /* tp_mro */
- 0, /* tp_cache */
- 0, /* tp_subclasses */
- 0, /* tp_weaklist */
-#endif
-#if PY_VERSION_HEX >= 0x02030000
- 0, /* tp_del */
-#endif
-#ifdef COUNT_ALLOCS
- 0,0,0,0 /* tp_alloc -> tp_next */
-#endif
- };
- pyswigobject_type = tmp;
- pyswigobject_type.ob_type = &PyType_Type;
- type_init = 1;
- }
- return &pyswigobject_type;
-}
-
-SWIGRUNTIME PyObject *
-PySwigObject_New(void *ptr, swig_type_info *ty, int own)
-{
- PySwigObject *sobj = PyObject_NEW(PySwigObject, PySwigObject_type());
- if (sobj) {
- sobj->ptr = ptr;
- sobj->ty = ty;
- sobj->own = own;
- sobj->next = 0;
- }
- return (PyObject *)sobj;
-}
-
-/* -----------------------------------------------------------------------------
- * Implements a simple Swig Packed type, and use it instead of string
- * ----------------------------------------------------------------------------- */
-
-typedef struct {
- PyObject_HEAD
- void *pack;
- swig_type_info *ty;
- size_t size;
-} PySwigPacked;
-
-SWIGRUNTIME int
-PySwigPacked_print(PySwigPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
-{
- char result[SWIG_BUFFER_SIZE];
- fputs("<Swig Packed ", fp);
- if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
- fputs("at ", fp);
- fputs(result, fp);
- }
- fputs(v->ty->name,fp);
- fputs(">", fp);
- return 0;
-}
-
-SWIGRUNTIME PyObject *
-PySwigPacked_repr(PySwigPacked *v)
-{
- char result[SWIG_BUFFER_SIZE];
- if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
- return PyString_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
- } else {
- return PyString_FromFormat("<Swig Packed %s>", v->ty->name);
- }
-}
-
-SWIGRUNTIME PyObject *
-PySwigPacked_str(PySwigPacked *v)
-{
- char result[SWIG_BUFFER_SIZE];
- if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
- return PyString_FromFormat("%s%s", result, v->ty->name);
- } else {
- return PyString_FromString(v->ty->name);
- }
-}
-
-SWIGRUNTIME int
-PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w)
-{
- size_t i = v->size;
- size_t j = w->size;
- int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
- return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
-}
-
-SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void);
-
-SWIGRUNTIME PyTypeObject*
-PySwigPacked_type(void) {
- static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type();
- return type;
-}
-
-SWIGRUNTIMEINLINE int
-PySwigPacked_Check(PyObject *op) {
- return ((op)->ob_type == _PySwigPacked_type())
- || (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0);
-}
-
-SWIGRUNTIME void
-PySwigPacked_dealloc(PyObject *v)
-{
- if (PySwigPacked_Check(v)) {
- PySwigPacked *sobj = (PySwigPacked *) v;
- free(sobj->pack);
- }
- PyObject_DEL(v);
-}
-
-SWIGRUNTIME PyTypeObject*
-_PySwigPacked_type(void) {
- static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
- static PyTypeObject pyswigpacked_type;
- static int type_init = 0;
- if (!type_init) {
- const PyTypeObject tmp
- = {
- PyObject_HEAD_INIT(NULL)
- 0, /* ob_size */
- (char *)"PySwigPacked", /* tp_name */
- sizeof(PySwigPacked), /* tp_basicsize */
- 0, /* tp_itemsize */
- (destructor)PySwigPacked_dealloc, /* tp_dealloc */
- (printfunc)PySwigPacked_print, /* tp_print */
- (getattrfunc)0, /* tp_getattr */
- (setattrfunc)0, /* tp_setattr */
- (cmpfunc)PySwigPacked_compare, /* tp_compare */
- (reprfunc)PySwigPacked_repr, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- (hashfunc)0, /* tp_hash */
- (ternaryfunc)0, /* tp_call */
- (reprfunc)PySwigPacked_str, /* tp_str */
- PyObject_GenericGetAttr, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT, /* tp_flags */
- swigpacked_doc, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
-#if PY_VERSION_HEX >= 0x02020000
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
- 0, /* tp_free */
- 0, /* tp_is_gc */
- 0, /* tp_bases */
- 0, /* tp_mro */
- 0, /* tp_cache */
- 0, /* tp_subclasses */
- 0, /* tp_weaklist */
-#endif
-#if PY_VERSION_HEX >= 0x02030000
- 0, /* tp_del */
-#endif
-#ifdef COUNT_ALLOCS
- 0,0,0,0 /* tp_alloc -> tp_next */
-#endif
- };
- pyswigpacked_type = tmp;
- pyswigpacked_type.ob_type = &PyType_Type;
- type_init = 1;
- }
- return &pyswigpacked_type;
-}
-
-SWIGRUNTIME PyObject *
-PySwigPacked_New(void *ptr, size_t size, swig_type_info *ty)
-{
- PySwigPacked *sobj = PyObject_NEW(PySwigPacked, PySwigPacked_type());
- if (sobj) {
- void *pack = malloc(size);
- if (pack) {
- memcpy(pack, ptr, size);
- sobj->pack = pack;
- sobj->ty = ty;
- sobj->size = size;
- } else {
- PyObject_DEL((PyObject *) sobj);
- sobj = 0;
- }
- }
- return (PyObject *) sobj;
-}
-
-SWIGRUNTIME swig_type_info *
-PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
-{
- if (PySwigPacked_Check(obj)) {
- PySwigPacked *sobj = (PySwigPacked *)obj;
- if (sobj->size != size) return 0;
- memcpy(ptr, sobj->pack, size);
- return sobj->ty;
- } else {
- return 0;
- }
-}
-
-/* -----------------------------------------------------------------------------
- * pointers/data manipulation
- * ----------------------------------------------------------------------------- */
-
-SWIGRUNTIMEINLINE PyObject *
-_SWIG_This(void)
-{
- return PyString_FromString("this");
-}
-
-SWIGRUNTIME PyObject *
-SWIG_This(void)
-{
- static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This();
- return swig_this;
-}
-
-/* #define SWIG_PYTHON_SLOW_GETSET_THIS */
-
-SWIGRUNTIME PySwigObject *
-SWIG_Python_GetSwigThis(PyObject *pyobj)
-{
- if (PySwigObject_Check(pyobj)) {
- return (PySwigObject *) pyobj;
- } else {
- PyObject *obj = 0;
-#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
- if (PyInstance_Check(pyobj)) {
- obj = _PyInstance_Lookup(pyobj, SWIG_This());
- } else {
- PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
- if (dictptr != NULL) {
- PyObject *dict = *dictptr;
- obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
- } else {
-#ifdef PyWeakref_CheckProxy
- if (PyWeakref_CheckProxy(pyobj)) {
- PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
- return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
- }
-#endif
- obj = PyObject_GetAttr(pyobj,SWIG_This());
- if (obj) {
- Py_DECREF(obj);
- } else {
- if (PyErr_Occurred()) PyErr_Clear();
- return 0;
- }
- }
- }
-#else
- obj = PyObject_GetAttr(pyobj,SWIG_This());
- if (obj) {
- Py_DECREF(obj);
- } else {
- if (PyErr_Occurred()) PyErr_Clear();
- return 0;
- }
-#endif
- if (obj && !PySwigObject_Check(obj)) {
- /* a PyObject is called 'this', try to get the 'real this'
- PySwigObject from it */
- return SWIG_Python_GetSwigThis(obj);
- }
- return (PySwigObject *)obj;
- }
-}
-
-/* Acquire a pointer value */
-
-SWIGRUNTIME int
-SWIG_Python_AcquirePtr(PyObject *obj, int own) {
- if (own == SWIG_POINTER_OWN) {
- PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
- if (sobj) {
- int oldown = sobj->own;
- sobj->own = own;
- return oldown;
- }
- }
- return 0;
-}
-
-/* Convert a pointer value */
-
-SWIGRUNTIME int
-SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
- if (!obj) return SWIG_ERROR;
- if (obj == Py_None) {
- if (ptr) *ptr = 0;
- return SWIG_OK;
- } else {
- PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
- if (own)
- *own = 0;
- while (sobj) {
- void *vptr = sobj->ptr;
- if (ty) {
- swig_type_info *to = sobj->ty;
- if (to == ty) {
- /* no type cast needed */
- if (ptr) *ptr = vptr;
- break;
- } else {
- swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
- if (!tc) {
- sobj = (PySwigObject *)sobj->next;
- } else {
- if (ptr) {
- int newmemory = 0;
- *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
- if (newmemory == SWIG_CAST_NEW_MEMORY) {
- assert(own);
- if (own)
- *own = *own | SWIG_CAST_NEW_MEMORY;
- }
- }
- break;
- }
- }
- } else {
- if (ptr) *ptr = vptr;
- break;
- }
- }
- if (sobj) {
- if (own)
- *own = *own | sobj->own;
- if (flags & SWIG_POINTER_DISOWN) {
- sobj->own = 0;
- }
- return SWIG_OK;
- } else {
- int res = SWIG_ERROR;
- if (flags & SWIG_POINTER_IMPLICIT_CONV) {
- PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
- if (data && !data->implicitconv) {
- PyObject *klass = data->klass;
- if (klass) {
- PyObject *impconv;
- data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
- impconv = SWIG_Python_CallFunctor(klass, obj);
- data->implicitconv = 0;
- if (PyErr_Occurred()) {
- PyErr_Clear();
- impconv = 0;
- }
- if (impconv) {
- PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv);
- if (iobj) {
- void *vptr;
- res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
- if (SWIG_IsOK(res)) {
- if (ptr) {
- *ptr = vptr;
- /* transfer the ownership to 'ptr' */
- iobj->own = 0;
- res = SWIG_AddCast(res);
- res = SWIG_AddNewMask(res);
- } else {
- res = SWIG_AddCast(res);
- }
- }
- }
- Py_DECREF(impconv);
- }
- }
- }
- }
- return res;
- }
- }
-}
-
-/* Convert a function ptr value */
-
-SWIGRUNTIME int
-SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
- if (!PyCFunction_Check(obj)) {
- return SWIG_ConvertPtr(obj, ptr, ty, 0);
- } else {
- void *vptr = 0;
-
- /* here we get the method pointer for callbacks */
- const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
- const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
- if (desc) {
- desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
- if (!desc) return SWIG_ERROR;
- }
- if (ty) {
- swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
- if (tc) {
- int newmemory = 0;
- *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
- assert(!newmemory); /* newmemory handling not yet implemented */
- } else {
- return SWIG_ERROR;
- }
- } else {
- *ptr = vptr;
- }
- return SWIG_OK;
- }
-}
-
-/* Convert a packed value value */
-
-SWIGRUNTIME int
-SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
- swig_type_info *to = PySwigPacked_UnpackData(obj, ptr, sz);
- if (!to) return SWIG_ERROR;
- if (ty) {
- if (to != ty) {
- /* check type cast? */
- swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
- if (!tc) return SWIG_ERROR;
- }
- }
- return SWIG_OK;
-}
-
-/* -----------------------------------------------------------------------------
- * Create a new pointer object
- * ----------------------------------------------------------------------------- */
-
-/*
- Create a new instance object, whitout calling __init__, and set the
- 'this' attribute.
-*/
-
-SWIGRUNTIME PyObject*
-SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this)
-{
-#if (PY_VERSION_HEX >= 0x02020000)
- PyObject *inst = 0;
- PyObject *newraw = data->newraw;
- if (newraw) {
- inst = PyObject_Call(newraw, data->newargs, NULL);
- if (inst) {
-#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
- PyObject **dictptr = _PyObject_GetDictPtr(inst);
- if (dictptr != NULL) {
- PyObject *dict = *dictptr;
- if (dict == NULL) {
- dict = PyDict_New();
- *dictptr = dict;
- PyDict_SetItem(dict, SWIG_This(), swig_this);
- }
- }
-#else
- PyObject *key = SWIG_This();
- PyObject_SetAttr(inst, key, swig_this);
-#endif
- }
- } else {
- PyObject *dict = PyDict_New();
- PyDict_SetItem(dict, SWIG_This(), swig_this);
- inst = PyInstance_NewRaw(data->newargs, dict);
- Py_DECREF(dict);
- }
- return inst;
-#else
-#if (PY_VERSION_HEX >= 0x02010000)
- PyObject *inst;
- PyObject *dict = PyDict_New();
- PyDict_SetItem(dict, SWIG_This(), swig_this);
- inst = PyInstance_NewRaw(data->newargs, dict);
- Py_DECREF(dict);
- return (PyObject *) inst;
-#else
- PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
- if (inst == NULL) {
- return NULL;
- }
- inst->in_class = (PyClassObject *)data->newargs;
- Py_INCREF(inst->in_class);
- inst->in_dict = PyDict_New();
- if (inst->in_dict == NULL) {
- Py_DECREF(inst);
- return NULL;
- }
-#ifdef Py_TPFLAGS_HAVE_WEAKREFS
- inst->in_weakreflist = NULL;
-#endif
-#ifdef Py_TPFLAGS_GC
- PyObject_GC_Init(inst);
-#endif
- PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
- return (PyObject *) inst;
-#endif
-#endif
-}
-
-SWIGRUNTIME void
-SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
-{
- PyObject *dict;
-#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
- PyObject **dictptr = _PyObject_GetDictPtr(inst);
- if (dictptr != NULL) {
- dict = *dictptr;
- if (dict == NULL) {
- dict = PyDict_New();
- *dictptr = dict;
- }
- PyDict_SetItem(dict, SWIG_This(), swig_this);
- return;
- }
-#endif
- dict = PyObject_GetAttrString(inst, (char*)"__dict__");
- PyDict_SetItem(dict, SWIG_This(), swig_this);
- Py_DECREF(dict);
-}
-
-
-SWIGINTERN PyObject *
-SWIG_Python_InitShadowInstance(PyObject *args) {
- PyObject *obj[2];
- if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) {
- return NULL;
- } else {
- PySwigObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
- if (sthis) {
- PySwigObject_append((PyObject*) sthis, obj[1]);
- } else {
- SWIG_Python_SetSwigThis(obj[0], obj[1]);
- }
- return SWIG_Py_Void();
- }
-}
-
-/* Create a new pointer object */
-
-SWIGRUNTIME PyObject *
-SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
- if (!ptr) {
- return SWIG_Py_Void();
- } else {
- int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
- PyObject *robj = PySwigObject_New(ptr, type, own);
- PySwigClientData *clientdata = type ? (PySwigClientData *)(type->clientdata) : 0;
- if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
- PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
- if (inst) {
- Py_DECREF(robj);
- robj = inst;
- }
- }
- return robj;
- }
-}
-
-/* Create a new packed object */
-
-SWIGRUNTIMEINLINE PyObject *
-SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
- return ptr ? PySwigPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
-}
-
-/* -----------------------------------------------------------------------------*
- * Get type list
- * -----------------------------------------------------------------------------*/
-
-#ifdef SWIG_LINK_RUNTIME
-void *SWIG_ReturnGlobalTypeList(void *);
-#endif
-
-SWIGRUNTIME swig_module_info *
-SWIG_Python_GetModule(void) {
- static void *type_pointer = (void *)0;
- /* first check if module already created */
- if (!type_pointer) {
-#ifdef SWIG_LINK_RUNTIME
- type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
-#else
- type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
- (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
- if (PyErr_Occurred()) {
- PyErr_Clear();
- type_pointer = (void *)0;
- }
-#endif
- }
- return (swig_module_info *) type_pointer;
-}
-
-#if PY_MAJOR_VERSION < 2
-/* PyModule_AddObject function was introduced in Python 2.0. The following function
- is copied out of Python/modsupport.c in python version 2.3.4 */
-SWIGINTERN int
-PyModule_AddObject(PyObject *m, char *name, PyObject *o)
-{
- PyObject *dict;
- if (!PyModule_Check(m)) {
- PyErr_SetString(PyExc_TypeError,
- "PyModule_AddObject() needs module as first arg");
- return SWIG_ERROR;
- }
- if (!o) {
- PyErr_SetString(PyExc_TypeError,
- "PyModule_AddObject() needs non-NULL value");
- return SWIG_ERROR;
- }
-
- dict = PyModule_GetDict(m);
- if (dict == NULL) {
- /* Internal error -- modules must have a dict! */
- PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
- PyModule_GetName(m));
- return SWIG_ERROR;
- }
- if (PyDict_SetItemString(dict, name, o))
- return SWIG_ERROR;
- Py_DECREF(o);
- return SWIG_OK;
-}
-#endif
-
-SWIGRUNTIME void
-SWIG_Python_DestroyModule(void *vptr)
-{
- swig_module_info *swig_module = (swig_module_info *) vptr;
- swig_type_info **types = swig_module->types;
- size_t i;
- for (i =0; i < swig_module->size; ++i) {
- swig_type_info *ty = types[i];
- if (ty->owndata) {
- PySwigClientData *data = (PySwigClientData *) ty->clientdata;
- if (data) PySwigClientData_Del(data);
- }
- }
- Py_DECREF(SWIG_This());
-}
-
-SWIGRUNTIME void
-SWIG_Python_SetModule(swig_module_info *swig_module) {
- static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
-
- PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
- swig_empty_runtime_method_table);
- PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
- if (pointer && module) {
- PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
- } else {
- Py_XDECREF(pointer);
- }
-}
-
-/* The python cached type query */
-SWIGRUNTIME PyObject *
-SWIG_Python_TypeCache(void) {
- static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
- return cache;
-}
-
-SWIGRUNTIME swig_type_info *
-SWIG_Python_TypeQuery(const char *type)
-{
- PyObject *cache = SWIG_Python_TypeCache();
- PyObject *key = PyString_FromString(type);
- PyObject *obj = PyDict_GetItem(cache, key);
- swig_type_info *descriptor;
- if (obj) {
- descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
- } else {
- swig_module_info *swig_module = SWIG_Python_GetModule();
- descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
- if (descriptor) {
- obj = PyCObject_FromVoidPtr(descriptor, NULL);
- PyDict_SetItem(cache, key, obj);
- Py_DECREF(obj);
- }
- }
- Py_DECREF(key);
- return descriptor;
-}
-
-/*
- For backward compatibility only
-*/
-#define SWIG_POINTER_EXCEPTION 0
-#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
-#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
-
-SWIGRUNTIME int
-SWIG_Python_AddErrMesg(const char* mesg, int infront)
-{
- if (PyErr_Occurred()) {
- PyObject *type = 0;
- PyObject *value = 0;
- PyObject *traceback = 0;
- PyErr_Fetch(&type, &value, &traceback);
- if (value) {
- PyObject *old_str = PyObject_Str(value);
- Py_XINCREF(type);
- PyErr_Clear();
- if (infront) {
- PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str));
- } else {
- PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
- }
- Py_DECREF(old_str);
- }
- return 1;
- } else {
- return 0;
- }
-}
-
-SWIGRUNTIME int
-SWIG_Python_ArgFail(int argnum)
-{
- if (PyErr_Occurred()) {
- /* add information about failing argument */
- char mesg[256];
- PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
- return SWIG_Python_AddErrMesg(mesg, 1);
- } else {
- return 0;
- }
-}
-
-SWIGRUNTIMEINLINE const char *
-PySwigObject_GetDesc(PyObject *self)
-{
- PySwigObject *v = (PySwigObject *)self;
- swig_type_info *ty = v ? v->ty : 0;
- return ty ? ty->str : (char*)"";
-}
-
-SWIGRUNTIME void
-SWIG_Python_TypeError(const char *type, PyObject *obj)
-{
- if (type) {
-#if defined(SWIG_COBJECT_TYPES)
- if (obj && PySwigObject_Check(obj)) {
- const char *otype = (const char *) PySwigObject_GetDesc(obj);
- if (otype) {
- PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received",
- type, otype);
- return;
- }
- } else
-#endif
- {
- const char *otype = (obj ? obj->ob_type->tp_name : 0);
- if (otype) {
- PyObject *str = PyObject_Str(obj);
- const char *cstr = str ? PyString_AsString(str) : 0;
- if (cstr) {
- PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
- type, otype, cstr);
- } else {
- PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
- type, otype);
- }
- Py_XDECREF(str);
- return;
- }
- }
- PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
- } else {
- PyErr_Format(PyExc_TypeError, "unexpected type is received");
- }
-}
-
-
-/* Convert a pointer value, signal an exception on a type mismatch */
-SWIGRUNTIME void *
-SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) {
- void *result;
- if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
- PyErr_Clear();
- if (flags & SWIG_POINTER_EXCEPTION) {
- SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
- SWIG_Python_ArgFail(argnum);
- }
- }
- return result;
-}
-
-
-#ifdef __cplusplus
-#if 0
-{ /* cc-mode */
-#endif
-}
-#endif
-
-
-
-#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
-
-#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
-
-
-
-/* -------- TYPES TABLE (BEGIN) -------- */
-
-#define SWIGTYPE_p_TDB_DATA swig_types[0]
-#define SWIGTYPE_p_char swig_types[1]
-#define SWIGTYPE_p_int swig_types[2]
-#define SWIGTYPE_p_long_long swig_types[3]
-#define SWIGTYPE_p_short swig_types[4]
-#define SWIGTYPE_p_signed_char swig_types[5]
-#define SWIGTYPE_p_tdb_context swig_types[6]
-#define SWIGTYPE_p_unsigned_char swig_types[7]
-#define SWIGTYPE_p_unsigned_int swig_types[8]
-#define SWIGTYPE_p_unsigned_long_long swig_types[9]
-#define SWIGTYPE_p_unsigned_short swig_types[10]
-static swig_type_info *swig_types[12];
-static swig_module_info swig_module = {swig_types, 11, 0, 0, 0, 0};
-#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
-#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
-
-/* -------- TYPES TABLE (END) -------- */
-
-#if (PY_VERSION_HEX <= 0x02000000)
-# if !defined(SWIG_PYTHON_CLASSIC)
-# error "This python version requires swig to be run with the '-classic' option"
-# endif
-#endif
-#if (PY_VERSION_HEX <= 0x02020000)
-# error "This python version requires swig to be run with the '-nomodern' option"
-#endif
-#if (PY_VERSION_HEX <= 0x02020000)
-# error "This python version requires swig to be run with the '-nomodernargs' option"
-#endif
-#ifndef METH_O
-# error "This python version requires swig to be run with the '-nofastunpack' option"
-#endif
-#ifdef SWIG_TypeQuery
-# undef SWIG_TypeQuery
-#endif
-#define SWIG_TypeQuery SWIG_Python_TypeQuery
-
-/*-----------------------------------------------
- @(target):= _tdb.so
- ------------------------------------------------*/
-#define SWIG_init init_tdb
-
-#define SWIG_name "_tdb"
-
-#define SWIGVERSION 0x010335
-#define SWIG_VERSION SWIGVERSION
-
-
-#define SWIG_as_voidptr(a) (void *)((const void *)(a))
-#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
-
-
-
-/* This symbol is used in both includes.h and Python.h which causes an
- annoying compiler warning. */
-
-#ifdef HAVE_FSTAT
-#undef HAVE_FSTAT
-#endif
-
-/* Include tdb headers */
-#include <stdint.h>
-#include <signal.h>
-#include <tdb.h>
-#include <fcntl.h>
-
-typedef TDB_CONTEXT tdb;
-
-
- #define SWIG_From_long PyInt_FromLong
-
-
-SWIGINTERNINLINE PyObject *
-SWIG_From_int (int value)
-{
- return SWIG_From_long (value);
-}
-
-
-SWIGINTERN swig_type_info*
-SWIG_pchar_descriptor(void)
-{
- static int init = 0;
- static swig_type_info* info = 0;
- if (!init) {
- info = SWIG_TypeQuery("_p_char");
- init = 1;
- }
- return info;
-}
-
-
-SWIGINTERN int
-SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
-{
- if (PyString_Check(obj)) {
- char *cstr; Py_ssize_t len;
- PyString_AsStringAndSize(obj, &cstr, &len);
- if (cptr) {
- if (alloc) {
- /*
- In python the user should not be able to modify the inner
- string representation. To warranty that, if you define
- SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string
- buffer is always returned.
-
- The default behavior is just to return the pointer value,
- so, be careful.
- */
-#if defined(SWIG_PYTHON_SAFE_CSTRINGS)
- if (*alloc != SWIG_OLDOBJ)
-#else
- if (*alloc == SWIG_NEWOBJ)
-#endif
- {
- *cptr = (char *)memcpy((char *)malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1));
- *alloc = SWIG_NEWOBJ;
- }
- else {
- *cptr = cstr;
- *alloc = SWIG_OLDOBJ;
- }
- } else {
- *cptr = PyString_AsString(obj);
- }
- }
- if (psize) *psize = len + 1;
- return SWIG_OK;
- } else {
- swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
- if (pchar_descriptor) {
- void* vptr = 0;
- if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
- if (cptr) *cptr = (char *) vptr;
- if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
- if (alloc) *alloc = SWIG_OLDOBJ;
- return SWIG_OK;
- }
- }
- }
- return SWIG_TypeError;
-}
-
-
-
-
-
-#include <limits.h>
-#if !defined(SWIG_NO_LLONG_MAX)
-# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
-# define LLONG_MAX __LONG_LONG_MAX__
-# define LLONG_MIN (-LLONG_MAX - 1LL)
-# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
-# endif
-#endif
-
-
-SWIGINTERN int
-SWIG_AsVal_double (PyObject *obj, double *val)
-{
- int res = SWIG_TypeError;
- if (PyFloat_Check(obj)) {
- if (val) *val = PyFloat_AsDouble(obj);
- return SWIG_OK;
- } else if (PyInt_Check(obj)) {
- if (val) *val = PyInt_AsLong(obj);
- return SWIG_OK;
- } else if (PyLong_Check(obj)) {
- double v = PyLong_AsDouble(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = v;
- return SWIG_OK;
- } else {
- PyErr_Clear();
- }
- }
-#ifdef SWIG_PYTHON_CAST_MODE
- {
- int dispatch = 0;
- double d = PyFloat_AsDouble(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = d;
- return SWIG_AddCast(SWIG_OK);
- } else {
- PyErr_Clear();
- }
- if (!dispatch) {
- long v = PyLong_AsLong(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = v;
- return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
- } else {
- PyErr_Clear();
- }
- }
- }
-#endif
- return res;
-}
-
-
-#include <float.h>
-
-
-#include <math.h>
-
-
-SWIGINTERNINLINE int
-SWIG_CanCastAsInteger(double *d, double min, double max) {
- double x = *d;
- if ((min <= x && x <= max)) {
- double fx = floor(x);
- double cx = ceil(x);
- double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
- if ((errno == EDOM) || (errno == ERANGE)) {
- errno = 0;
- } else {
- double summ, reps, diff;
- if (rd < x) {
- diff = x - rd;
- } else if (rd > x) {
- diff = rd - x;
- } else {
- return 1;
- }
- summ = rd + x;
- reps = diff/summ;
- if (reps < 8*DBL_EPSILON) {
- *d = rd;
- return 1;
- }
- }
- }
- return 0;
-}
-
-
-SWIGINTERN int
-SWIG_AsVal_long (PyObject *obj, long* val)
-{
- if (PyInt_Check(obj)) {
- if (val) *val = PyInt_AsLong(obj);
- return SWIG_OK;
- } else if (PyLong_Check(obj)) {
- long v = PyLong_AsLong(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = v;
- return SWIG_OK;
- } else {
- PyErr_Clear();
- }
- }
-#ifdef SWIG_PYTHON_CAST_MODE
- {
- int dispatch = 0;
- long v = PyInt_AsLong(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = v;
- return SWIG_AddCast(SWIG_OK);
- } else {
- PyErr_Clear();
- }
- if (!dispatch) {
- double d;
- int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
- if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
- if (val) *val = (long)(d);
- return res;
- }
- }
- }
-#endif
- return SWIG_TypeError;
-}
-
-
-SWIGINTERN int
-SWIG_AsVal_int (PyObject * obj, int *val)
-{
- long v;
- int res = SWIG_AsVal_long (obj, &v);
- if (SWIG_IsOK(res)) {
- if ((v < INT_MIN || v > INT_MAX)) {
- return SWIG_OverflowError;
- } else {
- if (val) *val = (int)(v);
- }
- }
- return res;
-}
-
-SWIGINTERN tdb *new_tdb(char const *name,int hash_size,int tdb_flags,int flags,mode_t mode){
- return tdb_open(name, hash_size, tdb_flags, flags, mode);
- }
-SWIGINTERN void delete_tdb(tdb *self){ tdb_close(self); }
-
-SWIGINTERNINLINE PyObject *
-SWIG_FromCharPtrAndSize(const char* carray, size_t size)
-{
- if (carray) {
- if (size > INT_MAX) {
- swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
- return pchar_descriptor ?
- SWIG_NewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void();
- } else {
- return PyString_FromStringAndSize(carray, (int)(size));
- }
- } else {
- return SWIG_Py_Void();
- }
-}
-
-
-SWIGINTERNINLINE PyObject *
-SWIG_FromCharPtr(const char *cptr)
-{
- return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
-}
-
-
-SWIGINTERNINLINE PyObject*
-SWIG_From_unsigned_SS_long (unsigned long value)
-{
- return (value > LONG_MAX) ?
- PyLong_FromUnsignedLong(value) : PyInt_FromLong((long)(value));
-}
-
-
-SWIGINTERNINLINE PyObject *
-SWIG_From_size_t (size_t value)
-{
- return SWIG_From_unsigned_SS_long ((unsigned long)(value));
-}
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-SWIGINTERN PyObject *_wrap_new_Tdb(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- char *arg1 = (char *) 0 ;
- int arg2 ;
- int arg3 ;
- int arg4 ;
- mode_t arg5 ;
- tdb *result = 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- int val4 ;
- int ecode4 = 0 ;
- int val5 ;
- int ecode5 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
- PyObject * obj4 = 0 ;
- char * kwnames[] = {
- (char *) "name",(char *) "hash_size",(char *) "tdb_flags",(char *) "flags",(char *) "mode", NULL
- };
-
- arg2 = 0;
- arg3 = TDB_DEFAULT;
- arg4 = O_RDWR;
- arg5 = 0600;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOO:new_Tdb",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
- res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Tdb" "', argument " "1"" of type '" "char const *""'");
- }
- arg1 = (char *)(buf1);
- if (obj1) {
- ecode2 = SWIG_AsVal_int(obj1, &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Tdb" "', argument " "2"" of type '" "int""'");
- }
- arg2 = (int)(val2);
- }
- if (obj2) {
- ecode3 = SWIG_AsVal_int(obj2, &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_Tdb" "', argument " "3"" of type '" "int""'");
- }
- arg3 = (int)(val3);
- }
- if (obj3) {
- ecode4 = SWIG_AsVal_int(obj3, &val4);
- if (!SWIG_IsOK(ecode4)) {
- SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "new_Tdb" "', argument " "4"" of type '" "int""'");
- }
- arg4 = (int)(val4);
- }
- if (obj4) {
- ecode5 = SWIG_AsVal_int(obj4, &val5);
- if (!SWIG_IsOK(ecode5)) {
- SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "new_Tdb" "', argument " "5"" of type '" "mode_t""'");
- }
- arg5 = (mode_t)(val5);
- }
- result = (tdb *)new_tdb((char const *)arg1,arg2,arg3,arg4,arg5);
- /* Throw an IOError exception from errno if tdb_open() returns NULL */
- if (result == NULL) {
- PyErr_SetFromErrno(PyExc_IOError);
- SWIG_fail;
- }
- resultobj = SWIG_NewPointerObj(result, SWIGTYPE_p_tdb_context, 0);
- if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
- return resultobj;
-fail:
- if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_error(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- enum TDB_ERROR result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_error" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- result = (enum TDB_ERROR)tdb_error(arg1);
- resultobj = SWIG_From_int((int)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_delete_Tdb(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Tdb" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- delete_tdb(arg1);
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_close(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_close" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- result = (int)tdb_close(arg1);
- resultobj = SWIG_From_int((int)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- TDB_DATA arg2 ;
- TDB_DATA arg3 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- char * kwnames[] = {
- (char *) "self",(char *) "key",(char *) "new_dbuf", NULL
- };
-
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:Tdb_append",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_append" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- if (obj1 == Py_None) {
- (&arg2)->dsize = 0;
- (&arg2)->dptr = NULL;
- } else if (!PyString_Check(obj1)) {
- PyErr_SetString(PyExc_TypeError, "string arg expected");
- return NULL;
- } else {
- (&arg2)->dsize = PyString_Size(obj1);
- (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
- }
- if (obj2 == Py_None) {
- (&arg3)->dsize = 0;
- (&arg3)->dptr = NULL;
- } else if (!PyString_Check(obj2)) {
- PyErr_SetString(PyExc_TypeError, "string arg expected");
- return NULL;
- } else {
- (&arg3)->dsize = PyString_Size(obj2);
- (&arg3)->dptr = (uint8_t *)PyString_AsString(obj2);
- }
- result = (int)tdb_append(arg1,arg2,arg3);
- resultobj = SWIG_From_int((int)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_errorstr(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_errorstr" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- result = (char *)tdb_errorstr(arg1);
- resultobj = SWIG_FromCharPtr((const char *)result);
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- TDB_DATA arg2 ;
- TDB_DATA result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- char * kwnames[] = {
- (char *) "self",(char *) "key", NULL
- };
-
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_get",kwnames,&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_get" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- if (obj1 == Py_None) {
- (&arg2)->dsize = 0;
- (&arg2)->dptr = NULL;
- } else if (!PyString_Check(obj1)) {
- PyErr_SetString(PyExc_TypeError, "string arg expected");
- return NULL;
- } else {
- (&arg2)->dsize = PyString_Size(obj1);
- (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
- }
- result = tdb_fetch(arg1,arg2);
- if ((&result)->dptr == NULL && (&result)->dsize == 0) {
- resultobj = Py_None;
- } else {
- resultobj = PyString_FromStringAndSize((const char *)(&result)->dptr, (&result)->dsize);
- free((&result)->dptr);
- }
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_delete(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- TDB_DATA arg2 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- char * kwnames[] = {
- (char *) "self",(char *) "key", NULL
- };
-
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_delete",kwnames,&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_delete" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- if (obj1 == Py_None) {
- (&arg2)->dsize = 0;
- (&arg2)->dptr = NULL;
- } else if (!PyString_Check(obj1)) {
- PyErr_SetString(PyExc_TypeError, "string arg expected");
- return NULL;
- } else {
- (&arg2)->dsize = PyString_Size(obj1);
- (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
- }
- result = (int)tdb_delete(arg1,arg2);
- resultobj = SWIG_From_int((int)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_store(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- TDB_DATA arg2 ;
- TDB_DATA arg3 ;
- int arg4 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val4 ;
- int ecode4 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
- char * kwnames[] = {
- (char *) "self",(char *) "key",(char *) "dbuf",(char *) "flag", NULL
- };
-
- arg4 = TDB_REPLACE;
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:Tdb_store",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_store" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- if (obj1 == Py_None) {
- (&arg2)->dsize = 0;
- (&arg2)->dptr = NULL;
- } else if (!PyString_Check(obj1)) {
- PyErr_SetString(PyExc_TypeError, "string arg expected");
- return NULL;
- } else {
- (&arg2)->dsize = PyString_Size(obj1);
- (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
- }
- if (obj2 == Py_None) {
- (&arg3)->dsize = 0;
- (&arg3)->dptr = NULL;
- } else if (!PyString_Check(obj2)) {
- PyErr_SetString(PyExc_TypeError, "string arg expected");
- return NULL;
- } else {
- (&arg3)->dsize = PyString_Size(obj2);
- (&arg3)->dptr = (uint8_t *)PyString_AsString(obj2);
- }
- if (obj3) {
- ecode4 = SWIG_AsVal_int(obj3, &val4);
- if (!SWIG_IsOK(ecode4)) {
- SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Tdb_store" "', argument " "4"" of type '" "int""'");
- }
- arg4 = (int)(val4);
- }
- result = (int)tdb_store(arg1,arg2,arg3,arg4);
- resultobj = SWIG_From_int((int)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_exists(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- TDB_DATA arg2 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- char * kwnames[] = {
- (char *) "self",(char *) "key", NULL
- };
-
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_exists",kwnames,&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_exists" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- if (obj1 == Py_None) {
- (&arg2)->dsize = 0;
- (&arg2)->dptr = NULL;
- } else if (!PyString_Check(obj1)) {
- PyErr_SetString(PyExc_TypeError, "string arg expected");
- return NULL;
- } else {
- (&arg2)->dsize = PyString_Size(obj1);
- (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
- }
- result = (int)tdb_exists(arg1,arg2);
- resultobj = SWIG_From_int((int)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_firstkey(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- TDB_DATA result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_firstkey" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- result = tdb_firstkey(arg1);
- if ((&result)->dptr == NULL && (&result)->dsize == 0) {
- resultobj = Py_None;
- } else {
- resultobj = PyString_FromStringAndSize((const char *)(&result)->dptr, (&result)->dsize);
- free((&result)->dptr);
- }
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_nextkey(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- TDB_DATA arg2 ;
- TDB_DATA result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- char * kwnames[] = {
- (char *) "self",(char *) "key", NULL
- };
-
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_nextkey",kwnames,&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_nextkey" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- if (obj1 == Py_None) {
- (&arg2)->dsize = 0;
- (&arg2)->dptr = NULL;
- } else if (!PyString_Check(obj1)) {
- PyErr_SetString(PyExc_TypeError, "string arg expected");
- return NULL;
- } else {
- (&arg2)->dsize = PyString_Size(obj1);
- (&arg2)->dptr = (uint8_t *)PyString_AsString(obj1);
- }
- result = tdb_nextkey(arg1,arg2);
- if ((&result)->dptr == NULL && (&result)->dsize == 0) {
- resultobj = Py_None;
- } else {
- resultobj = PyString_FromStringAndSize((const char *)(&result)->dptr, (&result)->dsize);
- free((&result)->dptr);
- }
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_lock_all" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- result = (int)tdb_lockall(arg1);
- resultobj = SWIG_From_int((int)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_unlock_all" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- result = (int)tdb_unlockall(arg1);
- resultobj = SWIG_From_int((int)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_read_lock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_read_lock_all" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- result = (int)tdb_lockall_read(arg1);
- resultobj = SWIG_From_int((int)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_read_unlock_all(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_read_unlock_all" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- result = (int)tdb_unlockall_read(arg1);
- resultobj = SWIG_From_int((int)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_reopen(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_reopen" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- result = (int)tdb_reopen(arg1);
- resultobj = SWIG_From_int((int)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_transaction_start(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_transaction_start" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- result = (int)tdb_transaction_start(arg1);
- resultobj = SWIG_From_int((int)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_transaction_commit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_transaction_commit" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- result = (int)tdb_transaction_commit(arg1);
- resultobj = SWIG_From_int((int)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_transaction_cancel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_transaction_cancel" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- result = (int)tdb_transaction_cancel(arg1);
- resultobj = SWIG_From_int((int)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_transaction_recover(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_transaction_recover" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- result = (int)tdb_transaction_recover(arg1);
- resultobj = SWIG_From_int((int)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_hash_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_hash_size" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- result = (int)tdb_hash_size(arg1);
- resultobj = SWIG_From_int((int)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_map_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- size_t result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_map_size" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- result = tdb_map_size(arg1);
- resultobj = SWIG_From_size_t((size_t)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_get_flags(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_get_flags" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- result = (int)tdb_get_flags(arg1);
- resultobj = SWIG_From_int((int)(result));
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_set_max_dead(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- char * kwnames[] = {
- (char *) "self",(char *) "max_dead", NULL
- };
-
- if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:Tdb_set_max_dead",kwnames,&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_set_max_dead" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- ecode2 = SWIG_AsVal_int(obj1, &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Tdb_set_max_dead" "', argument " "2"" of type '" "int""'");
- }
- arg2 = (int)(val2);
- tdb_set_max_dead(arg1,arg2);
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_Tdb_name(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- tdb *arg1 = (tdb *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject *swig_obj[1] ;
-
- if (!args) SWIG_fail;
- swig_obj[0] = args;
- res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_tdb_context, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Tdb_name" "', argument " "1"" of type '" "tdb *""'");
- }
- arg1 = (tdb *)(argp1);
- result = (char *)tdb_name(arg1);
- resultobj = SWIG_FromCharPtr((const char *)result);
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *Tdb_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *obj;
- if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
- SWIG_TypeNewClientData(SWIGTYPE_p_tdb_context, SWIG_NewClientData(obj));
- return SWIG_Py_Void();
-}
-
-SWIGINTERN PyObject *Tdb_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- return SWIG_Python_InitShadowInstance(args);
-}
-
-static PyMethodDef SwigMethods[] = {
- { (char *)"new_Tdb", (PyCFunction) _wrap_new_Tdb, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
- "S.__init__(name,hash_size=0,tdb_flags=TDB_DEFAULT,flags=O_RDWR,mode=0600)\n"
- "Open a TDB file.\n"
- ""},
- { (char *)"Tdb_error", (PyCFunction)_wrap_Tdb_error, METH_O, (char *)"\n"
- "S.error() -> int\n"
- "Find last error number returned by operation on this TDB.\n"
- ""},
- { (char *)"delete_Tdb", (PyCFunction)_wrap_delete_Tdb, METH_O, NULL},
- { (char *)"Tdb_close", (PyCFunction)_wrap_Tdb_close, METH_O, (char *)"\n"
- "S.close() -> None\n"
- "Close the TDB file.\n"
- ""},
- { (char *)"Tdb_append", (PyCFunction) _wrap_Tdb_append, METH_VARARGS | METH_KEYWORDS, NULL},
- { (char *)"Tdb_errorstr", (PyCFunction)_wrap_Tdb_errorstr, METH_O, (char *)"\n"
- "S.errorstr() -> errorstring\n"
- "Obtain last error message.\n"
- ""},
- { (char *)"Tdb_get", (PyCFunction) _wrap_Tdb_get, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
- "S.fetch(key) -> value\n"
- "Fetch a value.\n"
- ""},
- { (char *)"Tdb_delete", (PyCFunction) _wrap_Tdb_delete, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
- "S.delete(key) -> None\n"
- "Delete an entry.\n"
- ""},
- { (char *)"Tdb_store", (PyCFunction) _wrap_Tdb_store, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
- "S.store(key, value, flag=TDB_REPLACE) -> None\n"
- "Store an entry.\n"
- ""},
- { (char *)"Tdb_exists", (PyCFunction) _wrap_Tdb_exists, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
- "S.exists(key) -> bool\n"
- "Check whether key exists in this database.\n"
- ""},
- { (char *)"Tdb_firstkey", (PyCFunction)_wrap_Tdb_firstkey, METH_O, (char *)"\n"
- "S.firstkey() -> data\n"
- "Return the first key in this database.\n"
- ""},
- { (char *)"Tdb_nextkey", (PyCFunction) _wrap_Tdb_nextkey, METH_VARARGS | METH_KEYWORDS, (char *)"\n"
- "S.nextkey(prev) -> data\n"
- "Return the next key in this database.\n"
- ""},
- { (char *)"Tdb_lock_all", (PyCFunction)_wrap_Tdb_lock_all, METH_O, (char *)"S.lockall() -> bool"},
- { (char *)"Tdb_unlock_all", (PyCFunction)_wrap_Tdb_unlock_all, METH_O, (char *)"S.unlockall() -> bool"},
- { (char *)"Tdb_read_lock_all", (PyCFunction)_wrap_Tdb_read_lock_all, METH_O, NULL},
- { (char *)"Tdb_read_unlock_all", (PyCFunction)_wrap_Tdb_read_unlock_all, METH_O, NULL},
- { (char *)"Tdb_reopen", (PyCFunction)_wrap_Tdb_reopen, METH_O, (char *)"\n"
- "S.reopen() -> bool\n"
- "Reopen this file.\n"
- ""},
- { (char *)"Tdb_transaction_start", (PyCFunction)_wrap_Tdb_transaction_start, METH_O, (char *)"\n"
- "S.transaction_start() -> None\n"
- "Start a new transaction.\n"
- ""},
- { (char *)"Tdb_transaction_commit", (PyCFunction)_wrap_Tdb_transaction_commit, METH_O, (char *)"\n"
- "S.transaction_commit() -> None\n"
- "Commit the currently active transaction.\n"
- ""},
- { (char *)"Tdb_transaction_cancel", (PyCFunction)_wrap_Tdb_transaction_cancel, METH_O, (char *)"\n"
- "S.transaction_cancel() -> None\n"
- "Cancel the currently active transaction.\n"
- ""},
- { (char *)"Tdb_transaction_recover", (PyCFunction)_wrap_Tdb_transaction_recover, METH_O, NULL},
- { (char *)"Tdb_hash_size", (PyCFunction)_wrap_Tdb_hash_size, METH_O, (char *)"S.hash_size() -> int"},
- { (char *)"Tdb_map_size", (PyCFunction)_wrap_Tdb_map_size, METH_O, (char *)"S.map_size() -> int"},
- { (char *)"Tdb_get_flags", (PyCFunction)_wrap_Tdb_get_flags, METH_O, (char *)"S.get_flags() -> int"},
- { (char *)"Tdb_set_max_dead", (PyCFunction) _wrap_Tdb_set_max_dead, METH_VARARGS | METH_KEYWORDS, (char *)"S.set_max_dead(int) -> None"},
- { (char *)"Tdb_name", (PyCFunction)_wrap_Tdb_name, METH_O, (char *)"\n"
- "S.name() -> path\n"
- "Return filename of this TDB file.\n"
- ""},
- { (char *)"Tdb_swigregister", Tdb_swigregister, METH_VARARGS, NULL},
- { (char *)"Tdb_swiginit", Tdb_swiginit, METH_VARARGS, NULL},
- { NULL, NULL, 0, NULL }
-};
-
-
-/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
-
-static swig_type_info _swigt__p_TDB_DATA = {"_p_TDB_DATA", "TDB_DATA *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *|mode_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_long_long = {"_p_long_long", "int_least64_t *|int_fast64_t *|int64_t *|long long *|intmax_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_least8_t *|int_fast8_t *|int8_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_tdb_context = {"_p_tdb_context", "struct tdb_context *|tdb *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|uint_least8_t *|uint_fast8_t *|uint8_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uintptr_t *|uint_least32_t *|uint_fast32_t *|uint32_t *|unsigned int *|uint_fast16_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_unsigned_long_long = {"_p_unsigned_long_long", "uint_least64_t *|uint_fast64_t *|uint64_t *|unsigned long long *|uintmax_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|uint_least16_t *|uint16_t *", 0, 0, (void*)0, 0};
-
-static swig_type_info *swig_type_initial[] = {
- &_swigt__p_TDB_DATA,
- &_swigt__p_char,
- &_swigt__p_int,
- &_swigt__p_long_long,
- &_swigt__p_short,
- &_swigt__p_signed_char,
- &_swigt__p_tdb_context,
- &_swigt__p_unsigned_char,
- &_swigt__p_unsigned_int,
- &_swigt__p_unsigned_long_long,
- &_swigt__p_unsigned_short,
-};
-
-static swig_cast_info _swigc__p_TDB_DATA[] = { {&_swigt__p_TDB_DATA, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_long_long[] = { {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_tdb_context[] = { {&_swigt__p_tdb_context, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_unsigned_long_long[] = { {&_swigt__p_unsigned_long_long, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_unsigned_short[] = { {&_swigt__p_unsigned_short, 0, 0, 0},{0, 0, 0, 0}};
-
-static swig_cast_info *swig_cast_initial[] = {
- _swigc__p_TDB_DATA,
- _swigc__p_char,
- _swigc__p_int,
- _swigc__p_long_long,
- _swigc__p_short,
- _swigc__p_signed_char,
- _swigc__p_tdb_context,
- _swigc__p_unsigned_char,
- _swigc__p_unsigned_int,
- _swigc__p_unsigned_long_long,
- _swigc__p_unsigned_short,
-};
-
-
-/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
-
-static swig_const_info swig_const_table[] = {
-{0, 0, 0, 0.0, 0, 0}};
-
-#ifdef __cplusplus
-}
-#endif
-/* -----------------------------------------------------------------------------
- * Type initialization:
- * This problem is tough by the requirement that no dynamic
- * memory is used. Also, since swig_type_info structures store pointers to
- * swig_cast_info structures and swig_cast_info structures store pointers back
- * to swig_type_info structures, we need some lookup code at initialization.
- * The idea is that swig generates all the structures that are needed.
- * The runtime then collects these partially filled structures.
- * The SWIG_InitializeModule function takes these initial arrays out of
- * swig_module, and does all the lookup, filling in the swig_module.types
- * array with the correct data and linking the correct swig_cast_info
- * structures together.
- *
- * The generated swig_type_info structures are assigned staticly to an initial
- * array. We just loop through that array, and handle each type individually.
- * First we lookup if this type has been already loaded, and if so, use the
- * loaded structure instead of the generated one. Then we have to fill in the
- * cast linked list. The cast data is initially stored in something like a
- * two-dimensional array. Each row corresponds to a type (there are the same
- * number of rows as there are in the swig_type_initial array). Each entry in
- * a column is one of the swig_cast_info structures for that type.
- * The cast_initial array is actually an array of arrays, because each row has
- * a variable number of columns. So to actually build the cast linked list,
- * we find the array of casts associated with the type, and loop through it
- * adding the casts to the list. The one last trick we need to do is making
- * sure the type pointer in the swig_cast_info struct is correct.
- *
- * First off, we lookup the cast->type name to see if it is already loaded.
- * There are three cases to handle:
- * 1) If the cast->type has already been loaded AND the type we are adding
- * casting info to has not been loaded (it is in this module), THEN we
- * replace the cast->type pointer with the type pointer that has already
- * been loaded.
- * 2) If BOTH types (the one we are adding casting info to, and the
- * cast->type) are loaded, THEN the cast info has already been loaded by
- * the previous module so we just ignore it.
- * 3) Finally, if cast->type has not already been loaded, then we add that
- * swig_cast_info to the linked list (because the cast->type) pointer will
- * be correct.
- * ----------------------------------------------------------------------------- */
-
-#ifdef __cplusplus
-extern "C" {
-#if 0
-} /* c-mode */
-#endif
-#endif
-
-#if 0
-#define SWIGRUNTIME_DEBUG
-#endif
-
-
-SWIGRUNTIME void
-SWIG_InitializeModule(void *clientdata) {
- size_t i;
- swig_module_info *module_head, *iter;
- int found, init;
-
- clientdata = clientdata;
-
- /* check to see if the circular list has been setup, if not, set it up */
- if (swig_module.next==0) {
- /* Initialize the swig_module */
- swig_module.type_initial = swig_type_initial;
- swig_module.cast_initial = swig_cast_initial;
- swig_module.next = &swig_module;
- init = 1;
- } else {
- init = 0;
- }
-
- /* Try and load any already created modules */
- module_head = SWIG_GetModule(clientdata);
- if (!module_head) {
- /* This is the first module loaded for this interpreter */
- /* so set the swig module into the interpreter */
- SWIG_SetModule(clientdata, &swig_module);
- module_head = &swig_module;
- } else {
- /* the interpreter has loaded a SWIG module, but has it loaded this one? */
- found=0;
- iter=module_head;
- do {
- if (iter==&swig_module) {
- found=1;
- break;
- }
- iter=iter->next;
- } while (iter!= module_head);
-
- /* if the is found in the list, then all is done and we may leave */
- if (found) return;
- /* otherwise we must add out module into the list */
- swig_module.next = module_head->next;
- module_head->next = &swig_module;
- }
-
- /* When multiple interpeters are used, a module could have already been initialized in
- a different interpreter, but not yet have a pointer in this interpreter.
- In this case, we do not want to continue adding types... everything should be
- set up already */
- if (init == 0) return;
-
- /* Now work on filling in swig_module.types */
-#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: size %d\n", swig_module.size);
-#endif
- for (i = 0; i < swig_module.size; ++i) {
- swig_type_info *type = 0;
- swig_type_info *ret;
- swig_cast_info *cast;
-
-#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
-#endif
-
- /* if there is another module already loaded */
- if (swig_module.next != &swig_module) {
- type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
- }
- if (type) {
- /* Overwrite clientdata field */
-#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: found type %s\n", type->name);
-#endif
- if (swig_module.type_initial[i]->clientdata) {
- type->clientdata = swig_module.type_initial[i]->clientdata;
-#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
-#endif
- }
- } else {
- type = swig_module.type_initial[i];
- }
-
- /* Insert casting types */
- cast = swig_module.cast_initial[i];
- while (cast->type) {
- /* Don't need to add information already in the list */
- ret = 0;
-#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
-#endif
- if (swig_module.next != &swig_module) {
- ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
-#ifdef SWIGRUNTIME_DEBUG
- if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
-#endif
- }
- if (ret) {
- if (type == swig_module.type_initial[i]) {
-#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
-#endif
- cast->type = ret;
- ret = 0;
- } else {
- /* Check for casting already in the list */
- swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
-#ifdef SWIGRUNTIME_DEBUG
- if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
-#endif
- if (!ocast) ret = 0;
- }
- }
-
- if (!ret) {
-#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
-#endif
- if (type->cast) {
- type->cast->prev = cast;
- cast->next = type->cast;
- }
- type->cast = cast;
- }
- cast++;
- }
- /* Set entry in modules->types array equal to the type */
- swig_module.types[i] = type;
- }
- swig_module.types[i] = 0;
-
-#ifdef SWIGRUNTIME_DEBUG
- printf("**** SWIG_InitializeModule: Cast List ******\n");
- for (i = 0; i < swig_module.size; ++i) {
- int j = 0;
- swig_cast_info *cast = swig_module.cast_initial[i];
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
- while (cast->type) {
- printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
- cast++;
- ++j;
- }
- printf("---- Total casts: %d\n",j);
- }
- printf("**** SWIG_InitializeModule: Cast List ******\n");
-#endif
-}
-
-/* This function will propagate the clientdata field of type to
-* any new swig_type_info structures that have been added into the list
-* of equivalent types. It is like calling
-* SWIG_TypeClientData(type, clientdata) a second time.
-*/
-SWIGRUNTIME void
-SWIG_PropagateClientData(void) {
- size_t i;
- swig_cast_info *equiv;
- static int init_run = 0;
-
- if (init_run) return;
- init_run = 1;
-
- for (i = 0; i < swig_module.size; i++) {
- if (swig_module.types[i]->clientdata) {
- equiv = swig_module.types[i]->cast;
- while (equiv) {
- if (!equiv->converter) {
- if (equiv->type && !equiv->type->clientdata)
- SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
- }
- equiv = equiv->next;
- }
- }
- }
-}
-
-#ifdef __cplusplus
-#if 0
-{
- /* c-mode */
-#endif
-}
-#endif
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- /* Python-specific SWIG API */
-#define SWIG_newvarlink() SWIG_Python_newvarlink()
-#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
-#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
-
- /* -----------------------------------------------------------------------------
- * global variable support code.
- * ----------------------------------------------------------------------------- */
-
- typedef struct swig_globalvar {
- char *name; /* Name of global variable */
- PyObject *(*get_attr)(void); /* Return the current value */
- int (*set_attr)(PyObject *); /* Set the value */
- struct swig_globalvar *next;
- } swig_globalvar;
-
- typedef struct swig_varlinkobject {
- PyObject_HEAD
- swig_globalvar *vars;
- } swig_varlinkobject;
-
- SWIGINTERN PyObject *
- swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
- return PyString_FromString("<Swig global variables>");
- }
-
- SWIGINTERN PyObject *
- swig_varlink_str(swig_varlinkobject *v) {
- PyObject *str = PyString_FromString("(");
- swig_globalvar *var;
- for (var = v->vars; var; var=var->next) {
- PyString_ConcatAndDel(&str,PyString_FromString(var->name));
- if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
- }
- PyString_ConcatAndDel(&str,PyString_FromString(")"));
- return str;
- }
-
- SWIGINTERN int
- swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) {
- PyObject *str = swig_varlink_str(v);
- fprintf(fp,"Swig global variables ");
- fprintf(fp,"%s\n", PyString_AsString(str));
- Py_DECREF(str);
- return 0;
- }
-
- SWIGINTERN void
- swig_varlink_dealloc(swig_varlinkobject *v) {
- swig_globalvar *var = v->vars;
- while (var) {
- swig_globalvar *n = var->next;
- free(var->name);
- free(var);
- var = n;
- }
- }
-
- SWIGINTERN PyObject *
- swig_varlink_getattr(swig_varlinkobject *v, char *n) {
- PyObject *res = NULL;
- swig_globalvar *var = v->vars;
- while (var) {
- if (strcmp(var->name,n) == 0) {
- res = (*var->get_attr)();
- break;
- }
- var = var->next;
- }
- if (res == NULL && !PyErr_Occurred()) {
- PyErr_SetString(PyExc_NameError,"Unknown C global variable");
- }
- return res;
- }
-
- SWIGINTERN int
- swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
- int res = 1;
- swig_globalvar *var = v->vars;
- while (var) {
- if (strcmp(var->name,n) == 0) {
- res = (*var->set_attr)(p);
- break;
- }
- var = var->next;
- }
- if (res == 1 && !PyErr_Occurred()) {
- PyErr_SetString(PyExc_NameError,"Unknown C global variable");
- }
- return res;
- }
-
- SWIGINTERN PyTypeObject*
- swig_varlink_type(void) {
- static char varlink__doc__[] = "Swig var link object";
- static PyTypeObject varlink_type;
- static int type_init = 0;
- if (!type_init) {
- const PyTypeObject tmp
- = {
- PyObject_HEAD_INIT(NULL)
- 0, /* Number of items in variable part (ob_size) */
- (char *)"swigvarlink", /* Type name (tp_name) */
- sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */
- 0, /* Itemsize (tp_itemsize) */
- (destructor) swig_varlink_dealloc, /* Deallocator (tp_dealloc) */
- (printfunc) swig_varlink_print, /* Print (tp_print) */
- (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */
- (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */
- 0, /* tp_compare */
- (reprfunc) swig_varlink_repr, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- (reprfunc)swig_varlink_str, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- 0, /* tp_flags */
- varlink__doc__, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
-#if PY_VERSION_HEX >= 0x02020000
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
-#endif
-#if PY_VERSION_HEX >= 0x02030000
- 0, /* tp_del */
-#endif
-#ifdef COUNT_ALLOCS
- 0,0,0,0 /* tp_alloc -> tp_next */
-#endif
- };
- varlink_type = tmp;
- varlink_type.ob_type = &PyType_Type;
- type_init = 1;
- }
- return &varlink_type;
- }
-
- /* Create a variable linking object for use later */
- SWIGINTERN PyObject *
- SWIG_Python_newvarlink(void) {
- swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
- if (result) {
- result->vars = 0;
- }
- return ((PyObject*) result);
- }
-
- SWIGINTERN void
- SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
- swig_varlinkobject *v = (swig_varlinkobject *) p;
- swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
- if (gv) {
- size_t size = strlen(name)+1;
- gv->name = (char *)malloc(size);
- if (gv->name) {
- strncpy(gv->name,name,size);
- gv->get_attr = get_attr;
- gv->set_attr = set_attr;
- gv->next = v->vars;
- }
- }
- v->vars = gv;
- }
-
- SWIGINTERN PyObject *
- SWIG_globals(void) {
- static PyObject *_SWIG_globals = 0;
- if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink();
- return _SWIG_globals;
- }
-
- /* -----------------------------------------------------------------------------
- * constants/methods manipulation
- * ----------------------------------------------------------------------------- */
-
- /* Install Constants */
- SWIGINTERN void
- SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
- PyObject *obj = 0;
- size_t i;
- for (i = 0; constants[i].type; ++i) {
- switch(constants[i].type) {
- case SWIG_PY_POINTER:
- obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
- break;
- case SWIG_PY_BINARY:
- obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
- break;
- default:
- obj = 0;
- break;
- }
- if (obj) {
- PyDict_SetItemString(d, constants[i].name, obj);
- Py_DECREF(obj);
- }
- }
- }
-
- /* -----------------------------------------------------------------------------*/
- /* Fix SwigMethods to carry the callback ptrs when needed */
- /* -----------------------------------------------------------------------------*/
-
- SWIGINTERN void
- SWIG_Python_FixMethods(PyMethodDef *methods,
- swig_const_info *const_table,
- swig_type_info **types,
- swig_type_info **types_initial) {
- size_t i;
- for (i = 0; methods[i].ml_name; ++i) {
- const char *c = methods[i].ml_doc;
- if (c && (c = strstr(c, "swig_ptr: "))) {
- int j;
- swig_const_info *ci = 0;
- const char *name = c + 10;
- for (j = 0; const_table[j].type; ++j) {
- if (strncmp(const_table[j].name, name,
- strlen(const_table[j].name)) == 0) {
- ci = &(const_table[j]);
- break;
- }
- }
- if (ci) {
- size_t shift = (ci->ptype) - types;
- swig_type_info *ty = types_initial[shift];
- size_t ldoc = (c - methods[i].ml_doc);
- size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
- char *ndoc = (char*)malloc(ldoc + lptr + 10);
- if (ndoc) {
- char *buff = ndoc;
- void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
- if (ptr) {
- strncpy(buff, methods[i].ml_doc, ldoc);
- buff += ldoc;
- strncpy(buff, "swig_ptr: ", 10);
- buff += 10;
- SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
- methods[i].ml_doc = ndoc;
- }
- }
- }
- }
- }
- }
-
-#ifdef __cplusplus
-}
-#endif
-
-/* -----------------------------------------------------------------------------*
- * Partial Init method
- * -----------------------------------------------------------------------------*/
-
-#ifdef __cplusplus
-extern "C"
-#endif
-SWIGEXPORT void SWIG_init(void) {
- PyObject *m, *d;
-
- /* Fix SwigMethods to carry the callback ptrs when needed */
- SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
-
- m = Py_InitModule((char *) SWIG_name, SwigMethods);
- d = PyModule_GetDict(m);
-
- SWIG_InitializeModule(0);
- SWIG_InstallConstants(d,swig_const_table);
-
-
- SWIG_Python_SetConstant(d, "REPLACE",SWIG_From_int((int)(TDB_REPLACE)));
- SWIG_Python_SetConstant(d, "INSERT",SWIG_From_int((int)(TDB_INSERT)));
- SWIG_Python_SetConstant(d, "MODIFY",SWIG_From_int((int)(TDB_MODIFY)));
- SWIG_Python_SetConstant(d, "DEFAULT",SWIG_From_int((int)(TDB_DEFAULT)));
- SWIG_Python_SetConstant(d, "CLEAR_IF_FIRST",SWIG_From_int((int)(TDB_CLEAR_IF_FIRST)));
- SWIG_Python_SetConstant(d, "INTERNAL",SWIG_From_int((int)(TDB_INTERNAL)));
- SWIG_Python_SetConstant(d, "NOLOCK",SWIG_From_int((int)(TDB_NOLOCK)));
- SWIG_Python_SetConstant(d, "NOMMAP",SWIG_From_int((int)(TDB_NOMMAP)));
- SWIG_Python_SetConstant(d, "CONVERT",SWIG_From_int((int)(TDB_CONVERT)));
- SWIG_Python_SetConstant(d, "BIGENDIAN",SWIG_From_int((int)(TDB_BIGENDIAN)));
- SWIG_Python_SetConstant(d, "TDB_SUCCESS",SWIG_From_int((int)(TDB_SUCCESS)));
- SWIG_Python_SetConstant(d, "TDB_ERR_CORRUPT",SWIG_From_int((int)(TDB_ERR_CORRUPT)));
- SWIG_Python_SetConstant(d, "TDB_ERR_IO",SWIG_From_int((int)(TDB_ERR_IO)));
- SWIG_Python_SetConstant(d, "TDB_ERR_LOCK",SWIG_From_int((int)(TDB_ERR_LOCK)));
- SWIG_Python_SetConstant(d, "TDB_ERR_OOM",SWIG_From_int((int)(TDB_ERR_OOM)));
- SWIG_Python_SetConstant(d, "TDB_ERR_EXISTS",SWIG_From_int((int)(TDB_ERR_EXISTS)));
- SWIG_Python_SetConstant(d, "TDB_ERR_NOLOCK",SWIG_From_int((int)(TDB_ERR_NOLOCK)));
- SWIG_Python_SetConstant(d, "TDB_ERR_LOCK_TIMEOUT",SWIG_From_int((int)(TDB_ERR_LOCK_TIMEOUT)));
- SWIG_Python_SetConstant(d, "TDB_ERR_NOEXIST",SWIG_From_int((int)(TDB_ERR_NOEXIST)));
- SWIG_Python_SetConstant(d, "TDB_ERR_EINVAL",SWIG_From_int((int)(TDB_ERR_EINVAL)));
- SWIG_Python_SetConstant(d, "TDB_ERR_RDONLY",SWIG_From_int((int)(TDB_ERR_RDONLY)));
-}
-
diff --git a/source3/lib/tdb/tools/tdbbackup.c b/source3/lib/tdb/tools/tdbbackup.c
deleted file mode 100644
index 6f3ca48314..0000000000
--- a/source3/lib/tdb/tools/tdbbackup.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- low level tdb backup and restore utility
- Copyright (C) Andrew Tridgell 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/>.
-*/
-
-/*
-
- This program is meant for backup/restore of tdb databases. Typical usage would be:
- tdbbackup *.tdb
- when Samba shuts down cleanly, which will make a backup of all the local databases
- to *.bak files. Then on Samba startup you would use:
- tdbbackup -v *.tdb
- and this will check the databases for corruption and if corruption is detected then
- the backup will be restored.
-
- You may also like to do a backup on a regular basis while Samba is
- running, perhaps using cron.
-
- The reason this program is needed is to cope with power failures
- while Samba is running. A power failure could lead to database
- corruption and Samba will then not start correctly.
-
- Note that many of the databases in Samba are transient and thus
- don't need to be backed up, so you can optimise the above a little
- by only running the backup on the critical databases.
-
- */
-
-#include "replace.h"
-#include "system/locale.h"
-#include "system/time.h"
-#include "system/filesys.h"
-#include "system/wait.h"
-#include "tdb.h"
-
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#endif
-
-static int failed;
-
-static char *add_suffix(const char *name, const char *suffix)
-{
- char *ret;
- int len = strlen(name) + strlen(suffix) + 1;
- ret = (char *)malloc(len);
- if (!ret) {
- fprintf(stderr,"Out of memory!\n");
- exit(1);
- }
- snprintf(ret, len, "%s%s", name, suffix);
- return ret;
-}
-
-static int copy_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
-{
- TDB_CONTEXT *tdb_new = (TDB_CONTEXT *)state;
-
- if (tdb_store(tdb_new, key, dbuf, TDB_INSERT) != 0) {
- fprintf(stderr,"Failed to insert into %s\n", tdb_name(tdb_new));
- failed = 1;
- return 1;
- }
- return 0;
-}
-
-
-static int test_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
-{
- return 0;
-}
-
-/*
- carefully backup a tdb, validating the contents and
- only doing the backup if its OK
- this function is also used for restore
-*/
-static int backup_tdb(const char *old_name, const char *new_name, int hash_size)
-{
- TDB_CONTEXT *tdb;
- TDB_CONTEXT *tdb_new;
- char *tmp_name;
- struct stat st;
- int count1, count2;
-
- tmp_name = add_suffix(new_name, ".tmp");
-
- /* stat the old tdb to find its permissions */
- if (stat(old_name, &st) != 0) {
- perror(old_name);
- free(tmp_name);
- return 1;
- }
-
- /* open the old tdb */
- tdb = tdb_open(old_name, 0, 0, O_RDWR, 0);
- if (!tdb) {
- printf("Failed to open %s\n", old_name);
- free(tmp_name);
- return 1;
- }
-
- /* create the new tdb */
- unlink(tmp_name);
- tdb_new = tdb_open(tmp_name,
- hash_size ? hash_size : tdb_hash_size(tdb),
- TDB_DEFAULT, O_RDWR|O_CREAT|O_EXCL,
- st.st_mode & 0777);
- if (!tdb_new) {
- perror(tmp_name);
- free(tmp_name);
- return 1;
- }
-
- /* lock the old tdb */
- if (tdb_lockall(tdb) != 0) {
- fprintf(stderr,"Failed to lock %s\n", old_name);
- tdb_close(tdb);
- tdb_close(tdb_new);
- unlink(tmp_name);
- free(tmp_name);
- return 1;
- }
-
- failed = 0;
-
- /* traverse and copy */
- count1 = tdb_traverse(tdb, copy_fn, (void *)tdb_new);
- if (count1 < 0 || failed) {
- fprintf(stderr,"failed to copy %s\n", old_name);
- tdb_close(tdb);
- tdb_close(tdb_new);
- unlink(tmp_name);
- free(tmp_name);
- return 1;
- }
-
- /* close the old tdb */
- tdb_close(tdb);
-
- /* close the new tdb and re-open read-only */
- tdb_close(tdb_new);
- tdb_new = tdb_open(tmp_name, 0, TDB_DEFAULT, O_RDONLY, 0);
- if (!tdb_new) {
- fprintf(stderr,"failed to reopen %s\n", tmp_name);
- unlink(tmp_name);
- perror(tmp_name);
- free(tmp_name);
- return 1;
- }
-
- /* traverse the new tdb to confirm */
- count2 = tdb_traverse(tdb_new, test_fn, NULL);
- if (count2 != count1) {
- fprintf(stderr,"failed to copy %s\n", old_name);
- tdb_close(tdb_new);
- unlink(tmp_name);
- free(tmp_name);
- return 1;
- }
-
- /* make sure the new tdb has reached stable storage */
- fsync(tdb_fd(tdb_new));
-
- /* close the new tdb and rename it to .bak */
- tdb_close(tdb_new);
- if (rename(tmp_name, new_name) != 0) {
- perror(new_name);
- free(tmp_name);
- return 1;
- }
-
- free(tmp_name);
-
- return 0;
-}
-
-/*
- verify a tdb and if it is corrupt then restore from *.bak
-*/
-static int verify_tdb(const char *fname, const char *bak_name)
-{
- TDB_CONTEXT *tdb;
- int count = -1;
-
- /* open the tdb */
- tdb = tdb_open(fname, 0, 0, O_RDONLY, 0);
-
- /* traverse the tdb, then close it */
- if (tdb) {
- count = tdb_traverse(tdb, test_fn, NULL);
- tdb_close(tdb);
- }
-
- /* count is < 0 means an error */
- if (count < 0) {
- printf("restoring %s\n", fname);
- return backup_tdb(bak_name, fname, 0);
- }
-
- printf("%s : %d records\n", fname, count);
-
- return 0;
-}
-
-/*
- see if one file is newer than another
-*/
-static int file_newer(const char *fname1, const char *fname2)
-{
- struct stat st1, st2;
- if (stat(fname1, &st1) != 0) {
- return 0;
- }
- if (stat(fname2, &st2) != 0) {
- return 1;
- }
- return (st1.st_mtime > st2.st_mtime);
-}
-
-static void usage(void)
-{
- printf("Usage: tdbbackup [options] <fname...>\n\n");
- printf(" -h this help message\n");
- printf(" -s suffix set the backup suffix\n");
- printf(" -v verify mode (restore if corrupt)\n");
- printf(" -n hashsize set the new hash size for the backup\n");
-}
-
-
- int main(int argc, char *argv[])
-{
- int i;
- int ret = 0;
- int c;
- int verify = 0;
- int hashsize = 0;
- const char *suffix = ".bak";
-
- while ((c = getopt(argc, argv, "vhs:n:")) != -1) {
- switch (c) {
- case 'h':
- usage();
- exit(0);
- case 'v':
- verify = 1;
- break;
- case 's':
- suffix = optarg;
- break;
- case 'n':
- hashsize = atoi(optarg);
- break;
- }
- }
-
- argc -= optind;
- argv += optind;
-
- if (argc < 1) {
- usage();
- exit(1);
- }
-
- for (i=0; i<argc; i++) {
- const char *fname = argv[i];
- char *bak_name;
-
- bak_name = add_suffix(fname, suffix);
-
- if (verify) {
- if (verify_tdb(fname, bak_name) != 0) {
- ret = 1;
- }
- } else {
- if (file_newer(fname, bak_name) &&
- backup_tdb(fname, bak_name, hashsize) != 0) {
- ret = 1;
- }
- }
-
- free(bak_name);
- }
-
- return ret;
-}
diff --git a/source3/lib/tdb/tools/tdbdump.c b/source3/lib/tdb/tools/tdbdump.c
deleted file mode 100644
index 8d930383b0..0000000000
--- a/source3/lib/tdb/tools/tdbdump.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- simple tdb dump util
- Copyright (C) Andrew Tridgell 2001
-
- 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 "replace.h"
-#include "system/locale.h"
-#include "system/time.h"
-#include "system/filesys.h"
-#include "system/wait.h"
-#include "tdb.h"
-
-static void print_data(TDB_DATA d)
-{
- unsigned char *p = (unsigned char *)d.dptr;
- int len = d.dsize;
- while (len--) {
- if (isprint(*p) && !strchr("\"\\", *p)) {
- fputc(*p, stdout);
- } else {
- printf("\\%02X", *p);
- }
- p++;
- }
-}
-
-static int traverse_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
-{
- printf("{\n");
- printf("key(%d) = \"", (int)key.dsize);
- print_data(key);
- printf("\"\n");
- printf("data(%d) = \"", (int)dbuf.dsize);
- print_data(dbuf);
- printf("\"\n");
- printf("}\n");
- return 0;
-}
-
-static int dump_tdb(const char *fname, const char *keyname)
-{
- TDB_CONTEXT *tdb;
- TDB_DATA key, value;
-
- tdb = tdb_open(fname, 0, 0, O_RDONLY, 0);
- if (!tdb) {
- printf("Failed to open %s\n", fname);
- return 1;
- }
-
- if (!keyname) {
- tdb_traverse(tdb, traverse_fn, NULL);
- } else {
- key.dptr = discard_const_p(uint8_t,keyname);
- key.dsize = strlen( keyname);
- value = tdb_fetch(tdb, key);
- if (!value.dptr) {
- return 1;
- } else {
- print_data(value);
- free(value.dptr);
- }
- }
-
- return 0;
-}
-
-static void usage( void)
-{
- printf( "Usage: tdbdump [options] <filename>\n\n");
- printf( " -h this help message\n");
- printf( " -k keyname dumps value of keyname\n");
-}
-
- int main(int argc, char *argv[])
-{
- char *fname, *keyname=NULL;
- int c;
-
- if (argc < 2) {
- printf("Usage: tdbdump <fname>\n");
- exit(1);
- }
-
- while ((c = getopt( argc, argv, "hk:")) != -1) {
- switch (c) {
- case 'h':
- usage();
- exit( 0);
- case 'k':
- keyname = optarg;
- break;
- default:
- usage();
- exit( 1);
- }
- }
-
- fname = argv[optind];
-
- return dump_tdb(fname, keyname);
-}
diff --git a/source3/lib/tdb/tools/tdbtest.c b/source3/lib/tdb/tools/tdbtest.c
deleted file mode 100644
index 416bc50a5b..0000000000
--- a/source3/lib/tdb/tools/tdbtest.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/* a test program for tdb - the trivial database */
-
-#include "replace.h"
-#include "tdb.h"
-#include "system/filesys.h"
-#include "system/time.h"
-
-#include <gdbm.h>
-
-
-#define DELETE_PROB 7
-#define STORE_PROB 5
-
-static struct tdb_context *db;
-static GDBM_FILE gdbm;
-
-struct timeval tp1,tp2;
-
-static void _start_timer(void)
-{
- gettimeofday(&tp1,NULL);
-}
-
-static double _end_timer(void)
-{
- gettimeofday(&tp2,NULL);
- return((tp2.tv_sec - tp1.tv_sec) +
- (tp2.tv_usec - tp1.tv_usec)*1.0e-6);
-}
-
-static void fatal(const char *why)
-{
- perror(why);
- exit(1);
-}
-
-#ifdef PRINTF_ATTRIBUTE
-static void tdb_log(struct tdb_context *tdb, int level, const char *format, ...) PRINTF_ATTRIBUTE(3,4);
-#endif
-static void tdb_log(struct tdb_context *tdb, int level, const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
- vfprintf(stdout, format, ap);
- va_end(ap);
- fflush(stdout);
-}
-
-static void compare_db(void)
-{
- TDB_DATA d, key, nextkey;
- datum gd, gkey, gnextkey;
-
- key = tdb_firstkey(db);
- while (key.dptr) {
- d = tdb_fetch(db, key);
- gkey.dptr = key.dptr;
- gkey.dsize = key.dsize;
-
- gd = gdbm_fetch(gdbm, gkey);
-
- if (!gd.dptr) fatal("key not in gdbm");
- if (gd.dsize != d.dsize) fatal("data sizes differ");
- if (memcmp(gd.dptr, d.dptr, d.dsize)) {
- fatal("data differs");
- }
-
- nextkey = tdb_nextkey(db, key);
- free(key.dptr);
- free(d.dptr);
- free(gd.dptr);
- key = nextkey;
- }
-
- gkey = gdbm_firstkey(gdbm);
- while (gkey.dptr) {
- gd = gdbm_fetch(gdbm, gkey);
- key.dptr = gkey.dptr;
- key.dsize = gkey.dsize;
-
- d = tdb_fetch(db, key);
-
- if (!d.dptr) fatal("key not in db");
- if (d.dsize != gd.dsize) fatal("data sizes differ");
- if (memcmp(d.dptr, gd.dptr, gd.dsize)) {
- fatal("data differs");
- }
-
- gnextkey = gdbm_nextkey(gdbm, gkey);
- free(gkey.dptr);
- free(gd.dptr);
- free(d.dptr);
- gkey = gnextkey;
- }
-}
-
-static char *randbuf(int len)
-{
- char *buf;
- int i;
- buf = (char *)malloc(len+1);
-
- for (i=0;i<len;i++) {
- buf[i] = 'a' + (rand() % 26);
- }
- buf[i] = 0;
- return buf;
-}
-
-static void addrec_db(void)
-{
- int klen, dlen;
- char *k, *d;
- TDB_DATA key, data;
-
- klen = 1 + (rand() % 4);
- dlen = 1 + (rand() % 100);
-
- k = randbuf(klen);
- d = randbuf(dlen);
-
- key.dptr = k;
- key.dsize = klen+1;
-
- data.dptr = d;
- data.dsize = dlen+1;
-
- if (rand() % DELETE_PROB == 0) {
- tdb_delete(db, key);
- } else if (rand() % STORE_PROB == 0) {
- if (tdb_store(db, key, data, TDB_REPLACE) != 0) {
- fatal("tdb_store failed");
- }
- } else {
- data = tdb_fetch(db, key);
- if (data.dptr) free(data.dptr);
- }
-
- free(k);
- free(d);
-}
-
-static void addrec_gdbm(void)
-{
- int klen, dlen;
- char *k, *d;
- datum key, data;
-
- klen = 1 + (rand() % 4);
- dlen = 1 + (rand() % 100);
-
- k = randbuf(klen);
- d = randbuf(dlen);
-
- key.dptr = k;
- key.dsize = klen+1;
-
- data.dptr = d;
- data.dsize = dlen+1;
-
- if (rand() % DELETE_PROB == 0) {
- gdbm_delete(gdbm, key);
- } else if (rand() % STORE_PROB == 0) {
- if (gdbm_store(gdbm, key, data, GDBM_REPLACE) != 0) {
- fatal("gdbm_store failed");
- }
- } else {
- data = gdbm_fetch(gdbm, key);
- if (data.dptr) free(data.dptr);
- }
-
- free(k);
- free(d);
-}
-
-static int traverse_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
-{
-#if 0
- printf("[%s] [%s]\n", key.dptr, dbuf.dptr);
-#endif
- tdb_delete(tdb, key);
- return 0;
-}
-
-static void merge_test(void)
-{
- int i;
- char keys[5][2];
- char tdata[] = "test";
- TDB_DATA key, data;
-
- for (i = 0; i < 5; i++) {
- snprintf(keys[i],2, "%d", i);
- key.dptr = keys[i];
- key.dsize = 2;
-
- data.dptr = tdata;
- data.dsize = 4;
-
- if (tdb_store(db, key, data, TDB_REPLACE) != 0) {
- fatal("tdb_store failed");
- }
- }
-
- key.dptr = keys[0];
- tdb_delete(db, key);
- key.dptr = keys[4];
- tdb_delete(db, key);
- key.dptr = keys[2];
- tdb_delete(db, key);
- key.dptr = keys[1];
- tdb_delete(db, key);
- key.dptr = keys[3];
- tdb_delete(db, key);
-}
-
- int main(int argc, const char *argv[])
-{
- int i, seed=0;
- int loops = 10000;
- int num_entries;
- char test_gdbm[] = "test.gdbm";
-
- unlink("test.gdbm");
-
- db = tdb_open("test.tdb", 0, TDB_CLEAR_IF_FIRST,
- O_RDWR | O_CREAT | O_TRUNC, 0600);
- gdbm = gdbm_open(test_gdbm, 512, GDBM_WRITER|GDBM_NEWDB|GDBM_FAST,
- 0600, NULL);
-
- if (!db || !gdbm) {
- fatal("db open failed");
- }
-
-#if 1
- srand(seed);
- _start_timer();
- for (i=0;i<loops;i++) addrec_gdbm();
- printf("gdbm got %.2f ops/sec\n", i/_end_timer());
-#endif
-
- merge_test();
-
- srand(seed);
- _start_timer();
- for (i=0;i<loops;i++) addrec_db();
- printf("tdb got %.2f ops/sec\n", i/_end_timer());
-
- if (tdb_validate_freelist(db, &num_entries) == -1) {
- printf("tdb freelist is corrupt\n");
- } else {
- printf("tdb freelist is good (%d entries)\n", num_entries);
- }
-
- compare_db();
-
- printf("traversed %d records\n", tdb_traverse(db, traverse_fn, NULL));
- printf("traversed %d records\n", tdb_traverse(db, traverse_fn, NULL));
-
- tdb_close(db);
- gdbm_close(gdbm);
-
- return 0;
-}
diff --git a/source3/lib/tdb/tools/tdbtool.c b/source3/lib/tdb/tools/tdbtool.c
deleted file mode 100644
index d104ccd7c4..0000000000
--- a/source3/lib/tdb/tools/tdbtool.c
+++ /dev/null
@@ -1,659 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Samba database functions
- Copyright (C) Andrew Tridgell 1999-2000
- Copyright (C) Paul `Rusty' Russell 2000
- Copyright (C) Jeremy Allison 2000
- Copyright (C) Andrew Esh 2001
-
- 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 "replace.h"
-#include "system/locale.h"
-#include "system/time.h"
-#include "system/filesys.h"
-#include "system/wait.h"
-#include "tdb.h"
-
-static int do_command(void);
-const char *cmdname;
-char *arg1, *arg2;
-size_t arg1len, arg2len;
-int bIterate = 0;
-char *line;
-TDB_DATA iterate_kbuf;
-char cmdline[1024];
-static int disable_mmap;
-
-enum commands {
- CMD_CREATE_TDB,
- CMD_OPEN_TDB,
- CMD_ERASE,
- CMD_DUMP,
- CMD_INSERT,
- CMD_MOVE,
- CMD_STORE,
- CMD_SHOW,
- CMD_KEYS,
- CMD_HEXKEYS,
- CMD_DELETE,
- CMD_LIST_HASH_FREE,
- CMD_LIST_FREE,
- CMD_INFO,
- CMD_MMAP,
- CMD_SPEED,
- CMD_FIRST,
- CMD_NEXT,
- CMD_SYSTEM,
- CMD_QUIT,
- CMD_HELP
-};
-
-typedef struct {
- const char *name;
- enum commands cmd;
-} COMMAND_TABLE;
-
-COMMAND_TABLE cmd_table[] = {
- {"create", CMD_CREATE_TDB},
- {"open", CMD_OPEN_TDB},
- {"erase", CMD_ERASE},
- {"dump", CMD_DUMP},
- {"insert", CMD_INSERT},
- {"move", CMD_MOVE},
- {"store", CMD_STORE},
- {"show", CMD_SHOW},
- {"keys", CMD_KEYS},
- {"hexkeys", CMD_HEXKEYS},
- {"delete", CMD_DELETE},
- {"list", CMD_LIST_HASH_FREE},
- {"free", CMD_LIST_FREE},
- {"info", CMD_INFO},
- {"speed", CMD_SPEED},
- {"mmap", CMD_MMAP},
- {"first", CMD_FIRST},
- {"1", CMD_FIRST},
- {"next", CMD_NEXT},
- {"n", CMD_NEXT},
- {"quit", CMD_QUIT},
- {"q", CMD_QUIT},
- {"!", CMD_SYSTEM},
- {NULL, CMD_HELP}
-};
-
-struct timeval tp1,tp2;
-
-static void _start_timer(void)
-{
- gettimeofday(&tp1,NULL);
-}
-
-static double _end_timer(void)
-{
- gettimeofday(&tp2,NULL);
- return((tp2.tv_sec - tp1.tv_sec) +
- (tp2.tv_usec - tp1.tv_usec)*1.0e-6);
-}
-
-/* a tdb tool for manipulating a tdb database */
-
-static TDB_CONTEXT *tdb;
-
-static int print_rec(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state);
-static int print_key(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state);
-static int print_hexkey(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state);
-
-static void print_asc(const char *buf,int len)
-{
- int i;
-
- /* We're probably printing ASCII strings so don't try to display
- the trailing NULL character. */
-
- if (buf[len - 1] == 0)
- len--;
-
- for (i=0;i<len;i++)
- printf("%c",isprint(buf[i])?buf[i]:'.');
-}
-
-static void print_data(const char *buf,int len)
-{
- int i=0;
- if (len<=0) return;
- printf("[%03X] ",i);
- for (i=0;i<len;) {
- printf("%02X ",(int)((unsigned char)buf[i]));
- i++;
- if (i%8 == 0) printf(" ");
- if (i%16 == 0) {
- print_asc(&buf[i-16],8); printf(" ");
- print_asc(&buf[i-8],8); printf("\n");
- if (i<len) printf("[%03X] ",i);
- }
- }
- if (i%16) {
- int n;
-
- n = 16 - (i%16);
- printf(" ");
- if (n>8) printf(" ");
- while (n--) printf(" ");
-
- n = i%16;
- if (n > 8) n = 8;
- print_asc(&buf[i-(i%16)],n); printf(" ");
- n = (i%16) - n;
- if (n>0) print_asc(&buf[i-n],n);
- printf("\n");
- }
-}
-
-static void help(void)
-{
- printf("\n"
-"tdbtool: \n"
-" create dbname : create a database\n"
-" open dbname : open an existing database\n"
-" erase : erase the database\n"
-" dump : dump the database as strings\n"
-" keys : dump the database keys as strings\n"
-" hexkeys : dump the database keys as hex values\n"
-" info : print summary info about the database\n"
-" insert key data : insert a record\n"
-" move key file : move a record to a destination tdb\n"
-" store key data : store a record (replace)\n"
-" show key : show a record by key\n"
-" delete key : delete a record by key\n"
-" list : print the database hash table and freelist\n"
-" free : print the database freelist\n"
-" ! command : execute system command\n"
-" 1 | first : print the first record\n"
-" n | next : print the next record\n"
-" q | quit : terminate\n"
-" \\n : repeat 'next' command\n"
-"\n");
-}
-
-static void terror(const char *why)
-{
- printf("%s\n", why);
-}
-
-static void create_tdb(const char *tdbname)
-{
- if (tdb) tdb_close(tdb);
- tdb = tdb_open(tdbname, 0, TDB_CLEAR_IF_FIRST | (disable_mmap?TDB_NOMMAP:0),
- O_RDWR | O_CREAT | O_TRUNC, 0600);
- if (!tdb) {
- printf("Could not create %s: %s\n", tdbname, strerror(errno));
- }
-}
-
-static void open_tdb(const char *tdbname)
-{
- if (tdb) tdb_close(tdb);
- tdb = tdb_open(tdbname, 0, disable_mmap?TDB_NOMMAP:0, O_RDWR, 0600);
- if (!tdb) {
- printf("Could not open %s: %s\n", tdbname, strerror(errno));
- }
-}
-
-static void insert_tdb(char *keyname, size_t keylen, char* data, size_t datalen)
-{
- TDB_DATA key, dbuf;
-
- if ((keyname == NULL) || (keylen == 0)) {
- terror("need key");
- return;
- }
-
- key.dptr = (unsigned char *)keyname;
- key.dsize = keylen;
- dbuf.dptr = (unsigned char *)data;
- dbuf.dsize = datalen;
-
- if (tdb_store(tdb, key, dbuf, TDB_INSERT) == -1) {
- terror("insert failed");
- }
-}
-
-static void store_tdb(char *keyname, size_t keylen, char* data, size_t datalen)
-{
- TDB_DATA key, dbuf;
-
- if ((keyname == NULL) || (keylen == 0)) {
- terror("need key");
- return;
- }
-
- if ((data == NULL) || (datalen == 0)) {
- terror("need data");
- return;
- }
-
- key.dptr = (unsigned char *)keyname;
- key.dsize = keylen;
- dbuf.dptr = (unsigned char *)data;
- dbuf.dsize = datalen;
-
- printf("Storing key:\n");
- print_rec(tdb, key, dbuf, NULL);
-
- if (tdb_store(tdb, key, dbuf, TDB_REPLACE) == -1) {
- terror("store failed");
- }
-}
-
-static void show_tdb(char *keyname, size_t keylen)
-{
- TDB_DATA key, dbuf;
-
- if ((keyname == NULL) || (keylen == 0)) {
- terror("need key");
- return;
- }
-
- key.dptr = (unsigned char *)keyname;
- key.dsize = keylen;
-
- dbuf = tdb_fetch(tdb, key);
- if (!dbuf.dptr) {
- terror("fetch failed");
- return;
- }
-
- print_rec(tdb, key, dbuf, NULL);
-
- free( dbuf.dptr );
-
- return;
-}
-
-static void delete_tdb(char *keyname, size_t keylen)
-{
- TDB_DATA key;
-
- if ((keyname == NULL) || (keylen == 0)) {
- terror("need key");
- return;
- }
-
- key.dptr = (unsigned char *)keyname;
- key.dsize = keylen;
-
- if (tdb_delete(tdb, key) != 0) {
- terror("delete failed");
- }
-}
-
-static void move_rec(char *keyname, size_t keylen, char* tdbname)
-{
- TDB_DATA key, dbuf;
- TDB_CONTEXT *dst_tdb;
-
- if ((keyname == NULL) || (keylen == 0)) {
- terror("need key");
- return;
- }
-
- if ( !tdbname ) {
- terror("need destination tdb name");
- return;
- }
-
- key.dptr = (unsigned char *)keyname;
- key.dsize = keylen;
-
- dbuf = tdb_fetch(tdb, key);
- if (!dbuf.dptr) {
- terror("fetch failed");
- return;
- }
-
- print_rec(tdb, key, dbuf, NULL);
-
- dst_tdb = tdb_open(tdbname, 0, 0, O_RDWR, 0600);
- if ( !dst_tdb ) {
- terror("unable to open destination tdb");
- return;
- }
-
- if ( tdb_store( dst_tdb, key, dbuf, TDB_REPLACE ) == -1 ) {
- terror("failed to move record");
- }
- else
- printf("record moved\n");
-
- tdb_close( dst_tdb );
-
- return;
-}
-
-static int print_rec(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
-{
- printf("\nkey %d bytes\n", (int)key.dsize);
- print_asc((const char *)key.dptr, key.dsize);
- printf("\ndata %d bytes\n", (int)dbuf.dsize);
- print_data((const char *)dbuf.dptr, dbuf.dsize);
- return 0;
-}
-
-static int print_key(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
-{
- printf("key %d bytes: ", (int)key.dsize);
- print_asc((const char *)key.dptr, key.dsize);
- printf("\n");
- return 0;
-}
-
-static int print_hexkey(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
-{
- printf("key %d bytes\n", (int)key.dsize);
- print_data((const char *)key.dptr, key.dsize);
- printf("\n");
- return 0;
-}
-
-static int total_bytes;
-
-static int traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
-{
- total_bytes += dbuf.dsize;
- return 0;
-}
-
-static void info_tdb(void)
-{
- int count;
- total_bytes = 0;
- if ((count = tdb_traverse(tdb, traverse_fn, NULL)) == -1)
- printf("Error = %s\n", tdb_errorstr(tdb));
- else
- printf("%d records totalling %d bytes\n", count, total_bytes);
-}
-
-static void speed_tdb(const char *tlimit)
-{
- unsigned timelimit = tlimit?atoi(tlimit):0;
- double t;
- int ops=0;
- if (timelimit == 0) timelimit = 10;
- printf("Testing traverse speed for %u seconds\n", timelimit);
- _start_timer();
- while ((t=_end_timer()) < timelimit) {
- tdb_traverse(tdb, traverse_fn, NULL);
- printf("%10.3f ops/sec\r", (++ops)/t);
- }
- printf("\n");
-}
-
-static void toggle_mmap(void)
-{
- disable_mmap = !disable_mmap;
- if (disable_mmap) {
- printf("mmap is disabled\n");
- } else {
- printf("mmap is enabled\n");
- }
-}
-
-static char *tdb_getline(const char *prompt)
-{
- static char thisline[1024];
- char *p;
- fputs(prompt, stdout);
- thisline[0] = 0;
- p = fgets(thisline, sizeof(thisline)-1, stdin);
- if (p) p = strchr(p, '\n');
- if (p) *p = 0;
- return p?thisline:NULL;
-}
-
-static int do_delete_fn(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf,
- void *state)
-{
- return tdb_delete(the_tdb, key);
-}
-
-static void first_record(TDB_CONTEXT *the_tdb, TDB_DATA *pkey)
-{
- TDB_DATA dbuf;
- *pkey = tdb_firstkey(the_tdb);
-
- dbuf = tdb_fetch(the_tdb, *pkey);
- if (!dbuf.dptr) terror("fetch failed");
- else {
- print_rec(the_tdb, *pkey, dbuf, NULL);
- }
-}
-
-static void next_record(TDB_CONTEXT *the_tdb, TDB_DATA *pkey)
-{
- TDB_DATA dbuf;
- *pkey = tdb_nextkey(the_tdb, *pkey);
-
- dbuf = tdb_fetch(the_tdb, *pkey);
- if (!dbuf.dptr)
- terror("fetch failed");
- else
- print_rec(the_tdb, *pkey, dbuf, NULL);
-}
-
-static int do_command(void)
-{
- COMMAND_TABLE *ctp = cmd_table;
- enum commands mycmd = CMD_HELP;
- int cmd_len;
-
- if (cmdname && strlen(cmdname) == 0) {
- mycmd = CMD_NEXT;
- } else {
- while (ctp->name) {
- cmd_len = strlen(ctp->name);
- if (strncmp(ctp->name,cmdname,cmd_len) == 0) {
- mycmd = ctp->cmd;
- break;
- }
- ctp++;
- }
- }
-
- switch (mycmd) {
- case CMD_CREATE_TDB:
- bIterate = 0;
- create_tdb(arg1);
- return 0;
- case CMD_OPEN_TDB:
- bIterate = 0;
- open_tdb(arg1);
- return 0;
- case CMD_SYSTEM:
- /* Shell command */
- system(arg1);
- return 0;
- case CMD_QUIT:
- return 1;
- default:
- /* all the rest require a open database */
- if (!tdb) {
- bIterate = 0;
- terror("database not open");
- help();
- return 0;
- }
- switch (mycmd) {
- case CMD_ERASE:
- bIterate = 0;
- tdb_traverse(tdb, do_delete_fn, NULL);
- return 0;
- case CMD_DUMP:
- bIterate = 0;
- tdb_traverse(tdb, print_rec, NULL);
- return 0;
- case CMD_INSERT:
- bIterate = 0;
- insert_tdb(arg1, arg1len,arg2,arg2len);
- return 0;
- case CMD_MOVE:
- bIterate = 0;
- move_rec(arg1,arg1len,arg2);
- return 0;
- case CMD_STORE:
- bIterate = 0;
- store_tdb(arg1,arg1len,arg2,arg2len);
- return 0;
- case CMD_SHOW:
- bIterate = 0;
- show_tdb(arg1, arg1len);
- return 0;
- case CMD_KEYS:
- tdb_traverse(tdb, print_key, NULL);
- return 0;
- case CMD_HEXKEYS:
- tdb_traverse(tdb, print_hexkey, NULL);
- return 0;
- case CMD_DELETE:
- bIterate = 0;
- delete_tdb(arg1,arg1len);
- return 0;
- case CMD_LIST_HASH_FREE:
- tdb_dump_all(tdb);
- return 0;
- case CMD_LIST_FREE:
- tdb_printfreelist(tdb);
- return 0;
- case CMD_INFO:
- info_tdb();
- return 0;
- case CMD_SPEED:
- speed_tdb(arg1);
- return 0;
- case CMD_MMAP:
- toggle_mmap();
- return 0;
- case CMD_FIRST:
- bIterate = 1;
- first_record(tdb, &iterate_kbuf);
- return 0;
- case CMD_NEXT:
- if (bIterate)
- next_record(tdb, &iterate_kbuf);
- return 0;
- case CMD_HELP:
- help();
- return 0;
- case CMD_CREATE_TDB:
- case CMD_OPEN_TDB:
- case CMD_SYSTEM:
- case CMD_QUIT:
- /*
- * unhandled commands. cases included here to avoid compiler
- * warnings.
- */
- return 0;
- }
- }
-
- return 0;
-}
-
-static char *convert_string(char *instring, size_t *sizep)
-{
- size_t length = 0;
- char *outp, *inp;
- char temp[3];
-
-
- outp = inp = instring;
-
- while (*inp) {
- if (*inp == '\\') {
- inp++;
- if (*inp && strchr("0123456789abcdefABCDEF",(int)*inp)) {
- temp[0] = *inp++;
- temp[1] = '\0';
- if (*inp && strchr("0123456789abcdefABCDEF",(int)*inp)) {
- temp[1] = *inp++;
- temp[2] = '\0';
- }
- *outp++ = (char)strtol((const char *)temp,NULL,16);
- } else {
- *outp++ = *inp++;
- }
- } else {
- *outp++ = *inp++;
- }
- length++;
- }
- *sizep = length;
- return instring;
-}
-
-int main(int argc, char *argv[])
-{
- cmdname = "";
- arg1 = NULL;
- arg1len = 0;
- arg2 = NULL;
- arg2len = 0;
-
- if (argv[1]) {
- cmdname = "open";
- arg1 = argv[1];
- do_command();
- cmdname = "";
- arg1 = NULL;
- }
-
- switch (argc) {
- case 1:
- case 2:
- /* Interactive mode */
- while ((cmdname = tdb_getline("tdb> "))) {
- arg2 = arg1 = NULL;
- if ((arg1 = strchr((const char *)cmdname,' ')) != NULL) {
- arg1++;
- arg2 = arg1;
- while (*arg2) {
- if (*arg2 == ' ') {
- *arg2++ = '\0';
- break;
- }
- if ((*arg2++ == '\\') && (*arg2 == ' ')) {
- arg2++;
- }
- }
- }
- if (arg1) arg1 = convert_string(arg1,&arg1len);
- if (arg2) arg2 = convert_string(arg2,&arg2len);
- if (do_command()) break;
- }
- break;
- case 5:
- arg2 = convert_string(argv[4],&arg2len);
- case 4:
- arg1 = convert_string(argv[3],&arg1len);
- case 3:
- cmdname = argv[2];
- default:
- do_command();
- break;
- }
-
- if (tdb) tdb_close(tdb);
-
- return 0;
-}
diff --git a/source3/lib/tdb/tools/tdbtorture.c b/source3/lib/tdb/tools/tdbtorture.c
deleted file mode 100644
index 9265cf07aa..0000000000
--- a/source3/lib/tdb/tools/tdbtorture.c
+++ /dev/null
@@ -1,318 +0,0 @@
-/* this tests tdb by doing lots of ops from several simultaneous
- writers - that stresses the locking code.
-*/
-
-#include "replace.h"
-#include "system/time.h"
-#include "system/wait.h"
-#include "system/filesys.h"
-#include "tdb.h"
-
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#endif
-
-
-#define REOPEN_PROB 30
-#define DELETE_PROB 8
-#define STORE_PROB 4
-#define APPEND_PROB 6
-#define TRANSACTION_PROB 10
-#define LOCKSTORE_PROB 5
-#define TRAVERSE_PROB 20
-#define TRAVERSE_READ_PROB 20
-#define CULL_PROB 100
-#define KEYLEN 3
-#define DATALEN 100
-
-static struct tdb_context *db;
-static int in_transaction;
-static int error_count;
-
-#ifdef PRINTF_ATTRIBUTE
-static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, const char *format, ...) PRINTF_ATTRIBUTE(3,4);
-#endif
-static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, const char *format, ...)
-{
- va_list ap;
-
- error_count++;
-
- va_start(ap, format);
- vfprintf(stdout, format, ap);
- va_end(ap);
- fflush(stdout);
-#if 0
- {
- char *ptr;
- asprintf(&ptr,"xterm -e gdb /proc/%d/exe %d", getpid(), getpid());
- system(ptr);
- free(ptr);
- }
-#endif
-}
-
-static void fatal(const char *why)
-{
- perror(why);
- error_count++;
-}
-
-static char *randbuf(int len)
-{
- char *buf;
- int i;
- buf = (char *)malloc(len+1);
-
- for (i=0;i<len;i++) {
- buf[i] = 'a' + (rand() % 26);
- }
- buf[i] = 0;
- return buf;
-}
-
-static int cull_traverse(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf,
- void *state)
-{
-#if CULL_PROB
- if (random() % CULL_PROB == 0) {
- tdb_delete(tdb, key);
- }
-#endif
- return 0;
-}
-
-static void addrec_db(void)
-{
- int klen, dlen;
- char *k, *d;
- TDB_DATA key, data;
-
- klen = 1 + (rand() % KEYLEN);
- dlen = 1 + (rand() % DATALEN);
-
- k = randbuf(klen);
- d = randbuf(dlen);
-
- key.dptr = (unsigned char *)k;
- key.dsize = klen+1;
-
- data.dptr = (unsigned char *)d;
- data.dsize = dlen+1;
-
-#if TRANSACTION_PROB
- if (in_transaction == 0 && random() % TRANSACTION_PROB == 0) {
- if (tdb_transaction_start(db) != 0) {
- fatal("tdb_transaction_start failed");
- }
- in_transaction++;
- goto next;
- }
- if (in_transaction && random() % TRANSACTION_PROB == 0) {
- if (tdb_transaction_commit(db) != 0) {
- fatal("tdb_transaction_commit failed");
- }
- in_transaction--;
- goto next;
- }
- if (in_transaction && random() % TRANSACTION_PROB == 0) {
- if (tdb_transaction_cancel(db) != 0) {
- fatal("tdb_transaction_cancel failed");
- }
- in_transaction--;
- goto next;
- }
-#endif
-
-#if REOPEN_PROB
- if (in_transaction == 0 && random() % REOPEN_PROB == 0) {
- tdb_reopen_all(0);
- goto next;
- }
-#endif
-
-#if DELETE_PROB
- if (random() % DELETE_PROB == 0) {
- tdb_delete(db, key);
- goto next;
- }
-#endif
-
-#if STORE_PROB
- if (random() % STORE_PROB == 0) {
- if (tdb_store(db, key, data, TDB_REPLACE) != 0) {
- fatal("tdb_store failed");
- }
- goto next;
- }
-#endif
-
-#if APPEND_PROB
- if (random() % APPEND_PROB == 0) {
- if (tdb_append(db, key, data) != 0) {
- fatal("tdb_append failed");
- }
- goto next;
- }
-#endif
-
-#if LOCKSTORE_PROB
- if (random() % LOCKSTORE_PROB == 0) {
- tdb_chainlock(db, key);
- data = tdb_fetch(db, key);
- if (tdb_store(db, key, data, TDB_REPLACE) != 0) {
- fatal("tdb_store failed");
- }
- if (data.dptr) free(data.dptr);
- tdb_chainunlock(db, key);
- goto next;
- }
-#endif
-
-#if TRAVERSE_PROB
- if (random() % TRAVERSE_PROB == 0) {
- tdb_traverse(db, cull_traverse, NULL);
- goto next;
- }
-#endif
-
-#if TRAVERSE_READ_PROB
- if (random() % TRAVERSE_READ_PROB == 0) {
- tdb_traverse_read(db, NULL, NULL);
- goto next;
- }
-#endif
-
- data = tdb_fetch(db, key);
- if (data.dptr) free(data.dptr);
-
-next:
- free(k);
- free(d);
-}
-
-static int traverse_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf,
- void *state)
-{
- tdb_delete(tdb, key);
- return 0;
-}
-
-static void usage(void)
-{
- printf("Usage: tdbtorture [-n NUM_PROCS] [-l NUM_LOOPS] [-s SEED] [-H HASH_SIZE]\n");
- exit(0);
-}
-
- int main(int argc, char * const *argv)
-{
- int i, seed = -1;
- int num_procs = 3;
- int num_loops = 5000;
- int hash_size = 2;
- int c;
- extern char *optarg;
- pid_t *pids;
-
- struct tdb_logging_context log_ctx;
- log_ctx.log_fn = tdb_log;
-
- while ((c = getopt(argc, argv, "n:l:s:H:h")) != -1) {
- switch (c) {
- case 'n':
- num_procs = strtol(optarg, NULL, 0);
- break;
- case 'l':
- num_loops = strtol(optarg, NULL, 0);
- break;
- case 'H':
- hash_size = strtol(optarg, NULL, 0);
- break;
- case 's':
- seed = strtol(optarg, NULL, 0);
- break;
- default:
- usage();
- }
- }
-
- unlink("torture.tdb");
-
- pids = (pid_t *)calloc(sizeof(pid_t), num_procs);
- pids[0] = getpid();
-
- for (i=0;i<num_procs-1;i++) {
- if ((pids[i+1]=fork()) == 0) break;
- }
-
- db = tdb_open_ex("torture.tdb", hash_size, TDB_CLEAR_IF_FIRST,
- O_RDWR | O_CREAT, 0600, &log_ctx, NULL);
- if (!db) {
- fatal("db open failed");
- }
-
- if (seed == -1) {
- seed = (getpid() + time(NULL)) & 0x7FFFFFFF;
- }
-
- if (i == 0) {
- printf("testing with %d processes, %d loops, %d hash_size, seed=%d\n",
- num_procs, num_loops, hash_size, seed);
- }
-
- srand(seed + i);
- srandom(seed + i);
-
- for (i=0;i<num_loops && error_count == 0;i++) {
- addrec_db();
- }
-
- if (error_count == 0) {
- tdb_traverse_read(db, NULL, NULL);
- tdb_traverse(db, traverse_fn, NULL);
- tdb_traverse(db, traverse_fn, NULL);
- }
-
- tdb_close(db);
-
- if (getpid() != pids[0]) {
- return error_count;
- }
-
- for (i=1;i<num_procs;i++) {
- int status, j;
- pid_t pid;
- if (error_count != 0) {
- /* try and stop the test on any failure */
- for (j=1;j<num_procs;j++) {
- if (pids[j] != 0) {
- kill(pids[j], SIGTERM);
- }
- }
- }
- pid = waitpid(-1, &status, 0);
- if (pid == -1) {
- perror("failed to wait for child\n");
- exit(1);
- }
- for (j=1;j<num_procs;j++) {
- if (pids[j] == pid) break;
- }
- if (j == num_procs) {
- printf("unknown child %d exited!?\n", (int)pid);
- exit(1);
- }
- if (WEXITSTATUS(status) != 0) {
- printf("child %d exited with status %d\n",
- (int)pid, WEXITSTATUS(status));
- error_count++;
- }
- pids[j] = 0;
- }
-
- if (error_count == 0) {
- printf("OK\n");
- }
-
- return error_count;
-}
diff --git a/source3/lib/tdb/web/index.html b/source3/lib/tdb/web/index.html
deleted file mode 100644
index a53da6b8f7..0000000000
--- a/source3/lib/tdb/web/index.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
-<TITLE>ldb</TITLE>
-</HEAD>
-<BODY BGCOLOR="#ffffff" TEXT="#000000" VLINK="#292555" LINK="#292555" ALINK="#cc0033">
-
-<h1>tdb</h1>
-
-TDB is a Trivial Database. In concept, it is very much like GDBM, and BSD's DB
-except that it allows multiple simultaneous writers and uses locking
-internally to keep writers from trampling on each other. TDB is also extremely
-small.
-
-<h2>Discussion and bug reports</h2>
-
-tdb does not currently have its own mailing list or bug tracking
-system. For now, please use the <a
-href="https://lists.samba.org/mailman/listinfo/samba-technical">samba-technical</a>
-mailing list, and the <a href="http://bugzilla.samba.org/">Samba
-bugzilla</a> bug tracking system.
-
-<h2>Download</h2>
-
-You can download the latest release either via rsync or git.<br>
-<br>
-To fetch via git see the following guide:<br>
-<a href="http://wiki.samba.org/index.php/Using_Git_for_Samba_Development">Using Git for Samba Development</a><br>
-Once you have cloned the tree switch to the v4-0-test branch and cd into the source/lib/tdb directory.<br>
-<br>
-To fetch via rsync use these commands:
-
-<pre>
- rsync -Pavz samba.org::ftp/unpacked/tdb .
- rsync -Pavz samba.org::ftp/unpacked/libreplace .
-</pre>
-
-and build in tdb. It will find the replace library in the directory
-above automatically.
-
-</BODY>
-</HTML>
diff --git a/source3/lib/time.c b/source3/lib/time.c
index 8cefef6e23..c4aa7d01b3 100644
--- a/source3/lib/time.c
+++ b/source3/lib/time.c
@@ -38,112 +38,12 @@
#define NTTIME_INFINITY (NTTIME)0x8000000000000000LL
-/***************************************************************************
- External access to time_t_min and time_t_max.
-****************************************************************************/
-
-time_t get_time_t_max(void)
-{
- return TIME_T_MAX;
-}
-
-/***************************************************************************
- A gettimeofday wrapper.
-****************************************************************************/
-
-void GetTimeOfDay(struct timeval *tval)
-{
-#ifdef HAVE_GETTIMEOFDAY_TZ
- gettimeofday(tval,NULL);
-#else
- gettimeofday(tval);
-#endif
-}
-
#if (SIZEOF_LONG == 8)
#define TIME_FIXUP_CONSTANT_INT 11644473600L
#elif (SIZEOF_LONG_LONG == 8)
#define TIME_FIXUP_CONSTANT_INT 11644473600LL
#endif
-/****************************************************************************
- Interpret an 8 byte "filetime" structure to a time_t
- It's originally in "100ns units since jan 1st 1601"
-
- An 8 byte value of 0xffffffffffffffff will be returned as a timespec of
-
- tv_sec = 0
- tv_nsec = 0;
-
- Returns GMT.
-****************************************************************************/
-
-time_t nt_time_to_unix(NTTIME nt)
-{
- return convert_timespec_to_time_t(nt_time_to_unix_timespec(&nt));
-}
-
-/****************************************************************************
- Put a 8 byte filetime from a time_t. Uses GMT.
-****************************************************************************/
-
-void unix_to_nt_time(NTTIME *nt, time_t t)
-{
- uint64_t t2;
-
- if (t == (time_t)-1) {
- *nt = (NTTIME)-1LL;
- return;
- }
-
- if (t == TIME_T_MAX) {
- *nt = 0x7fffffffffffffffLL;
- return;
- }
-
- if (t == 0) {
- *nt = 0;
- return;
- }
-
- t2 = t;
- t2 += TIME_FIXUP_CONSTANT_INT;
- t2 *= 1000*1000*10;
-
- *nt = t2;
-}
-
-/****************************************************************************
- Check if it's a null unix time.
-****************************************************************************/
-
-bool null_time(time_t t)
-{
- return t == 0 ||
- t == (time_t)0xFFFFFFFF ||
- t == (time_t)-1;
-}
-
-/****************************************************************************
- Check if it's a null NTTIME.
-****************************************************************************/
-
-bool null_nttime(NTTIME t)
-{
- return t == 0 || t == (NTTIME)-1;
-}
-
-/****************************************************************************
- Check if it's a null timespec.
-****************************************************************************/
-
-bool null_timespec(struct timespec ts)
-{
- return ts.tv_sec == 0 ||
- ts.tv_sec == (time_t)0xFFFFFFFF ||
- ts.tv_sec == (time_t)-1;
-}
-
/*******************************************************************
create a 16 bit dos packed date
********************************************************************/
@@ -193,183 +93,6 @@ static uint32_t make_dos_date(time_t unixdate, int zone_offset)
}
/**
-put a dos date into a buffer (time/date format)
-This takes GMT time and puts local time in the buffer
-**/
-void push_dos_date(uint8_t *buf, int offset, time_t unixdate, int zone_offset)
-{
- uint32_t x = make_dos_date(unixdate, zone_offset);
- SIVAL(buf,offset,x);
-}
-
-/**
-put a dos date into a buffer (date/time format)
-This takes GMT time and puts local time in the buffer
-**/
-void push_dos_date2(uint8_t *buf,int offset,time_t unixdate, int zone_offset)
-{
- uint32_t x;
- x = make_dos_date(unixdate, zone_offset);
- x = ((x&0xFFFF)<<16) | ((x&0xFFFF0000)>>16);
- SIVAL(buf,offset,x);
-}
-
-/**
-put a dos 32 bit "unix like" date into a buffer. This routine takes
-GMT and converts it to LOCAL time before putting it (most SMBs assume
-localtime for this sort of date)
-**/
-void push_dos_date3(uint8_t *buf,int offset,time_t unixdate, int zone_offset)
-{
- if (!null_time(unixdate)) {
- unixdate -= zone_offset;
- }
- SIVAL(buf,offset,unixdate);
-}
-
-/*******************************************************************
- interpret a 32 bit dos packed date/time to some parameters
-********************************************************************/
-static void interpret_dos_date(uint32_t date,int *year,int *month,int *day,int *hour,int *minute,int *second)
-{
- uint32_t p0,p1,p2,p3;
-
- p0=date&0xFF; p1=((date&0xFF00)>>8)&0xFF;
- p2=((date&0xFF0000)>>16)&0xFF; p3=((date&0xFF000000)>>24)&0xFF;
-
- *second = 2*(p0 & 0x1F);
- *minute = ((p0>>5)&0xFF) + ((p1&0x7)<<3);
- *hour = (p1>>3)&0xFF;
- *day = (p2&0x1F);
- *month = ((p2>>5)&0xFF) + ((p3&0x1)<<3) - 1;
- *year = ((p3>>1)&0xFF) + 80;
-}
-
-/**
- create a unix date (int GMT) from a dos date (which is actually in
- localtime)
-**/
-time_t pull_dos_date(const uint8_t *date_ptr, int zone_offset)
-{
- uint32_t dos_date=0;
- struct tm t;
- time_t ret;
-
- dos_date = IVAL(date_ptr,0);
-
- if (dos_date == 0) return (time_t)0;
-
- interpret_dos_date(dos_date,&t.tm_year,&t.tm_mon,
- &t.tm_mday,&t.tm_hour,&t.tm_min,&t.tm_sec);
- t.tm_isdst = -1;
-
- ret = timegm(&t);
-
- ret += zone_offset;
-
- return ret;
-}
-
-/**
-like make_unix_date() but the words are reversed
-**/
-time_t pull_dos_date2(const uint8_t *date_ptr, int zone_offset)
-{
- uint32_t x,x2;
-
- x = IVAL(date_ptr,0);
- x2 = ((x&0xFFFF)<<16) | ((x&0xFFFF0000)>>16);
- SIVAL(&x,0,x2);
-
- return pull_dos_date((const uint8_t *)&x, zone_offset);
-}
-
-/**
- create a unix GMT date from a dos date in 32 bit "unix like" format
- these generally arrive as localtimes, with corresponding DST
-**/
-time_t pull_dos_date3(const uint8_t *date_ptr, int zone_offset)
-{
- time_t t = (time_t)IVAL(date_ptr,0);
- if (!null_time(t)) {
- t += zone_offset;
- }
- return t;
-}
-
-/***************************************************************************
- Return a HTTP/1.0 time string.
-***************************************************************************/
-
-char *http_timestring(time_t t)
-{
- fstring buf;
- struct tm *tm = localtime(&t);
-
- if (t == TIME_T_MAX) {
- fstrcpy(buf, "never");
- } else if (!tm) {
- fstr_sprintf(buf, "%ld seconds since the Epoch", (long)t);
- } else {
-#ifndef HAVE_STRFTIME
- const char *asct = asctime(tm);
- fstrcpy(buf, asct ? asct : "unknown");
- }
- if(buf[strlen(buf)-1] == '\n') {
- buf[strlen(buf)-1] = 0;
-#else /* !HAVE_STRFTIME */
- strftime(buf, sizeof(buf)-1, "%a, %d %b %Y %H:%M:%S %Z", tm);
-#endif /* !HAVE_STRFTIME */
- }
- return talloc_strdup(talloc_tos(), buf);
-}
-
-
-/**
- Return the date and time as a string
-**/
-char *timestring(TALLOC_CTX *mem_ctx, time_t t)
-{
- char *TimeBuf;
- char tempTime[80];
- struct tm *tm;
-
- tm = localtime(&t);
- if (!tm) {
- return talloc_asprintf(mem_ctx,
- "%ld seconds since the Epoch",
- (long)t);
- }
-
-#ifdef HAVE_STRFTIME
- /* some versions of gcc complain about using %c. This is a bug
- in the gcc warning, not a bug in this code. See a recent
- strftime() manual page for details.
- */
- strftime(tempTime,sizeof(tempTime)-1,"%c %Z",tm);
- TimeBuf = talloc_strdup(mem_ctx, tempTime);
-#else
- TimeBuf = talloc_strdup(mem_ctx, asctime(tm));
-#endif
-
- return TimeBuf;
-}
-
-/**
- return a talloced string representing a NTTIME for human consumption
-*/
-const char *nt_time_string(TALLOC_CTX *mem_ctx, NTTIME nt)
-{
- time_t t;
- if (nt == 0) {
- return "NTTIME(0)";
- }
- t = nt_time_to_unix(nt);
- return timestring(mem_ctx, t);
-}
-
-
-/**
parse a nttime as a large integer in a string and return a NTTIME
*/
NTTIME nttime_from_string(const char *s)
@@ -377,190 +100,6 @@ NTTIME nttime_from_string(const char *s)
return strtoull(s, NULL, 0);
}
-/**
- return (tv1 - tv2) in microseconds
-*/
-int64_t usec_time_diff(struct timeval *tv1, struct timeval *tv2)
-{
- int64_t sec_diff = tv1->tv_sec - tv2->tv_sec;
- return (sec_diff * 1000000) + (int64_t)(tv1->tv_usec - tv2->tv_usec);
-}
-
-
-/**
- return a zero timeval
-*/
-struct timeval timeval_zero(void)
-{
- struct timeval tv;
- tv.tv_sec = 0;
- tv.tv_usec = 0;
- return tv;
-}
-
-/**
- return True if a timeval is zero
-*/
-bool timeval_is_zero(const struct timeval *tv)
-{
- return tv->tv_sec == 0 && tv->tv_usec == 0;
-}
-
-/**
- return a timeval for the current time
-*/
-struct timeval timeval_current(void)
-{
- struct timeval tv;
- GetTimeOfDay(&tv);
- return tv;
-}
-
-/**
- return a timeval struct with the given elements
-*/
-struct timeval timeval_set(uint32_t secs, uint32_t usecs)
-{
- struct timeval tv;
- tv.tv_sec = secs;
- tv.tv_usec = usecs;
- return tv;
-}
-
-
-/**
- return a timeval ofs microseconds after tv
-*/
-struct timeval timeval_add(const struct timeval *tv,
- uint32_t secs, uint32_t usecs)
-{
- struct timeval tv2 = *tv;
- const unsigned int million = 1000000;
- tv2.tv_sec += secs;
- tv2.tv_usec += usecs;
- tv2.tv_sec += tv2.tv_usec / million;
- tv2.tv_usec = tv2.tv_usec % million;
- return tv2;
-}
-
-/**
- return the sum of two timeval structures
-*/
-struct timeval timeval_sum(const struct timeval *tv1,
- const struct timeval *tv2)
-{
- return timeval_add(tv1, tv2->tv_sec, tv2->tv_usec);
-}
-
-/**
- return a timeval secs/usecs into the future
-*/
-struct timeval timeval_current_ofs(uint32_t secs, uint32_t usecs)
-{
- struct timeval tv = timeval_current();
- return timeval_add(&tv, secs, usecs);
-}
-
-/**
- compare two timeval structures.
- Return -1 if tv1 < tv2
- Return 0 if tv1 == tv2
- Return 1 if tv1 > tv2
-*/
-int timeval_compare(const struct timeval *tv1, const struct timeval *tv2)
-{
- if (tv1->tv_sec > tv2->tv_sec) return 1;
- if (tv1->tv_sec < tv2->tv_sec) return -1;
- if (tv1->tv_usec > tv2->tv_usec) return 1;
- if (tv1->tv_usec < tv2->tv_usec) return -1;
- return 0;
-}
-
-/**
- return True if a timer is in the past
-*/
-bool timeval_expired(const struct timeval *tv)
-{
- struct timeval tv2 = timeval_current();
- if (tv2.tv_sec > tv->tv_sec) return True;
- if (tv2.tv_sec < tv->tv_sec) return False;
- return (tv2.tv_usec >= tv->tv_usec);
-}
-
-/**
- return the number of seconds elapsed between two times
-*/
-double timeval_elapsed2(const struct timeval *tv1, const struct timeval *tv2)
-{
- return (tv2->tv_sec - tv1->tv_sec) +
- (tv2->tv_usec - tv1->tv_usec)*1.0e-6;
-}
-
-/**
- return the number of seconds elapsed since a given time
-*/
-double timeval_elapsed(const struct timeval *tv)
-{
- struct timeval tv2 = timeval_current();
- return timeval_elapsed2(tv, &tv2);
-}
-
-/**
- return the lesser of two timevals
-*/
-struct timeval timeval_min(const struct timeval *tv1,
- const struct timeval *tv2)
-{
- if (tv1->tv_sec < tv2->tv_sec) return *tv1;
- if (tv1->tv_sec > tv2->tv_sec) return *tv2;
- if (tv1->tv_usec < tv2->tv_usec) return *tv1;
- return *tv2;
-}
-
-/**
- return the greater of two timevals
-*/
-struct timeval timeval_max(const struct timeval *tv1,
- const struct timeval *tv2)
-{
- if (tv1->tv_sec > tv2->tv_sec) return *tv1;
- if (tv1->tv_sec < tv2->tv_sec) return *tv2;
- if (tv1->tv_usec > tv2->tv_usec) return *tv1;
- return *tv2;
-}
-
-/**
- return the difference between two timevals as a timeval
- if tv1 comes after tv2, then return a zero timeval
- (this is *tv2 - *tv1)
-*/
-struct timeval timeval_until(const struct timeval *tv1,
- const struct timeval *tv2)
-{
- struct timeval t;
- if (timeval_compare(tv1, tv2) >= 0) {
- return timeval_zero();
- }
- t.tv_sec = tv2->tv_sec - tv1->tv_sec;
- if (tv1->tv_usec > tv2->tv_usec) {
- t.tv_sec--;
- t.tv_usec = 1000000 - (tv1->tv_usec - tv2->tv_usec);
- } else {
- t.tv_usec = tv2->tv_usec - tv1->tv_usec;
- }
- return t;
-}
-
-
-/**
- convert a timeval to a NTTIME
-*/
-NTTIME timeval_to_nttime(const struct timeval *tv)
-{
- return 10*(tv->tv_usec +
- ((TIME_FIXUP_CONSTANT_INT + (uint64_t)tv->tv_sec) * 1000000));
-}
-
/**************************************************************
Handle conversions between time_t and uint32, taking care to
preserve the "special" values.
@@ -592,44 +131,8 @@ time_t convert_uint32_to_time_t(uint32 u)
return (time_t)u;
}
-/*******************************************************************
- Yield the difference between *A and *B, in seconds, ignoring leap seconds.
-********************************************************************/
-
-static int tm_diff(struct tm *a, struct tm *b)
-{
- int ay = a->tm_year + (1900 - 1);
- int by = b->tm_year + (1900 - 1);
- int intervening_leap_days =
- (ay/4 - by/4) - (ay/100 - by/100) + (ay/400 - by/400);
- int years = ay - by;
- int days = 365*years + intervening_leap_days + (a->tm_yday - b->tm_yday);
- int hours = 24*days + (a->tm_hour - b->tm_hour);
- int minutes = 60*hours + (a->tm_min - b->tm_min);
- int seconds = 60*minutes + (a->tm_sec - b->tm_sec);
-
- return seconds;
-}
-
int extra_time_offset=0;
-/*******************************************************************
- Return the UTC offset in seconds west of UTC, or 0 if it cannot be determined.
-********************************************************************/
-
-int get_time_zone(time_t t)
-{
- struct tm *tm = gmtime(&t);
- struct tm tm_utc;
- if (!tm)
- return 0;
- tm_utc = *tm;
- tm = localtime(&t);
- if (!tm)
- return 0;
- return tm_diff(&tm_utc,tm)+60*extra_time_offset;
-}
-
/****************************************************************************
Check if NTTIME is 0.
****************************************************************************/
@@ -1084,24 +587,6 @@ time_t srv_make_unix_date3(const void *date_ptr)
return make_unix_date3(date_ptr, server_zone_offset);
}
-time_t convert_timespec_to_time_t(struct timespec ts)
-{
- /* 1 ns == 1,000,000,000 - one thousand millionths of a second.
- increment if it's greater than 500 millionth of a second. */
- if (ts.tv_nsec > 500000000) {
- return ts.tv_sec + 1;
- }
- return ts.tv_sec;
-}
-
-struct timespec convert_time_t_to_timespec(time_t t)
-{
- struct timespec ts;
- ts.tv_sec = t;
- ts.tv_nsec = 0;
- return ts;
-}
-
/****************************************************************************
Convert a normalized timeval to a timespec.
****************************************************************************/
@@ -1222,49 +707,6 @@ time_t cli_make_unix_date3(struct cli_state *cli, const void *date_ptr)
return make_unix_date3(date_ptr, cli->serverzone);
}
-/* Large integer version. */
-struct timespec nt_time_to_unix_timespec(NTTIME *nt)
-{
- int64 d;
- struct timespec ret;
-
- if (*nt == 0 || *nt == (int64)-1) {
- ret.tv_sec = 0;
- ret.tv_nsec = 0;
- return ret;
- }
-
- d = (int64)*nt;
- /* d is now in 100ns units, since jan 1st 1601".
- Save off the ns fraction. */
-
- /*
- * Take the last seven decimal digits and multiply by 100.
- * to convert from 100ns units to 1ns units.
- */
- ret.tv_nsec = (long) ((d % (1000 * 1000 * 10)) * 100);
-
- /* Convert to seconds */
- d /= 1000*1000*10;
-
- /* Now adjust by 369 years to make the secs since 1970 */
- d -= TIME_FIXUP_CONSTANT_INT;
-
- if (d <= (int64)TIME_T_MIN) {
- ret.tv_sec = TIME_T_MIN;
- ret.tv_nsec = 0;
- return ret;
- }
-
- if (d >= (int64)TIME_T_MAX) {
- ret.tv_sec = TIME_T_MAX;
- ret.tv_nsec = 0;
- return ret;
- }
-
- ret.tv_sec = (time_t)d;
- return ret;
-}
/****************************************************************************
Check if two NTTIMEs are the same.
****************************************************************************/
diff --git a/source3/lib/ufc.c b/source3/lib/ufc.c
deleted file mode 100644
index 89329808c9..0000000000
--- a/source3/lib/ufc.c
+++ /dev/null
@@ -1,770 +0,0 @@
-/*
- This bit of code was derived from the UFC-crypt package which
- carries the following copyright
-
- Modified for use by Samba by Andrew Tridgell, October 1994
-
- Note that this routine is only faster on some machines. Under Linux 1.1.51
- libc 4.5.26 I actually found this routine to be slightly slower.
-
- Under SunOS I found a huge speedup by using these routines
- (a factor of 20 or so)
-
- Warning: I've had a report from Steve Kennedy <steve@gbnet.org>
- that this crypt routine may sometimes get the wrong answer. Only
- use UFC_CRYT if you really need it.
-
-*/
-
-#include "includes.h"
-
-#ifndef HAVE_CRYPT
-
-/*
- * UFC-crypt: ultra fast crypt(3) implementation
- *
- * Copyright (C) 1991-1998, Free Software Foundation, Inc.
- *
- * 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 library; if not, see <http://www.gnu.org/licenses/>.
- *
- * @(#)crypt_util.c 2.31 02/08/92
- *
- * Support routines
- *
- */
-
-
-#ifndef long32
-#define long32 int32
-#endif
-
-#ifndef long64
-#define long64 int64
-#endif
-
-#ifndef ufc_long
-#define ufc_long unsigned
-#endif
-
-#ifndef _UFC_64_
-#define _UFC_32_
-#endif
-
-/*
- * Permutation done once on the 56 bit
- * key derived from the original 8 byte ASCII key.
- */
-static int pc1[56] = {
- 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18,
- 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36,
- 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22,
- 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4
-};
-
-/*
- * How much to rotate each 28 bit half of the pc1 permutated
- * 56 bit key before using pc2 to give the i' key
- */
-static int rots[16] = {
- 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1
-};
-
-/*
- * Permutation giving the key
- * of the i' DES round
- */
-static int pc2[48] = {
- 14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10,
- 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2,
- 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48,
- 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32
-};
-
-/*
- * The E expansion table which selects
- * bits from the 32 bit intermediate result.
- */
-static int esel[48] = {
- 32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9,
- 8, 9, 10, 11, 12, 13, 12, 13, 14, 15, 16, 17,
- 16, 17, 18, 19, 20, 21, 20, 21, 22, 23, 24, 25,
- 24, 25, 26, 27, 28, 29, 28, 29, 30, 31, 32, 1
-};
-static int e_inverse[64];
-
-/*
- * Permutation done on the
- * result of sbox lookups
- */
-static int perm32[32] = {
- 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10,
- 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25
-};
-
-/*
- * The sboxes
- */
-static int sbox[8][4][16]= {
- { { 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7 },
- { 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8 },
- { 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0 },
- { 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13 }
- },
-
- { { 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10 },
- { 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5 },
- { 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15 },
- { 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9 }
- },
-
- { { 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8 },
- { 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1 },
- { 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7 },
- { 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12 }
- },
-
- { { 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15 },
- { 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9 },
- { 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4 },
- { 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14 }
- },
-
- { { 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9 },
- { 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6 },
- { 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14 },
- { 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3 }
- },
-
- { { 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11 },
- { 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8 },
- { 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6 },
- { 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13 }
- },
-
- { { 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1 },
- { 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6 },
- { 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2 },
- { 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12 }
- },
-
- { { 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7 },
- { 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2 },
- { 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8 },
- { 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11 }
- }
-};
-
-/*
- * This is the final
- * permutation matrix
- */
-static int final_perm[64] = {
- 40, 8, 48, 16, 56, 24, 64, 32, 39, 7, 47, 15, 55, 23, 63, 31,
- 38, 6, 46, 14, 54, 22, 62, 30, 37, 5, 45, 13, 53, 21, 61, 29,
- 36, 4, 44, 12, 52, 20, 60, 28, 35, 3, 43, 11, 51, 19, 59, 27,
- 34, 2, 42, 10, 50, 18, 58, 26, 33, 1, 41, 9, 49, 17, 57, 25
-};
-
-/*
- * The 16 DES keys in BITMASK format
- */
-#ifdef _UFC_32_
-long32 _ufc_keytab[16][2];
-#endif
-
-#ifdef _UFC_64_
-long64 _ufc_keytab[16];
-#endif
-
-
-#define ascii_to_bin(c) ((c)>='a'?(c-59):(c)>='A'?((c)-53):(c)-'.')
-#define bin_to_ascii(c) ((c)>=38?((c)-38+'a'):(c)>=12?((c)-12+'A'):(c)+'.')
-
-/* Macro to set a bit (0..23) */
-#define BITMASK(i) ( (1<<(11-(i)%12+3)) << ((i)<12?16:0) )
-
-/*
- * sb arrays:
- *
- * Workhorses of the inner loop of the DES implementation.
- * They do sbox lookup, shifting of this value, 32 bit
- * permutation and E permutation for the next round.
- *
- * Kept in 'BITMASK' format.
- */
-
-#ifdef _UFC_32_
-long32 _ufc_sb0[8192], _ufc_sb1[8192], _ufc_sb2[8192], _ufc_sb3[8192];
-static long32 *sb[4] = {_ufc_sb0, _ufc_sb1, _ufc_sb2, _ufc_sb3};
-#endif
-
-#ifdef _UFC_64_
-long64 _ufc_sb0[4096], _ufc_sb1[4096], _ufc_sb2[4096], _ufc_sb3[4096];
-static long64 *sb[4] = {_ufc_sb0, _ufc_sb1, _ufc_sb2, _ufc_sb3};
-#endif
-
-/*
- * eperm32tab: do 32 bit permutation and E selection
- *
- * The first index is the byte number in the 32 bit value to be permuted
- * - second - is the value of this byte
- * - third - selects the two 32 bit values
- *
- * The table is used and generated internally in init_des to speed it up
- */
-static ufc_long eperm32tab[4][256][2];
-
-/*
- * do_pc1: permform pc1 permutation in the key schedule generation.
- *
- * The first index is the byte number in the 8 byte ASCII key
- * - second - - the two 28 bits halfs of the result
- * - third - selects the 7 bits actually used of each byte
- *
- * The result is kept with 28 bit per 32 bit with the 4 most significant
- * bits zero.
- */
-static ufc_long do_pc1[8][2][128];
-
-/*
- * do_pc2: permform pc2 permutation in the key schedule generation.
- *
- * The first index is the septet number in the two 28 bit intermediate values
- * - second - - - septet values
- *
- * Knowledge of the structure of the pc2 permutation is used.
- *
- * The result is kept with 28 bit per 32 bit with the 4 most significant
- * bits zero.
- */
-static ufc_long do_pc2[8][128];
-
-/*
- * efp: undo an extra e selection and do final
- * permutation giving the DES result.
- *
- * Invoked 6 bit a time on two 48 bit values
- * giving two 32 bit longs.
- */
-static ufc_long efp[16][64][2];
-
-static unsigned char bytemask[8] = {
- 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
-};
-
-static ufc_long longmask[32] = {
- 0x80000000, 0x40000000, 0x20000000, 0x10000000,
- 0x08000000, 0x04000000, 0x02000000, 0x01000000,
- 0x00800000, 0x00400000, 0x00200000, 0x00100000,
- 0x00080000, 0x00040000, 0x00020000, 0x00010000,
- 0x00008000, 0x00004000, 0x00002000, 0x00001000,
- 0x00000800, 0x00000400, 0x00000200, 0x00000100,
- 0x00000080, 0x00000040, 0x00000020, 0x00000010,
- 0x00000008, 0x00000004, 0x00000002, 0x00000001
-};
-
-
-/*
- * Silly rewrite of 'bzero'. I do so
- * because some machines don't have
- * bzero and some don't have memset.
- */
-
-static void clearmem(char *start, int cnt)
- { while(cnt--)
- *start++ = '\0';
- }
-
-static int initialized = 0;
-
-/* lookup a 6 bit value in sbox */
-
-#define s_lookup(i,s) sbox[(i)][(((s)>>4) & 0x2)|((s) & 0x1)][((s)>>1) & 0xf];
-
-/*
- * Initialize unit - may be invoked directly
- * by fcrypt users.
- */
-
-static void ufc_init_des(void)
- { int comes_from_bit;
- int bit, sg;
- ufc_long j;
- ufc_long mask1, mask2;
-
- /*
- * Create the do_pc1 table used
- * to affect pc1 permutation
- * when generating keys
- */
- for(bit = 0; bit < 56; bit++) {
- comes_from_bit = pc1[bit] - 1;
- mask1 = bytemask[comes_from_bit % 8 + 1];
- mask2 = longmask[bit % 28 + 4];
- for(j = 0; j < 128; j++) {
- if(j & mask1)
- do_pc1[comes_from_bit / 8][bit / 28][j] |= mask2;
- }
- }
-
- /*
- * Create the do_pc2 table used
- * to affect pc2 permutation when
- * generating keys
- */
- for(bit = 0; bit < 48; bit++) {
- comes_from_bit = pc2[bit] - 1;
- mask1 = bytemask[comes_from_bit % 7 + 1];
- mask2 = BITMASK(bit % 24);
- for(j = 0; j < 128; j++) {
- if(j & mask1)
- do_pc2[comes_from_bit / 7][j] |= mask2;
- }
- }
-
- /*
- * Now generate the table used to do combined
- * 32 bit permutation and e expansion
- *
- * We use it because we have to permute 16384 32 bit
- * longs into 48 bit in order to initialize sb.
- *
- * Looping 48 rounds per permutation becomes
- * just too slow...
- *
- */
-
- clearmem((char*)eperm32tab, sizeof(eperm32tab));
-
- for(bit = 0; bit < 48; bit++) {
- ufc_long inner_mask1,comes_from;
-
- comes_from = perm32[esel[bit]-1]-1;
- inner_mask1 = bytemask[comes_from % 8];
-
- for(j = 256; j--;) {
- if(j & inner_mask1)
- eperm32tab[comes_from / 8][j][bit / 24] |= BITMASK(bit % 24);
- }
- }
-
- /*
- * Create the sb tables:
- *
- * For each 12 bit segment of an 48 bit intermediate
- * result, the sb table precomputes the two 4 bit
- * values of the sbox lookups done with the two 6
- * bit halves, shifts them to their proper place,
- * sends them through perm32 and finally E expands
- * them so that they are ready for the next
- * DES round.
- *
- */
- for(sg = 0; sg < 4; sg++) {
- int j1, j2;
- int s1, s2;
-
- for(j1 = 0; j1 < 64; j1++) {
- s1 = s_lookup(2 * sg, j1);
- for(j2 = 0; j2 < 64; j2++) {
- ufc_long to_permute, inx;
-
- s2 = s_lookup(2 * sg + 1, j2);
- to_permute = ((s1 << 4) | s2) << (24 - 8 * sg);
-
-#ifdef _UFC_32_
- inx = ((j1 << 6) | j2) << 1;
- sb[sg][inx ] = eperm32tab[0][(to_permute >> 24) & 0xff][0];
- sb[sg][inx+1] = eperm32tab[0][(to_permute >> 24) & 0xff][1];
- sb[sg][inx ] |= eperm32tab[1][(to_permute >> 16) & 0xff][0];
- sb[sg][inx+1] |= eperm32tab[1][(to_permute >> 16) & 0xff][1];
- sb[sg][inx ] |= eperm32tab[2][(to_permute >> 8) & 0xff][0];
- sb[sg][inx+1] |= eperm32tab[2][(to_permute >> 8) & 0xff][1];
- sb[sg][inx ] |= eperm32tab[3][(to_permute) & 0xff][0];
- sb[sg][inx+1] |= eperm32tab[3][(to_permute) & 0xff][1];
-#endif
-#ifdef _UFC_64_
- inx = ((j1 << 6) | j2);
- sb[sg][inx] =
- ((long64)eperm32tab[0][(to_permute >> 24) & 0xff][0] << 32) |
- (long64)eperm32tab[0][(to_permute >> 24) & 0xff][1];
- sb[sg][inx] |=
- ((long64)eperm32tab[1][(to_permute >> 16) & 0xff][0] << 32) |
- (long64)eperm32tab[1][(to_permute >> 16) & 0xff][1];
- sb[sg][inx] |=
- ((long64)eperm32tab[2][(to_permute >> 8) & 0xff][0] << 32) |
- (long64)eperm32tab[2][(to_permute >> 8) & 0xff][1];
- sb[sg][inx] |=
- ((long64)eperm32tab[3][(to_permute) & 0xff][0] << 32) |
- (long64)eperm32tab[3][(to_permute) & 0xff][1];
-#endif
- }
- }
- }
-
- /*
- * Create an inverse matrix for esel telling
- * where to plug out bits if undoing it
- */
- for(bit=48; bit--;) {
- e_inverse[esel[bit] - 1 ] = bit;
- e_inverse[esel[bit] - 1 + 32] = bit + 48;
- }
-
- /*
- * create efp: the matrix used to
- * undo the E expansion and effect final permutation
- */
- clearmem((char*)efp, sizeof efp);
- for(bit = 0; bit < 64; bit++) {
- int o_bit, o_long;
- ufc_long word_value, inner_mask1, inner_mask2;
- int comes_from_f_bit, comes_from_e_bit;
- int comes_from_word, bit_within_word;
-
- /* See where bit i belongs in the two 32 bit long's */
- o_long = bit / 32; /* 0..1 */
- o_bit = bit % 32; /* 0..31 */
-
- /*
- * And find a bit in the e permutated value setting this bit.
- *
- * Note: the e selection may have selected the same bit several
- * times. By the initialization of e_inverse, we only look
- * for one specific instance.
- */
- comes_from_f_bit = final_perm[bit] - 1; /* 0..63 */
- comes_from_e_bit = e_inverse[comes_from_f_bit]; /* 0..95 */
- comes_from_word = comes_from_e_bit / 6; /* 0..15 */
- bit_within_word = comes_from_e_bit % 6; /* 0..5 */
-
- inner_mask1 = longmask[bit_within_word + 26];
- inner_mask2 = longmask[o_bit];
-
- for(word_value = 64; word_value--;) {
- if(word_value & inner_mask1)
- efp[comes_from_word][word_value][o_long] |= inner_mask2;
- }
- }
- initialized++;
- }
-
-/*
- * Process the elements of the sb table permuting the
- * bits swapped in the expansion by the current salt.
- */
-
-#ifdef _UFC_32_
-static void shuffle_sb(long32 *k, ufc_long saltbits)
- { ufc_long j;
- long32 x;
- for(j=4096; j--;) {
- x = (k[0] ^ k[1]) & (long32)saltbits;
- *k++ ^= x;
- *k++ ^= x;
- }
- }
-#endif
-
-#ifdef _UFC_64_
-static void shuffle_sb(long64 *k, ufc_long saltbits)
- { ufc_long j;
- long64 x;
- for(j=4096; j--;) {
- x = ((*k >> 32) ^ *k) & (long64)saltbits;
- *k++ ^= (x << 32) | x;
- }
- }
-#endif
-
-/*
- * Setup the unit for a new salt
- * Hopefully we'll not see a new salt in each crypt call.
- */
-
-static unsigned char current_salt[3] = "&&"; /* invalid value */
-static ufc_long current_saltbits = 0;
-static int direction = 0;
-
-static void setup_salt(const char *s1)
- { ufc_long i, j, saltbits;
- const unsigned char *s2 = (const unsigned char *)s1;
-
- if(!initialized)
- ufc_init_des();
-
- if(s2[0] == current_salt[0] && s2[1] == current_salt[1])
- return;
- current_salt[0] = s2[0]; current_salt[1] = s2[1];
-
- /*
- * This is the only crypt change to DES:
- * entries are swapped in the expansion table
- * according to the bits set in the salt.
- */
- saltbits = 0;
- for(i = 0; i < 2; i++) {
- long c=ascii_to_bin(s2[i]);
- if(c < 0 || c > 63)
- c = 0;
- for(j = 0; j < 6; j++) {
- if((c >> j) & 0x1)
- saltbits |= BITMASK(6 * i + j);
- }
- }
-
- /*
- * Permute the sb table values
- * to reflect the changed e
- * selection table
- */
- shuffle_sb(_ufc_sb0, current_saltbits ^ saltbits);
- shuffle_sb(_ufc_sb1, current_saltbits ^ saltbits);
- shuffle_sb(_ufc_sb2, current_saltbits ^ saltbits);
- shuffle_sb(_ufc_sb3, current_saltbits ^ saltbits);
-
- current_saltbits = saltbits;
- }
-
-static void ufc_mk_keytab(char *key)
- { ufc_long v1, v2, *k1;
- int i;
-#ifdef _UFC_32_
- long32 v, *k2 = &_ufc_keytab[0][0];
-#endif
-#ifdef _UFC_64_
- long64 v, *k2 = &_ufc_keytab[0];
-#endif
-
- v1 = v2 = 0; k1 = &do_pc1[0][0][0];
- for(i = 8; i--;) {
- v1 |= k1[*key & 0x7f]; k1 += 128;
- v2 |= k1[*key++ & 0x7f]; k1 += 128;
- }
-
- for(i = 0; i < 16; i++) {
- k1 = &do_pc2[0][0];
-
- v1 = (v1 << rots[i]) | (v1 >> (28 - rots[i]));
- v = k1[(v1 >> 21) & 0x7f]; k1 += 128;
- v |= k1[(v1 >> 14) & 0x7f]; k1 += 128;
- v |= k1[(v1 >> 7) & 0x7f]; k1 += 128;
- v |= k1[(v1 ) & 0x7f]; k1 += 128;
-
-#ifdef _UFC_32_
- *k2++ = v;
- v = 0;
-#endif
-#ifdef _UFC_64_
- v <<= 32;
-#endif
-
- v2 = (v2 << rots[i]) | (v2 >> (28 - rots[i]));
- v |= k1[(v2 >> 21) & 0x7f]; k1 += 128;
- v |= k1[(v2 >> 14) & 0x7f]; k1 += 128;
- v |= k1[(v2 >> 7) & 0x7f]; k1 += 128;
- v |= k1[(v2 ) & 0x7f];
-
- *k2++ = v;
- }
-
- direction = 0;
- }
-
-/*
- * Undo an extra E selection and do final permutations
- */
-
-ufc_long *_ufc_dofinalperm(ufc_long l1, ufc_long l2, ufc_long r1, ufc_long r2)
- { ufc_long v1, v2, x;
- static ufc_long ary[2];
-
- x = (l1 ^ l2) & current_saltbits; l1 ^= x; l2 ^= x;
- x = (r1 ^ r2) & current_saltbits; r1 ^= x; r2 ^= x;
-
- v1=v2=0; l1 >>= 3; l2 >>= 3; r1 >>= 3; r2 >>= 3;
-
- v1 |= efp[15][ r2 & 0x3f][0]; v2 |= efp[15][ r2 & 0x3f][1];
- v1 |= efp[14][(r2 >>= 6) & 0x3f][0]; v2 |= efp[14][ r2 & 0x3f][1];
- v1 |= efp[13][(r2 >>= 10) & 0x3f][0]; v2 |= efp[13][ r2 & 0x3f][1];
- v1 |= efp[12][(r2 >>= 6) & 0x3f][0]; v2 |= efp[12][ r2 & 0x3f][1];
-
- v1 |= efp[11][ r1 & 0x3f][0]; v2 |= efp[11][ r1 & 0x3f][1];
- v1 |= efp[10][(r1 >>= 6) & 0x3f][0]; v2 |= efp[10][ r1 & 0x3f][1];
- v1 |= efp[ 9][(r1 >>= 10) & 0x3f][0]; v2 |= efp[ 9][ r1 & 0x3f][1];
- v1 |= efp[ 8][(r1 >>= 6) & 0x3f][0]; v2 |= efp[ 8][ r1 & 0x3f][1];
-
- v1 |= efp[ 7][ l2 & 0x3f][0]; v2 |= efp[ 7][ l2 & 0x3f][1];
- v1 |= efp[ 6][(l2 >>= 6) & 0x3f][0]; v2 |= efp[ 6][ l2 & 0x3f][1];
- v1 |= efp[ 5][(l2 >>= 10) & 0x3f][0]; v2 |= efp[ 5][ l2 & 0x3f][1];
- v1 |= efp[ 4][(l2 >>= 6) & 0x3f][0]; v2 |= efp[ 4][ l2 & 0x3f][1];
-
- v1 |= efp[ 3][ l1 & 0x3f][0]; v2 |= efp[ 3][ l1 & 0x3f][1];
- v1 |= efp[ 2][(l1 >>= 6) & 0x3f][0]; v2 |= efp[ 2][ l1 & 0x3f][1];
- v1 |= efp[ 1][(l1 >>= 10) & 0x3f][0]; v2 |= efp[ 1][ l1 & 0x3f][1];
- v1 |= efp[ 0][(l1 >>= 6) & 0x3f][0]; v2 |= efp[ 0][ l1 & 0x3f][1];
-
- ary[0] = v1; ary[1] = v2;
- return ary;
- }
-
-/*
- * crypt only: convert from 64 bit to 11 bit ASCII
- * prefixing with the salt
- */
-
-static char *output_conversion(ufc_long v1, ufc_long v2, const char *salt)
- { static char outbuf[14];
- int i, s;
-
- outbuf[0] = salt[0];
- outbuf[1] = salt[1] ? salt[1] : salt[0];
-
- for(i = 0; i < 5; i++)
- outbuf[i + 2] = bin_to_ascii((v1 >> (26 - 6 * i)) & 0x3f);
-
- s = (v2 & 0xf) << 2;
- v2 = (v2 >> 2) | ((v1 & 0x3) << 30);
-
- for(i = 5; i < 10; i++)
- outbuf[i + 2] = bin_to_ascii((v2 >> (56 - 6 * i)) & 0x3f);
-
- outbuf[12] = bin_to_ascii(s);
- outbuf[13] = 0;
-
- return outbuf;
- }
-
-/*
- * UNIX crypt function
- */
-
-static ufc_long *_ufc_doit(ufc_long , ufc_long, ufc_long, ufc_long, ufc_long);
-
-char *ufc_crypt(const char *key,const char *salt)
- { ufc_long *s;
- char ktab[9];
-
- /*
- * Hack DES tables according to salt
- */
- setup_salt(salt);
-
- /*
- * Setup key schedule
- */
- clearmem(ktab, sizeof ktab);
- StrnCpy(ktab, key, 8);
- ufc_mk_keytab(ktab);
-
- /*
- * Go for the 25 DES encryptions
- */
- s = _ufc_doit((ufc_long)0, (ufc_long)0,
- (ufc_long)0, (ufc_long)0, (ufc_long)25);
-
- /*
- * And convert back to 6 bit ASCII
- */
- return output_conversion(s[0], s[1], salt);
- }
-
-
-#ifdef _UFC_32_
-
-/*
- * 32 bit version
- */
-
-extern long32 _ufc_keytab[16][2];
-extern long32 _ufc_sb0[], _ufc_sb1[], _ufc_sb2[], _ufc_sb3[];
-
-#define SBA(sb, v) (*(long32*)((char*)(sb)+(v)))
-
-static ufc_long *_ufc_doit(ufc_long l1, ufc_long l2, ufc_long r1, ufc_long r2, ufc_long itr)
- { int i;
- long32 s, *k;
-
- while(itr--) {
- k = &_ufc_keytab[0][0];
- for(i=8; i--; ) {
- s = *k++ ^ r1;
- l1 ^= SBA(_ufc_sb1, s & 0xffff); l2 ^= SBA(_ufc_sb1, (s & 0xffff)+4);
- l1 ^= SBA(_ufc_sb0, s >>= 16); l2 ^= SBA(_ufc_sb0, (s) +4);
- s = *k++ ^ r2;
- l1 ^= SBA(_ufc_sb3, s & 0xffff); l2 ^= SBA(_ufc_sb3, (s & 0xffff)+4);
- l1 ^= SBA(_ufc_sb2, s >>= 16); l2 ^= SBA(_ufc_sb2, (s) +4);
-
- s = *k++ ^ l1;
- r1 ^= SBA(_ufc_sb1, s & 0xffff); r2 ^= SBA(_ufc_sb1, (s & 0xffff)+4);
- r1 ^= SBA(_ufc_sb0, s >>= 16); r2 ^= SBA(_ufc_sb0, (s) +4);
- s = *k++ ^ l2;
- r1 ^= SBA(_ufc_sb3, s & 0xffff); r2 ^= SBA(_ufc_sb3, (s & 0xffff)+4);
- r1 ^= SBA(_ufc_sb2, s >>= 16); r2 ^= SBA(_ufc_sb2, (s) +4);
- }
- s=l1; l1=r1; r1=s; s=l2; l2=r2; r2=s;
- }
- return _ufc_dofinalperm(l1, l2, r1, r2);
- }
-
-#endif
-
-#ifdef _UFC_64_
-
-/*
- * 64 bit version
- */
-
-extern long64 _ufc_keytab[16];
-extern long64 _ufc_sb0[], _ufc_sb1[], _ufc_sb2[], _ufc_sb3[];
-
-#define SBA(sb, v) (*(long64*)((char*)(sb)+(v)))
-
-static ufc_long *_ufc_doit(ufc_long l1, ufc_long l2, ufc_long r1, ufc_long r2, ufc_long itr)
- { int i;
- long64 l, r, s, *k;
-
- l = (((long64)l1) << 32) | ((long64)l2);
- r = (((long64)r1) << 32) | ((long64)r2);
-
- while(itr--) {
- k = &_ufc_keytab[0];
- for(i=8; i--; ) {
- s = *k++ ^ r;
- l ^= SBA(_ufc_sb3, (s >> 0) & 0xffff);
- l ^= SBA(_ufc_sb2, (s >> 16) & 0xffff);
- l ^= SBA(_ufc_sb1, (s >> 32) & 0xffff);
- l ^= SBA(_ufc_sb0, (s >> 48) & 0xffff);
-
- s = *k++ ^ l;
- r ^= SBA(_ufc_sb3, (s >> 0) & 0xffff);
- r ^= SBA(_ufc_sb2, (s >> 16) & 0xffff);
- r ^= SBA(_ufc_sb1, (s >> 32) & 0xffff);
- r ^= SBA(_ufc_sb0, (s >> 48) & 0xffff);
- }
- s=l; l=r; r=s;
- }
-
- l1 = l >> 32; l2 = l & 0xffffffff;
- r1 = r >> 32; r2 = r & 0xffffffff;
- return _ufc_dofinalperm(l1, l2, r1, r2);
- }
-
-#endif
-
-
-#else
- int ufc_dummy_procedure(void);
- int ufc_dummy_procedure(void) {return 0;}
-#endif
diff --git a/source3/lib/util.c b/source3/lib/util.c
index ec43ea7037..820cf376be 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -439,19 +439,6 @@ bool set_cmdline_auth_info_machine_account_creds(void)
return true;
}
-/**************************************************************************n
- Find a suitable temporary directory. The result should be copied immediately
- as it may be overwritten by a subsequent call.
-****************************************************************************/
-
-const char *tmpdir(void)
-{
- char *p;
- if ((p = getenv("TMPDIR")))
- return p;
- return "/tmp";
-}
-
/****************************************************************************
Add a gid to an array of gids if it's not already there.
****************************************************************************/
@@ -540,7 +527,7 @@ const char *get_numlist(const char *p, uint32 **num, int *count)
Check if a file exists - call vfs_file_exist for samba files.
********************************************************************/
-bool file_exist(const char *fname,SMB_STRUCT_STAT *sbuf)
+bool file_exist_stat(const char *fname,SMB_STRUCT_STAT *sbuf)
{
SMB_STRUCT_STAT st;
if (!sbuf)
@@ -566,24 +553,10 @@ bool socket_exist(const char *fname)
}
/*******************************************************************
- Check a files mod time.
-********************************************************************/
-
-time_t file_modtime(const char *fname)
-{
- SMB_STRUCT_STAT st;
-
- if (sys_stat(fname,&st) != 0)
- return(0);
-
- return(st.st_mtime);
-}
-
-/*******************************************************************
Check if a directory exists.
********************************************************************/
-bool directory_exist(char *dname,SMB_STRUCT_STAT *st)
+bool directory_exist_stat(char *dname,SMB_STRUCT_STAT *st)
{
SMB_STRUCT_STAT st2;
bool ret;
@@ -927,36 +900,6 @@ ssize_t write_data_at_offset(int fd, const char *buffer, size_t N, SMB_OFF_T pos
#endif
}
-/****************************************************************************
- Set a fd into blocking/nonblocking mode. Uses POSIX O_NONBLOCK if available,
- else
- if SYSV use O_NDELAY
- if BSD use FNDELAY
-****************************************************************************/
-
-int set_blocking(int fd, bool set)
-{
- int val;
-#ifdef O_NONBLOCK
-#define FLAG_TO_SET O_NONBLOCK
-#else
-#ifdef SYSV
-#define FLAG_TO_SET O_NDELAY
-#else /* BSD */
-#define FLAG_TO_SET FNDELAY
-#endif
-#endif
-
- if((val = sys_fcntl_long(fd, F_GETFL, 0)) == -1)
- return -1;
- if(set) /* Turn blocking on - ie. clear nonblock flag */
- val &= ~FLAG_TO_SET;
- else
- val |= FLAG_TO_SET;
- return sys_fcntl_long( fd, F_SETFL, val);
-#undef FLAG_TO_SET
-}
-
/*******************************************************************
Sleep for a specified number of milliseconds.
********************************************************************/
@@ -1130,26 +1073,6 @@ static void *realloc_(void *ptr, size_t size)
#endif /* PARANOID_MALLOC_CHECKER */
/****************************************************************************
- Type-safe malloc.
-****************************************************************************/
-
-void *malloc_array(size_t el_size, unsigned int count)
-{
- if (count >= MAX_ALLOC_SIZE/el_size) {
- return NULL;
- }
-
- if (el_size == 0 || count == 0) {
- return NULL;
- }
-#if defined(PARANOID_MALLOC_CHECKER)
- return malloc_(el_size*count);
-#else
- return malloc(el_size*count);
-#endif
-}
-
-/****************************************************************************
Type-safe memalign
****************************************************************************/
@@ -1250,21 +1173,6 @@ void *Realloc(void *p, size_t size, bool free_old_on_error)
}
/****************************************************************************
- Type-safe realloc.
-****************************************************************************/
-
-void *realloc_array(void *p, size_t el_size, unsigned int count, bool free_old_on_error)
-{
- if (count >= MAX_ALLOC_SIZE/el_size) {
- if (free_old_on_error) {
- SAFE_FREE(p);
- }
- return NULL;
- }
- return Realloc(p, el_size*count, free_old_on_error);
-}
-
-/****************************************************************************
(Hopefully) efficient array append.
****************************************************************************/
@@ -1320,21 +1228,10 @@ void add_to_large_array(TALLOC_CTX *mem_ctx, size_t element_size,
}
/****************************************************************************
- Free memory, checks for NULL.
- Use directly SAFE_FREE()
- Exists only because we need to pass a function pointer somewhere --SSS
-****************************************************************************/
-
-void safe_free(void *p)
-{
- SAFE_FREE(p);
-}
-
-/****************************************************************************
Get my own name and IP.
****************************************************************************/
-char *get_myname(TALLOC_CTX *ctx)
+char *talloc_get_myname(TALLOC_CTX *ctx)
{
char *p;
char hostname[HOST_NAME_MAX];
@@ -1549,14 +1446,6 @@ bool process_exists(const struct server_id pid)
#endif
}
-bool process_exists_by_pid(pid_t pid)
-{
- /* Doing kill with a non-positive pid causes messages to be
- * sent to places we don't want. */
- SMB_ASSERT(pid > 0);
- return(kill(pid,0) == 0 || errno != ESRCH);
-}
-
/*******************************************************************
Convert a uid into a user name.
********************************************************************/
@@ -2003,42 +1892,6 @@ void free_namearray(name_compare_entry *name_array)
#define DBGC_CLASS DBGC_LOCKING
/****************************************************************************
- Simple routine to do POSIX file locking. Cruft in NFS and 64->32 bit mapping
- is dealt with in posix.c
- Returns True if the lock was granted, False otherwise.
-****************************************************************************/
-
-bool fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
-{
- SMB_STRUCT_FLOCK lock;
- int ret;
-
- DEBUG(8,("fcntl_lock fd=%d op=%d offset=%.0f count=%.0f type=%d\n",
- fd,op,(double)offset,(double)count,type));
-
- lock.l_type = type;
- lock.l_whence = SEEK_SET;
- lock.l_start = offset;
- lock.l_len = count;
- lock.l_pid = 0;
-
- ret = sys_fcntl_ptr(fd,op,&lock);
-
- if (ret == -1) {
- int sav = errno;
- DEBUG(3,("fcntl_lock: lock failed at offset %.0f count %.0f op %d type %d (%s)\n",
- (double)offset,(double)count,op,type,strerror(errno)));
- errno = sav;
- return False;
- }
-
- /* everything went OK */
- DEBUG(8,("fcntl_lock: Lock call successful\n"));
-
- return True;
-}
-
-/****************************************************************************
Simple routine to query existing file locks. Cruft in NFS and 64->32 bit mapping
is dealt with in posix.c
Returns True if we have information regarding this lock region (and returns
@@ -2210,57 +2063,6 @@ enum remote_arch_types get_remote_arch(void)
return ra_type;
}
-void print_asc(int level, const unsigned char *buf,int len)
-{
- int i;
- for (i=0;i<len;i++)
- DEBUG(level,("%c", isprint(buf[i])?buf[i]:'.'));
-}
-
-void dump_data(int level, const unsigned char *buf1,int len)
-{
- const unsigned char *buf = (const unsigned char *)buf1;
- int i=0;
- if (len<=0) return;
-
- if (!DEBUGLVL(level)) return;
-
- DEBUGADD(level,("[%03X] ",i));
- for (i=0;i<len;) {
- DEBUGADD(level,("%02X ",(int)buf[i]));
- i++;
- if (i%8 == 0) DEBUGADD(level,(" "));
- if (i%16 == 0) {
- print_asc(level,&buf[i-16],8); DEBUGADD(level,(" "));
- print_asc(level,&buf[i-8],8); DEBUGADD(level,("\n"));
- if (i<len) DEBUGADD(level,("[%03X] ",i));
- }
- }
- if (i%16) {
- int n;
- n = 16 - (i%16);
- DEBUGADD(level,(" "));
- if (n>8) DEBUGADD(level,(" "));
- while (n--) DEBUGADD(level,(" "));
- n = MIN(8,i%16);
- print_asc(level,&buf[i-(i%16)],n); DEBUGADD(level,( " " ));
- n = (i%16) - n;
- if (n>0) print_asc(level,&buf[i-n],n);
- DEBUGADD(level,("\n"));
- }
-}
-
-void dump_data_pw(const char *msg, const uchar * data, size_t len)
-{
-#ifdef DEBUG_PASSWORD
- DEBUG(11, ("%s", msg));
- if (data != NULL && len > 0)
- {
- dump_data(11, data, len);
- }
-#endif
-}
-
const char *tab_depth(int level, int depth)
{
if( CHECK_DEBUGLVL(level) ) {
@@ -2425,78 +2227,6 @@ void *smb_xmalloc_array(size_t size, unsigned int count)
return p;
}
-/**
- Memdup with smb_panic on fail.
-**/
-
-void *smb_xmemdup(const void *p, size_t size)
-{
- void *p2;
- p2 = SMB_XMALLOC_ARRAY(unsigned char,size);
- memcpy(p2, p, size);
- return p2;
-}
-
-/**
- strdup that aborts on malloc fail.
-**/
-
-char *smb_xstrdup(const char *s)
-{
-#if defined(PARANOID_MALLOC_CHECKER)
-#ifdef strdup
-#undef strdup
-#endif
-#endif
-
-#ifndef HAVE_STRDUP
-#define strdup rep_strdup
-#endif
-
- char *s1 = strdup(s);
-#if defined(PARANOID_MALLOC_CHECKER)
-#ifdef strdup
-#undef strdup
-#endif
-#define strdup(s) __ERROR_DONT_USE_STRDUP_DIRECTLY
-#endif
- if (!s1) {
- smb_panic("smb_xstrdup: malloc failed");
- }
- return s1;
-
-}
-
-/**
- strndup that aborts on malloc fail.
-**/
-
-char *smb_xstrndup(const char *s, size_t n)
-{
-#if defined(PARANOID_MALLOC_CHECKER)
-#ifdef strndup
-#undef strndup
-#endif
-#endif
-
-#if (defined(BROKEN_STRNDUP) || !defined(HAVE_STRNDUP))
-#undef HAVE_STRNDUP
-#define strndup rep_strndup
-#endif
-
- char *s1 = strndup(s, n);
-#if defined(PARANOID_MALLOC_CHECKER)
-#ifdef strndup
-#undef strndup
-#endif
-#define strndup(s,n) __ERROR_DONT_USE_STRNDUP_DIRECTLY
-#endif
- if (!s1) {
- smb_panic("smb_xstrndup: malloc failed");
- }
- return s1;
-}
-
/*
vasprintf that aborts on malloc fail
*/
@@ -2506,7 +2236,7 @@ char *smb_xstrndup(const char *s, size_t n)
int n;
va_list ap2;
- VA_COPY(ap2, ap);
+ va_copy(ap2, ap);
n = vasprintf(ptr, format, ap2);
if (n == -1 || ! *ptr) {
@@ -2517,22 +2247,6 @@ char *smb_xstrndup(const char *s, size_t n)
}
/*****************************************************************
- Like strdup but for memory.
-*****************************************************************/
-
-void *memdup(const void *p, size_t size)
-{
- void *p2;
- if (size == 0)
- return NULL;
- p2 = SMB_MALLOC(size);
- if (!p2)
- return NULL;
- memcpy(p2, p, size);
- return p2;
-}
-
-/*****************************************************************
Get local hostname and cache result.
*****************************************************************/
@@ -2542,7 +2256,7 @@ char *myhostname(void)
if (ret == NULL) {
/* This is cached forever so
* use NULL talloc ctx. */
- ret = get_myname(NULL);
+ ret = talloc_get_myname(NULL);
}
return ret;
}
@@ -2561,7 +2275,7 @@ static char *xx_path(const char *name, const char *rootpath)
}
trim_string(fname,"","/");
- if (!directory_exist(fname,NULL)) {
+ if (!directory_exist(fname)) {
mkdir(fname,0755);
}
@@ -2972,25 +2686,6 @@ bool name_to_fqdn(fstring fqdn, const char *name)
}
/**********************************************************************
- Extension to talloc_get_type: Abort on type mismatch
-***********************************************************************/
-
-void *talloc_check_name_abort(const void *ptr, const char *name)
-{
- void *result;
-
- result = talloc_check_name(ptr, name);
- if (result != NULL)
- return result;
-
- DEBUG(0, ("Talloc type mismatch, expected %s, got %s\n",
- name, talloc_get_name(ptr)));
- smb_panic("talloc type mismatch");
- /* Keep the compiler happy */
- return NULL;
-}
-
-/**********************************************************************
Append a DATA_BLOB to a talloc'ed object
***********************************************************************/
diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c
index b628b06cc6..c5a9b7c29a 100644
--- a/source3/lib/util_file.c
+++ b/source3/lib/util_file.c
@@ -19,89 +19,11 @@
#include "includes.h"
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void *)-1)
-#endif
-
-/****************************************************************************
- Read a line from a file with possible \ continuation chars.
- Blanks at the start or end of a line are stripped.
- The string will be allocated if s2 is NULL.
-****************************************************************************/
-
-char *fgets_slash(char *s2,int maxlen,XFILE *f)
-{
- char *s=s2;
- int len = 0;
- int c;
- bool start_of_line = True;
-
- if (x_feof(f)) {
- return(NULL);
- }
-
- if (maxlen <2) {
- return(NULL);
- }
-
- if (!s2) {
- maxlen = MIN(maxlen,8);
- s = (char *)SMB_MALLOC(maxlen);
- }
-
- if (!s) {
- return(NULL);
- }
-
- *s = 0;
-
- while (len < maxlen-1) {
- c = x_getc(f);
- switch (c) {
- case '\r':
- break;
- case '\n':
- while (len > 0 && s[len-1] == ' ') {
- s[--len] = 0;
- }
- if (len > 0 && s[len-1] == '\\') {
- s[--len] = 0;
- start_of_line = True;
- break;
- }
- return(s);
- case EOF:
- if (len <= 0 && !s2) {
- SAFE_FREE(s);
- }
- return(len>0?s:NULL);
- case ' ':
- if (start_of_line) {
- break;
- }
- default:
- start_of_line = False;
- s[len++] = c;
- s[len] = 0;
- }
-
- if (!s2 && len > maxlen-3) {
- maxlen *= 2;
- s = (char *)SMB_REALLOC(s,maxlen);
- if (!s) {
- DEBUG(0,("fgets_slash: failed to expand buffer!\n"));
- return(NULL);
- }
- }
- }
- return(s);
-}
-
-/****************************************************************************
+/**
Load from a pipe into memory.
-****************************************************************************/
+**/
-static char *file_pload(char *syscmd, size_t *size)
+static char *file_pload(const char *syscmd, size_t *size)
{
int fd, n;
char *p;
@@ -143,215 +65,14 @@ static char *file_pload(char *syscmd, size_t *size)
return p;
}
-/****************************************************************************
- Load a file into memory from a fd.
- Truncate at maxsize. If maxsize == 0 - no limit.
-****************************************************************************/
-
-char *fd_load(int fd, size_t *psize, size_t maxsize)
-{
- SMB_STRUCT_STAT sbuf;
- size_t size;
- char *p;
-
- if (sys_fstat(fd, &sbuf) != 0) {
- return NULL;
- }
-
- size = sbuf.st_size;
- if (maxsize) {
- size = MIN(size, maxsize);
- }
-
- p = (char *)SMB_MALLOC(size+1);
- if (!p) {
- return NULL;
- }
-
- if (read(fd, p, size) != size) {
- SAFE_FREE(p);
- return NULL;
- }
- p[size] = 0;
-
- if (psize) {
- *psize = size;
- }
-
- return p;
-}
-
-/****************************************************************************
- Load a file into memory.
-****************************************************************************/
-
-char *file_load(const char *fname, size_t *size, size_t maxsize)
-{
- int fd;
- char *p;
-
- if (!fname || !*fname) {
- return NULL;
- }
-
- fd = open(fname,O_RDONLY);
- if (fd == -1) {
- return NULL;
- }
-
- p = fd_load(fd, size, maxsize);
- close(fd);
- return p;
-}
-
-/*******************************************************************
- unmap or free memory
-*******************************************************************/
-
-bool unmap_file(void* start, size_t size)
-{
-#ifdef HAVE_MMAP
- if ( munmap( start, size ) != 0 ) {
- DEBUG( 1, ("map_file: Failed to unmap address %p "
- "of size %u - %s\n",
- start, (unsigned int)size, strerror(errno) ));
- return False;
- }
- return True;
-#else
- SAFE_FREE( start );
- return True;
-#endif
-}
-
-/*******************************************************************
- mmap (if possible) or read a file.
-********************************************************************/
-
-void *map_file(char *fname, size_t size)
-{
- size_t s2 = 0;
- void *p = NULL;
-#ifdef HAVE_MMAP
- int fd;
- fd = open(fname, O_RDONLY, 0);
- if (fd == -1) {
- DEBUG(2,("map_file: Failed to load %s - %s\n", fname, strerror(errno)));
- return NULL;
- }
- p = mmap(NULL, size, PROT_READ, MAP_SHARED|MAP_FILE, fd, 0);
- close(fd);
- if (p == MAP_FAILED) {
- DEBUG(1,("map_file: Failed to mmap %s - %s\n", fname, strerror(errno)));
- return NULL;
- }
-#endif
- if (!p) {
- p = file_load(fname, &s2, 0);
- if (!p) {
- return NULL;
- }
- if (s2 != size) {
- DEBUG(1,("map_file: incorrect size for %s - got %lu expected %lu\n",
- fname, (unsigned long)s2, (unsigned long)size));
- SAFE_FREE(p);
- return NULL;
- }
- }
- return p;
-}
-
-/****************************************************************************
- Parse a buffer into lines.
-****************************************************************************/
-
-static char **file_lines_parse(char *p, size_t size, int *numlines)
-{
- int i;
- char *s, **ret;
-
- if (!p) {
- return NULL;
- }
-
- for (s = p, i=0; s < p+size; s++) {
- if (s[0] == '\n') i++;
- }
-
- ret = SMB_MALLOC_ARRAY(char *, i+2);
- if (!ret) {
- SAFE_FREE(p);
- return NULL;
- }
- memset(ret, 0, sizeof(ret[0])*(i+2));
-
- ret[0] = p;
- for (s = p, i=0; s < p+size; s++) {
- if (s[0] == '\n') {
- s[0] = 0;
- i++;
- ret[i] = s+1;
- }
- if (s[0] == '\r') {
- s[0] = 0;
- }
- }
-
- /* remove any blank lines at the end */
- while (i > 0 && ret[i-1][0] == 0) {
- i--;
- }
-
- if (numlines) {
- *numlines = i;
- }
-
- return ret;
-}
-
-/****************************************************************************
- Load a file into memory and return an array of pointers to lines in the file
- must be freed with file_lines_free().
-****************************************************************************/
-
-char **file_lines_load(const char *fname, int *numlines, size_t maxsize)
-{
- char *p;
- size_t size = 0;
-
- p = file_load(fname, &size, maxsize);
- if (!p) {
- return NULL;
- }
-
- return file_lines_parse(p, size, numlines);
-}
-
-/****************************************************************************
- Load a fd into memory and return an array of pointers to lines in the file
- must be freed with file_lines_free(). If convert is true calls unix_to_dos on
- the list.
-****************************************************************************/
-char **fd_lines_load(int fd, int *numlines, size_t maxsize)
-{
- char *p;
- size_t size;
- p = fd_load(fd, &size, maxsize);
- if (!p) {
- return NULL;
- }
-
- return file_lines_parse(p, size, numlines);
-}
-
-/****************************************************************************
+/**
Load a pipe into memory and return an array of pointers to lines in the data
must be freed with file_lines_free().
-****************************************************************************/
+**/
-char **file_lines_pload(char *syscmd, int *numlines)
+char **file_lines_pload(const char *syscmd, int *numlines)
{
char *p;
size_t size;
@@ -361,64 +82,5 @@ char **file_lines_pload(char *syscmd, int *numlines)
return NULL;
}
- return file_lines_parse(p, size, numlines);
-}
-
-/****************************************************************************
- Free lines loaded with file_lines_load.
-****************************************************************************/
-
-void file_lines_free(char **lines)
-{
- if (!lines) {
- return;
- }
- SAFE_FREE(lines[0]);
- SAFE_FREE(lines);
-}
-
-/****************************************************************************
- Take a list of lines and modify them to produce a list where \ continues
- a line.
-****************************************************************************/
-
-void file_lines_slashcont(char **lines)
-{
- int i, j;
-
- for (i=0; lines[i];) {
- int len = strlen(lines[i]);
- if (lines[i][len-1] == '\\') {
- lines[i][len-1] = ' ';
- if (lines[i+1]) {
- char *p = &lines[i][len];
- while (p < lines[i+1]) {
- *p++ = ' ';
- }
- for (j = i+1; lines[j]; j++) {
- lines[j] = lines[j+1];
- }
- }
- } else {
- i++;
- }
- }
-}
-
-/****************************************************************************
- Save a lump of data into a file. Mostly used for debugging.
-****************************************************************************/
-
-bool file_save(const char *fname, void *packet, size_t length)
-{
- int fd;
- fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0644);
- if (fd == -1) {
- return False;
- }
- if (write(fd, packet, length) != (size_t)length) {
- return False;
- }
- close(fd);
- return True;
+ return file_lines_parse(p, size, numlines, NULL);
}
diff --git a/source3/lib/util_pw.c b/source3/lib/util_pw.c
index 428378505f..c0d37f1094 100644
--- a/source3/lib/util_pw.c
+++ b/source3/lib/util_pw.c
@@ -47,7 +47,7 @@ struct passwd *getpwnam_alloc(TALLOC_CTX *mem_ctx, const char *name)
struct passwd *temp, *cached;
temp = (struct passwd *)memcache_lookup_talloc(
- NULL, GETPWNAM_CACHE, data_blob_string_const(name));
+ NULL, GETPWNAM_CACHE, data_blob_string_const_null(name));
if (temp != NULL) {
return tcopy_passwd(mem_ctx, temp);
}
@@ -65,7 +65,7 @@ struct passwd *getpwnam_alloc(TALLOC_CTX *mem_ctx, const char *name)
return temp;
}
- memcache_add_talloc(NULL, GETPWNAM_CACHE, data_blob_string_const(name),
+ memcache_add_talloc(NULL, GETPWNAM_CACHE, data_blob_string_const_null(name),
cached);
return tcopy_passwd(mem_ctx, temp);
}
diff --git a/source3/lib/util_seaccess.c b/source3/lib/util_seaccess.c
index 87e70bb95b..7e461556b3 100644
--- a/source3/lib/util_seaccess.c
+++ b/source3/lib/util_seaccess.c
@@ -30,7 +30,7 @@ extern NT_USER_TOKEN anonymous_token;
static uint32 check_ace(SEC_ACE *ace, const NT_USER_TOKEN *token, uint32 acc_desired,
NTSTATUS *status)
{
- uint32 mask = ace->access_mask;
+ uint32_t mask = ace->access_mask;
/*
* Inherit only is ignored.
@@ -176,6 +176,24 @@ void se_map_generic(uint32 *access_mask, const struct generic_mapping *mapping)
}
}
+/* Map generic access rights to object specific rights for all the ACE's
+ * in a security_acl.
+ */
+
+void security_acl_map_generic(struct security_acl *sa,
+ const struct generic_mapping *mapping)
+{
+ unsigned int i;
+
+ if (!sa) {
+ return;
+ }
+
+ for (i = 0; i < sa->num_aces; i++) {
+ se_map_generic(&sa->aces[i].access_mask, mapping);
+ }
+}
+
/* Map standard access rights to object specific rights. This technique is
used to give meaning to assigning read, write, execute and all access to
objects. Each type of object has its own mapping of standard to object
@@ -328,7 +346,6 @@ NTSTATUS samr_make_sam_obj_sd(TALLOC_CTX *ctx, SEC_DESC **psd, size_t *sd_size)
DOM_SID act_sid;
SEC_ACE ace[3];
- SEC_ACCESS mask;
SEC_ACL *psa = NULL;
@@ -339,13 +356,14 @@ NTSTATUS samr_make_sam_obj_sd(TALLOC_CTX *ctx, SEC_DESC **psd, size_t *sd_size)
sid_append_rid(&act_sid, BUILTIN_ALIAS_RID_ACCOUNT_OPS);
/*basic access for every one*/
- init_sec_access(&mask, GENERIC_RIGHTS_SAM_EXECUTE | GENERIC_RIGHTS_SAM_READ);
- init_sec_ace(&ace[0], &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
+ init_sec_ace(&ace[0], &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED,
+ GENERIC_RIGHTS_SAM_EXECUTE | GENERIC_RIGHTS_SAM_READ, 0);
/*full access for builtin aliases Administrators and Account Operators*/
- init_sec_access(&mask, GENERIC_RIGHTS_SAM_ALL_ACCESS);
- init_sec_ace(&ace[1], &adm_sid, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
- init_sec_ace(&ace[2], &act_sid, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
+ init_sec_ace(&ace[1], &adm_sid,
+ SEC_ACE_TYPE_ACCESS_ALLOWED, GENERIC_RIGHTS_SAM_ALL_ACCESS, 0);
+ init_sec_ace(&ace[2], &act_sid,
+ SEC_ACE_TYPE_ACCESS_ALLOWED, GENERIC_RIGHTS_SAM_ALL_ACCESS, 0);
if ((psa = make_sec_acl(ctx, NT4_ACL_REVISION, 3, ace)) == NULL)
return NT_STATUS_NO_MEMORY;
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index e20768ed89..f3dc3fc1d1 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -1706,7 +1706,7 @@ static bool lookup_nc(struct name_addr_pair *nc)
if (!memcache_lookup(
NULL, SINGLETON_CACHE,
- data_blob_string_const("get_peer_name"),
+ data_blob_string_const_null("get_peer_name"),
&tmp)) {
return false;
}
@@ -1733,7 +1733,7 @@ static void store_nc(const struct name_addr_pair *nc)
memcpy(tmp.data+sizeof(nc->ss), nc->name, namelen+1);
memcache_add(NULL, SINGLETON_CACHE,
- data_blob_string_const("get_peer_name"),
+ data_blob_string_const_null("get_peer_name"),
tmp);
data_blob_free(&tmp);
}
@@ -1945,7 +1945,7 @@ const char *get_mydnsfullname(void)
DATA_BLOB tmp;
if (memcache_lookup(NULL, SINGLETON_CACHE,
- data_blob_string_const("get_mydnsfullname"),
+ data_blob_string_const_null("get_mydnsfullname"),
&tmp)) {
SMB_ASSERT(tmp.length > 0);
return (const char *)tmp.data;
@@ -1989,11 +1989,11 @@ const char *get_mydnsfullname(void)
*/
memcache_add(NULL, SINGLETON_CACHE,
- data_blob_string_const("get_mydnsfullname"),
- data_blob_string_const(res->ai_canonname));
+ data_blob_string_const_null("get_mydnsfullname"),
+ data_blob_string_const_null(res->ai_canonname));
if (!memcache_lookup(NULL, SINGLETON_CACHE,
- data_blob_string_const("get_mydnsfullname"),
+ data_blob_string_const_null("get_mydnsfullname"),
&tmp)) {
tmp = data_blob_talloc(talloc_tos(), res->ai_canonname,
strlen(res->ai_canonname) + 1);
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 9f952abf10..046ce61ea3 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -558,47 +558,6 @@ bool trim_char(char *s,char cfront,char cback)
}
/**
- Trim the specified elements off the front and back of a string.
-**/
-
-bool trim_string(char *s,const char *front,const char *back)
-{
- bool ret = false;
- size_t front_len;
- size_t back_len;
- size_t len;
-
- /* Ignore null or empty strings. */
- if (!s || (s[0] == '\0'))
- return false;
-
- front_len = front? strlen(front) : 0;
- back_len = back? strlen(back) : 0;
-
- len = strlen(s);
-
- if (front_len) {
- while (len && strncmp(s, front, front_len)==0) {
- /* Must use memmove here as src & dest can
- * easily overlap. Found by valgrind. JRA. */
- memmove(s, s+front_len, (len-front_len)+1);
- len -= front_len;
- ret=true;
- }
- }
-
- if (back_len) {
- while ((len >= back_len) &&
- strncmp(s+len-back_len,back,back_len)==0) {
- s[len-back_len]='\0';
- len -= back_len;
- ret=true;
- }
- }
- return ret;
-}
-
-/**
Does a string have any uppercase chars in it?
**/
@@ -649,29 +608,6 @@ bool strhaslower(const char *s)
}
/**
- Find the number of 'c' chars in a string
-**/
-
-size_t count_chars(const char *s,char c)
-{
- smb_ucs2_t *ptr;
- int count;
- smb_ucs2_t *alloc_tmpbuf = NULL;
- size_t converted_size;
-
- if (!push_ucs2_allocate(&alloc_tmpbuf, s, &converted_size)) {
- return 0;
- }
-
- for(count=0,ptr=alloc_tmpbuf;*ptr;ptr++)
- if(*ptr==UCS2_CHAR(c))
- count++;
-
- SAFE_FREE(alloc_tmpbuf);
- return(count);
-}
-
-/**
Safe string copy into a known length string. maxlength does not
include the terminating zero.
**/
@@ -871,88 +807,6 @@ static char *strncpyn(char *dest, const char *src, size_t n, char c)
#endif
/**
- Routine to get hex characters and turn them into a 16 byte array.
- the array can be variable length, and any non-hex-numeric
- characters are skipped. "0xnn" or "0Xnn" is specially catered
- for.
-
- valid examples: "0A5D15"; "0x15, 0x49, 0xa2"; "59\ta9\te3\n"
-
-**/
-
-size_t strhex_to_str(char *buf, size_t buf_len, const char *strhex, size_t strhex_len)
-{
- size_t i;
- size_t num_chars = 0;
- unsigned char lonybble, hinybble;
- const char *hexchars = "0123456789ABCDEF";
- char *p1 = NULL, *p2 = NULL;
-
- for (i = 0; i < strhex_len && strhex[i] != 0; i++) {
- if (strnequal(hexchars, "0x", 2)) {
- i++; /* skip two chars */
- continue;
- }
-
- if (!(p1 = strchr_m(hexchars, toupper_ascii(strhex[i]))))
- break;
-
- i++; /* next hex digit */
-
- if (!(p2 = strchr_m(hexchars, toupper_ascii(strhex[i]))))
- break;
-
- /* get the two nybbles */
- hinybble = PTR_DIFF(p1, hexchars);
- lonybble = PTR_DIFF(p2, hexchars);
-
- if (num_chars >= buf_len) {
- break;
- }
- buf[num_chars] = (hinybble << 4) | lonybble;
- num_chars++;
-
- p1 = NULL;
- p2 = NULL;
- }
- return num_chars;
-}
-
-DATA_BLOB strhex_to_data_blob(TALLOC_CTX *mem_ctx, const char *strhex)
-{
- DATA_BLOB ret_blob;
-
- if (mem_ctx != NULL)
- ret_blob = data_blob_talloc(mem_ctx, NULL, strlen(strhex)/2+1);
- else
- ret_blob = data_blob(NULL, strlen(strhex)/2+1);
-
- ret_blob.length = strhex_to_str((char*)ret_blob.data,
- ret_blob.length,
- strhex,
- strlen(strhex));
-
- return ret_blob;
-}
-
-/**
- * Routine to print a buffer as HEX digits, into an allocated string.
- */
-
-char *hex_encode(TALLOC_CTX *mem_ctx, const unsigned char *buff_in, size_t len)
-{
- int i;
- char *hex_buffer;
-
- hex_buffer = TALLOC_ARRAY(mem_ctx, char, (len*2)+1);
-
- for (i = 0; i < len; i++)
- slprintf(&hex_buffer[i*2], 3, "%02X", buff_in[i]);
-
- return hex_buffer;
-}
-
-/**
Check if a string is part of a list.
**/
@@ -1843,136 +1697,6 @@ int fstr_sprintf(fstring s, const char *fmt, ...)
#define S_LIST_ABS 16 /* List Allocation Block Size */
-char **str_list_make(TALLOC_CTX *mem_ctx, const char *string, const char *sep)
-{
- char **list;
- const char *str;
- char *s;
- int num, lsize;
- char *tok;
-
- if (!string || !*string)
- return NULL;
-
- list = TALLOC_ARRAY(mem_ctx, char *, S_LIST_ABS+1);
- if (list == NULL) {
- return NULL;
- }
- lsize = S_LIST_ABS;
-
- s = talloc_strdup(list, string);
- if (s == NULL) {
- DEBUG(0,("str_list_make: Unable to allocate memory"));
- TALLOC_FREE(list);
- return NULL;
- }
- if (!sep) sep = LIST_SEP;
-
- num = 0;
- str = s;
-
- while (next_token_talloc(list, &str, &tok, sep)) {
-
- if (num == lsize) {
- char **tmp;
-
- lsize += S_LIST_ABS;
-
- tmp = TALLOC_REALLOC_ARRAY(mem_ctx, list, char *,
- lsize + 1);
- if (tmp == NULL) {
- DEBUG(0,("str_list_make: "
- "Unable to allocate memory"));
- TALLOC_FREE(list);
- return NULL;
- }
-
- list = tmp;
-
- memset (&list[num], 0,
- ((sizeof(char**)) * (S_LIST_ABS +1)));
- }
-
- list[num] = tok;
- num += 1;
- }
-
- list[num] = NULL;
-
- TALLOC_FREE(s);
- return list;
-}
-
-bool str_list_copy(TALLOC_CTX *mem_ctx, char ***dest, const char **src)
-{
- char **list;
- int i, num;
-
- *dest = NULL;
- if (!src)
- return false;
-
- num = 0;
- while (src[num] != NULL) {
- num += 1;
- }
-
- list = TALLOC_ARRAY(mem_ctx, char *, num+1);
- if (list == NULL) {
- return false;
- }
-
- for (i=0; i<num; i++) {
- list[i] = talloc_strdup(list, src[i]);
- if (list[i] == NULL) {
- TALLOC_FREE(list);
- return false;
- }
- }
- list[i] = NULL;
- *dest = list;
- return true;
-}
-
-/**
- * Return true if all the elements of the list match exactly.
- **/
-bool str_list_compare(char **list1, char **list2)
-{
- int num;
-
- if (!list1 || !list2)
- return (list1 == list2);
-
- for (num = 0; list1[num]; num++) {
- if (!list2[num])
- return false;
- if (!strcsequal(list1[num], list2[num]))
- return false;
- }
- if (list2[num])
- return false; /* if list2 has more elements than list1 fail */
-
- return true;
-}
-
-/******************************************************************************
- *****************************************************************************/
-
-int str_list_count( const char **list )
-{
- int i = 0;
-
- if ( ! list )
- return 0;
-
- /* count the number of list members */
-
- for ( i=0; *list; i++, list++ );
-
- return i;
-}
-
/******************************************************************************
version of standard_sub_basic() for string lists; uses talloc_sub_basic()
for the work
@@ -2235,41 +1959,6 @@ void ipstr_list_free(char* ipstr_list)
SAFE_FREE(ipstr_list);
}
-/**
- Unescape a URL encoded string, in place.
-**/
-
-void rfc1738_unescape(char *buf)
-{
- char *p=buf;
-
- while (p && *p && (p=strchr_m(p,'%'))) {
- int c1 = p[1];
- int c2 = p[2];
-
- if (c1 >= '0' && c1 <= '9')
- c1 = c1 - '0';
- else if (c1 >= 'A' && c1 <= 'F')
- c1 = 10 + c1 - 'A';
- else if (c1 >= 'a' && c1 <= 'f')
- c1 = 10 + c1 - 'a';
- else {p++; continue;}
-
- if (c2 >= '0' && c2 <= '9')
- c2 = c2 - '0';
- else if (c2 >= 'A' && c2 <= 'F')
- c2 = 10 + c2 - 'A';
- else if (c2 >= 'a' && c2 <= 'f')
- c2 = 10 + c2 - 'a';
- else {p++; continue;}
-
- *p = (c1<<4) | c2;
-
- memmove(p+1, p+3, strlen(p+3)+1);
- p++;
- }
-}
-
static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/**
@@ -2386,10 +2075,10 @@ char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data)
}
/* read a SMB_BIG_UINT from a string */
-SMB_BIG_UINT STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr)
+uint64_t STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr)
{
- SMB_BIG_UINT val = -1;
+ uint64_t val = -1;
const char *p = nptr;
if (!p) {
@@ -2402,11 +2091,7 @@ SMB_BIG_UINT STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr)
while (*p && isspace(*p))
p++;
-#ifdef LARGE_SMB_OFF_T
- sscanf(p,"%llu",&val);
-#else /* LARGE_SMB_OFF_T */
- sscanf(p,"%lu",&val);
-#endif /* LARGE_SMB_OFF_T */
+ sscanf(p,"%"PRIu64,&val);
if (entptr) {
while (*p && isdigit(*p))
p++;
@@ -2684,54 +2369,6 @@ bool validate_net_name( const char *name,
}
-/**
-return the number of bytes occupied by a buffer in ASCII format
-the result includes the null termination
-limited by 'n' bytes
-**/
-size_t ascii_len_n(const char *src, size_t n)
-{
- size_t len;
-
- len = strnlen(src, n);
- if (len+1 <= n) {
- len += 1;
- }
-
- return len;
-}
-
-/**
-return the number of bytes occupied by a buffer in CH_UTF16 format
-the result includes the null termination
-**/
-size_t utf16_len(const void *buf)
-{
- size_t len;
-
- for (len = 0; SVAL(buf,len); len += 2) ;
-
- return len + 2;
-}
-
-/**
-return the number of bytes occupied by a buffer in CH_UTF16 format
-the result includes the null termination
-limited by 'n' bytes
-**/
-size_t utf16_len_n(const void *src, size_t n)
-{
- size_t len;
-
- for (len = 0; (len+2 < n) && SVAL(src, len); len += 2) ;
-
- if (len+2 <= n) {
- len += 2;
- }
-
- return len;
-}
-
/*******************************************************************
Add a shell escape character '\' to any character not in a known list
of characters. UNIX charset format.
diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c
index 8257232667..bb568bc22e 100644
--- a/source3/lib/util_tdb.c
+++ b/source3/lib/util_tdb.c
@@ -39,28 +39,6 @@ static void gotalarm_sig(void)
gotalarm = 1;
}
-/***************************************************************
- Make a TDB_DATA and keep the const warning in one place
-****************************************************************/
-
-TDB_DATA make_tdb_data(const uint8 *dptr, size_t dsize)
-{
- TDB_DATA ret;
- ret.dptr = CONST_DISCARD(uint8 *, dptr);
- ret.dsize = dsize;
- return ret;
-}
-
-TDB_DATA string_tdb_data(const char *string)
-{
- return make_tdb_data((const uint8 *)string, string ? strlen(string) : 0 );
-}
-
-TDB_DATA string_term_tdb_data(const char *string)
-{
- return make_tdb_data((const uint8 *)string, string ? strlen(string) + 1 : 0);
-}
-
/****************************************************************************
Lock a chain with timeout (in seconds).
****************************************************************************/
@@ -109,17 +87,6 @@ int tdb_chainlock_with_timeout( TDB_CONTEXT *tdb, TDB_DATA key, unsigned int tim
return tdb_chainlock_with_timeout_internal(tdb, key, timeout, F_WRLCK);
}
-/****************************************************************************
- Lock a chain by string. Return -1 if timeout or lock failed.
-****************************************************************************/
-
-int tdb_lock_bystring(TDB_CONTEXT *tdb, const char *keyval)
-{
- TDB_DATA key = string_term_tdb_data(keyval);
-
- return tdb_chainlock(tdb, key);
-}
-
int tdb_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval,
int timeout)
{
@@ -129,17 +96,6 @@ int tdb_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval,
}
/****************************************************************************
- Unlock a chain by string.
-****************************************************************************/
-
-void tdb_unlock_bystring(TDB_CONTEXT *tdb, const char *keyval)
-{
- TDB_DATA key = string_term_tdb_data(keyval);
-
- tdb_chainunlock(tdb, key);
-}
-
-/****************************************************************************
Read lock a chain by string. Return -1 if timeout or lock failed.
****************************************************************************/
@@ -150,155 +106,8 @@ int tdb_read_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval, un
return tdb_chainlock_with_timeout_internal(tdb, key, timeout, F_RDLCK);
}
-/****************************************************************************
- Read unlock a chain by string.
-****************************************************************************/
-
-void tdb_read_unlock_bystring(TDB_CONTEXT *tdb, const char *keyval)
-{
- TDB_DATA key = string_term_tdb_data(keyval);
-
- tdb_chainunlock_read(tdb, key);
-}
-
-
-/****************************************************************************
- Fetch a int32 value by a arbitrary blob key, return -1 if not found.
- Output is int32 in native byte order.
-****************************************************************************/
-
-int32 tdb_fetch_int32_byblob(TDB_CONTEXT *tdb, TDB_DATA key)
-{
- TDB_DATA data;
- int32 ret;
-
- data = tdb_fetch(tdb, key);
- if (!data.dptr || data.dsize != sizeof(int32)) {
- SAFE_FREE(data.dptr);
- return -1;
- }
-
- ret = IVAL(data.dptr,0);
- SAFE_FREE(data.dptr);
- return ret;
-}
-
-/****************************************************************************
- Fetch a int32 value by string key, return -1 if not found.
- Output is int32 in native byte order.
-****************************************************************************/
-
-int32 tdb_fetch_int32(TDB_CONTEXT *tdb, const char *keystr)
-{
- TDB_DATA key = string_term_tdb_data(keystr);
-
- return tdb_fetch_int32_byblob(tdb, key);
-}
-
-/****************************************************************************
- Store a int32 value by an arbitary blob key, return 0 on success, -1 on failure.
- Input is int32 in native byte order. Output in tdb is in little-endian.
-****************************************************************************/
-
-int tdb_store_int32_byblob(TDB_CONTEXT *tdb, TDB_DATA key, int32 v)
-{
- TDB_DATA data;
- int32 v_store;
-
- SIVAL(&v_store,0,v);
- data.dptr = (uint8 *)&v_store;
- data.dsize = sizeof(int32);
-
- return tdb_store(tdb, key, data, TDB_REPLACE);
-}
-
-/****************************************************************************
- Store a int32 value by string key, return 0 on success, -1 on failure.
- Input is int32 in native byte order. Output in tdb is in little-endian.
-****************************************************************************/
-
-int tdb_store_int32(TDB_CONTEXT *tdb, const char *keystr, int32 v)
-{
- TDB_DATA key = string_term_tdb_data(keystr);
-
- return tdb_store_int32_byblob(tdb, key, v);
-}
-
-/****************************************************************************
- Fetch a uint32 value by a arbitrary blob key, return -1 if not found.
- Output is uint32 in native byte order.
-****************************************************************************/
-
-bool tdb_fetch_uint32_byblob(TDB_CONTEXT *tdb, TDB_DATA key, uint32 *value)
-{
- TDB_DATA data;
-
- data = tdb_fetch(tdb, key);
- if (!data.dptr || data.dsize != sizeof(uint32)) {
- SAFE_FREE(data.dptr);
- return False;
- }
-
- *value = IVAL(data.dptr,0);
- SAFE_FREE(data.dptr);
- return True;
-}
-
-/****************************************************************************
- Fetch a uint32 value by string key, return -1 if not found.
- Output is uint32 in native byte order.
-****************************************************************************/
-
-bool tdb_fetch_uint32(TDB_CONTEXT *tdb, const char *keystr, uint32 *value)
-{
- TDB_DATA key = string_term_tdb_data(keystr);
-
- return tdb_fetch_uint32_byblob(tdb, key, value);
-}
-
-/****************************************************************************
- Store a uint32 value by an arbitary blob key, return 0 on success, -1 on failure.
- Input is uint32 in native byte order. Output in tdb is in little-endian.
-****************************************************************************/
-
-bool tdb_store_uint32_byblob(TDB_CONTEXT *tdb, TDB_DATA key, uint32 value)
-{
- TDB_DATA data;
- uint32 v_store;
- bool ret = True;
-
- SIVAL(&v_store, 0, value);
- data.dptr = (uint8 *)&v_store;
- data.dsize = sizeof(uint32);
- if (tdb_store(tdb, key, data, TDB_REPLACE) == -1)
- ret = False;
- return ret;
-}
-
-/****************************************************************************
- Store a uint32 value by string key, return 0 on success, -1 on failure.
- Input is uint32 in native byte order. Output in tdb is in little-endian.
-****************************************************************************/
-
-bool tdb_store_uint32(TDB_CONTEXT *tdb, const char *keystr, uint32 value)
-{
- TDB_DATA key = string_term_tdb_data(keystr);
-
- return tdb_store_uint32_byblob(tdb, key, value);
-}
-/****************************************************************************
- Store a buffer by a null terminated string key. Return 0 on success, -1
- on failure.
-****************************************************************************/
-
-int tdb_store_bystring(TDB_CONTEXT *tdb, const char *keystr, TDB_DATA data, int flags)
-{
- TDB_DATA key = string_term_tdb_data(keystr);
-
- return tdb_store(tdb, key, data, flags);
-}
int tdb_trans_store_bystring(TDB_CONTEXT *tdb, const char *keystr,
TDB_DATA data, int flags)
@@ -309,112 +118,6 @@ int tdb_trans_store_bystring(TDB_CONTEXT *tdb, const char *keystr,
}
/****************************************************************************
- Fetch a buffer using a null terminated string key. Don't forget to call
- free() on the result dptr.
-****************************************************************************/
-
-TDB_DATA tdb_fetch_bystring(TDB_CONTEXT *tdb, const char *keystr)
-{
- TDB_DATA key = string_term_tdb_data(keystr);
-
- return tdb_fetch(tdb, key);
-}
-
-/****************************************************************************
- Delete an entry using a null terminated string key.
-****************************************************************************/
-
-int tdb_delete_bystring(TDB_CONTEXT *tdb, const char *keystr)
-{
- TDB_DATA key = string_term_tdb_data(keystr);
-
- return tdb_delete(tdb, key);
-}
-
-/****************************************************************************
- Atomic integer change. Returns old value. To create, set initial value in *oldval.
-****************************************************************************/
-
-int32 tdb_change_int32_atomic(TDB_CONTEXT *tdb, const char *keystr, int32 *oldval, int32 change_val)
-{
- int32 val;
- int32 ret = -1;
-
- if (tdb_lock_bystring(tdb, keystr) == -1)
- return -1;
-
- if ((val = tdb_fetch_int32(tdb, keystr)) == -1) {
- /* The lookup failed */
- if (tdb_error(tdb) != TDB_ERR_NOEXIST) {
- /* but not because it didn't exist */
- goto err_out;
- }
-
- /* Start with 'old' value */
- val = *oldval;
-
- } else {
- /* It worked, set return value (oldval) to tdb data */
- *oldval = val;
- }
-
- /* Increment value for storage and return next time */
- val += change_val;
-
- if (tdb_store_int32(tdb, keystr, val) == -1)
- goto err_out;
-
- ret = 0;
-
- err_out:
-
- tdb_unlock_bystring(tdb, keystr);
- return ret;
-}
-
-/****************************************************************************
- Atomic unsigned integer change. Returns old value. To create, set initial value in *oldval.
-****************************************************************************/
-
-bool tdb_change_uint32_atomic(TDB_CONTEXT *tdb, const char *keystr, uint32 *oldval, uint32 change_val)
-{
- uint32 val;
- bool ret = False;
-
- if (tdb_lock_bystring(tdb, keystr) == -1)
- return False;
-
- if (!tdb_fetch_uint32(tdb, keystr, &val)) {
- /* It failed */
- if (tdb_error(tdb) != TDB_ERR_NOEXIST) {
- /* and not because it didn't exist */
- goto err_out;
- }
-
- /* Start with 'old' value */
- val = *oldval;
-
- } else {
- /* it worked, set return value (oldval) to tdb data */
- *oldval = val;
-
- }
-
- /* get a new value to store */
- val += change_val;
-
- if (!tdb_store_uint32(tdb, keystr, val))
- goto err_out;
-
- ret = True;
-
- err_out:
-
- tdb_unlock_bystring(tdb, keystr);
- return ret;
-}
-
-/****************************************************************************
Useful pair of routines for packing/unpacking data consisting of
integers and strings.
****************************************************************************/
diff --git a/source3/lib/util_uuid.c b/source3/lib/util_uuid.c
index 3a8f7b3f4f..c681b66d34 100644
--- a/source3/lib/util_uuid.c
+++ b/source3/lib/util_uuid.c
@@ -20,12 +20,6 @@
#include "includes.h"
-/*
- * Offset between 15-Oct-1582 and 1-Jan-70
- */
-#define TIME_OFFSET_HIGH 0x01B21DD2
-#define TIME_OFFSET_LOW 0x13814000
-
void smb_uuid_pack(const struct GUID uu, UUID_FLAT *ptr)
{
SIVAL(ptr->info, 0, uu.time_low);
@@ -44,78 +38,6 @@ void smb_uuid_unpack(const UUID_FLAT in, struct GUID *uu)
memcpy(uu->node, in.info+10, 6);
}
-void smb_uuid_generate_random(struct GUID *uu)
-{
- UUID_FLAT tmp;
-
- generate_random_buffer(tmp.info, sizeof(tmp.info));
- smb_uuid_unpack(tmp, uu);
-
- uu->clock_seq[0] = (uu->clock_seq[0] & 0x3F) | 0x80;
- uu->time_hi_and_version = (uu->time_hi_and_version & 0x0FFF) | 0x4000;
-}
-
-const char *smb_uuid_string(TALLOC_CTX *mem_ctx, const struct GUID uu)
-{
- char *result;
-
- result = talloc_asprintf(
- mem_ctx,
- "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
- uu.time_low, uu.time_mid, uu.time_hi_and_version,
- uu.clock_seq[0], uu.clock_seq[1],
- uu.node[0], uu.node[1], uu.node[2],
- uu.node[3], uu.node[4], uu.node[5]);
-
- SMB_ASSERT(result != NULL);
- return result;
-}
-
-bool smb_string_to_uuid(const char *in, struct GUID* uu)
-{
- bool ret = False;
- const char *ptr = in;
- char *end = (char *)in;
- int i;
- unsigned v1, v2;
-
- if (!in || !uu) goto out;
-
- uu->time_low = strtoul(ptr, &end, 16);
- if ((end - ptr) != 8 || *end != '-') goto out;
- ptr = (end + 1);
-
- uu->time_mid = strtoul(ptr, &end, 16);
- if ((end - ptr) != 4 || *end != '-') goto out;
- ptr = (end + 1);
-
- uu->time_hi_and_version = strtoul(ptr, &end, 16);
- if ((end - ptr) != 4 || *end != '-') goto out;
- ptr = (end + 1);
-
- if (sscanf(ptr, "%02x%02x", &v1, &v2) != 2) {
- goto out;
- }
- uu->clock_seq[0] = v1;
- uu->clock_seq[1] = v2;
- ptr += 4;
-
- if (*ptr != '-') goto out;
- ptr++;
-
- for (i = 0; i < 6; i++) {
- if (sscanf(ptr, "%02x", &v1) != 1) {
- goto out;
- }
- uu->node[i] = v1;
- ptr += 2;
- }
-
- ret = True;
-out:
- return ret;
-}
-
/*****************************************************************
Return the binary string representation of a GUID.
Caller must free.
diff --git a/source3/lib/xfile.c b/source3/lib/xfile.c
deleted file mode 100644
index e44a92d34d..0000000000
--- a/source3/lib/xfile.c
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- stdio replacement
- Copyright (C) Andrew Tridgell 2001
-
- 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/>.
-*/
-
-/*
- stdio is very convenient, but on some systems the file descriptor
- in FILE* is 8 bits, so it fails when more than 255 files are open.
-
- XFILE replaces stdio. It is less efficient, but at least it works
- when you have lots of files open
-
- The main restriction on XFILE is that it doesn't support seeking,
- and doesn't support O_RDWR. That keeps the code simple.
-*/
-
-#include "includes.h"
-
-#define XBUFSIZE BUFSIZ
-
-static XFILE _x_stdin = { 0, NULL, NULL, XBUFSIZE, 0, O_RDONLY, X_IOFBF, 0 };
-static XFILE _x_stdout = { 1, NULL, NULL, XBUFSIZE, 0, O_WRONLY, X_IOLBF, 0 };
-static XFILE _x_stderr = { 2, NULL, NULL, 0, 0, O_WRONLY, X_IONBF, 0 };
-
-XFILE *x_stdin = &_x_stdin;
-XFILE *x_stdout = &_x_stdout;
-XFILE *x_stderr = &_x_stderr;
-
-#define X_FLAG_EOF 1
-#define X_FLAG_ERROR 2
-#define X_FLAG_EINVAL 3
-
-/* simulate setvbuf() */
-int x_setvbuf(XFILE *f, char *buf, int mode, size_t size)
-{
- if (x_fflush(f) != 0) return -1;
- if (f->bufused) return -1;
-
- /* on files being read full buffering is the only option */
- if ((f->open_flags & O_ACCMODE) == O_RDONLY) {
- mode = X_IOFBF;
- }
-
- /* destroy any earlier buffer */
- SAFE_FREE(f->buf);
- f->buf = 0;
- f->bufsize = 0;
- f->next = NULL;
- f->bufused = 0;
- f->buftype = mode;
-
- if (f->buftype == X_IONBF) return 0;
-
- /* if buffering then we need some size */
- if (size == 0) size = XBUFSIZE;
-
- f->bufsize = size;
- f->bufused = 0;
-
- return 0;
-}
-
-/* allocate the buffer */
-static int x_allocate_buffer(XFILE *f)
-{
- if (f->buf) return 1;
- if (f->bufsize == 0) return 0;
- f->buf = (char *)SMB_MALLOC(f->bufsize);
- if (!f->buf) return 0;
- f->next = f->buf;
- return 1;
-}
-
-
-/* this looks more like open() than fopen(), but that is quite deliberate.
- I want programmers to *think* about O_EXCL, O_CREAT etc not just
- get them magically added
-*/
-XFILE *x_fopen(const char *fname, int flags, mode_t mode)
-{
- XFILE *ret;
-
- ret = SMB_MALLOC_P(XFILE);
- if (!ret) {
- return NULL;
- }
-
- memset(ret, 0, sizeof(XFILE));
-
- if ((flags & O_ACCMODE) == O_RDWR) {
- /* we don't support RDWR in XFILE - use file
- descriptors instead */
- SAFE_FREE(ret);
- errno = EINVAL;
- return NULL;
- }
-
- ret->open_flags = flags;
-
- ret->fd = sys_open(fname, flags, mode);
- if (ret->fd == -1) {
- SAFE_FREE(ret);
- return NULL;
- }
-
- x_setvbuf(ret, NULL, X_IOFBF, XBUFSIZE);
-
- return ret;
-}
-
-XFILE *x_fdup(const XFILE *f)
-{
- XFILE *ret;
- int fd;
-
- fd = dup(x_fileno(f));
- if (fd < 0) {
- return NULL;
- }
-
- ret = SMB_CALLOC_ARRAY(XFILE, 1);
- if (!ret) {
- close(fd);
- return NULL;
- }
-
- ret->fd = fd;
- ret->open_flags = f->open_flags;
- x_setvbuf(ret, NULL, X_IOFBF, XBUFSIZE);
- return ret;
-}
-
-/* simulate fclose() */
-int x_fclose(XFILE *f)
-{
- int ret;
-
- /* make sure we flush any buffered data */
- (void)x_fflush(f);
-
- ret = close(f->fd);
- f->fd = -1;
- if (f->buf) {
- /* make sure data can't leak into a later malloc */
- memset(f->buf, 0, f->bufsize);
- SAFE_FREE(f->buf);
- }
- /* check the file descriptor given to the function is NOT one of the static
- * descriptor of this libreary or we will free unallocated memory
- * --sss */
- if (f != x_stdin && f != x_stdout && f != x_stderr) {
- SAFE_FREE(f);
- }
- return ret;
-}
-
-/* simulate fwrite() */
-size_t x_fwrite(const void *p, size_t size, size_t nmemb, XFILE *f)
-{
- ssize_t ret;
- size_t total=0;
-
- /* we might be writing unbuffered */
- if (f->buftype == X_IONBF ||
- (!f->buf && !x_allocate_buffer(f))) {
- ret = write(f->fd, p, size*nmemb);
- if (ret == -1) return -1;
- return ret/size;
- }
-
-
- while (total < size*nmemb) {
- size_t n = f->bufsize - f->bufused;
- n = MIN(n, (size*nmemb)-total);
-
- if (n == 0) {
- /* it's full, flush it */
- if (x_fflush(f) != 0) {
- return -1;
- }
- continue;
- }
-
- memcpy(f->buf + f->bufused, total+(const char *)p, n);
- f->bufused += n;
- total += n;
- }
-
- /* when line buffered we need to flush at the last linefeed. This can
- flush a bit more than necessary, but that is harmless */
- if (f->buftype == X_IOLBF && f->bufused) {
- int i;
- for (i=(size*nmemb)-1; i>=0; i--) {
- if (*(i+(const char *)p) == '\n') {
- if (x_fflush(f) != 0) {
- return -1;
- }
- break;
- }
- }
- }
-
- return total/size;
-}
-
-/* thank goodness for asprintf() */
- int x_vfprintf(XFILE *f, const char *format, va_list ap)
-{
- char *p;
- int len, ret;
- va_list ap2;
-
- VA_COPY(ap2, ap);
-
- len = vasprintf(&p, format, ap2);
- if (len <= 0) {
- va_end(ap2);
- return len;
- }
- ret = x_fwrite(p, 1, len, f);
- SAFE_FREE(p);
-
- va_end(ap2);
-
- return ret;
-}
-
- int x_fprintf(XFILE *f, const char *format, ...)
-{
- va_list ap;
- int ret;
-
- va_start(ap, format);
- ret = x_vfprintf(f, format, ap);
- va_end(ap);
- return ret;
-}
-
-/* at least fileno() is simple! */
-int x_fileno(const XFILE *f)
-{
- return f->fd;
-}
-
-/* simulate fflush() */
-int x_fflush(XFILE *f)
-{
- int ret;
-
- if (f->flags & X_FLAG_ERROR) return -1;
-
- if (f->bufused == 0 || !f->buf) return 0;
-
- if ((f->open_flags & O_ACCMODE) != O_WRONLY) {
- errno = EINVAL;
- return -1;
- }
-
- ret = write(f->fd, f->buf, f->bufused);
- if (ret == -1) return -1;
-
- f->bufused -= ret;
- if (f->bufused > 0) {
- f->flags |= X_FLAG_ERROR;
- memmove(f->buf, ret + (char *)f->buf, f->bufused);
- return -1;
- }
-
- return 0;
-}
-
-/* simulate setbuffer() */
-void x_setbuffer(XFILE *f, char *buf, size_t size)
-{
- x_setvbuf(f, buf, buf?X_IOFBF:X_IONBF, size);
-}
-
-/* simulate setbuf() */
-void x_setbuf(XFILE *f, char *buf)
-{
- x_setvbuf(f, buf, buf?X_IOFBF:X_IONBF, XBUFSIZE);
-}
-
-/* simulate setlinebuf() */
-void x_setlinebuf(XFILE *f)
-{
- x_setvbuf(f, NULL, X_IOLBF, 0);
-}
-
-
-/* simulate feof() */
-int x_feof(XFILE *f)
-{
- if (f->flags & X_FLAG_EOF) return 1;
- return 0;
-}
-
-/* simulate ferror() */
-int x_ferror(XFILE *f)
-{
- if (f->flags & X_FLAG_ERROR) return 1;
- return 0;
-}
-
-/* fill the read buffer */
-static void x_fillbuf(XFILE *f)
-{
- int n;
-
- if (f->bufused) return;
-
- if (!f->buf && !x_allocate_buffer(f)) return;
-
- n = read(f->fd, f->buf, f->bufsize);
- if (n <= 0) return;
- f->bufused = n;
- f->next = f->buf;
-}
-
-/* simulate fgetc() */
-int x_fgetc(XFILE *f)
-{
- int ret;
-
- if (f->flags & (X_FLAG_EOF | X_FLAG_ERROR)) return EOF;
-
- if (f->bufused == 0) x_fillbuf(f);
-
- if (f->bufused == 0) {
- f->flags |= X_FLAG_EOF;
- return EOF;
- }
-
- ret = *(unsigned char *)(f->next);
- f->next++;
- f->bufused--;
- return ret;
-}
-
-/* simulate fread */
-size_t x_fread(void *p, size_t size, size_t nmemb, XFILE *f)
-{
- size_t total = 0;
- while (total < size*nmemb) {
- int c = x_fgetc(f);
- if (c == EOF) break;
- (total+(char *)p)[0] = (char)c;
- total++;
- }
- return total/size;
-}
-
-/* simulate fgets() */
-char *x_fgets(char *s, int size, XFILE *stream)
-{
- char *s0 = s;
- int l = size;
- while (l>1) {
- int c = x_fgetc(stream);
- if (c == EOF) break;
- *s++ = (char)c;
- l--;
- if (c == '\n') break;
- }
- if (l==size || x_ferror(stream)) {
- return 0;
- }
- *s = 0;
- return s0;
-}
-
-/* trivial seek, works only for SEEK_SET and SEEK_END if SEEK_CUR is
- * set then an error is returned */
-off_t x_tseek(XFILE *f, off_t offset, int whence)
-{
- if (f->flags & X_FLAG_ERROR)
- return -1;
-
- /* only SEEK_SET and SEEK_END are supported */
- /* SEEK_CUR needs internal offset counter */
- if (whence != SEEK_SET && whence != SEEK_END) {
- f->flags |= X_FLAG_EINVAL;
- errno = EINVAL;
- return -1;
- }
-
- /* empty the buffer */
- switch (f->open_flags & O_ACCMODE) {
- case O_RDONLY:
- f->bufused = 0;
- break;
- case O_WRONLY:
- if (x_fflush(f) != 0)
- return -1;
- break;
- default:
- errno = EINVAL;
- return -1;
- }
-
- f->flags &= ~X_FLAG_EOF;
- return (off_t)sys_lseek(f->fd, offset, whence);
-}
diff --git a/source3/libaddns/dns.h b/source3/libaddns/dns.h
index 2eaeaf7608..3f95c739d5 100644
--- a/source3/libaddns/dns.h
+++ b/source3/libaddns/dns.h
@@ -25,7 +25,7 @@
#ifndef _DNS_H
#define _DNS_H
-#include "lib/replace/replace.h"
+#include "../replace/replace.h"
#include "system/network.h"
/* make sure we have included the correct config.h */
diff --git a/source3/libaddns/dnsmarshall.c b/source3/libaddns/dnsmarshall.c
index 8c3389eb9b..5530290c57 100644
--- a/source3/libaddns/dnsmarshall.c
+++ b/source3/libaddns/dnsmarshall.c
@@ -252,6 +252,7 @@ void dns_unmarshall_domain_name(TALLOC_CTX *mem_ctx,
if (!(name = talloc(mem_ctx, struct dns_domain_name))) {
buf->error = ERROR_DNS_NO_MEMORY;
+ return;
}
dns_unmarshall_label(name, 0, buf, &name->pLabelList);
diff --git a/source3/libaddns/dnsrecord.c b/source3/libaddns/dnsrecord.c
index 500cbd6681..559c2644d4 100644
--- a/source3/libaddns/dnsrecord.c
+++ b/source3/libaddns/dnsrecord.c
@@ -378,10 +378,10 @@ DNS_ERROR dns_create_update_request(TALLOC_CTX *mem_ctx,
if (!ERR_DNS_IS_OK(err)) return err;
/*
- * The zone must be used at all
+ * Use the same prereq as WinXP -- No CNAME records for this host.
*/
- err = dns_create_rrec(req, domainname, QTYPE_ANY, DNS_CLASS_ANY,
+ err = dns_create_rrec(req, hostname, QTYPE_CNAME, DNS_CLASS_NONE,
0, 0, NULL, &rec);
if (!ERR_DNS_IS_OK(err)) goto error;
diff --git a/source3/libads/authdata.c b/source3/libads/authdata.c
index 0bde3e6984..9f0f68ed7b 100644
--- a/source3/libads/authdata.c
+++ b/source3/libads/authdata.c
@@ -23,6 +23,7 @@
*/
#include "includes.h"
+#include "librpc/gen_ndr/ndr_krb5pac.h"
#ifdef HAVE_KRB5
@@ -108,7 +109,7 @@ static krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx,
}
ndr_err = ndr_pull_struct_blob(pac_data_blob, pac_data,
- pac_data,
+ NULL, pac_data,
(ndr_pull_flags_fn_t)ndr_pull_PAC_DATA);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = ndr_map_error2ntstatus(ndr_err);
@@ -124,7 +125,7 @@ static krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx,
}
ndr_err = ndr_pull_struct_blob(pac_data_blob, pac_data_raw,
- pac_data_raw,
+ NULL, pac_data_raw,
(ndr_pull_flags_fn_t)ndr_pull_PAC_DATA_RAW);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = ndr_map_error2ntstatus(ndr_err);
@@ -205,7 +206,7 @@ static krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx,
/* We find the data blobs above, now we parse them to get at the exact portion we should zero */
ndr_err = ndr_pull_struct_blob(kdc_sig_blob, kdc_sig_wipe,
- kdc_sig_wipe,
+ NULL, kdc_sig_wipe,
(ndr_pull_flags_fn_t)ndr_pull_PAC_SIGNATURE_DATA);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = ndr_map_error2ntstatus(ndr_err);
@@ -215,7 +216,7 @@ static krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx,
}
ndr_err = ndr_pull_struct_blob(srv_sig_blob, srv_sig_wipe,
- srv_sig_wipe,
+ NULL, srv_sig_wipe,
(ndr_pull_flags_fn_t)ndr_pull_PAC_SIGNATURE_DATA);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = ndr_map_error2ntstatus(ndr_err);
@@ -230,7 +231,7 @@ static krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx,
/* and reencode, back into the same place it came from */
ndr_err = ndr_push_struct_blob(kdc_sig_blob, pac_data_raw,
- kdc_sig_wipe,
+ NULL, kdc_sig_wipe,
(ndr_push_flags_fn_t)ndr_push_PAC_SIGNATURE_DATA);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = ndr_map_error2ntstatus(ndr_err);
@@ -239,7 +240,7 @@ static krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx,
return status;
}
ndr_err = ndr_push_struct_blob(srv_sig_blob, pac_data_raw,
- srv_sig_wipe,
+ NULL, srv_sig_wipe,
(ndr_push_flags_fn_t)ndr_push_PAC_SIGNATURE_DATA);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = ndr_map_error2ntstatus(ndr_err);
@@ -250,7 +251,7 @@ static krb5_error_code check_pac_checksum(TALLOC_CTX *mem_ctx,
/* push out the whole structure, but now with zero'ed signatures */
ndr_err = ndr_push_struct_blob(&modified_pac_blob, pac_data_raw,
- pac_data_raw,
+ NULL, pac_data_raw,
(ndr_push_flags_fn_t)ndr_push_PAC_DATA_RAW);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = ndr_map_error2ntstatus(ndr_err);
@@ -403,12 +404,12 @@ NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
DEBUG(10,("got TGT for %s in %s\n", auth_princ, cc));
if (expire_time) {
DEBUGADD(10,("\tvalid until: %s (%d)\n",
- http_timestring(*expire_time),
+ http_timestring(talloc_tos(), *expire_time),
(int)*expire_time));
}
if (renew_till_time) {
DEBUGADD(10,("\trenewable till: %s (%d)\n",
- http_timestring(*renew_till_time),
+ http_timestring(talloc_tos(), *renew_till_time),
(int)*renew_till_time));
}
diff --git a/source3/libads/cldap.c b/source3/libads/cldap.c
index 11565065af..c37220c903 100644
--- a/source3/libads/cldap.c
+++ b/source3/libads/cldap.c
@@ -119,8 +119,8 @@ static void gotalarm_sig(void)
*/
static int recv_cldap_netlogon(TALLOC_CTX *mem_ctx,
int sock,
- uint32_t *nt_version,
- union nbt_cldap_netlogon **reply)
+ uint32_t nt_version,
+ struct netlogon_samlogon_response **reply)
{
int ret;
ASN1_DATA data;
@@ -131,7 +131,8 @@ static int recv_cldap_netlogon(TALLOC_CTX *mem_ctx,
int i1;
/* half the time of a regular ldap timeout, not less than 3 seconds. */
unsigned int al_secs = MAX(3,lp_ldap_timeout()/2);
- union nbt_cldap_netlogon *r = NULL;
+ struct netlogon_samlogon_response *r = NULL;
+ NTSTATUS status;
blob = data_blob(NULL, 8192);
if (blob.data == NULL) {
@@ -185,7 +186,7 @@ static int recv_cldap_netlogon(TALLOC_CTX *mem_ctx,
return -1;
}
- r = TALLOC_ZERO_P(mem_ctx, union nbt_cldap_netlogon);
+ r = TALLOC_ZERO_P(mem_ctx, struct netlogon_samlogon_response);
if (!r) {
errno = ENOMEM;
data_blob_free(&os1);
@@ -195,7 +196,8 @@ static int recv_cldap_netlogon(TALLOC_CTX *mem_ctx,
return -1;
}
- if (!pull_mailslot_cldap_reply(mem_ctx, &os3, r, nt_version)) {
+ status = pull_netlogon_samlogon_response(&os3, mem_ctx, NULL, r);
+ if (!NT_STATUS_IS_OK(status)) {
data_blob_free(&os1);
data_blob_free(&os2);
data_blob_free(&os3);
@@ -204,6 +206,8 @@ static int recv_cldap_netlogon(TALLOC_CTX *mem_ctx,
return -1;
}
+ map_netlogon_samlogon_response(r);
+
data_blob_free(&os1);
data_blob_free(&os2);
data_blob_free(&os3);
@@ -227,8 +231,8 @@ static int recv_cldap_netlogon(TALLOC_CTX *mem_ctx,
bool ads_cldap_netlogon(TALLOC_CTX *mem_ctx,
const char *server,
const char *realm,
- uint32_t *nt_version,
- union nbt_cldap_netlogon **reply)
+ uint32_t nt_version,
+ struct netlogon_samlogon_response **reply)
{
int sock;
int ret;
@@ -240,7 +244,7 @@ bool ads_cldap_netlogon(TALLOC_CTX *mem_ctx,
return False;
}
- ret = send_cldap_netlogon(sock, realm, global_myname(), *nt_version);
+ ret = send_cldap_netlogon(sock, realm, global_myname(), nt_version);
if (ret != 0) {
close(sock);
return False;
@@ -262,107 +266,24 @@ bool ads_cldap_netlogon(TALLOC_CTX *mem_ctx,
bool ads_cldap_netlogon_5(TALLOC_CTX *mem_ctx,
const char *server,
const char *realm,
- struct nbt_cldap_netlogon_5 *reply5)
+ struct NETLOGON_SAM_LOGON_RESPONSE_EX *reply5)
{
- uint32_t nt_version = NETLOGON_VERSION_5 | NETLOGON_VERSION_5EX;
- union nbt_cldap_netlogon *reply = NULL;
+ uint32_t nt_version = NETLOGON_NT_VERSION_5 | NETLOGON_NT_VERSION_5EX;
+ struct netlogon_samlogon_response *reply = NULL;
bool ret;
- ret = ads_cldap_netlogon(mem_ctx, server, realm, &nt_version, &reply);
+ ret = ads_cldap_netlogon(mem_ctx, server, realm, nt_version, &reply);
if (!ret) {
return false;
}
- if (nt_version != (NETLOGON_VERSION_5 | NETLOGON_VERSION_5EX)) {
+ if (reply->ntver != NETLOGON_NT_VERSION_5EX) {
+ DEBUG(0,("ads_cldap_netlogon_5: nt_version mismatch: 0x%08x\n",
+ reply->ntver));
return false;
}
- *reply5 = reply->logon5;
-
- return true;
-}
-
-/****************************************************************
-****************************************************************/
-
-bool pull_mailslot_cldap_reply(TALLOC_CTX *mem_ctx,
- const DATA_BLOB *blob,
- union nbt_cldap_netlogon *r,
- uint32_t *nt_version)
-{
- enum ndr_err_code ndr_err;
- uint32_t nt_version_query = ((*nt_version) & 0x0000001f);
- uint16_t command = 0;
-
- ndr_err = ndr_pull_struct_blob(blob, mem_ctx, &command,
- (ndr_pull_flags_fn_t)ndr_pull_uint16);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- return false;
- }
-
- switch (command) {
- case 0x13: /* 19 */
- case 0x15: /* 21 */
- case 0x17: /* 23 */
- case 0x19: /* 25 */
- break;
- default:
- DEBUG(1,("got unexpected command: %d (0x%08x)\n",
- command, command));
- return false;
- }
-
- ndr_err = ndr_pull_union_blob_all(blob, mem_ctx, r, nt_version_query,
- (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon);
- if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- goto done;
- }
-
- /* when the caller requested just those nt_version bits that the server
- * was able to reply to, we are fine and all done. otherwise we need to
- * assume downgraded replies which are painfully parsed here - gd */
-
- if (nt_version_query & NETLOGON_VERSION_WITH_CLOSEST_SITE) {
- nt_version_query &= ~NETLOGON_VERSION_WITH_CLOSEST_SITE;
- }
- ndr_err = ndr_pull_union_blob_all(blob, mem_ctx, r, nt_version_query,
- (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon);
- if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- goto done;
- }
- if (nt_version_query & NETLOGON_VERSION_5EX_WITH_IP) {
- nt_version_query &= ~NETLOGON_VERSION_5EX_WITH_IP;
- }
- ndr_err = ndr_pull_union_blob_all(blob, mem_ctx, r, nt_version_query,
- (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon);
- if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- goto done;
- }
- if (nt_version_query & NETLOGON_VERSION_5EX) {
- nt_version_query &= ~NETLOGON_VERSION_5EX;
- }
- ndr_err = ndr_pull_union_blob_all(blob, mem_ctx, r, nt_version_query,
- (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon);
- if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- goto done;
- }
- if (nt_version_query & NETLOGON_VERSION_5) {
- nt_version_query &= ~NETLOGON_VERSION_5;
- }
- ndr_err = ndr_pull_union_blob_all(blob, mem_ctx, r, nt_version_query,
- (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon);
- if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- goto done;
- }
-
- return false;
-
- done:
- if (DEBUGLEVEL >= 10) {
- NDR_PRINT_UNION_DEBUG(nbt_cldap_netlogon, nt_version_query, r);
- }
-
- *nt_version = nt_version_query;
+ *reply5 = reply->data.nt5_ex;
return true;
}
diff --git a/source3/libads/disp_sec.c b/source3/libads/disp_sec.c
index f4c68638df..a5e04a4a6c 100644
--- a/source3/libads/disp_sec.c
+++ b/source3/libads/disp_sec.c
@@ -114,15 +114,15 @@ static void ads_disp_sec_ace_object(ADS_STRUCT *ads,
{
if (object->flags & SEC_ACE_OBJECT_PRESENT) {
printf("Object type: SEC_ACE_OBJECT_PRESENT\n");
- printf("Object GUID: %s (%s)\n", smb_uuid_string(mem_ctx,
- object->type.type),
+ printf("Object GUID: %s (%s)\n", GUID_string(mem_ctx,
+ &object->type.type),
ads_interprete_guid_from_object(ads, mem_ctx,
&object->type.type));
}
if (object->flags & SEC_ACE_OBJECT_INHERITED_PRESENT) {
printf("Object type: SEC_ACE_OBJECT_INHERITED_PRESENT\n");
- printf("Object GUID: %s (%s)\n", smb_uuid_string(mem_ctx,
- object->inherited_type.inherited_type),
+ printf("Object GUID: %s (%s)\n", GUID_string(mem_ctx,
+ &object->inherited_type.inherited_type),
ads_interprete_guid_from_object(ads, mem_ctx,
&object->inherited_type.inherited_type));
}
diff --git a/source3/libads/krb5_setpw.c b/source3/libads/krb5_setpw.c
index 719f3bd3ec..0ff9f2ba32 100644
--- a/source3/libads/krb5_setpw.c
+++ b/source3/libads/krb5_setpw.c
@@ -285,7 +285,7 @@ static krb5_error_code parse_setpw_reply(krb5_context context,
return KRB5KRB_AP_ERR_MODIFIED;
}
- p = packet->data;
+ p = (char *)packet->data;
/*
** see if it is an error
*/
@@ -368,7 +368,7 @@ static krb5_error_code parse_setpw_reply(krb5_context context,
return KRB5KRB_AP_ERR_MODIFIED;
}
- p = clearresult.data;
+ p = (char *)clearresult.data;
res_code = RSVAL(p, 0);
@@ -687,10 +687,10 @@ kerb_prompter(krb5_context ctx, void *data,
memset(prompts[0].reply->data, 0, prompts[0].reply->length);
if (prompts[0].reply->length > 0) {
if (data) {
- strncpy(prompts[0].reply->data,
+ strncpy((char *)prompts[0].reply->data,
(const char *)data,
prompts[0].reply->length-1);
- prompts[0].reply->length = strlen(prompts[0].reply->data);
+ prompts[0].reply->length = strlen((const char *)prompts[0].reply->data);
} else {
prompts[0].reply->length = 0;
}
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index eb45e3a0dd..2dcd1fd6ae 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -176,7 +176,7 @@ bool ads_closest_dc(ADS_STRUCT *ads)
static bool ads_try_connect(ADS_STRUCT *ads, const char *server, bool gc)
{
char *srv;
- struct nbt_cldap_netlogon_5 cldap_reply;
+ struct NETLOGON_SAM_LOGON_RESPONSE_EX cldap_reply;
TALLOC_CTX *mem_ctx = NULL;
bool ret = false;
@@ -801,7 +801,7 @@ static ADS_STATUS ads_do_paged_search_args(ADS_STRUCT *ads,
int *count, struct berval **cookie)
{
int rc, i, version;
- char *utf8_expr, *utf8_path, **search_attrs;
+ char *utf8_expr, *utf8_path, **search_attrs = NULL;
size_t converted_size;
LDAPControl PagedResults, NoReferrals, ExternalCtrl, *controls[4], **rcontrols;
BerElement *cookie_be = NULL;
@@ -832,7 +832,7 @@ static ADS_STATUS ads_do_paged_search_args(ADS_STRUCT *ads,
else {
/* This would be the utf8-encoded version...*/
/* if (!(search_attrs = ads_push_strvals(ctx, attrs))) */
- if (!(str_list_copy(talloc_tos(), &search_attrs, attrs))) {
+ if (!(search_attrs = str_list_copy(talloc_tos(), attrs))) {
rc = LDAP_NO_MEMORY;
goto done;
}
@@ -1144,7 +1144,7 @@ ADS_STATUS ads_do_search_all_fn(ADS_STRUCT *ads, const char *bind_path,
else {
/* This would be the utf8-encoded version...*/
/* if (!(search_attrs = ads_push_strvals(ctx, attrs))) */
- if (!(str_list_copy(talloc_tos(), &search_attrs, attrs)))
+ if (!(search_attrs = str_list_copy(talloc_tos(), attrs)))
{
DEBUG(1,("ads_do_search: str_list_copy() failed!"));
rc = LDAP_NO_MEMORY;
@@ -2062,7 +2062,7 @@ static void dump_guid(ADS_STRUCT *ads, const char *field, struct berval **values
memcpy(guid.info, values[i]->bv_val, sizeof(guid.info));
smb_uuid_unpack(guid, &tmp);
- printf("%s: %s\n", field, smb_uuid_string(talloc_tos(), tmp));
+ printf("%s: %s\n", field, GUID_string(talloc_tos(), &tmp));
}
}
@@ -2828,6 +2828,7 @@ ADS_STATUS ads_domain_func_level(ADS_STRUCT *ads, uint32 *val)
if ( (ads_s = ads_init( ads->server.realm, ads->server.workgroup,
ads->server.ldap_server )) == NULL )
{
+ status = ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
goto done;
}
ads_s->auth.flags = ADS_AUTH_ANON_BIND;
@@ -3747,7 +3748,7 @@ const char *ads_get_extended_right_name_by_guid(ADS_STRUCT *ads,
}
expr = talloc_asprintf(mem_ctx, "(rightsGuid=%s)",
- smb_uuid_string(mem_ctx, *rights_guid));
+ GUID_string(mem_ctx, rights_guid));
if (!expr) {
goto done;
}
diff --git a/source3/libads/ldap_schema.c b/source3/libads/ldap_schema.c
index ff41ccc861..b5d2d35889 100644
--- a/source3/libads/ldap_schema.c
+++ b/source3/libads/ldap_schema.c
@@ -246,19 +246,22 @@ ADS_STATUS ads_check_posix_schema_mapping(TALLOC_CTX *mem_ctx,
ADS_ATTR_SFU_GIDNUMBER_OID,
ADS_ATTR_SFU_HOMEDIR_OID,
ADS_ATTR_SFU_SHELL_OID,
- ADS_ATTR_SFU_GECOS_OID};
+ ADS_ATTR_SFU_GECOS_OID,
+ ADS_ATTR_SFU_UID_OID };
const char *oids_sfu20[] = { ADS_ATTR_SFU20_UIDNUMBER_OID,
ADS_ATTR_SFU20_GIDNUMBER_OID,
ADS_ATTR_SFU20_HOMEDIR_OID,
ADS_ATTR_SFU20_SHELL_OID,
- ADS_ATTR_SFU20_GECOS_OID};
+ ADS_ATTR_SFU20_GECOS_OID,
+ ADS_ATTR_SFU20_UID_OID };
const char *oids_rfc2307[] = { ADS_ATTR_RFC2307_UIDNUMBER_OID,
ADS_ATTR_RFC2307_GIDNUMBER_OID,
ADS_ATTR_RFC2307_HOMEDIR_OID,
ADS_ATTR_RFC2307_SHELL_OID,
- ADS_ATTR_RFC2307_GECOS_OID };
+ ADS_ATTR_RFC2307_GECOS_OID,
+ ADS_ATTR_RFC2307_UID_OID };
DEBUG(10,("ads_check_posix_schema_mapping for schema mode: %d\n", map_type));
@@ -359,6 +362,12 @@ ADS_STATUS ads_check_posix_schema_mapping(TALLOC_CTX *mem_ctx,
strequal(ADS_ATTR_SFU20_GECOS_OID, oids_out[i])) {
schema->posix_gecos_attr = talloc_strdup(schema, names_out[i]);
}
+
+ if (strequal(ADS_ATTR_RFC2307_UID_OID, oids_out[i]) ||
+ strequal(ADS_ATTR_SFU_UID_OID, oids_out[i]) ||
+ strequal(ADS_ATTR_SFU20_UID_OID, oids_out[i])) {
+ schema->posix_uid_attr = talloc_strdup(schema, names_out[i]);
+ }
}
if (!schema->posix_uidnumber_attr ||
diff --git a/source3/libads/util.c b/source3/libads/util.c
index 72f5dee80c..9866a15285 100644
--- a/source3/libads/util.c
+++ b/source3/libads/util.c
@@ -33,7 +33,7 @@ ADS_STATUS ads_change_trust_account_password(ADS_STRUCT *ads, char *host_princip
return ADS_ERROR_SYSTEM(ENOENT);
}
- new_password = generate_random_str(DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
+ new_password = generate_random_str(talloc_tos(), DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
ret = kerberos_set_password(ads->auth.kdc_server, host_principal, password, host_principal, new_password, ads->auth.time_offset);
@@ -86,6 +86,8 @@ ADS_STATUS ads_guess_service_principal(ADS_STRUCT *ads,
server_realm = SMB_STRDUP(ads->config.realm);
if (!server || !server_realm) {
+ SAFE_FREE(server);
+ SAFE_FREE(server_realm);
return ADS_ERROR(LDAP_NO_MEMORY);
}
diff --git a/source3/libcli/nbt/libnbt.h b/source3/libcli/nbt/libnbt.h
deleted file mode 100644
index d37a17c192..0000000000
--- a/source3/libcli/nbt/libnbt.h
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- a raw async NBT library
-
- Copyright (C) Andrew Tridgell 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/>.
-*/
-
-#ifndef __LIBNBT_H__
-#define __LIBNBT_H__
-
-#include "librpc/gen_ndr/nbt.h"
-#include "librpc/ndr/libndr.h"
-
-/*
- possible states for pending requests
-*/
-enum nbt_request_state {NBT_REQUEST_SEND,
- NBT_REQUEST_WAIT,
- NBT_REQUEST_DONE,
- NBT_REQUEST_TIMEOUT,
- NBT_REQUEST_ERROR};
-
-/*
- a nbt name request
-*/
-struct nbt_name_request {
- struct nbt_name_request *next, *prev;
-
- enum nbt_request_state state;
-
- NTSTATUS status;
-
- /* the socket this was on */
- struct nbt_name_socket *nbtsock;
-
- /* where to send the request */
- struct socket_address *dest;
-
- /* timeout between retries */
- int timeout;
-
- /* how many retries to send on timeout */
- int num_retries;
-
- /* whether we have received a WACK */
- bool received_wack;
-
- /* the timeout event */
- struct timed_event *te;
-
- /* the name transaction id */
- uint16_t name_trn_id;
-
- /* is it a reply? */
- bool is_reply;
-
- /* the encoded request */
- DATA_BLOB encoded;
-
- /* shall we allow multiple replies? */
- bool allow_multiple_replies;
-
- unsigned int num_replies;
- struct nbt_name_reply {
- struct nbt_name_packet *packet;
- struct socket_address *dest;
- } *replies;
-
- /* information on what to do on completion */
- struct {
- void (*fn)(struct nbt_name_request *);
- void *_private;
- } async;
-};
-
-
-
-/*
- context structure for operations on name queries
-*/
-struct nbt_name_socket {
- struct socket_context *sock;
- struct event_context *event_ctx;
-/*
- struct smb_iconv_convenience *iconv_convenience;
-*/
- /* a queue of requests pending to be sent */
- struct nbt_name_request *send_queue;
-
- /* the fd event */
- struct fd_event *fde;
-
- /* mapping from name_trn_id to pending event */
- struct idr_context *idr;
-
- /* how many requests are waiting for a reply */
- uint16_t num_pending;
-
- /* what to do with incoming request packets */
- struct {
- void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *,
- struct socket_address *);
- void *_private;
- } incoming;
-
- /* what to do with unexpected replies */
- struct {
- void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *,
- struct socket_address *);
- void *_private;
- } unexpected;
-};
-
-
-/* a simple name query */
-struct nbt_name_query {
- struct {
- struct nbt_name name;
- const char *dest_addr;
- uint16_t dest_port;
- bool broadcast;
- bool wins_lookup;
- int timeout; /* in seconds */
- int retries;
- } in;
- struct {
- const char *reply_from;
- struct nbt_name name;
- int16_t num_addrs;
- const char **reply_addrs;
- } out;
-};
-
-/* a simple name status query */
-struct nbt_name_status {
- struct {
- struct nbt_name name;
- const char *dest_addr;
- uint16_t dest_port;
- int timeout; /* in seconds */
- int retries;
- } in;
- struct {
- const char *reply_from;
- struct nbt_name name;
- struct nbt_rdata_status status;
- } out;
-};
-
-/* a name registration request */
-struct nbt_name_register {
- struct {
- struct nbt_name name;
- const char *dest_addr;
- uint16_t dest_port;
- const char *address;
- uint16_t nb_flags;
- bool register_demand;
- bool broadcast;
- bool multi_homed;
- uint32_t ttl;
- int timeout; /* in seconds */
- int retries;
- } in;
- struct {
- const char *reply_from;
- struct nbt_name name;
- const char *reply_addr;
- uint8_t rcode;
- } out;
-};
-
-/* a send 3 times then demand name broadcast name registration */
-struct nbt_name_register_bcast {
- struct {
- struct nbt_name name;
- const char *dest_addr;
- uint16_t dest_port;
- const char *address;
- uint16_t nb_flags;
- uint32_t ttl;
- } in;
-};
-
-
-/* wins name register with multiple wins servers to try and multiple
- addresses to register */
-struct nbt_name_register_wins {
- struct {
- struct nbt_name name;
- const char **wins_servers;
- uint16_t wins_port;
- const char **addresses;
- uint16_t nb_flags;
- uint32_t ttl;
- } in;
- struct {
- const char *wins_server;
- uint8_t rcode;
- } out;
-};
-
-
-
-/* a name refresh request */
-struct nbt_name_refresh {
- struct {
- struct nbt_name name;
- const char *dest_addr;
- uint16_t dest_port;
- const char *address;
- uint16_t nb_flags;
- bool broadcast;
- uint32_t ttl;
- int timeout; /* in seconds */
- int retries;
- } in;
- struct {
- const char *reply_from;
- struct nbt_name name;
- const char *reply_addr;
- uint8_t rcode;
- } out;
-};
-
-/* wins name refresh with multiple wins servers to try and multiple
- addresses to register */
-struct nbt_name_refresh_wins {
- struct {
- struct nbt_name name;
- const char **wins_servers;
- uint16_t wins_port;
- const char **addresses;
- uint16_t nb_flags;
- uint32_t ttl;
- } in;
- struct {
- const char *wins_server;
- uint8_t rcode;
- } out;
-};
-
-
-/* a name release request */
-struct nbt_name_release {
- struct {
- struct nbt_name name;
- const char *dest_addr;
- uint16_t dest_port;
- const char *address;
- uint16_t nb_flags;
- bool broadcast;
- int timeout; /* in seconds */
- int retries;
- } in;
- struct {
- const char *reply_from;
- struct nbt_name name;
- const char *reply_addr;
- uint8_t rcode;
- } out;
-};
-
-struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx,
- struct event_context *event_ctx);
- /*,
- struct smb_iconv_convenience *iconv_convenience);*/
-struct nbt_name_request *nbt_name_query_send(struct nbt_name_socket *nbtsock,
- struct nbt_name_query *io);
-NTSTATUS nbt_name_query_recv(struct nbt_name_request *req,
- TALLOC_CTX *mem_ctx, struct nbt_name_query *io);
-NTSTATUS nbt_name_query(struct nbt_name_socket *nbtsock,
- TALLOC_CTX *mem_ctx, struct nbt_name_query *io);
-struct nbt_name_request *nbt_name_status_send(struct nbt_name_socket *nbtsock,
- struct nbt_name_status *io);
-NTSTATUS nbt_name_status_recv(struct nbt_name_request *req,
- TALLOC_CTX *mem_ctx, struct nbt_name_status *io);
-NTSTATUS nbt_name_status(struct nbt_name_socket *nbtsock,
- TALLOC_CTX *mem_ctx, struct nbt_name_status *io);
-
-NTSTATUS nbt_name_dup(TALLOC_CTX *mem_ctx, struct nbt_name *name, struct nbt_name *newname);
-NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct nbt_name *name);
-NTSTATUS nbt_name_from_blob(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, struct nbt_name *name);
-void nbt_choose_called_name(TALLOC_CTX *mem_ctx, struct nbt_name *n, const char *name, int type);
-char *nbt_name_string(TALLOC_CTX *mem_ctx, const struct nbt_name *name);
-NTSTATUS nbt_name_register(struct nbt_name_socket *nbtsock,
- TALLOC_CTX *mem_ctx, struct nbt_name_register *io);
-NTSTATUS nbt_name_refresh(struct nbt_name_socket *nbtsock,
- TALLOC_CTX *mem_ctx, struct nbt_name_refresh *io);
-NTSTATUS nbt_name_release(struct nbt_name_socket *nbtsock,
- TALLOC_CTX *mem_ctx, struct nbt_name_release *io);
-NTSTATUS nbt_name_register_wins(struct nbt_name_socket *nbtsock,
- TALLOC_CTX *mem_ctx,
- struct nbt_name_register_wins *io);
-NTSTATUS nbt_name_refresh_wins(struct nbt_name_socket *nbtsock,
- TALLOC_CTX *mem_ctx,
- struct nbt_name_refresh_wins *io);
-NTSTATUS nbt_name_register_recv(struct nbt_name_request *req,
- TALLOC_CTX *mem_ctx, struct nbt_name_register *io);
-struct nbt_name_request *nbt_name_register_send(struct nbt_name_socket *nbtsock,
- struct nbt_name_register *io);
-NTSTATUS nbt_name_release_recv(struct nbt_name_request *req,
- TALLOC_CTX *mem_ctx, struct nbt_name_release *io);
-
-struct nbt_name_request *nbt_name_release_send(struct nbt_name_socket *nbtsock,
- struct nbt_name_release *io);
-
-NTSTATUS nbt_name_refresh_recv(struct nbt_name_request *req,
- TALLOC_CTX *mem_ctx, struct nbt_name_refresh *io);
-
-NTSTATUS nbt_set_incoming_handler(struct nbt_name_socket *nbtsock,
- void (*handler)(struct nbt_name_socket *, struct nbt_name_packet *,
- struct socket_address *),
- void *_private);
-NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock,
- struct socket_address *dest,
- struct nbt_name_packet *request);
-
-
-NDR_SCALAR_PROTO(wrepl_nbt_name, const struct nbt_name *);
-NDR_SCALAR_PROTO(nbt_string, const char *);
-NDR_BUFFER_PROTO(nbt_name, struct nbt_name);
-NTSTATUS nbt_rcode_to_ntstatus(uint8_t rcode);
-
-struct composite_context;
-struct composite_context *nbt_name_register_bcast_send(struct nbt_name_socket *nbtsock,
- struct nbt_name_register_bcast *io);
-NTSTATUS nbt_name_register_bcast_recv(struct composite_context *c);
-struct composite_context *nbt_name_register_wins_send(struct nbt_name_socket *nbtsock,
- struct nbt_name_register_wins *io);
-NTSTATUS nbt_name_refresh_wins_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
- struct nbt_name_refresh_wins *io);
-struct composite_context *nbt_name_refresh_wins_send(struct nbt_name_socket *nbtsock,
- struct nbt_name_refresh_wins *io);
-NTSTATUS nbt_name_register_wins_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
- struct nbt_name_register_wins *io);
-
-
-#endif /* __LIBNBT_H__ */
diff --git a/source3/libcli/nbt/nbtname.c b/source3/libcli/nbt/nbtname.c
deleted file mode 100644
index fbb9550655..0000000000
--- a/source3/libcli/nbt/nbtname.c
+++ /dev/null
@@ -1,626 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- manipulate nbt name structures
-
- Copyright (C) Andrew Tridgell 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/>.
-*/
-
-/*
- see rfc1002 for the detailed format of compressed names
-*/
-
-#include "includes.h"
-#include "librpc/gen_ndr/ndr_nbt.h"
-#include "librpc/gen_ndr/ndr_misc.h"
-
-/* don't allow an unlimited number of name components */
-#define MAX_COMPONENTS 10
-
-/**
- print a nbt string
-*/
-_PUBLIC_ void ndr_print_nbt_string(struct ndr_print *ndr, const char *name, const char *s)
-{
- ndr_print_string(ndr, name, s);
-}
-
-/*
- pull one component of a nbt_string
-*/
-static enum ndr_err_code ndr_pull_component(struct ndr_pull *ndr,
- uint8_t **component,
- uint32_t *offset,
- uint32_t *max_offset)
-{
- uint8_t len;
- uint_t loops = 0;
- while (loops < 5) {
- if (*offset >= ndr->data_size) {
- return ndr_pull_error(ndr, NDR_ERR_STRING,
- "BAD NBT NAME component");
- }
- len = ndr->data[*offset];
- if (len == 0) {
- *offset += 1;
- *max_offset = MAX(*max_offset, *offset);
- *component = NULL;
- return NDR_ERR_SUCCESS;
- }
- if ((len & 0xC0) == 0xC0) {
- /* its a label pointer */
- if (1 + *offset >= ndr->data_size) {
- return ndr_pull_error(ndr, NDR_ERR_STRING,
- "BAD NBT NAME component");
- }
- *max_offset = MAX(*max_offset, *offset + 2);
- *offset = ((len&0x3F)<<8) | ndr->data[1 + *offset];
- *max_offset = MAX(*max_offset, *offset);
- loops++;
- continue;
- }
- if ((len & 0xC0) != 0) {
- /* its a reserved length field */
- return ndr_pull_error(ndr, NDR_ERR_STRING,
- "BAD NBT NAME component");
- }
- if (*offset + len + 2 > ndr->data_size) {
- return ndr_pull_error(ndr, NDR_ERR_STRING,
- "BAD NBT NAME component");
- }
- *component = (uint8_t*)talloc_strndup(ndr, (const char *)&ndr->data[1 + *offset], len);
- NDR_ERR_HAVE_NO_MEMORY(*component);
- *offset += len + 1;
- *max_offset = MAX(*max_offset, *offset);
- return NDR_ERR_SUCCESS;
- }
-
- /* too many pointers */
- return ndr_pull_error(ndr, NDR_ERR_STRING, "BAD NBT NAME component");
-}
-
-/**
- pull a nbt_string from the wire
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_string(struct ndr_pull *ndr, int ndr_flags, const char **s)
-{
- uint32_t offset = ndr->offset;
- uint32_t max_offset = offset;
- unsigned num_components;
- char *name;
-
- if (!(ndr_flags & NDR_SCALARS)) {
- return NDR_ERR_SUCCESS;
- }
-
- name = NULL;
-
- /* break up name into a list of components */
- for (num_components=0;num_components<MAX_COMPONENTS;num_components++) {
- uint8_t *component = NULL;
- NDR_CHECK(ndr_pull_component(ndr, &component, &offset, &max_offset));
- if (component == NULL) break;
- if (name) {
- name = talloc_asprintf_append_buffer(name, ".%s", component);
- NDR_ERR_HAVE_NO_MEMORY(name);
- } else {
- name = (char *)component;
- }
- }
- if (num_components == MAX_COMPONENTS) {
- return ndr_pull_error(ndr, NDR_ERR_STRING,
- "BAD NBT NAME too many components");
- }
- if (num_components == 0) {
- name = talloc_strdup(ndr, "");
- NDR_ERR_HAVE_NO_MEMORY(name);
- }
-
- (*s) = name;
- ndr->offset = max_offset;
-
- return NDR_ERR_SUCCESS;
-}
-
-/**
- push a nbt string to the wire
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_string(struct ndr_push *ndr, int ndr_flags, const char *s)
-{
- if (!(ndr_flags & NDR_SCALARS)) {
- return NDR_ERR_SUCCESS;
- }
-
- while (s && *s) {
- enum ndr_err_code ndr_err;
- char *compname;
- size_t complen;
- uint32_t offset;
-
- /* see if we have pushed the remaing string allready,
- * if so we use a label pointer to this string
- */
- ndr_err = ndr_token_retrieve_cmp_fn(&ndr->nbt_string_list, s, &offset, (comparison_fn_t)strcmp, false);
- if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- uint8_t b[2];
-
- if (offset > 0x3FFF) {
- return ndr_push_error(ndr, NDR_ERR_STRING,
- "offset for nbt string label pointer %u[%08X] > 0x00003FFF",
- offset, offset);
- }
-
- b[0] = 0xC0 | (offset>>8);
- b[1] = (offset & 0xFF);
-
- return ndr_push_bytes(ndr, b, 2);
- }
-
- complen = strcspn(s, ".");
-
- /* we need to make sure the length fits into 6 bytes */
- if (complen >= 0x3F) {
- return ndr_push_error(ndr, NDR_ERR_STRING,
- "component length %u[%08X] > 0x00003F",
- (unsigned)complen, (unsigned)complen);
- }
-
- compname = talloc_asprintf(ndr, "%c%*.*s",
- (unsigned char)complen,
- (unsigned char)complen,
- (unsigned char)complen, s);
- NDR_ERR_HAVE_NO_MEMORY(compname);
-
- /* remember the current componemt + the rest of the string
- * so it can be reused later
- */
- NDR_CHECK(ndr_token_store(ndr, &ndr->nbt_string_list, s, ndr->offset));
-
- /* push just this component into the blob */
- NDR_CHECK(ndr_push_bytes(ndr, (const uint8_t *)compname, complen+1));
- talloc_free(compname);
-
- s += complen;
- if (*s == '.') s++;
- }
-
- /* if we reach the end of the string and have pushed the last component
- * without using a label pointer, we need to terminate the string
- */
- return ndr_push_bytes(ndr, (const uint8_t *)"", 1);
-}
-
-
-/*
- decompress a 'compressed' name component
- */
-static bool decompress_name(char *name, enum nbt_name_type *type)
-{
- int i;
- for (i=0;name[2*i];i++) {
- uint8_t c1 = name[2*i];
- uint8_t c2 = name[1+(2*i)];
- if (c1 < 'A' || c1 > 'P' ||
- c2 < 'A' || c2 > 'P') {
- return false;
- }
- name[i] = ((c1-'A')<<4) | (c2-'A');
- }
- name[i] = 0;
- if (i == 16) {
- *type = (enum nbt_name_type)(name[15]);
- name[15] = 0;
- i--;
- } else {
- *type = NBT_NAME_CLIENT;
- }
-
- /* trim trailing spaces */
- for (;i>0 && name[i-1]==' ';i--) {
- name[i-1] = 0;
- }
-
- return true;
-}
-
-
-/*
- compress a name component
- */
-static uint8_t *compress_name(TALLOC_CTX *mem_ctx,
- const uint8_t *name, enum nbt_name_type type)
-{
- uint8_t *cname;
- int i;
- uint8_t pad_char;
-
- if (strlen((const char *)name) > 15) {
- return NULL;
- }
-
- cname = talloc_array(mem_ctx, uint8_t, 33);
- if (cname == NULL) return NULL;
-
- for (i=0;name[i];i++) {
- cname[2*i] = 'A' + (name[i]>>4);
- cname[1+2*i] = 'A' + (name[i]&0xF);
- }
- if (strcmp((const char *)name, "*") == 0) {
- pad_char = 0;
- } else {
- pad_char = ' ';
- }
- for (;i<15;i++) {
- cname[2*i] = 'A' + (pad_char>>4);
- cname[1+2*i] = 'A' + (pad_char&0xF);
- }
-
- pad_char = type;
- cname[2*i] = 'A' + (pad_char>>4);
- cname[1+2*i] = 'A' + (pad_char&0xF);
-
- cname[32] = 0;
- return cname;
-}
-
-
-/**
- pull a nbt name from the wire
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_name *r)
-{
- uint8_t *scope;
- char *cname;
- const char *s;
- bool ok;
-
- if (!(ndr_flags & NDR_SCALARS)) {
- return NDR_ERR_SUCCESS;
- }
-
- NDR_CHECK(ndr_pull_nbt_string(ndr, ndr_flags, &s));
-
- scope = (uint8_t *)strchr(s, '.');
- if (scope) {
- *scope = 0;
- r->scope = talloc_strdup(ndr->current_mem_ctx, (const char *)&scope[1]);
- NDR_ERR_HAVE_NO_MEMORY(r->scope);
- } else {
- r->scope = NULL;
- }
-
- cname = discard_const_p(char, s);
-
- /* the first component is limited to 16 bytes in the DOS charset,
- which is 32 in the 'compressed' form */
- if (strlen(cname) > 32) {
- return ndr_pull_error(ndr, NDR_ERR_STRING,
- "NBT NAME cname > 32");
- }
-
- /* decompress the first component */
- ok = decompress_name(cname, &r->type);
- if (!ok) {
- return ndr_pull_error(ndr, NDR_ERR_STRING,
- "NBT NAME failed to decompress");
- }
-
- r->name = talloc_strdup(ndr->current_mem_ctx, cname);
- NDR_ERR_HAVE_NO_MEMORY(r->name);
-
- talloc_free(cname);
-
- return NDR_ERR_SUCCESS;
-}
-
-/**
- push a nbt name to the wire
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name *r)
-{
- uint8_t *cname, *fullname;
- enum ndr_err_code ndr_err;
-
- if (!(ndr_flags & NDR_SCALARS)) {
- return NDR_ERR_SUCCESS;
- }
-
- if (strlen(r->name) > 15) {
- return ndr_push_error(ndr, NDR_ERR_STRING,
- "nbt_name longer as 15 chars: %s",
- r->name);
- }
-
- cname = compress_name(ndr, (const uint8_t *)r->name, r->type);
- NDR_ERR_HAVE_NO_MEMORY(cname);
-
- if (r->scope) {
- fullname = (uint8_t *)talloc_asprintf(ndr, "%s.%s", cname, r->scope);
- NDR_ERR_HAVE_NO_MEMORY(fullname);
- talloc_free(cname);
- } else {
- fullname = cname;
- }
-
- ndr_err = ndr_push_nbt_string(ndr, ndr_flags, (const char *)fullname);
-
- return ndr_err;
-}
-
-
-/**
- copy a nbt name structure
-*/
-_PUBLIC_ NTSTATUS nbt_name_dup(TALLOC_CTX *mem_ctx, struct nbt_name *name, struct nbt_name *newname)
-{
- *newname = *name;
- newname->name = talloc_strdup(mem_ctx, newname->name);
- NT_STATUS_HAVE_NO_MEMORY(newname->name);
- newname->scope = talloc_strdup(mem_ctx, newname->scope);
- if (name->scope) {
- NT_STATUS_HAVE_NO_MEMORY(newname->scope);
- }
- return NT_STATUS_OK;
-}
-
-/**
- push a nbt name into a blob
-*/
-_PUBLIC_ NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct nbt_name *name)
-{
- enum ndr_err_code ndr_err;
-
- ndr_err = ndr_push_struct_blob(blob, mem_ctx, name, (ndr_push_flags_fn_t)ndr_push_nbt_name);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- return ndr_map_error2ntstatus(ndr_err);
- }
-
- return NT_STATUS_OK;
-}
-
-/**
- pull a nbt name from a blob
-*/
-_PUBLIC_ NTSTATUS nbt_name_from_blob(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob, struct nbt_name *name)
-{
- enum ndr_err_code ndr_err;
-
- ndr_err = ndr_pull_struct_blob(blob, mem_ctx, name,
- (ndr_pull_flags_fn_t)ndr_pull_nbt_name);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- return ndr_map_error2ntstatus(ndr_err);
- }
-
- return NT_STATUS_OK;
-}
-
-
-/**
- choose a name to use when calling a server in a NBT session request.
- we use heuristics to see if the name we have been given is a IP
- address, or a too-long name. If it is then use *SMBSERVER, or a
- truncated name
-*/
-_PUBLIC_ void nbt_choose_called_name(TALLOC_CTX *mem_ctx,
- struct nbt_name *n, const char *name, int type)
-{
- n->scope = NULL;
- n->type = type;
-
- if ((name == NULL) || is_ipaddress(name)) {
- n->name = "*SMBSERVER";
- return;
- }
- if (strlen(name) > 15) {
- const char *p = strchr(name, '.');
- char *s;
- if (p - name > 15) {
- n->name = "*SMBSERVER";
- return;
- }
- s = talloc_strndup(mem_ctx, name, PTR_DIFF(p, name));
- n->name = talloc_strdup_upper(mem_ctx, s);
- return;
- }
-
- n->name = talloc_strdup_upper(mem_ctx, name);
-}
-
-
-/*
- escape a string into a form containing only a small set of characters,
- the rest is hex encoded. This is similar to URL encoding
-*/
-static const char *nbt_hex_encode(TALLOC_CTX *mem_ctx, const char *s)
-{
- int i, len;
- char *ret;
- const char *valid_chars = "_-.$@ ";
-#define NBT_CHAR_ALLOW(c) (isalnum((unsigned char)c) || strchr(valid_chars, c))
-
- for (len=i=0;s[i];i++,len++) {
- if (!NBT_CHAR_ALLOW(s[i])) {
- len += 2;
- }
- }
-
- ret = talloc_array(mem_ctx, char, len+1);
- if (ret == NULL) return NULL;
-
- for (len=i=0;s[i];i++) {
- if (NBT_CHAR_ALLOW(s[i])) {
- ret[len++] = s[i];
- } else {
- snprintf(&ret[len], 4, "%%%02x", (unsigned char)s[i]);
- len += 3;
- }
- }
- ret[len] = 0;
-
- return ret;
-}
-
-
-/**
- form a string for a NBT name
-*/
-_PUBLIC_ char *nbt_name_string(TALLOC_CTX *mem_ctx, const struct nbt_name *name)
-{
- TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
- char *ret;
- if (name->scope) {
- ret = talloc_asprintf(mem_ctx, "%s<%02x>-%s",
- nbt_hex_encode(tmp_ctx, name->name),
- name->type,
- nbt_hex_encode(tmp_ctx, name->scope));
- } else {
- ret = talloc_asprintf(mem_ctx, "%s<%02x>",
- nbt_hex_encode(tmp_ctx, name->name),
- name->type);
- }
- talloc_free(tmp_ctx);
- return ret;
-}
-
-/**
- pull a nbt name, WINS Replication uses another on wire format for nbt name
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_wrepl_nbt_name(struct ndr_pull *ndr, int ndr_flags, const struct nbt_name **_r)
-{
- struct nbt_name *r;
- uint8_t *namebuf;
- uint32_t namebuf_len;
-
- if (!(ndr_flags & NDR_SCALARS)) {
- return NDR_ERR_SUCCESS;
- }
-
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &namebuf_len));
- if (namebuf_len < 1 || namebuf_len > 255) {
- return ndr_pull_error(ndr, NDR_ERR_ALLOC, "value out of range");
- }
- NDR_PULL_ALLOC_N(ndr, namebuf, namebuf_len);
- NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, namebuf, namebuf_len));
-
- NDR_PULL_ALLOC(ndr, r);
-
- /* oh wow, what a nasty bug in windows ... */
- if (namebuf[0] == 0x1b && namebuf_len >= 16) {
- namebuf[0] = namebuf[15];
- namebuf[15] = 0x1b;
- }
-
- if (namebuf_len < 17) {
- r->type = 0x00;
-
- r->name = talloc_strndup(r, (char *)namebuf, namebuf_len);
- if (!r->name) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "out of memory");
-
- r->scope= NULL;
-
- talloc_free(namebuf);
- *_r = r;
- return NDR_ERR_SUCCESS;
- }
-
- r->type = namebuf[15];
-
- namebuf[15] = '\0';
- trim_string((char *)namebuf, NULL, " ");
- r->name = talloc_strdup(r, (char *)namebuf);
- if (!r->name) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "out of memory");
-
- if (namebuf_len > 18) {
- r->scope = talloc_strndup(r, (char *)(namebuf+17), namebuf_len-17);
- if (!r->scope) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "out of memory");
- } else {
- r->scope = NULL;
- }
-
- talloc_free(namebuf);
- *_r = r;
- return NDR_ERR_SUCCESS;
-}
-
-/**
- push a nbt name, WINS Replication uses another on wire format for nbt name
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_wrepl_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name *r)
-{
- uint8_t *namebuf;
- uint32_t namebuf_len;
- uint32_t _name_len;
- uint32_t scope_len = 0;
-
- if (r == NULL) {
- return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER,
- "wrepl_nbt_name NULL pointer");
- }
-
- if (!(ndr_flags & NDR_SCALARS)) {
- return NDR_ERR_SUCCESS;
- }
-
- _name_len = strlen(r->name);
- if (_name_len > 15) {
- return ndr_push_error(ndr, NDR_ERR_STRING,
- "wrepl_nbt_name longer as 15 chars: %s",
- r->name);
- }
-
- if (r->scope) {
- scope_len = strlen(r->scope);
- }
- if (scope_len > 238) {
- return ndr_push_error(ndr, NDR_ERR_STRING,
- "wrepl_nbt_name scope longer as 238 chars: %s",
- r->scope);
- }
-
- namebuf = (uint8_t *)talloc_asprintf(ndr, "%-15s%c%s",
- r->name, 'X',
- (r->scope?r->scope:""));
- if (!namebuf) return ndr_push_error(ndr, NDR_ERR_ALLOC, "out of memory");
-
- namebuf_len = strlen((char *)namebuf) + 1;
-
- /*
- * we need to set the type here, and use a place-holder in the talloc_asprintf()
- * as the type can be 0x00, and then the namebuf_len = strlen(namebuf); would give wrong results
- */
- namebuf[15] = r->type;
-
- /* oh wow, what a nasty bug in windows ... */
- if (r->type == 0x1b) {
- namebuf[15] = namebuf[0];
- namebuf[0] = 0x1b;
- }
-
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, namebuf_len));
- NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, namebuf, namebuf_len));
-
- talloc_free(namebuf);
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_wrepl_nbt_name(struct ndr_print *ndr, const char *name, const struct nbt_name *r)
-{
- char *s = nbt_name_string(ndr, r);
- ndr_print_string(ndr, name, s);
- talloc_free(s);
-}
diff --git a/source3/libgpo/gpext/registry.c b/source3/libgpo/gpext/registry.c
index 188a48ab49..f501498407 100644
--- a/source3/libgpo/gpext/registry.c
+++ b/source3/libgpo/gpext/registry.c
@@ -410,7 +410,7 @@ static NTSTATUS reg_parse_registry(TALLOC_CTX *mem_ctx,
return status;
}
- buf = (uint16 *)file_load(real_filename, &n, 0);
+ buf = (uint16 *)file_load(real_filename, &n, 0, NULL);
if (!buf) {
TALLOC_FREE(reg_file);
return NT_STATUS_CANNOT_LOAD_REGISTRY_FILE;
@@ -455,7 +455,7 @@ static NTSTATUS reg_parse_registry(TALLOC_CTX *mem_ctx,
status = NT_STATUS_OK;
out:
- SAFE_FREE(buf);
+ TALLOC_FREE(buf);
prs_mem_free(&ps);
return status;
diff --git a/source3/libgpo/gpext/scripts.c b/source3/libgpo/gpext/scripts.c
index c07407c3f0..02c3abaa1e 100644
--- a/source3/libgpo/gpext/scripts.c
+++ b/source3/libgpo/gpext/scripts.c
@@ -93,7 +93,7 @@ static NTSTATUS generate_gp_registry_entry(TALLOC_CTX *mem_ctx,
data->type = data_type;
switch (data->type) {
case REG_QWORD:
- data->v.qword = (uint64_t)data_p;
+ data->v.qword = *(uint64_t *)data_p;
break;
case REG_SZ:
data->v.sz.str = talloc_strdup(mem_ctx, (char *)data_p);
diff --git a/source3/libgpo/gpext/security.c b/source3/libgpo/gpext/security.c
new file mode 100644
index 0000000000..6aeb354c41
--- /dev/null
+++ b/source3/libgpo/gpext/security.c
@@ -0,0 +1,267 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * Group Policy Support
+ * Copyright (C) Guenther Deschner 2005-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 "libgpo/gpo_ini.h"
+
+#define GP_EXT_NAME "security"
+
+#define GPTTMPL_UNIX_PATH "Microsoft/Windows NT/SecEdit/GptTmpl.inf"
+
+#define GPTTMPL_SECTION_UNICODE "Unicode"
+#define GPTTMPL_SECTION_VERSION "Version"
+
+#define GPTTMPL_SECTION_REGISTRY_VALUES "Registry Values"
+#define GPTTMPL_SECTION_SYSTEM_ACCESS "System Access"
+#define GPTTMPL_SECTION_KERBEROS_POLICY "Kerberos Policy"
+#define GPTTMPL_SECTION_EVENT_AUDIT "Event Audit"
+#define GPTTMPL_SECTION_PRIVILEGE_RIGHTS "Privilege Rights"
+#define GPTTMPL_SECTION_APPLICATION_LOG "Application Log"
+#define GPTTMPL_SECTION_SECURITY_LOG "Security Log"
+#define GPTTMPL_SECTION_SYSTEM_LOG "System Log"
+#define GPTTMPL_SECTION_GROUP_MEMBERSHIP "Group Membership"
+#define GPTTMPL_SECTION_FILE_SECURITY "File Security"
+#define GPTTMPL_SECTION_SERVICE_GENERAL_SETTING "Service General Setting"
+
+static TALLOC_CTX *ctx = NULL;
+
+struct gpttmpl_table {
+ const char *section;
+ const char *parameter;
+ enum winreg_Type type;
+};
+
+/****************************************************************
+ parse the Version section from gpttmpl file
+****************************************************************/
+
+#define GPTTMPL_PARAMETER_REVISION "Revision"
+#define GPTTMPL_PARAMETER_SIGNATURE "signature"
+#define GPTTMPL_VALUE_CHICAGO "$CHICAGO$" /* whatever this is good for... */
+#define GPTTMPL_PARAMETER_UNICODE "Unicode"
+
+static NTSTATUS gpttmpl_parse_header(dictionary *dict,
+ uint32_t *version_out)
+{
+ const char *signature = NULL;
+ uint32_t version;
+
+ if (!dict) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ if ((signature = iniparser_getstring(dict, GPTTMPL_SECTION_VERSION
+ ":"GPTTMPL_PARAMETER_SIGNATURE, NULL)) == NULL) {
+ return NT_STATUS_INTERNAL_DB_CORRUPTION;
+ }
+
+ if (!strequal(signature, GPTTMPL_VALUE_CHICAGO)) {
+ return NT_STATUS_INTERNAL_DB_CORRUPTION;
+ }
+
+ if ((version = iniparser_getint(dict, GPTTMPL_SECTION_VERSION
+ ":"GPTTMPL_PARAMETER_REVISION, Undefined)) == Undefined) {
+ return NT_STATUS_INTERNAL_DB_CORRUPTION;
+ }
+
+ if (version_out) {
+ *version_out = version;
+ }
+
+ /* treat that as boolean */
+ if ((!iniparser_getboolean(dict, GPTTMPL_SECTION_UNICODE
+ ":"GPTTMPL_PARAMETER_UNICODE, Undefined)) == Undefined) {
+ return NT_STATUS_INTERNAL_DB_CORRUPTION;
+ }
+
+ return NT_STATUS_OK;
+}
+
+/****************************************************************
+****************************************************************/
+
+static NTSTATUS gpttmpl_init_context(TALLOC_CTX *mem_ctx,
+ uint32_t flags,
+ const char *unix_path,
+ struct gp_inifile_context **ini_ctx)
+{
+ NTSTATUS status;
+ uint32_t version;
+ struct gp_inifile_context *tmp_ctx = NULL;
+
+ status = gp_inifile_init_context(mem_ctx, flags, unix_path,
+ GPTTMPL_UNIX_PATH, &tmp_ctx);
+ NT_STATUS_NOT_OK_RETURN(status);
+
+ status = gpttmpl_parse_header(tmp_ctx->dict, &version);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1,("gpttmpl_init_context: failed: %s\n",
+ nt_errstr(status)));
+ TALLOC_FREE(tmp_ctx);
+ return status;
+ }
+
+ *ini_ctx = tmp_ctx;
+
+ return NT_STATUS_OK;
+}
+
+/****************************************************************
+****************************************************************/
+
+static NTSTATUS gpttmpl_process(struct gp_inifile_context *ini_ctx,
+ struct registry_key *root_key,
+ uint32_t flags)
+{
+ return NT_STATUS_OK;
+}
+
+/****************************************************************
+****************************************************************/
+
+static NTSTATUS security_process_group_policy(ADS_STRUCT *ads,
+ TALLOC_CTX *mem_ctx,
+ uint32_t flags,
+ struct registry_key *root_key,
+ const struct nt_user_token *token,
+ struct GROUP_POLICY_OBJECT *gpo,
+ const char *extension_guid,
+ const char *snapin_guid)
+{
+ NTSTATUS status;
+ char *unix_path = NULL;
+ struct gp_inifile_context *ini_ctx = NULL;
+
+ debug_gpext_header(0, "security_process_group_policy", flags, gpo,
+ extension_guid, snapin_guid);
+
+ /* this handler processes the gpttmpl files and merge output to the
+ * registry */
+
+ status = gpo_get_unix_path(mem_ctx, gpo, &unix_path);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto out;
+ }
+
+ status = gpttmpl_init_context(mem_ctx, flags, unix_path, &ini_ctx);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto out;
+ }
+
+ status = gpttmpl_process(ini_ctx, root_key, flags);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto out;
+ }
+
+ out:
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0,("security_process_group_policy: %s\n",
+ nt_errstr(status)));
+ }
+ TALLOC_FREE(ini_ctx);
+
+ return status;
+}
+
+/****************************************************************
+****************************************************************/
+
+static NTSTATUS security_get_reg_config(TALLOC_CTX *mem_ctx,
+ struct gp_extension_reg_info **reg_info)
+{
+ NTSTATUS status;
+ struct gp_extension_reg_info *info = NULL;
+
+ struct gp_extension_reg_table table[] = {
+ /* FIXME: how can we store the "(Default)" value ??? */
+ /* { "", REG_SZ, "Security" }, */
+ { "ProcessGroupPolicy", REG_SZ, "security_process_group_policy" },
+ { "NoUserPolicy", REG_DWORD, "1" },
+ { "ExtensionDebugLevel", REG_DWORD, "1" },
+ { NULL, REG_NONE, NULL }
+ };
+
+ info = TALLOC_ZERO_P(mem_ctx, struct gp_extension_reg_info);
+ NT_STATUS_HAVE_NO_MEMORY(info);
+
+ status = gp_ext_info_add_entry(mem_ctx, GP_EXT_NAME,
+ GP_EXT_GUID_SECURITY,
+ table, info);
+ NT_STATUS_NOT_OK_RETURN(status);
+
+ *reg_info = info;
+
+ return NT_STATUS_OK;
+}
+
+
+/****************************************************************
+****************************************************************/
+
+static NTSTATUS security_initialize(TALLOC_CTX *mem_ctx)
+{
+ return NT_STATUS_OK;
+}
+
+/****************************************************************
+****************************************************************/
+
+static NTSTATUS security_shutdown(void)
+{
+ NTSTATUS status;
+
+ status = unregister_gp_extension(GP_EXT_NAME);
+ if (NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ TALLOC_FREE(ctx);
+
+ return NT_STATUS_OK;
+}
+
+/****************************************************************
+****************************************************************/
+
+static struct gp_extension_methods security_methods = {
+ .initialize = security_initialize,
+ .process_group_policy = security_process_group_policy,
+ .get_reg_config = security_get_reg_config,
+ .shutdown = security_shutdown
+};
+
+/****************************************************************
+****************************************************************/
+
+NTSTATUS gpext_security_init(void)
+{
+ NTSTATUS status;
+
+ ctx = talloc_init("gpext_security_init");
+ NT_STATUS_HAVE_NO_MEMORY(ctx);
+
+ status = register_gp_extension(ctx, SMB_GPEXT_INTERFACE_VERSION,
+ GP_EXT_NAME, GP_EXT_GUID_SECURITY,
+ &security_methods);
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(ctx);
+ }
+
+ return status;
+}
diff --git a/source3/libgpo/gpo_ini.c b/source3/libgpo/gpo_ini.c
index 54aaffa477..aa8f7c7770 100644
--- a/source3/libgpo/gpo_ini.c
+++ b/source3/libgpo/gpo_ini.c
@@ -63,7 +63,7 @@ static NTSTATUS convert_file_from_ucs2(TALLOC_CTX *mem_ctx,
return NT_STATUS_INVALID_PARAMETER;
}
- data_in = (uint8 *)file_load(filename_in, &n, 0);
+ data_in = (uint8 *)file_load(filename_in, &n, 0, NULL);
if (!data_in) {
status = NT_STATUS_NO_SUCH_FILE;
goto out;
@@ -116,7 +116,7 @@ static NTSTATUS convert_file_from_ucs2(TALLOC_CTX *mem_ctx,
close(tmp_fd);
}
- SAFE_FREE(data_in);
+ TALLOC_FREE(data_in);
return status;
}
diff --git a/source3/libgpo/gpo_reg.c b/source3/libgpo/gpo_reg.c
index 920deeb189..d49315021e 100644
--- a/source3/libgpo/gpo_reg.c
+++ b/source3/libgpo/gpo_reg.c
@@ -689,25 +689,25 @@ static WERROR gp_reg_generate_sd(TALLOC_CTX *mem_ctx,
size_t *sd_size)
{
SEC_ACE ace[6];
- SEC_ACCESS mask;
+ uint32_t mask;
SEC_ACL *acl = NULL;
uint8_t inherit_flags;
- init_sec_access(&mask, REG_KEY_ALL);
+ mask = REG_KEY_ALL;
init_sec_ace(&ace[0],
&global_sid_System,
SEC_ACE_TYPE_ACCESS_ALLOWED,
mask, 0);
- init_sec_access(&mask, REG_KEY_ALL);
+ mask = REG_KEY_ALL;
init_sec_ace(&ace[1],
&global_sid_Builtin_Administrators,
SEC_ACE_TYPE_ACCESS_ALLOWED,
mask, 0);
- init_sec_access(&mask, REG_KEY_READ);
+ mask = REG_KEY_READ;
init_sec_ace(&ace[2],
sid ? sid : &global_sid_Authenticated_Users,
SEC_ACE_TYPE_ACCESS_ALLOWED,
@@ -717,19 +717,19 @@ static WERROR gp_reg_generate_sd(TALLOC_CTX *mem_ctx,
SEC_ACE_FLAG_CONTAINER_INHERIT |
SEC_ACE_FLAG_INHERIT_ONLY;
- init_sec_access(&mask, REG_KEY_ALL);
+ mask = REG_KEY_ALL;
init_sec_ace(&ace[3],
&global_sid_System,
SEC_ACE_TYPE_ACCESS_ALLOWED,
mask, inherit_flags);
- init_sec_access(&mask, REG_KEY_ALL);
+ mask = REG_KEY_ALL;
init_sec_ace(&ace[4],
&global_sid_Builtin_Administrators,
SEC_ACE_TYPE_ACCESS_ALLOWED,
mask, inherit_flags);
- init_sec_access(&mask, REG_KEY_READ);
+ mask = REG_KEY_READ;
init_sec_ace(&ace[5],
sid ? sid : &global_sid_Authenticated_Users,
SEC_ACE_TYPE_ACCESS_ALLOWED,
diff --git a/source3/libnet/libnet_dssync.c b/source3/libnet/libnet_dssync.c
index bae03effed..81866c85ba 100644
--- a/source3/libnet/libnet_dssync.c
+++ b/source3/libnet/libnet_dssync.c
@@ -297,7 +297,7 @@ static NTSTATUS libnet_dssync_lookup_nc(TALLOC_CTX *mem_ctx,
req.req1.count = 1;
req.req1.names = names;
req.req1.format_flags = DRSUAPI_DS_NAME_FLAG_NO_FLAGS;
- req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_UKNOWN;
+ req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_UNKNOWN;
req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779;
status = rpccli_drsuapi_DsCrackNames(ctx->cli, mem_ctx,
@@ -539,17 +539,24 @@ static NTSTATUS libnet_dssync_getncchanges(TALLOC_CTX *mem_ctx,
if (level_out == 1) {
out_level = 1;
ctr1 = &ctr.ctr1;
- } else if (level_out == 2) {
+ } else if (level_out == 2 && ctr.ctr2.mszip1.ts) {
out_level = 1;
- ctr1 = ctr.ctr2.ctr.mszip1.ctr1;
+ ctr1 = &ctr.ctr2.mszip1.ts->ctr1;
} else if (level_out == 6) {
out_level = 6;
ctr6 = &ctr.ctr6;
} else if (level_out == 7
&& ctr.ctr7.level == 6
- && ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_MSZIP) {
+ && ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_MSZIP
+ && ctr.ctr7.ctr.mszip6.ts) {
out_level = 6;
- ctr6 = ctr.ctr7.ctr.mszip6.ctr6;
+ ctr6 = &ctr.ctr7.ctr.mszip6.ts->ctr6;
+ } else if (level_out == 7
+ && ctr.ctr7.level == 6
+ && ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_XPRESS
+ && ctr.ctr7.ctr.xpress6.ts) {
+ out_level = 6;
+ ctr6 = &ctr.ctr7.ctr.xpress6.ts->ctr6;
}
if (out_level == 1) {
diff --git a/source3/libnet/libnet_dssync_keytab.c b/source3/libnet/libnet_dssync_keytab.c
index 6ba2c3aa41..6a3139d6ad 100644
--- a/source3/libnet/libnet_dssync_keytab.c
+++ b/source3/libnet/libnet_dssync_keytab.c
@@ -86,7 +86,7 @@ static NTSTATUS keytab_startup(struct dssync_context *ctx, TALLOC_CTX *mem_ctx,
old_utdv = talloc(mem_ctx, struct replUpToDateVectorBlob);
ndr_err = ndr_pull_struct_blob(&entry->password, old_utdv,
- old_utdv,
+ NULL, old_utdv,
(ndr_pull_flags_fn_t)ndr_pull_replUpToDateVectorBlob);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
NTSTATUS status = ndr_map_error2ntstatus(ndr_err);
@@ -124,7 +124,7 @@ static NTSTATUS keytab_finish(struct dssync_context *ctx, TALLOC_CTX *mem_ctx,
NDR_PRINT_DEBUG(replUpToDateVectorBlob, new_utdv);
}
- ndr_err = ndr_push_struct_blob(&blob, mem_ctx, new_utdv,
+ ndr_err = ndr_push_struct_blob(&blob, mem_ctx, NULL, new_utdv,
(ndr_push_flags_fn_t)ndr_push_replUpToDateVectorBlob);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = ndr_map_error2ntstatus(ndr_err);
@@ -179,7 +179,7 @@ static NTSTATUS parse_supplemental_credentials(TALLOC_CTX *mem_ctx,
bool newer_keys = false;
uint32_t j;
- ndr_err = ndr_pull_struct_blob_all(blob, mem_ctx, &scb,
+ ndr_err = ndr_pull_struct_blob_all(blob, mem_ctx, NULL, &scb,
(ndr_pull_flags_fn_t)ndr_pull_supplementalCredentialsBlob);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = ndr_map_error2ntstatus(ndr_err);
@@ -236,7 +236,7 @@ static NTSTATUS parse_supplemental_credentials(TALLOC_CTX *mem_ctx,
status = NT_STATUS_NO_MEMORY;
goto done;
}
- ndr_err = ndr_pull_struct_blob(&scpk_blob, mem_ctx, pkb,
+ ndr_err = ndr_pull_struct_blob(&scpk_blob, mem_ctx, NULL, pkb,
(ndr_pull_flags_fn_t)ndr_pull_package_PrimaryKerberosBlob);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = ndr_map_error2ntstatus(ndr_err);
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index a39dee676f..6935e000dc 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -357,10 +357,15 @@ static ADS_STATUS libnet_join_set_machine_spn(TALLOC_CTX *mem_ctx,
strupper_m(spn);
spn_array[0] = spn;
- if (name_to_fqdn(my_fqdn, r->in.machine_name) &&
- !strequal(my_fqdn, r->in.machine_name)) {
+ if (!name_to_fqdn(my_fqdn, r->in.machine_name)
+ || (strchr(my_fqdn, '.') == NULL)) {
+ fstr_sprintf(my_fqdn, "%s.%s", r->in.machine_name,
+ r->out.dns_domain_name);
+ }
+
+ strlower_m(my_fqdn);
- strlower_m(my_fqdn);
+ if (!strequal(my_fqdn, r->in.machine_name)) {
spn = talloc_asprintf(mem_ctx, "HOST/%s", my_fqdn);
if (!spn) {
return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
@@ -770,7 +775,7 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx,
ZERO_STRUCT(user_pol);
if (!r->in.machine_password) {
- r->in.machine_password = talloc_strdup(mem_ctx, generate_random_str(DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH));
+ r->in.machine_password = generate_random_str(mem_ctx, DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
NT_STATUS_HAVE_NO_MEMORY(r->in.machine_password);
}
diff --git a/source3/libnet/libnet_proto.h b/source3/libnet/libnet_proto.h
index 43046a44c0..69a16c1c7d 100644
--- a/source3/libnet/libnet_proto.h
+++ b/source3/libnet/libnet_proto.h
@@ -53,7 +53,7 @@ krb5_error_code libnet_keytab_add(struct libnet_keytab_context *ctx);
struct libnet_keytab_entry *libnet_keytab_search(struct libnet_keytab_context *ctx,
const char *principal, int kvno,
- const const krb5_enctype enctype,
+ const krb5_enctype enctype,
TALLOC_CTX *mem_ctx);
#endif
diff --git a/source3/libnet/libnet_samsync.c b/source3/libnet/libnet_samsync.c
index daf27ffb51..64dcf6de51 100644
--- a/source3/libnet/libnet_samsync.c
+++ b/source3/libnet/libnet_samsync.c
@@ -65,7 +65,7 @@ static NTSTATUS fix_user(TALLOC_CTX *mem_ctx,
user->user_private_info.SensitiveData = data.data;
user->user_private_info.DataLength = data.length;
- ndr_err = ndr_pull_struct_blob(&data, mem_ctx, &keys,
+ ndr_err = ndr_pull_struct_blob(&data, mem_ctx, NULL, &keys,
(ndr_pull_flags_fn_t)ndr_pull_netr_USER_KEYS);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
dump_data(10, data.data, data.length);
@@ -397,7 +397,7 @@ NTSTATUS pull_netr_AcctLockStr(TALLOC_CTX *mem_ctx,
blob = data_blob_const(r->array, r->length);
- ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, str,
+ ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, NULL, str,
(ndr_pull_flags_fn_t)ndr_pull_netr_AcctLockStr);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
diff --git a/source3/libnet/libnet_samsync_keytab.c b/source3/libnet/libnet_samsync_keytab.c
index f284f08ad9..9e666ced32 100644
--- a/source3/libnet/libnet_samsync_keytab.c
+++ b/source3/libnet/libnet_samsync_keytab.c
@@ -93,6 +93,7 @@ static NTSTATUS fetch_sam_entry_keytab(TALLOC_CTX *mem_ctx,
ctx->dns_domain_name);
entry.password = data_blob_talloc(mem_ctx, nt_passwd, 16);
entry.kvno = ads_get_kvno(ctx->ads, entry.name);
+ entry.enctype = ENCTYPE_NULL;
NT_STATUS_HAVE_NO_MEMORY(entry.name);
NT_STATUS_HAVE_NO_MEMORY(entry.principal);
diff --git a/source3/librpc/gen_ndr/cli_initshutdown.c b/source3/librpc/gen_ndr/cli_initshutdown.c
index ab48623ee1..bc8ca5b5f1 100644
--- a/source3/librpc/gen_ndr/cli_initshutdown.c
+++ b/source3/librpc/gen_ndr/cli_initshutdown.c
@@ -9,7 +9,7 @@
NTSTATUS rpccli_initshutdown_Init(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
uint16_t *hostname /* [in] [unique] */,
- struct initshutdown_String *message /* [in] [unique] */,
+ struct lsa_StringLarge *message /* [in] [unique] */,
uint32_t timeout /* [in] */,
uint8_t force_apps /* [in] */,
uint8_t do_reboot /* [in] */,
@@ -103,7 +103,7 @@ NTSTATUS rpccli_initshutdown_Abort(struct rpc_pipe_client *cli,
NTSTATUS rpccli_initshutdown_InitEx(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
uint16_t *hostname /* [in] [unique] */,
- struct initshutdown_String *message /* [in] [unique] */,
+ struct lsa_StringLarge *message /* [in] [unique] */,
uint32_t timeout /* [in] */,
uint8_t force_apps /* [in] */,
uint8_t do_reboot /* [in] */,
diff --git a/source3/librpc/gen_ndr/cli_initshutdown.h b/source3/librpc/gen_ndr/cli_initshutdown.h
index c7d2cad664..e2eb9daabe 100644
--- a/source3/librpc/gen_ndr/cli_initshutdown.h
+++ b/source3/librpc/gen_ndr/cli_initshutdown.h
@@ -4,7 +4,7 @@
NTSTATUS rpccli_initshutdown_Init(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
uint16_t *hostname /* [in] [unique] */,
- struct initshutdown_String *message /* [in] [unique] */,
+ struct lsa_StringLarge *message /* [in] [unique] */,
uint32_t timeout /* [in] */,
uint8_t force_apps /* [in] */,
uint8_t do_reboot /* [in] */,
@@ -16,7 +16,7 @@ NTSTATUS rpccli_initshutdown_Abort(struct rpc_pipe_client *cli,
NTSTATUS rpccli_initshutdown_InitEx(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
uint16_t *hostname /* [in] [unique] */,
- struct initshutdown_String *message /* [in] [unique] */,
+ struct lsa_StringLarge *message /* [in] [unique] */,
uint32_t timeout /* [in] */,
uint8_t force_apps /* [in] */,
uint8_t do_reboot /* [in] */,
diff --git a/source3/librpc/gen_ndr/cli_lsa.c b/source3/librpc/gen_ndr/cli_lsa.c
index 4ab27ed04b..e7775b1bfe 100644
--- a/source3/librpc/gen_ndr/cli_lsa.c
+++ b/source3/librpc/gen_ndr/cli_lsa.c
@@ -503,7 +503,7 @@ NTSTATUS rpccli_lsa_EnumAccounts(struct rpc_pipe_client *cli,
NTSTATUS rpccli_lsa_CreateTrustedDomain(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
- struct policy_handle *handle /* [in] [ref] */,
+ struct policy_handle *policy_handle /* [in] [ref] */,
struct lsa_DomainInfo *info /* [in] [ref] */,
uint32_t access_mask /* [in] */,
struct policy_handle *trustdom_handle /* [out] [ref] */)
@@ -512,7 +512,7 @@ NTSTATUS rpccli_lsa_CreateTrustedDomain(struct rpc_pipe_client *cli,
NTSTATUS status;
/* In parameters */
- r.in.handle = handle;
+ r.in.policy_handle = policy_handle;
r.in.info = info;
r.in.access_mask = access_mask;
@@ -1141,12 +1141,18 @@ NTSTATUS rpccli_lsa_QueryTrustedDomainInfo(struct rpc_pipe_client *cli,
}
NTSTATUS rpccli_lsa_SetInformationTrustedDomain(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx)
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *trustdom_handle /* [in] [ref] */,
+ enum lsa_TrustDomInfoEnum level /* [in] */,
+ union lsa_TrustedDomainInfo *info /* [in] [ref,switch_is(level)] */)
{
struct lsa_SetInformationTrustedDomain r;
NTSTATUS status;
/* In parameters */
+ r.in.trustdom_handle = trustdom_handle;
+ r.in.level = level;
+ r.in.info = info;
if (DEBUGLEVEL >= 10) {
NDR_PRINT_IN_DEBUG(lsa_SetInformationTrustedDomain, &r);
@@ -1706,12 +1712,20 @@ NTSTATUS rpccli_lsa_QueryTrustedDomainInfoBySid(struct rpc_pipe_client *cli,
}
NTSTATUS rpccli_lsa_SetTrustedDomainInfo(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx)
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle /* [in] [ref] */,
+ struct dom_sid2 *dom_sid /* [in] [ref] */,
+ enum lsa_TrustDomInfoEnum level /* [in] */,
+ union lsa_TrustedDomainInfo *info /* [in] [ref,switch_is(level)] */)
{
struct lsa_SetTrustedDomainInfo r;
NTSTATUS status;
/* In parameters */
+ r.in.handle = handle;
+ r.in.dom_sid = dom_sid;
+ r.in.level = level;
+ r.in.info = info;
if (DEBUGLEVEL >= 10) {
NDR_PRINT_IN_DEBUG(lsa_SetTrustedDomainInfo, &r);
@@ -2161,12 +2175,21 @@ NTSTATUS rpccli_lsa_EnumTrustedDomainsEx(struct rpc_pipe_client *cli,
}
NTSTATUS rpccli_lsa_CreateTrustedDomainEx(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx)
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *policy_handle /* [in] [ref] */,
+ struct lsa_TrustDomainInfoInfoEx *info /* [in] [ref] */,
+ struct lsa_TrustDomainInfoAuthInfoInternal *auth_info /* [in] [ref] */,
+ uint32_t access_mask /* [in] */,
+ struct policy_handle *trustdom_handle /* [out] [ref] */)
{
struct lsa_CreateTrustedDomainEx r;
NTSTATUS status;
/* In parameters */
+ r.in.policy_handle = policy_handle;
+ r.in.info = info;
+ r.in.auth_info = auth_info;
+ r.in.access_mask = access_mask;
if (DEBUGLEVEL >= 10) {
NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomainEx, &r);
@@ -2191,6 +2214,7 @@ NTSTATUS rpccli_lsa_CreateTrustedDomainEx(struct rpc_pipe_client *cli,
}
/* Return variables */
+ *trustdom_handle = *r.out.trustdom_handle;
/* Return result */
return r.out.result;
@@ -2462,8 +2486,8 @@ NTSTATUS rpccli_lsa_LookupNames2(struct rpc_pipe_client *cli,
struct lsa_TransSidArray2 *sids /* [in,out] [ref] */,
enum lsa_LookupNamesLevel level /* [in] */,
uint32_t *count /* [in,out] [ref] */,
- uint32_t unknown1 /* [in] */,
- uint32_t unknown2 /* [in] */)
+ uint32_t lookup_options /* [in] */,
+ uint32_t client_revision /* [in] */)
{
struct lsa_LookupNames2 r;
NTSTATUS status;
@@ -2475,8 +2499,8 @@ NTSTATUS rpccli_lsa_LookupNames2(struct rpc_pipe_client *cli,
r.in.sids = sids;
r.in.level = level;
r.in.count = count;
- r.in.unknown1 = unknown1;
- r.in.unknown2 = unknown2;
+ r.in.lookup_options = lookup_options;
+ r.in.client_revision = client_revision;
if (DEBUGLEVEL >= 10) {
NDR_PRINT_IN_DEBUG(lsa_LookupNames2, &r);
@@ -2510,12 +2534,21 @@ NTSTATUS rpccli_lsa_LookupNames2(struct rpc_pipe_client *cli,
}
NTSTATUS rpccli_lsa_CreateTrustedDomainEx2(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx)
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *policy_handle /* [in] [ref] */,
+ struct lsa_TrustDomainInfoInfoEx *info /* [in] [ref] */,
+ struct lsa_TrustDomainInfoAuthInfoInternal *auth_info /* [in] [ref] */,
+ uint32_t access_mask /* [in] */,
+ struct policy_handle *trustdom_handle /* [out] [ref] */)
{
struct lsa_CreateTrustedDomainEx2 r;
NTSTATUS status;
/* In parameters */
+ r.in.policy_handle = policy_handle;
+ r.in.info = info;
+ r.in.auth_info = auth_info;
+ r.in.access_mask = access_mask;
if (DEBUGLEVEL >= 10) {
NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomainEx2, &r);
@@ -2540,6 +2573,7 @@ NTSTATUS rpccli_lsa_CreateTrustedDomainEx2(struct rpc_pipe_client *cli,
}
/* Return variables */
+ *trustdom_handle = *r.out.trustdom_handle;
/* Return result */
return r.out.result;
@@ -2842,8 +2876,8 @@ NTSTATUS rpccli_lsa_LookupNames3(struct rpc_pipe_client *cli,
struct lsa_TransSidArray3 *sids /* [in,out] [ref] */,
enum lsa_LookupNamesLevel level /* [in] */,
uint32_t *count /* [in,out] [ref] */,
- uint32_t unknown1 /* [in] */,
- uint32_t unknown2 /* [in] */)
+ uint32_t lookup_options /* [in] */,
+ uint32_t client_revision /* [in] */)
{
struct lsa_LookupNames3 r;
NTSTATUS status;
@@ -2855,8 +2889,8 @@ NTSTATUS rpccli_lsa_LookupNames3(struct rpc_pipe_client *cli,
r.in.sids = sids;
r.in.level = level;
r.in.count = count;
- r.in.unknown1 = unknown1;
- r.in.unknown2 = unknown2;
+ r.in.lookup_options = lookup_options;
+ r.in.client_revision = client_revision;
if (DEBUGLEVEL >= 10) {
NDR_PRINT_IN_DEBUG(lsa_LookupNames3, &r);
@@ -3209,8 +3243,8 @@ NTSTATUS rpccli_lsa_LookupNames4(struct rpc_pipe_client *cli,
struct lsa_TransSidArray3 *sids /* [in,out] [ref] */,
enum lsa_LookupNamesLevel level /* [in] */,
uint32_t *count /* [in,out] [ref] */,
- uint32_t unknown1 /* [in] */,
- uint32_t unknown2 /* [in] */)
+ uint32_t lookup_options /* [in] */,
+ uint32_t client_revision /* [in] */)
{
struct lsa_LookupNames4 r;
NTSTATUS status;
@@ -3221,8 +3255,8 @@ NTSTATUS rpccli_lsa_LookupNames4(struct rpc_pipe_client *cli,
r.in.sids = sids;
r.in.level = level;
r.in.count = count;
- r.in.unknown1 = unknown1;
- r.in.unknown2 = unknown2;
+ r.in.lookup_options = lookup_options;
+ r.in.client_revision = client_revision;
if (DEBUGLEVEL >= 10) {
NDR_PRINT_IN_DEBUG(lsa_LookupNames4, &r);
diff --git a/source3/librpc/gen_ndr/cli_lsa.h b/source3/librpc/gen_ndr/cli_lsa.h
index f3333a091b..554182c6db 100644
--- a/source3/librpc/gen_ndr/cli_lsa.h
+++ b/source3/librpc/gen_ndr/cli_lsa.h
@@ -57,7 +57,7 @@ NTSTATUS rpccli_lsa_EnumAccounts(struct rpc_pipe_client *cli,
uint32_t num_entries /* [in] [range(0,8192)] */);
NTSTATUS rpccli_lsa_CreateTrustedDomain(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
- struct policy_handle *handle /* [in] [ref] */,
+ struct policy_handle *policy_handle /* [in] [ref] */,
struct lsa_DomainInfo *info /* [in] [ref] */,
uint32_t access_mask /* [in] */,
struct policy_handle *trustdom_handle /* [out] [ref] */);
@@ -133,7 +133,10 @@ NTSTATUS rpccli_lsa_QueryTrustedDomainInfo(struct rpc_pipe_client *cli,
enum lsa_TrustDomInfoEnum level /* [in] */,
union lsa_TrustedDomainInfo **info /* [out] [ref,switch_is(level)] */);
NTSTATUS rpccli_lsa_SetInformationTrustedDomain(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx);
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *trustdom_handle /* [in] [ref] */,
+ enum lsa_TrustDomInfoEnum level /* [in] */,
+ union lsa_TrustedDomainInfo *info /* [in] [ref,switch_is(level)] */);
NTSTATUS rpccli_lsa_OpenSecret(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle /* [in] [ref] */,
@@ -201,7 +204,11 @@ NTSTATUS rpccli_lsa_QueryTrustedDomainInfoBySid(struct rpc_pipe_client *cli,
enum lsa_TrustDomInfoEnum level /* [in] */,
union lsa_TrustedDomainInfo **info /* [out] [ref,switch_is(level)] */);
NTSTATUS rpccli_lsa_SetTrustedDomainInfo(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx);
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle /* [in] [ref] */,
+ struct dom_sid2 *dom_sid /* [in] [ref] */,
+ enum lsa_TrustDomInfoEnum level /* [in] */,
+ union lsa_TrustedDomainInfo *info /* [in] [ref,switch_is(level)] */);
NTSTATUS rpccli_lsa_DeleteTrustedDomain(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle /* [in] [ref] */,
@@ -250,7 +257,12 @@ NTSTATUS rpccli_lsa_EnumTrustedDomainsEx(struct rpc_pipe_client *cli,
struct lsa_DomainListEx *domains /* [out] [ref] */,
uint32_t max_size /* [in] */);
NTSTATUS rpccli_lsa_CreateTrustedDomainEx(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx);
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *policy_handle /* [in] [ref] */,
+ struct lsa_TrustDomainInfoInfoEx *info /* [in] [ref] */,
+ struct lsa_TrustDomainInfoAuthInfoInternal *auth_info /* [in] [ref] */,
+ uint32_t access_mask /* [in] */,
+ struct policy_handle *trustdom_handle /* [out] [ref] */);
NTSTATUS rpccli_lsa_CloseTrustedDomainEx(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle /* [in,out] [ref] */);
@@ -291,10 +303,15 @@ NTSTATUS rpccli_lsa_LookupNames2(struct rpc_pipe_client *cli,
struct lsa_TransSidArray2 *sids /* [in,out] [ref] */,
enum lsa_LookupNamesLevel level /* [in] */,
uint32_t *count /* [in,out] [ref] */,
- uint32_t unknown1 /* [in] */,
- uint32_t unknown2 /* [in] */);
+ uint32_t lookup_options /* [in] */,
+ uint32_t client_revision /* [in] */);
NTSTATUS rpccli_lsa_CreateTrustedDomainEx2(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx);
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *policy_handle /* [in] [ref] */,
+ struct lsa_TrustDomainInfoInfoEx *info /* [in] [ref] */,
+ struct lsa_TrustDomainInfoAuthInfoInternal *auth_info /* [in] [ref] */,
+ uint32_t access_mask /* [in] */,
+ struct policy_handle *trustdom_handle /* [out] [ref] */);
NTSTATUS rpccli_lsa_CREDRWRITE(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx);
NTSTATUS rpccli_lsa_CREDRREAD(struct rpc_pipe_client *cli,
@@ -320,8 +337,8 @@ NTSTATUS rpccli_lsa_LookupNames3(struct rpc_pipe_client *cli,
struct lsa_TransSidArray3 *sids /* [in,out] [ref] */,
enum lsa_LookupNamesLevel level /* [in] */,
uint32_t *count /* [in,out] [ref] */,
- uint32_t unknown1 /* [in] */,
- uint32_t unknown2 /* [in] */);
+ uint32_t lookup_options /* [in] */,
+ uint32_t client_revision /* [in] */);
NTSTATUS rpccli_lsa_CREDRGETSESSIONTYPES(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx);
NTSTATUS rpccli_lsa_LSARREGISTERAUDITEVENT(struct rpc_pipe_client *cli,
@@ -357,8 +374,8 @@ NTSTATUS rpccli_lsa_LookupNames4(struct rpc_pipe_client *cli,
struct lsa_TransSidArray3 *sids /* [in,out] [ref] */,
enum lsa_LookupNamesLevel level /* [in] */,
uint32_t *count /* [in,out] [ref] */,
- uint32_t unknown1 /* [in] */,
- uint32_t unknown2 /* [in] */);
+ uint32_t lookup_options /* [in] */,
+ uint32_t client_revision /* [in] */);
NTSTATUS rpccli_lsa_LSAROPENPOLICYSCE(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx);
NTSTATUS rpccli_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(struct rpc_pipe_client *cli,
diff --git a/source3/librpc/gen_ndr/cli_netlogon.c b/source3/librpc/gen_ndr/cli_netlogon.c
index d6ac8b9ede..941273bddc 100644
--- a/source3/librpc/gen_ndr/cli_netlogon.c
+++ b/source3/librpc/gen_ndr/cli_netlogon.c
@@ -110,8 +110,8 @@ NTSTATUS rpccli_netr_LogonSamLogon(struct rpc_pipe_client *cli,
const char *computer_name /* [in] [unique,charset(UTF16)] */,
struct netr_Authenticator *credential /* [in] [unique] */,
struct netr_Authenticator *return_authenticator /* [in,out] [unique] */,
- enum netr_LogonLevel logon_level /* [in] */,
- union netr_LogonInfo *logon /* [in] [ref,switch_is(logon_level)] */,
+ enum netr_LogonInfoClass logon_level /* [in] */,
+ union netr_LogonLevel *logon /* [in] [ref,switch_is(logon_level)] */,
uint16_t validation_level /* [in] */,
union netr_Validation *validation /* [out] [ref,switch_is(validation_level)] */,
uint8_t *authoritative /* [out] [ref] */)
@@ -167,8 +167,8 @@ NTSTATUS rpccli_netr_LogonSamLogoff(struct rpc_pipe_client *cli,
const char *computer_name /* [in] [unique,charset(UTF16)] */,
struct netr_Authenticator *credential /* [in] [unique] */,
struct netr_Authenticator *return_authenticator /* [in,out] [unique] */,
- enum netr_LogonLevel logon_level /* [in] */,
- union netr_LogonInfo logon /* [in] [switch_is(logon_level)] */)
+ enum netr_LogonInfoClass logon_level /* [in] */,
+ union netr_LogonLevel logon /* [in] [switch_is(logon_level)] */)
{
struct netr_LogonSamLogoff r;
NTSTATUS status;
@@ -1934,8 +1934,8 @@ NTSTATUS rpccli_netr_LogonSamLogonEx(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
const char *server_name /* [in] [unique,charset(UTF16)] */,
const char *computer_name /* [in] [unique,charset(UTF16)] */,
- enum netr_LogonLevel logon_level /* [in] */,
- union netr_LogonInfo *logon /* [in] [ref,switch_is(logon_level)] */,
+ enum netr_LogonInfoClass logon_level /* [in] */,
+ union netr_LogonLevel *logon /* [in] [ref,switch_is(logon_level)] */,
uint16_t validation_level /* [in] */,
union netr_Validation *validation /* [out] [ref,switch_is(validation_level)] */,
uint8_t *authoritative /* [out] [ref] */,
@@ -2241,8 +2241,8 @@ NTSTATUS rpccli_netr_LogonSamLogonWithFlags(struct rpc_pipe_client *cli,
const char *computer_name /* [in] [unique,charset(UTF16)] */,
struct netr_Authenticator *credential /* [in] [unique] */,
struct netr_Authenticator *return_authenticator /* [in,out] [unique] */,
- enum netr_LogonLevel logon_level /* [in] */,
- union netr_LogonInfo logon /* [in] [switch_is(logon_level)] */,
+ enum netr_LogonInfoClass logon_level /* [in] */,
+ union netr_LogonLevel logon /* [in] [switch_is(logon_level)] */,
uint16_t validation_level /* [in] */,
union netr_Validation *validation /* [out] [ref,switch_is(validation_level)] */,
uint8_t *authoritative /* [out] [ref] */,
diff --git a/source3/librpc/gen_ndr/cli_netlogon.h b/source3/librpc/gen_ndr/cli_netlogon.h
index 2033315a5d..0a0cfdf6e4 100644
--- a/source3/librpc/gen_ndr/cli_netlogon.h
+++ b/source3/librpc/gen_ndr/cli_netlogon.h
@@ -21,8 +21,8 @@ NTSTATUS rpccli_netr_LogonSamLogon(struct rpc_pipe_client *cli,
const char *computer_name /* [in] [unique,charset(UTF16)] */,
struct netr_Authenticator *credential /* [in] [unique] */,
struct netr_Authenticator *return_authenticator /* [in,out] [unique] */,
- enum netr_LogonLevel logon_level /* [in] */,
- union netr_LogonInfo *logon /* [in] [ref,switch_is(logon_level)] */,
+ enum netr_LogonInfoClass logon_level /* [in] */,
+ union netr_LogonLevel *logon /* [in] [ref,switch_is(logon_level)] */,
uint16_t validation_level /* [in] */,
union netr_Validation *validation /* [out] [ref,switch_is(validation_level)] */,
uint8_t *authoritative /* [out] [ref] */);
@@ -32,8 +32,8 @@ NTSTATUS rpccli_netr_LogonSamLogoff(struct rpc_pipe_client *cli,
const char *computer_name /* [in] [unique,charset(UTF16)] */,
struct netr_Authenticator *credential /* [in] [unique] */,
struct netr_Authenticator *return_authenticator /* [in,out] [unique] */,
- enum netr_LogonLevel logon_level /* [in] */,
- union netr_LogonInfo logon /* [in] [switch_is(logon_level)] */);
+ enum netr_LogonInfoClass logon_level /* [in] */,
+ union netr_LogonLevel logon /* [in] [switch_is(logon_level)] */);
NTSTATUS rpccli_netr_ServerReqChallenge(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
const char *server_name /* [in] [unique,charset(UTF16)] */,
@@ -297,8 +297,8 @@ NTSTATUS rpccli_netr_LogonSamLogonEx(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
const char *server_name /* [in] [unique,charset(UTF16)] */,
const char *computer_name /* [in] [unique,charset(UTF16)] */,
- enum netr_LogonLevel logon_level /* [in] */,
- union netr_LogonInfo *logon /* [in] [ref,switch_is(logon_level)] */,
+ enum netr_LogonInfoClass logon_level /* [in] */,
+ union netr_LogonLevel *logon /* [in] [ref,switch_is(logon_level)] */,
uint16_t validation_level /* [in] */,
union netr_Validation *validation /* [out] [ref,switch_is(validation_level)] */,
uint8_t *authoritative /* [out] [ref] */,
@@ -349,8 +349,8 @@ NTSTATUS rpccli_netr_LogonSamLogonWithFlags(struct rpc_pipe_client *cli,
const char *computer_name /* [in] [unique,charset(UTF16)] */,
struct netr_Authenticator *credential /* [in] [unique] */,
struct netr_Authenticator *return_authenticator /* [in,out] [unique] */,
- enum netr_LogonLevel logon_level /* [in] */,
- union netr_LogonInfo logon /* [in] [switch_is(logon_level)] */,
+ enum netr_LogonInfoClass logon_level /* [in] */,
+ union netr_LogonLevel logon /* [in] [switch_is(logon_level)] */,
uint16_t validation_level /* [in] */,
union netr_Validation *validation /* [out] [ref,switch_is(validation_level)] */,
uint8_t *authoritative /* [out] [ref] */,
diff --git a/source3/librpc/gen_ndr/cli_ntsvcs.c b/source3/librpc/gen_ndr/cli_ntsvcs.c
index bc5dba4d91..f8ef7a99ad 100644
--- a/source3/librpc/gen_ndr/cli_ntsvcs.c
+++ b/source3/librpc/gen_ndr/cli_ntsvcs.c
@@ -424,12 +424,19 @@ NTSTATUS rpccli_PNP_EnumerateSubKeys(struct rpc_pipe_client *cli,
NTSTATUS rpccli_PNP_GetDeviceList(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
+ const char *filter /* [in] [unique,charset(UTF16)] */,
+ uint16_t *buffer /* [out] [ref,length_is(*length),size_is(*length)] */,
+ uint32_t *length /* [in,out] [ref] */,
+ uint32_t flags /* [in] */,
WERROR *werror)
{
struct PNP_GetDeviceList r;
NTSTATUS status;
/* In parameters */
+ r.in.filter = filter;
+ r.in.length = length;
+ r.in.flags = flags;
if (DEBUGLEVEL >= 10) {
NDR_PRINT_IN_DEBUG(PNP_GetDeviceList, &r);
@@ -454,6 +461,8 @@ NTSTATUS rpccli_PNP_GetDeviceList(struct rpc_pipe_client *cli,
}
/* Return variables */
+ memcpy(buffer, r.out.buffer, *r.in.length * sizeof(*buffer));
+ *length = *r.out.length;
/* Return result */
if (werror) {
@@ -555,11 +564,11 @@ NTSTATUS rpccli_PNP_GetDeviceRegProp(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
const char *devicepath /* [in] [ref,charset(UTF16)] */,
uint32_t property /* [in] */,
- uint32_t *unknown1 /* [in,out] [ref] */,
+ uint32_t *reg_data_type /* [in,out] [ref] */,
uint8_t *buffer /* [out] [ref,length_is(*buffer_size),size_is(*buffer_size)] */,
uint32_t *buffer_size /* [in,out] [ref] */,
uint32_t *needed /* [in,out] [ref] */,
- uint32_t unknown3 /* [in] */,
+ uint32_t flags /* [in] */,
WERROR *werror)
{
struct PNP_GetDeviceRegProp r;
@@ -568,10 +577,10 @@ NTSTATUS rpccli_PNP_GetDeviceRegProp(struct rpc_pipe_client *cli,
/* In parameters */
r.in.devicepath = devicepath;
r.in.property = property;
- r.in.unknown1 = unknown1;
+ r.in.reg_data_type = reg_data_type;
r.in.buffer_size = buffer_size;
r.in.needed = needed;
- r.in.unknown3 = unknown3;
+ r.in.flags = flags;
if (DEBUGLEVEL >= 10) {
NDR_PRINT_IN_DEBUG(PNP_GetDeviceRegProp, &r);
@@ -596,7 +605,7 @@ NTSTATUS rpccli_PNP_GetDeviceRegProp(struct rpc_pipe_client *cli,
}
/* Return variables */
- *unknown1 = *r.out.unknown1;
+ *reg_data_type = *r.out.reg_data_type;
memcpy(buffer, r.out.buffer, *r.in.buffer_size * sizeof(*buffer));
*buffer_size = *r.out.buffer_size;
*needed = *r.out.needed;
diff --git a/source3/librpc/gen_ndr/cli_ntsvcs.h b/source3/librpc/gen_ndr/cli_ntsvcs.h
index a52a79ecc5..4ed8a401ec 100644
--- a/source3/librpc/gen_ndr/cli_ntsvcs.h
+++ b/source3/librpc/gen_ndr/cli_ntsvcs.h
@@ -36,6 +36,10 @@ NTSTATUS rpccli_PNP_EnumerateSubKeys(struct rpc_pipe_client *cli,
WERROR *werror);
NTSTATUS rpccli_PNP_GetDeviceList(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
+ const char *filter /* [in] [unique,charset(UTF16)] */,
+ uint16_t *buffer /* [out] [ref,length_is(*length),size_is(*length)] */,
+ uint32_t *length /* [in,out] [ref] */,
+ uint32_t flags /* [in] */,
WERROR *werror);
NTSTATUS rpccli_PNP_GetDeviceListSize(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
@@ -50,11 +54,11 @@ NTSTATUS rpccli_PNP_GetDeviceRegProp(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
const char *devicepath /* [in] [ref,charset(UTF16)] */,
uint32_t property /* [in] */,
- uint32_t *unknown1 /* [in,out] [ref] */,
+ uint32_t *reg_data_type /* [in,out] [ref] */,
uint8_t *buffer /* [out] [ref,length_is(*buffer_size),size_is(*buffer_size)] */,
uint32_t *buffer_size /* [in,out] [ref] */,
uint32_t *needed /* [in,out] [ref] */,
- uint32_t unknown3 /* [in] */,
+ uint32_t flags /* [in] */,
WERROR *werror);
NTSTATUS rpccli_PNP_SetDeviceRegProp(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
diff --git a/source3/librpc/gen_ndr/cli_svcctl.c b/source3/librpc/gen_ndr/cli_svcctl.c
index c996c761d5..e5fd4dac87 100644
--- a/source3/librpc/gen_ndr/cli_svcctl.c
+++ b/source3/librpc/gen_ndr/cli_svcctl.c
@@ -858,9 +858,9 @@ NTSTATUS rpccli_svcctl_OpenServiceW(struct rpc_pipe_client *cli,
NTSTATUS rpccli_svcctl_QueryServiceConfigW(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle /* [in] [ref] */,
- uint8_t *query /* [out] */,
- uint32_t buf_size /* [in] */,
- uint32_t *bytes_needed /* [out] [ref] */,
+ struct QUERY_SERVICE_CONFIG *query /* [out] [ref] */,
+ uint32_t buf_size /* [in] [range(0,8192)] */,
+ uint32_t *bytes_needed /* [out] [ref,range(0,8192)] */,
WERROR *werror)
{
struct svcctl_QueryServiceConfigW r;
@@ -893,7 +893,7 @@ NTSTATUS rpccli_svcctl_QueryServiceConfigW(struct rpc_pipe_client *cli,
}
/* Return variables */
- memcpy(query, r.out.query, r.in.buf_size * sizeof(*query));
+ *query = *r.out.query;
*bytes_needed = *r.out.bytes_needed;
/* Return result */
diff --git a/source3/librpc/gen_ndr/cli_svcctl.h b/source3/librpc/gen_ndr/cli_svcctl.h
index 56f0a2b0e7..02abbadf1e 100644
--- a/source3/librpc/gen_ndr/cli_svcctl.h
+++ b/source3/librpc/gen_ndr/cli_svcctl.h
@@ -127,9 +127,9 @@ NTSTATUS rpccli_svcctl_OpenServiceW(struct rpc_pipe_client *cli,
NTSTATUS rpccli_svcctl_QueryServiceConfigW(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle /* [in] [ref] */,
- uint8_t *query /* [out] */,
- uint32_t buf_size /* [in] */,
- uint32_t *bytes_needed /* [out] [ref] */,
+ struct QUERY_SERVICE_CONFIG *query /* [out] [ref] */,
+ uint32_t buf_size /* [in] [range(0,8192)] */,
+ uint32_t *bytes_needed /* [out] [ref,range(0,8192)] */,
WERROR *werror);
NTSTATUS rpccli_svcctl_QueryServiceLockStatusW(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
diff --git a/source3/librpc/gen_ndr/cli_winreg.c b/source3/librpc/gen_ndr/cli_winreg.c
index 29f7e50c45..17b7281c72 100644
--- a/source3/librpc/gen_ndr/cli_winreg.c
+++ b/source3/librpc/gen_ndr/cli_winreg.c
@@ -497,7 +497,7 @@ NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle /* [in] [ref] */,
uint32_t enum_index /* [in] */,
- struct winreg_ValNameBuf *name /* [in,out] [ref] */,
+ struct winreg_StringBuf *name /* [in,out] [ref] */,
enum winreg_Type *type /* [in,out] [unique] */,
uint8_t *value /* [in,out] [unique,length_is(*length),size_is(*size)] */,
uint32_t *size /* [in,out] [unique] */,
@@ -872,9 +872,9 @@ NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli,
struct policy_handle *handle /* [in] [ref] */,
struct winreg_String *value_name /* [in] [ref] */,
enum winreg_Type *type /* [in,out] [unique] */,
- uint8_t *data /* [in,out] [unique,length_is(*value_length),size_is(*data_size)] */,
+ uint8_t *data /* [in,out] [unique,length_is(*data_length),size_is(*data_size)] */,
uint32_t *data_size /* [in,out] [unique] */,
- uint32_t *value_length /* [in,out] [unique] */,
+ uint32_t *data_length /* [in,out] [unique] */,
WERROR *werror)
{
struct winreg_QueryValue r;
@@ -886,7 +886,7 @@ NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli,
r.in.type = type;
r.in.data = data;
r.in.data_size = data_size;
- r.in.value_length = value_length;
+ r.in.data_length = data_length;
if (DEBUGLEVEL >= 10) {
NDR_PRINT_IN_DEBUG(winreg_QueryValue, &r);
@@ -920,8 +920,8 @@ NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli,
if (data_size && r.out.data_size) {
*data_size = *r.out.data_size;
}
- if (value_length && r.out.value_length) {
- *value_length = *r.out.value_length;
+ if (data_length && r.out.data_length) {
+ *data_length = *r.out.data_length;
}
/* Return result */
@@ -1070,7 +1070,7 @@ NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli,
NTSTATUS rpccli_winreg_SetKeySecurity(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle /* [in] [ref] */,
- uint32_t access_mask /* [in] */,
+ uint32_t sec_info /* [in] */,
struct KeySecurityData *sd /* [in] [ref] */,
WERROR *werror)
{
@@ -1079,7 +1079,7 @@ NTSTATUS rpccli_winreg_SetKeySecurity(struct rpc_pipe_client *cli,
/* In parameters */
r.in.handle = handle;
- r.in.access_mask = access_mask;
+ r.in.sec_info = sec_info;
r.in.sd = sd;
if (DEBUGLEVEL >= 10) {
@@ -1209,7 +1209,7 @@ NTSTATUS rpccli_winreg_UnLoadKey(struct rpc_pipe_client *cli,
NTSTATUS rpccli_winreg_InitiateSystemShutdown(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
uint16_t *hostname /* [in] [unique] */,
- struct initshutdown_String *message /* [in] [unique] */,
+ struct lsa_StringLarge *message /* [in] [unique] */,
uint32_t timeout /* [in] */,
uint8_t force_apps /* [in] */,
uint8_t do_reboot /* [in] */,
@@ -1498,7 +1498,7 @@ NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli,
NTSTATUS rpccli_winreg_InitiateSystemShutdownEx(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
uint16_t *hostname /* [in] [unique] */,
- struct initshutdown_String *message /* [in] [unique] */,
+ struct lsa_StringLarge *message /* [in] [unique] */,
uint32_t timeout /* [in] */,
uint8_t force_apps /* [in] */,
uint8_t do_reboot /* [in] */,
diff --git a/source3/librpc/gen_ndr/cli_winreg.h b/source3/librpc/gen_ndr/cli_winreg.h
index 793a4ffc5b..fb27bce9d2 100644
--- a/source3/librpc/gen_ndr/cli_winreg.h
+++ b/source3/librpc/gen_ndr/cli_winreg.h
@@ -68,7 +68,7 @@ NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle /* [in] [ref] */,
uint32_t enum_index /* [in] */,
- struct winreg_ValNameBuf *name /* [in,out] [ref] */,
+ struct winreg_StringBuf *name /* [in,out] [ref] */,
enum winreg_Type *type /* [in,out] [unique] */,
uint8_t *value /* [in,out] [unique,length_is(*length),size_is(*size)] */,
uint32_t *size /* [in,out] [unique] */,
@@ -126,9 +126,9 @@ NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli,
struct policy_handle *handle /* [in] [ref] */,
struct winreg_String *value_name /* [in] [ref] */,
enum winreg_Type *type /* [in,out] [unique] */,
- uint8_t *data /* [in,out] [unique,length_is(*value_length),size_is(*data_size)] */,
+ uint8_t *data /* [in,out] [unique,length_is(*data_length),size_is(*data_size)] */,
uint32_t *data_size /* [in,out] [unique] */,
- uint32_t *value_length /* [in,out] [unique] */,
+ uint32_t *data_length /* [in,out] [unique] */,
WERROR *werror);
NTSTATUS rpccli_winreg_ReplaceKey(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
@@ -148,7 +148,7 @@ NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli,
NTSTATUS rpccli_winreg_SetKeySecurity(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle /* [in] [ref] */,
- uint32_t access_mask /* [in] */,
+ uint32_t sec_info /* [in] */,
struct KeySecurityData *sd /* [in] [ref] */,
WERROR *werror);
NTSTATUS rpccli_winreg_SetValue(struct rpc_pipe_client *cli,
@@ -165,7 +165,7 @@ NTSTATUS rpccli_winreg_UnLoadKey(struct rpc_pipe_client *cli,
NTSTATUS rpccli_winreg_InitiateSystemShutdown(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
uint16_t *hostname /* [in] [unique] */,
- struct initshutdown_String *message /* [in] [unique] */,
+ struct lsa_StringLarge *message /* [in] [unique] */,
uint32_t timeout /* [in] */,
uint8_t force_apps /* [in] */,
uint8_t do_reboot /* [in] */,
@@ -202,7 +202,7 @@ NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli,
NTSTATUS rpccli_winreg_InitiateSystemShutdownEx(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
uint16_t *hostname /* [in] [unique] */,
- struct initshutdown_String *message /* [in] [unique] */,
+ struct lsa_StringLarge *message /* [in] [unique] */,
uint32_t timeout /* [in] */,
uint8_t force_apps /* [in] */,
uint8_t do_reboot /* [in] */,
diff --git a/source3/librpc/gen_ndr/dfs.h b/source3/librpc/gen_ndr/dfs.h
index 8957eaef56..07548c3742 100644
--- a/source3/librpc/gen_ndr/dfs.h
+++ b/source3/librpc/gen_ndr/dfs.h
@@ -2,6 +2,7 @@
#include <stdint.h>
+#include "librpc/gen_ndr/misc.h"
#ifndef _HEADER_netdfs
#define _HEADER_netdfs
diff --git a/source3/librpc/gen_ndr/drsblobs.h b/source3/librpc/gen_ndr/drsblobs.h
index b0ab9aea2a..692746468e 100644
--- a/source3/librpc/gen_ndr/drsblobs.h
+++ b/source3/librpc/gen_ndr/drsblobs.h
@@ -4,12 +4,16 @@
#include "librpc/gen_ndr/drsuapi.h"
#include "librpc/gen_ndr/misc.h"
+#include "librpc/gen_ndr/samr.h"
+#include "librpc/gen_ndr/lsa.h"
#ifndef _HEADER_drsblobs
#define _HEADER_drsblobs
#define SUPPLEMENTAL_CREDENTIALS_PREFIX ( " " )
enum drsuapi_DsAttributeId;
+enum lsa_TrustAuthType;
+
struct replPropertyMetaData1 {
enum drsuapi_DsAttributeId attid;
uint32_t version;
@@ -247,7 +251,7 @@ struct package_PrimaryKerberosBlob {
}/* [public] */;
struct package_PrimaryCLEARTEXTBlob {
- const char * cleartext;/* [flag(LIBNDR_FLAG_STR_NOTERM|LIBNDR_FLAG_REMAINING)] */
+ DATA_BLOB cleartext;/* [flag(LIBNDR_FLAG_REMAINING)] */
}/* [public] */;
struct package_PrimaryWDigestHash {
@@ -263,63 +267,158 @@ struct package_PrimaryWDigestBlob {
struct package_PrimaryWDigestHash *hashes;
}/* [public] */;
-struct trustAuthInOutSecret1 {
- NTTIME time1;
- uint32_t unknown1;
- DATA_BLOB value;
- DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN4)] */
+struct AuthInfoNone {
+ uint32_t size;/* [value(0)] */
};
-struct trustAuthInOutCtr1 {
- struct trustAuthInOutSecret1 *value1;/* [relative] */
- struct trustAuthInOutSecret1 *value2;/* [relative] */
+struct AuthInfoNT4Owf {
+ uint32_t size;/* [value(16)] */
+ struct samr_Password password;
};
-struct trustAuthInOutSecret2V1 {
- NTTIME time1;
- uint32_t unknown1;
- DATA_BLOB value;
- NTTIME time2;
- uint32_t unknown2;
- uint32_t unknown3;
- uint32_t unknown4;
- DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN4)] */
+struct AuthInfoClear {
+ uint32_t size;
+ uint8_t *password;
};
-struct trustAuthInOutSecret2V2 {
- NTTIME time1;
- uint32_t unknown1;
- DATA_BLOB value;
- NTTIME time2;
- uint32_t unknown2;
- uint32_t unknown3;
- DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN4)] */
-};
-
-struct trustAuthInOutCtr2 {
- struct trustAuthInOutSecret2V1 *value1;/* [relative] */
- struct trustAuthInOutSecret2V2 *value2;/* [relative] */
+struct AuthInfoVersion {
+ uint32_t size;/* [value(4)] */
+ uint32_t version;
};
-union trustAuthInOutCtr {
- struct trustAuthInOutCtr1 ctr1;/* [case] */
- struct trustAuthInOutCtr2 ctr2;/* [case(2)] */
+union AuthInfo {
+ struct AuthInfoNone none;/* [case(TRUST_AUTH_TYPE_NONE)] */
+ struct AuthInfoNT4Owf nt4owf;/* [case(TRUST_AUTH_TYPE_NT4OWF)] */
+ struct AuthInfoClear clear;/* [case(TRUST_AUTH_TYPE_CLEAR)] */
+ struct AuthInfoVersion version;/* [case(TRUST_AUTH_TYPE_VERSION)] */
}/* [nodiscriminant] */;
-struct trustAuthInOutBlob {
- uint32_t version;
- union trustAuthInOutCtr ctr;/* [switch_is(version)] */
+struct AuthenticationInformation {
+ NTTIME LastUpdateTime;
+ enum lsa_TrustAuthType AuthType;
+ union AuthInfo AuthInfo;/* [switch_is(AuthType)] */
+ DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN4)] */
}/* [public] */;
+struct AuthenticationInformationArray {
+ struct AuthenticationInformation *array;/* [size_is] */
+}/* [noprint,nopush,nopull] */;
+
+struct trustAuthInOutBlob {
+ uint32_t count;
+ struct AuthenticationInformationArray *current;/* [relative] */
+ struct AuthenticationInformationArray *previous;/* [relative] */
+}/* [noprint,gensize,nopull,public,nopush] */;
+
+struct trustCurrentPasswords {
+ uint32_t count;
+ struct AuthenticationInformation **current;/* [relative] */
+}/* [gensize,public] */;
+
+struct trustDomainPasswords {
+ uint8_t confounder[512];
+ struct trustCurrentPasswords outgoing;/* [subcontext_size(outgoing_size),subcontext(0)] */
+ struct trustCurrentPasswords incoming;/* [subcontext_size(incoming_size),subcontext(0)] */
+ uint32_t outgoing_size;/* [value(ndr_size_trustCurrentPasswords(&outgoing,ndr->flags))] */
+ uint32_t incoming_size;/* [value(ndr_size_trustCurrentPasswords(&incoming,ndr->flags))] */
+}/* [public,nopull] */;
+
struct DsCompressedChunk {
uint32_t marker;
DATA_BLOB data;
}/* [public] */;
-struct DsCompressedBlob {
- struct DsCompressedChunk chunks[5];
+struct ExtendedErrorAString {
+ uint16_t __size;
+ const char *string;/* [unique,charset(DOS),size_is(__size)] */
+};
+
+struct ExtendedErrorUString {
+ uint16_t __size;
+ const char *string;/* [unique,charset(UTF16),size_is(__size)] */
+};
+
+struct ExtendedErrorBlob {
+ uint16_t length;
+ uint8_t *data;/* [unique,size_is(length)] */
+};
+
+enum ExtendedErrorComputerNamePresent
+#ifndef USE_UINT_ENUMS
+ {
+ EXTENDED_ERROR_COMPUTER_NAME_PRESENT=1,
+ EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT=2
+}
+#else
+ { __donnot_use_enum_ExtendedErrorComputerNamePresent=0x7FFFFFFF}
+#define EXTENDED_ERROR_COMPUTER_NAME_PRESENT ( 1 )
+#define EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT ( 2 )
+#endif
+;
+
+union ExtendedErrorComputerNameU {
+ struct ExtendedErrorUString name;/* [case(EXTENDED_ERROR_COMPUTER_NAME_PRESENT)] */
+}/* [switch_type(ExtendedErrorComputerNamePresent)] */;
+
+struct ExtendedErrorComputerName {
+ enum ExtendedErrorComputerNamePresent present;
+ union ExtendedErrorComputerNameU n;/* [switch_is(present)] */
+};
+
+enum ExtendedErrorParamType
+#ifndef USE_UINT_ENUMS
+ {
+ EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING=1,
+ EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING=2,
+ EXTENDED_ERROR_PARAM_TYPE_UINT32=3,
+ EXTENDED_ERROR_PARAM_TYPE_UINT16=4,
+ EXTENDED_ERROR_PARAM_TYPE_UINT64=5,
+ EXTENDED_ERROR_PARAM_TYPE_NONE=6,
+ EXTENDED_ERROR_PARAM_TYPE_BLOB=7
+}
+#else
+ { __donnot_use_enum_ExtendedErrorParamType=0x7FFFFFFF}
+#define EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING ( 1 )
+#define EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING ( 2 )
+#define EXTENDED_ERROR_PARAM_TYPE_UINT32 ( 3 )
+#define EXTENDED_ERROR_PARAM_TYPE_UINT16 ( 4 )
+#define EXTENDED_ERROR_PARAM_TYPE_UINT64 ( 5 )
+#define EXTENDED_ERROR_PARAM_TYPE_NONE ( 6 )
+#define EXTENDED_ERROR_PARAM_TYPE_BLOB ( 7 )
+#endif
+;
+
+union ExtendedErrorParamU {
+ struct ExtendedErrorAString a_string;/* [case(EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING)] */
+ struct ExtendedErrorUString u_string;/* [case(EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING)] */
+ uint32_t uint32;/* [case(EXTENDED_ERROR_PARAM_TYPE_UINT32)] */
+ uint16_t uint16;/* [case(EXTENDED_ERROR_PARAM_TYPE_UINT16)] */
+ uint64_t uint64;/* [case(EXTENDED_ERROR_PARAM_TYPE_UINT64)] */
+ struct ExtendedErrorBlob blob;/* [case(EXTENDED_ERROR_PARAM_TYPE_BLOB)] */
+}/* [switch_type(ExtendedErrorParamType)] */;
+
+struct ExtendedErrorParam {
+ enum ExtendedErrorParamType type;
+ union ExtendedErrorParamU p;/* [switch_is(type)] */
+};
+
+struct ExtendedErrorInfo {
+ struct ExtendedErrorInfo *next;/* [unique] */
+ struct ExtendedErrorComputerName computer_name;
+ uint64_t pid;
+ NTTIME time;
+ uint32_t generating_component;
+ WERROR status;
+ uint16_t detection_location;
+ uint16_t flags;
+ uint16_t num_params;
+ struct ExtendedErrorParam *params;/* [size_is(num_params)] */
}/* [public] */;
+struct ExtendedErrorInfoPtr {
+ struct ExtendedErrorInfo *info;/* [unique] */
+};
+
struct decode_replPropertyMetaData {
struct {
@@ -417,9 +516,17 @@ struct decode_trustAuthInOut {
};
-struct decode_DsCompressed {
+struct decode_trustDomainPasswords {
+ struct {
+ struct trustDomainPasswords blob;
+ } in;
+
+};
+
+
+struct decode_ExtendedErrorInfo {
struct {
- struct DsCompressedBlob blob;
+ struct ExtendedErrorInfoPtr ptr;/* [subcontext(0xFFFFFC01)] */
} in;
};
diff --git a/source3/librpc/gen_ndr/drsuapi.h b/source3/librpc/gen_ndr/drsuapi.h
index 049c2bf4b1..ba01e8f226 100644
--- a/source3/librpc/gen_ndr/drsuapi.h
+++ b/source3/librpc/gen_ndr/drsuapi.h
@@ -575,29 +575,37 @@ struct drsuapi_DsGetNCChangesCtr6 {
WERROR drs_error;
}/* [gensize,public] */;
+struct drsuapi_DsGetNCChangesCtr1TS {
+ struct drsuapi_DsGetNCChangesCtr1 ctr1;/* [subcontext(0xFFFFFC01)] */
+}/* [public] */;
+
+struct drsuapi_DsGetNCChangesCtr6TS {
+ struct drsuapi_DsGetNCChangesCtr6 ctr6;/* [subcontext(0xFFFFFC01)] */
+}/* [public] */;
+
struct drsuapi_DsGetNCChangesMSZIPCtr1 {
uint32_t decompressed_length;
uint32_t compressed_length;
- struct drsuapi_DsGetNCChangesCtr1 *ctr1;/* [unique,compression(NDR_COMPRESSION_MSZIP,compressed_length,decompressed_length),subcontext_size(compressed_length),subcontext(4)] */
-};
+ struct drsuapi_DsGetNCChangesCtr1TS *ts;/* [unique,compression(NDR_COMPRESSION_MSZIP,compressed_length,decompressed_length),subcontext_size(compressed_length),subcontext(4)] */
+}/* [nopush] */;
struct drsuapi_DsGetNCChangesMSZIPCtr6 {
uint32_t decompressed_length;
uint32_t compressed_length;
- struct drsuapi_DsGetNCChangesCtr6 *ctr6;/* [unique,compression(NDR_COMPRESSION_MSZIP,compressed_length,decompressed_length),subcontext_size(compressed_length),subcontext(4)] */
-};
+ struct drsuapi_DsGetNCChangesCtr6TS *ts;/* [unique,compression(NDR_COMPRESSION_MSZIP,compressed_length,decompressed_length),subcontext_size(compressed_length),subcontext(4)] */
+}/* [nopush] */;
struct drsuapi_DsGetNCChangesXPRESSCtr1 {
uint32_t decompressed_length;
uint32_t compressed_length;
- struct drsuapi_DsGetNCChangesCtr1 *ctr1;/* [unique,compression(NDR_COMPRESSION_XPRESS,compressed_length,decompressed_length),subcontext_size(compressed_length),subcontext(4)] */
-};
+ struct drsuapi_DsGetNCChangesCtr1TS *ts;/* [unique,compression(NDR_COMPRESSION_XPRESS,compressed_length,decompressed_length),subcontext_size(compressed_length),subcontext(4)] */
+}/* [nopush] */;
struct drsuapi_DsGetNCChangesXPRESSCtr6 {
uint32_t decompressed_length;
uint32_t compressed_length;
- struct drsuapi_DsGetNCChangesCtr6 *ctr6;/* [unique,compression(NDR_COMPRESSION_XPRESS,compressed_length,decompressed_length),subcontext_size(compressed_length),subcontext(4)] */
-};
+ struct drsuapi_DsGetNCChangesCtr6TS *ts;/* [unique,compression(NDR_COMPRESSION_XPRESS,compressed_length,decompressed_length),subcontext_size(compressed_length),subcontext(4)] */
+}/* [nopush] */;
enum drsuapi_DsGetNCChangesCompressionType
#ifndef USE_UINT_ENUMS
@@ -620,7 +628,7 @@ union drsuapi_DsGetNCChangesCompressedCtr {
}/* [nodiscriminant,flag(LIBNDR_PRINT_ARRAY_HEX)] */;
struct drsuapi_DsGetNCChangesCtr2 {
- union drsuapi_DsGetNCChangesCompressedCtr ctr;/* [switch_is(1|(DRSUAPI_COMPRESSION_TYPE_MSZIP<<16))] */
+ struct drsuapi_DsGetNCChangesMSZIPCtr1 mszip1;
};
struct drsuapi_DsGetNCChangesCtr7 {
@@ -790,7 +798,7 @@ enum drsuapi_DsNameFlags
enum drsuapi_DsNameFormat
#ifndef USE_UINT_ENUMS
{
- DRSUAPI_DS_NAME_FORMAT_UKNOWN=0,
+ DRSUAPI_DS_NAME_FORMAT_UNKNOWN=0,
DRSUAPI_DS_NAME_FORMAT_FQDN_1779=1,
DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT=2,
DRSUAPI_DS_NAME_FORMAT_DISPLAY=3,
@@ -804,7 +812,7 @@ enum drsuapi_DsNameFormat
}
#else
{ __donnot_use_enum_drsuapi_DsNameFormat=0x7FFFFFFF}
-#define DRSUAPI_DS_NAME_FORMAT_UKNOWN ( 0 )
+#define DRSUAPI_DS_NAME_FORMAT_UNKNOWN ( 0 )
#define DRSUAPI_DS_NAME_FORMAT_FQDN_1779 ( 1 )
#define DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT ( 2 )
#define DRSUAPI_DS_NAME_FORMAT_DISPLAY ( 3 )
@@ -889,7 +897,7 @@ union drsuapi_DsWriteAccountSpnResult {
struct drsuapi_DsRemoveDSServerRequest1 {
const char *server_dn;/* [unique,charset(UTF16)] */
const char *domain_dn;/* [unique,charset(UTF16)] */
- uint32_t unknown;
+ uint32_t commit;
};
union drsuapi_DsRemoveDSServerRequest {
@@ -897,7 +905,7 @@ union drsuapi_DsRemoveDSServerRequest {
}/* [switch_type(int32)] */;
struct drsuapi_DsRemoveDSServerResult1 {
- WERROR status;
+ uint32_t last_dc_in_domain;
};
union drsuapi_DsRemoveDSServerResult {
diff --git a/source3/librpc/gen_ndr/echo.h b/source3/librpc/gen_ndr/echo.h
index c8b5b86422..79d4220714 100644
--- a/source3/librpc/gen_ndr/echo.h
+++ b/source3/librpc/gen_ndr/echo.h
@@ -7,7 +7,7 @@
struct echo_info1 {
uint8_t v;
-};
+}/* [public] */;
struct echo_info2 {
uint16_t v;
diff --git a/source3/librpc/gen_ndr/epmapper.h b/source3/librpc/gen_ndr/epmapper.h
index d39269b32b..4b75261a02 100644
--- a/source3/librpc/gen_ndr/epmapper.h
+++ b/source3/librpc/gen_ndr/epmapper.h
@@ -2,6 +2,7 @@
#include <stdint.h>
+#include "librpc/gen_ndr/misc.h"
#ifndef _HEADER_epmapper
#define _HEADER_epmapper
@@ -226,7 +227,9 @@ struct epm_twr_t {
struct epm_entry_t {
struct GUID object;
struct epm_twr_t *tower;/* [ptr] */
- const char * annotation;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_LEN4)] */
+ uint32_t __annotation_offset;/* [value(0)] */
+ uint32_t __annotation_length;/* [value(strlen(annotation)+1)] */
+ const char *annotation;/* [charset(DOS)] */
};
struct rpc_if_id_t {
diff --git a/source3/librpc/gen_ndr/initshutdown.h b/source3/librpc/gen_ndr/initshutdown.h
index 366f017c97..014e2fe689 100644
--- a/source3/librpc/gen_ndr/initshutdown.h
+++ b/source3/librpc/gen_ndr/initshutdown.h
@@ -2,25 +2,15 @@
#include <stdint.h>
+#include "librpc/gen_ndr/lsa.h"
#ifndef _HEADER_initshutdown
#define _HEADER_initshutdown
-struct initshutdown_String_sub {
- uint32_t name_size;/* [value(strlen_m_term(name))] */
- const char * name;/* [flag(LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_NOTERM)] */
-};
-
-struct initshutdown_String {
- 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] */;
-
struct initshutdown_Init {
struct {
uint16_t *hostname;/* [unique] */
- struct initshutdown_String *message;/* [unique] */
+ struct lsa_StringLarge *message;/* [unique] */
uint32_t timeout;
uint8_t force_apps;
uint8_t do_reboot;
@@ -48,7 +38,7 @@ struct initshutdown_Abort {
struct initshutdown_InitEx {
struct {
uint16_t *hostname;/* [unique] */
- struct initshutdown_String *message;/* [unique] */
+ struct lsa_StringLarge *message;/* [unique] */
uint32_t timeout;
uint8_t force_apps;
uint8_t do_reboot;
diff --git a/source3/librpc/gen_ndr/krb5pac.h b/source3/librpc/gen_ndr/krb5pac.h
index b3b29e5b2f..7ec3e95d70 100644
--- a/source3/librpc/gen_ndr/krb5pac.h
+++ b/source3/librpc/gen_ndr/krb5pac.h
@@ -8,6 +8,7 @@
#ifndef _HEADER_krb5pac
#define _HEADER_krb5pac
+#define NETLOGON_GENERIC_KRB5_PAC_VALIDATE ( 3 )
struct PAC_LOGON_NAME {
NTTIME logon_time;
uint16_t size;/* [value(2*strlen_m(account_name))] */
@@ -39,10 +40,6 @@ struct PAC_UNKNOWN_12 {
};
struct PAC_LOGON_INFO_CTR {
- uint32_t unknown1;/* [value(0x00081001)] */
- uint32_t unknown2;/* [value(0xCCCCCCCC)] */
- uint32_t _ndr_size;/* [value(NDR_ROUND(ndr_size_PAC_LOGON_INFO(info,ndr->flags)+4,8))] */
- uint32_t unknown3;/* [value(0x00000000)] */
struct PAC_LOGON_INFO *info;/* [unique] */
}/* [public] */;
@@ -72,7 +69,7 @@ struct DATA_BLOB_REM {
};
union PAC_INFO {
- struct PAC_LOGON_INFO_CTR logon_info;/* [case(PAC_TYPE_LOGON_INFO)] */
+ struct PAC_LOGON_INFO_CTR logon_info;/* [subcontext(0xFFFFFC01),case(PAC_TYPE_LOGON_INFO)] */
struct PAC_SIGNATURE_DATA srv_cksum;/* [case(PAC_TYPE_SRV_CHECKSUM)] */
struct PAC_SIGNATURE_DATA kdc_cksum;/* [case(PAC_TYPE_KDC_CHECKSUM)] */
struct PAC_LOGON_NAME logon_name;/* [case(PAC_TYPE_LOGON_NAME)] */
@@ -105,6 +102,14 @@ struct PAC_DATA_RAW {
struct PAC_BUFFER_RAW *buffers;
}/* [public] */;
+struct PAC_Validate {
+ uint32_t MessageType;/* [value(NETLOGON_GENERIC_KRB5_PAC_VALIDATE)] */
+ uint32_t ChecksumLength;
+ int32_t SignatureType;
+ uint32_t SignatureLength;
+ DATA_BLOB ChecksumAndSignature;/* [flag(LIBNDR_FLAG_REMAINING)] */
+}/* [public] */;
+
struct netsamlogoncache_entry {
time_t timestamp;
struct netr_SamInfo3 info3;
@@ -134,4 +139,12 @@ struct decode_login_info {
};
+
+struct decode_pac_validate {
+ struct {
+ struct PAC_Validate pac_validate;
+ } in;
+
+};
+
#endif /* _HEADER_krb5pac */
diff --git a/source3/librpc/gen_ndr/libnetapi.h b/source3/librpc/gen_ndr/libnetapi.h
index 98da9e12ea..ae7acbf572 100644
--- a/source3/librpc/gen_ndr/libnetapi.h
+++ b/source3/librpc/gen_ndr/libnetapi.h
@@ -413,7 +413,9 @@ struct USER_INFO_X {
uint32_t usriX_code_page;
const char * usriX_profile;
const char * usriX_home_dir_drive;
+ uint32_t usriX_user_id;
uint32_t usriX_primary_group_id;
+ uint32_t usriX_password_expired;
};
struct GROUP_USERS_INFO_0 {
diff --git a/source3/librpc/gen_ndr/lsa.h b/source3/librpc/gen_ndr/lsa.h
index 1e3d3162b2..d91cf4b66d 100644
--- a/source3/librpc/gen_ndr/lsa.h
+++ b/source3/librpc/gen_ndr/lsa.h
@@ -2,6 +2,7 @@
#include <stdint.h>
+#include "librpc/gen_ndr/misc.h"
#include "librpc/gen_ndr/security.h"
#ifndef _HEADER_lsarpc
#define _HEADER_lsarpc
@@ -11,6 +12,9 @@
#define MAX_REF_DOMAINS ( LSA_REF_DOMAIN_LIST_MULTIPLIER )
#define MAX_LOOKUP_SIDS ( 0x5000 )
#define LSA_ENUM_TRUST_DOMAIN_EX_MULTIPLIER ( 82 )
+#define LSA_CLIENT_REVISION_NO_DNS ( 0x00000001 )
+#define LSA_CLIENT_REVISION_DNS ( 0x00000002 )
+#define LSA_LOOKUP_OPTIONS_NO_ISOLATED ( 0x80000000 )
struct lsa_String {
uint16_t length;/* [value(2*strlen_m(string))] */
uint16_t size;/* [value(2*strlen_m(string))] */
@@ -93,12 +97,11 @@ struct lsa_ObjectAttribute {
struct lsa_AuditLogInfo {
uint32_t percent_full;
- uint32_t log_size;
- NTTIME retention_time;
+ uint32_t maximum_log_size;
+ uint64_t retention_time;
uint8_t shutdown_in_progress;
- NTTIME time_to_shutdown;
+ uint64_t time_to_shutdown;
uint32_t next_audit_record;
- uint32_t unknown;
};
enum lsa_PolicyAuditPolicy
@@ -162,9 +165,21 @@ struct lsa_PDAccountInfo {
struct lsa_String name;
};
+enum lsa_Role
+#ifndef USE_UINT_ENUMS
+ {
+ LSA_ROLE_BACKUP=2,
+ LSA_ROLE_PRIMARY=3
+}
+#else
+ { __donnot_use_enum_lsa_Role=0x7FFFFFFF}
+#define LSA_ROLE_BACKUP ( 2 )
+#define LSA_ROLE_PRIMARY ( 3 )
+#endif
+;
+
struct lsa_ServerRole {
- uint16_t unknown;
- uint16_t role;
+ enum lsa_Role role;
};
struct lsa_ReplicaSourceInfo {
@@ -191,7 +206,6 @@ struct lsa_AuditFullSetInfo {
};
struct lsa_AuditFullQueryInfo {
- uint16_t unknown;
uint8_t shutdown_on_full;
uint8_t log_is_full;
};
@@ -215,10 +229,12 @@ enum lsa_PolicyInfo
LSA_POLICY_INFO_ROLE=6,
LSA_POLICY_INFO_REPLICA=7,
LSA_POLICY_INFO_QUOTA=8,
- LSA_POLICY_INFO_DB=9,
+ LSA_POLICY_INFO_MOD=9,
LSA_POLICY_INFO_AUDIT_FULL_SET=10,
LSA_POLICY_INFO_AUDIT_FULL_QUERY=11,
- LSA_POLICY_INFO_DNS=12
+ LSA_POLICY_INFO_DNS=12,
+ LSA_POLICY_INFO_DNS_INT=13,
+ LSA_POLICY_INFO_L_ACCOUNT_DOMAIN=14
}
#else
{ __donnot_use_enum_lsa_PolicyInfo=0x7FFFFFFF}
@@ -230,10 +246,12 @@ enum lsa_PolicyInfo
#define LSA_POLICY_INFO_ROLE ( 6 )
#define LSA_POLICY_INFO_REPLICA ( 7 )
#define LSA_POLICY_INFO_QUOTA ( 8 )
-#define LSA_POLICY_INFO_DB ( 9 )
+#define LSA_POLICY_INFO_MOD ( 9 )
#define LSA_POLICY_INFO_AUDIT_FULL_SET ( 10 )
#define LSA_POLICY_INFO_AUDIT_FULL_QUERY ( 11 )
#define LSA_POLICY_INFO_DNS ( 12 )
+#define LSA_POLICY_INFO_DNS_INT ( 13 )
+#define LSA_POLICY_INFO_L_ACCOUNT_DOMAIN ( 14 )
#endif
;
@@ -246,10 +264,11 @@ union lsa_PolicyInformation {
struct lsa_ServerRole role;/* [case(LSA_POLICY_INFO_ROLE)] */
struct lsa_ReplicaSourceInfo replica;/* [case(LSA_POLICY_INFO_REPLICA)] */
struct lsa_DefaultQuotaInfo quota;/* [case(LSA_POLICY_INFO_QUOTA)] */
- struct lsa_ModificationInfo db;/* [case(LSA_POLICY_INFO_DB)] */
+ struct lsa_ModificationInfo mod;/* [case(LSA_POLICY_INFO_MOD)] */
struct lsa_AuditFullSetInfo auditfullset;/* [case(LSA_POLICY_INFO_AUDIT_FULL_SET)] */
struct lsa_AuditFullQueryInfo auditfullquery;/* [case(LSA_POLICY_INFO_AUDIT_FULL_QUERY)] */
struct lsa_DnsDomainInfo dns;/* [case(LSA_POLICY_INFO_DNS)] */
+ struct lsa_DomainInfo l_account_domain;/* [case(LSA_POLICY_INFO_L_ACCOUNT_DOMAIN)] */
}/* [switch_type(uint16)] */;
struct lsa_SidPtr {
@@ -320,7 +339,8 @@ enum lsa_LookupNamesLevel
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_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2=6,
+ LSA_LOOKUP_NAMES_RODC_REFERRAL_TO_FULL_DC=7
}
#else
{ __donnot_use_enum_lsa_LookupNamesLevel=0x7FFFFFFF}
@@ -330,6 +350,7 @@ enum lsa_LookupNamesLevel
#define LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY ( 4 )
#define LSA_LOOKUP_NAMES_FOREST_TRUSTS_ONLY ( 5 )
#define LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2 ( 6 )
+#define LSA_LOOKUP_NAMES_RODC_REFERRAL_TO_FULL_DC ( 7 )
#endif
;
@@ -355,6 +376,21 @@ struct lsa_PrivilegeSet {
struct lsa_LUIDAttribute *set;/* [size_is(count)] */
};
+/* bitmap lsa_SystemAccessModeFlags */
+#define LSA_POLICY_MODE_INTERACTIVE ( 0x00000001 )
+#define LSA_POLICY_MODE_NETWORK ( 0x00000002 )
+#define LSA_POLICY_MODE_BATCH ( 0x00000004 )
+#define LSA_POLICY_MODE_SERVICE ( 0x00000010 )
+#define LSA_POLICY_MODE_PROXY ( 0x00000020 )
+#define LSA_POLICY_MODE_DENY_INTERACTIVE ( 0x00000040 )
+#define LSA_POLICY_MODE_DENY_NETWORK ( 0x00000080 )
+#define LSA_POLICY_MODE_DENY_BATCH ( 0x00000100 )
+#define LSA_POLICY_MODE_DENY_SERVICE ( 0x00000200 )
+#define LSA_POLICY_MODE_REMOTE_INTERACTIVE ( 0x00000400 )
+#define LSA_POLICY_MODE_DENY_REMOTE_INTERACTIVE ( 0x00000800 )
+#define LSA_POLICY_MODE_ALL ( 0x00000FF7 )
+#define LSA_POLICY_MODE_ALL_NT4 ( 0x00000037 )
+
struct lsa_DATA_BUF {
uint32_t length;
uint32_t size;
@@ -370,35 +406,75 @@ enum lsa_TrustDomInfoEnum
#ifndef USE_UINT_ENUMS
{
LSA_TRUSTED_DOMAIN_INFO_NAME=1,
- LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS_INFO=2,
+ LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS=2,
LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET=3,
LSA_TRUSTED_DOMAIN_INFO_PASSWORD=4,
LSA_TRUSTED_DOMAIN_INFO_BASIC=5,
LSA_TRUSTED_DOMAIN_INFO_INFO_EX=6,
LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO=7,
LSA_TRUSTED_DOMAIN_INFO_FULL_INFO=8,
- LSA_TRUSTED_DOMAIN_INFO_11=11,
- LSA_TRUSTED_DOMAIN_INFO_INFO_ALL=12
+ LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL=9,
+ LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL=10,
+ LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL=11,
+ LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL=12,
+ LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES=13
}
#else
{ __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_CONTROLLERS ( 2 )
#define LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET ( 3 )
#define LSA_TRUSTED_DOMAIN_INFO_PASSWORD ( 4 )
#define LSA_TRUSTED_DOMAIN_INFO_BASIC ( 5 )
#define LSA_TRUSTED_DOMAIN_INFO_INFO_EX ( 6 )
#define LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO ( 7 )
#define LSA_TRUSTED_DOMAIN_INFO_FULL_INFO ( 8 )
-#define LSA_TRUSTED_DOMAIN_INFO_11 ( 11 )
-#define LSA_TRUSTED_DOMAIN_INFO_INFO_ALL ( 12 )
+#define LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL ( 9 )
+#define LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL ( 10 )
+#define LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL ( 11 )
+#define LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL ( 12 )
+#define LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES ( 13 )
+#endif
+;
+
+/* bitmap lsa_TrustDirection */
+#define LSA_TRUST_DIRECTION_INBOUND ( 0x00000001 )
+#define LSA_TRUST_DIRECTION_OUTBOUND ( 0x00000002 )
+
+enum lsa_TrustType
+#ifndef USE_UINT_ENUMS
+ {
+ LSA_TRUST_TYPE_DOWNLEVEL=0x00000001,
+ LSA_TRUST_TYPE_UPLEVEL=0x00000002,
+ LSA_TRUST_TYPE_MIT=0x00000003
+}
+#else
+ { __donnot_use_enum_lsa_TrustType=0x7FFFFFFF}
+#define LSA_TRUST_TYPE_DOWNLEVEL ( 0x00000001 )
+#define LSA_TRUST_TYPE_UPLEVEL ( 0x00000002 )
+#define LSA_TRUST_TYPE_MIT ( 0x00000003 )
#endif
;
+/* bitmap lsa_TrustAttributes */
+#define LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE ( 0x00000001 )
+#define LSA_TRUST_ATTRIBUTE_UPLEVEL_ONLY ( 0x00000002 )
+#define LSA_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN ( 0x00000004 )
+#define LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE ( 0x00000008 )
+#define LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION ( 0x00000010 )
+#define LSA_TRUST_ATTRIBUTE_WITHIN_FOREST ( 0x00000020 )
+#define LSA_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL ( 0x00000040 )
+#define LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION ( 0x00000080 )
+
struct lsa_TrustDomainInfoName {
struct lsa_StringLarge netbios_name;
};
+struct lsa_TrustDomainInfoControllers {
+ uint32_t entries;
+ struct lsa_StringLarge *netbios_names;/* [unique,size_is(entries)] */
+};
+
struct lsa_TrustDomainInfoPosixOffset {
uint32_t posix_offset;
};
@@ -418,13 +494,30 @@ struct lsa_TrustDomainInfoInfoEx {
struct lsa_StringLarge netbios_name;
struct dom_sid2 *sid;/* [unique] */
uint32_t trust_direction;
- uint32_t trust_type;
+ enum lsa_TrustType trust_type;
uint32_t trust_attributes;
};
+enum lsa_TrustAuthType
+#ifndef USE_UINT_ENUMS
+ {
+ TRUST_AUTH_TYPE_NONE=0,
+ TRUST_AUTH_TYPE_NT4OWF=1,
+ TRUST_AUTH_TYPE_CLEAR=2,
+ TRUST_AUTH_TYPE_VERSION=3
+}
+#else
+ { __donnot_use_enum_lsa_TrustAuthType=0x7FFFFFFF}
+#define TRUST_AUTH_TYPE_NONE ( 0 )
+#define TRUST_AUTH_TYPE_NT4OWF ( 1 )
+#define TRUST_AUTH_TYPE_CLEAR ( 2 )
+#define TRUST_AUTH_TYPE_VERSION ( 3 )
+#endif
+;
+
struct lsa_TrustDomainInfoBuffer {
NTTIME last_update_time;
- uint32_t secret_type;
+ enum lsa_TrustAuthType AuthType;
struct lsa_DATA_BUF2 data;
};
@@ -443,28 +536,46 @@ struct lsa_TrustDomainInfoFullInfo {
struct lsa_TrustDomainInfoAuthInfo auth_info;
};
-struct lsa_TrustDomainInfo11 {
+struct lsa_TrustDomainInfoAuthInfoInternal {
+ struct lsa_DATA_BUF2 auth_blob;
+};
+
+struct lsa_TrustDomainInfoFullInfoInternal {
struct lsa_TrustDomainInfoInfoEx info_ex;
- struct lsa_DATA_BUF2 data1;
+ struct lsa_TrustDomainInfoPosixOffset posix_offset;
+ struct lsa_TrustDomainInfoAuthInfoInternal auth_info;
};
-struct lsa_TrustDomainInfoInfoAll {
+struct lsa_TrustDomainInfoInfoEx2Internal {
struct lsa_TrustDomainInfoInfoEx info_ex;
- struct lsa_DATA_BUF2 data1;
+ uint32_t forest_trust_length;
+ uint8_t *forest_trust_data;/* [unique,size_is(forest_trust_length)] */
+};
+
+struct lsa_TrustDomainInfoFullInfo2Internal {
+ struct lsa_TrustDomainInfoInfoEx2Internal info;
struct lsa_TrustDomainInfoPosixOffset posix_offset;
struct lsa_TrustDomainInfoAuthInfo auth_info;
};
+struct lsa_TrustDomainInfoSupportedEncTypes {
+ uint32_t enc_types;
+};
+
union lsa_TrustedDomainInfo {
struct lsa_TrustDomainInfoName name;/* [case(LSA_TRUSTED_DOMAIN_INFO_NAME)] */
+ struct lsa_TrustDomainInfoControllers controllers;/* [case(LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS)] */
struct lsa_TrustDomainInfoPosixOffset posix_offset;/* [case(LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET)] */
struct lsa_TrustDomainInfoPassword password;/* [case(LSA_TRUSTED_DOMAIN_INFO_PASSWORD)] */
struct lsa_TrustDomainInfoBasic info_basic;/* [case(LSA_TRUSTED_DOMAIN_INFO_BASIC)] */
struct lsa_TrustDomainInfoInfoEx info_ex;/* [case(LSA_TRUSTED_DOMAIN_INFO_INFO_EX)] */
struct lsa_TrustDomainInfoAuthInfo auth_info;/* [case(LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO)] */
struct lsa_TrustDomainInfoFullInfo full_info;/* [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)] */
- struct lsa_TrustDomainInfo11 info11;/* [case(LSA_TRUSTED_DOMAIN_INFO_11)] */
- struct lsa_TrustDomainInfoInfoAll info_all;/* [case(LSA_TRUSTED_DOMAIN_INFO_INFO_ALL)] */
+ struct lsa_TrustDomainInfoAuthInfoInternal auth_info_internal;/* [case(LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL)] */
+ struct lsa_TrustDomainInfoFullInfoInternal full_info_internal;/* [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL)] */
+ struct lsa_TrustDomainInfoInfoEx2Internal info_ex2_internal;/* [case(LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL)] */
+ struct lsa_TrustDomainInfoFullInfo2Internal full_info2_internal;/* [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL)] */
+ struct lsa_TrustDomainInfoSupportedEncTypes enc_types;/* [case(LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES)] */
}/* [switch_type(lsa_TrustDomInfoEnum)] */;
struct lsa_DATA_BUF_PTR {
@@ -545,7 +656,7 @@ struct lsa_TranslatedSid3 {
enum lsa_SidType sid_type;
struct dom_sid2 *sid;/* [unique] */
uint32_t sid_index;
- uint32_t unknown;
+ uint32_t flags;
};
struct lsa_TransSidArray3 {
@@ -762,7 +873,7 @@ struct lsa_EnumAccounts {
struct lsa_CreateTrustedDomain {
struct {
- struct policy_handle *handle;/* [ref] */
+ struct policy_handle *policy_handle;/* [ref] */
struct lsa_DomainInfo *info;/* [ref] */
uint32_t access_mask;
} in;
@@ -973,6 +1084,12 @@ struct lsa_QueryTrustedDomainInfo {
struct lsa_SetInformationTrustedDomain {
struct {
+ struct policy_handle *trustdom_handle;/* [ref] */
+ enum lsa_TrustDomInfoEnum level;
+ union lsa_TrustedDomainInfo *info;/* [ref,switch_is(level)] */
+ } in;
+
+ struct {
NTSTATUS result;
} out;
@@ -1160,6 +1277,13 @@ struct lsa_QueryTrustedDomainInfoBySid {
struct lsa_SetTrustedDomainInfo {
struct {
+ struct policy_handle *handle;/* [ref] */
+ struct dom_sid2 *dom_sid;/* [ref] */
+ enum lsa_TrustDomInfoEnum level;
+ union lsa_TrustedDomainInfo *info;/* [ref,switch_is(level)] */
+ } in;
+
+ struct {
NTSTATUS result;
} out;
@@ -1302,6 +1426,14 @@ struct lsa_EnumTrustedDomainsEx {
struct lsa_CreateTrustedDomainEx {
struct {
+ struct policy_handle *policy_handle;/* [ref] */
+ struct lsa_TrustDomainInfoInfoEx *info;/* [ref] */
+ struct lsa_TrustDomainInfoAuthInfoInternal *auth_info;/* [ref] */
+ uint32_t access_mask;
+ } in;
+
+ struct {
+ struct policy_handle *trustdom_handle;/* [ref] */
NTSTATUS result;
} out;
@@ -1399,8 +1531,8 @@ struct lsa_LookupNames2 {
uint32_t num_names;/* [range(0,1000)] */
struct lsa_String *names;/* [size_is(num_names)] */
enum lsa_LookupNamesLevel level;
- uint32_t unknown1;
- uint32_t unknown2;
+ uint32_t lookup_options;
+ uint32_t client_revision;
struct lsa_TransSidArray2 *sids;/* [ref] */
uint32_t *count;/* [ref] */
} in;
@@ -1417,6 +1549,14 @@ struct lsa_LookupNames2 {
struct lsa_CreateTrustedDomainEx2 {
struct {
+ struct policy_handle *policy_handle;/* [ref] */
+ struct lsa_TrustDomainInfoInfoEx *info;/* [ref] */
+ struct lsa_TrustDomainInfoAuthInfoInternal *auth_info;/* [ref] */
+ uint32_t access_mask;
+ } in;
+
+ struct {
+ struct policy_handle *trustdom_handle;/* [ref] */
NTSTATUS result;
} out;
@@ -1493,8 +1633,8 @@ struct lsa_LookupNames3 {
uint32_t num_names;/* [range(0,1000)] */
struct lsa_String *names;/* [size_is(num_names)] */
enum lsa_LookupNamesLevel level;
- uint32_t unknown1;
- uint32_t unknown2;
+ uint32_t lookup_options;
+ uint32_t client_revision;
struct lsa_TransSidArray3 *sids;/* [ref] */
uint32_t *count;/* [ref] */
} in;
@@ -1597,8 +1737,8 @@ struct lsa_LookupNames4 {
uint32_t num_names;/* [range(0,1000)] */
struct lsa_String *names;/* [size_is(num_names)] */
enum lsa_LookupNamesLevel level;
- uint32_t unknown1;
- uint32_t unknown2;
+ uint32_t lookup_options;
+ uint32_t client_revision;
struct lsa_TransSidArray3 *sids;/* [ref] */
uint32_t *count;/* [ref] */
} in;
diff --git a/source3/librpc/gen_ndr/misc.h b/source3/librpc/gen_ndr/misc.h
index 4fa7415db7..b3740faf34 100644
--- a/source3/librpc/gen_ndr/misc.h
+++ b/source3/librpc/gen_ndr/misc.h
@@ -26,13 +26,17 @@ struct policy_handle {
enum netr_SchannelType
#ifndef USE_UINT_ENUMS
{
+ SEC_CHAN_NULL=0,
SEC_CHAN_WKSTA=2,
+ SEC_CHAN_DNS_DOMAIN=3,
SEC_CHAN_DOMAIN=4,
SEC_CHAN_BDC=6
}
#else
{ __donnot_use_enum_netr_SchannelType=0x7FFFFFFF}
+#define SEC_CHAN_NULL ( 0 )
#define SEC_CHAN_WKSTA ( 2 )
+#define SEC_CHAN_DNS_DOMAIN ( 3 )
#define SEC_CHAN_DOMAIN ( 4 )
#define SEC_CHAN_BDC ( 6 )
#endif
diff --git a/source3/librpc/gen_ndr/nbt.h b/source3/librpc/gen_ndr/nbt.h
index 62ad524a91..4b872d7936 100644
--- a/source3/librpc/gen_ndr/nbt.h
+++ b/source3/librpc/gen_ndr/nbt.h
@@ -221,15 +221,15 @@ union nbt_rdata {
struct nbt_rdata_netbios netbios;/* [case(NBT_QTYPE_NETBIOS)] */
struct nbt_rdata_status status;/* [case(NBT_QTYPE_STATUS)] */
struct nbt_rdata_data data;/* [default] */
-}/* [nodiscriminant] */;
+}/* [nodiscriminant,public] */;
struct nbt_res_rec {
struct nbt_name name;
enum nbt_qtype rr_type;
enum nbt_qclass rr_class;
uint32_t ttl;
- union nbt_rdata rdata;/* [switch_is(((((rr_type)==NBT_QTYPE_NETBIOS)&&talloc_check_name(ndr,"struct ndr_push")&&((rdata).data.length==2))?0:rr_type))] */
-}/* [flag(LIBNDR_PRINT_ARRAY_HEX)] */;
+ union nbt_rdata rdata;/* [switch_is(rr_type)] */
+}/* [nopush,flag(LIBNDR_PRINT_ARRAY_HEX)] */;
struct nbt_name_packet {
uint16_t name_trn_id;
@@ -390,69 +390,11 @@ struct nbt_dgram_packet {
union dgram_data data;/* [switch_is(msg_type)] */
}/* [public,flag(LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_BIGENDIAN|LIBNDR_PRINT_ARRAY_HEX)] */;
-enum nbt_netlogon_command
-#ifndef USE_UINT_ENUMS
- {
- NETLOGON_QUERY_FOR_PDC=0x7,
- NETLOGON_ANNOUNCE_UAS=0xa,
- NETLOGON_RESPONSE_FROM_PDC=0xc,
- NETLOGON_QUERY_FOR_PDC2=0x12,
- NETLOGON_RESPONSE_FROM_PDC2=0x17,
- NETLOGON_RESPONSE_FROM_PDC_USER=0x19
-}
-#else
- { __donnot_use_enum_nbt_netlogon_command=0x7FFFFFFF}
-#define NETLOGON_QUERY_FOR_PDC ( 0x7 )
-#define NETLOGON_ANNOUNCE_UAS ( 0xa )
-#define NETLOGON_RESPONSE_FROM_PDC ( 0xc )
-#define NETLOGON_QUERY_FOR_PDC2 ( 0x12 )
-#define NETLOGON_RESPONSE_FROM_PDC2 ( 0x17 )
-#define NETLOGON_RESPONSE_FROM_PDC_USER ( 0x19 )
-#endif
-;
-
-/* bitmap nbt_netlogon_version */
-#define NETLOGON_VERSION_1 ( 0x00000001 )
-#define NETLOGON_VERSION_5 ( 0x00000002 )
-#define NETLOGON_VERSION_5EX ( 0x00000004 )
-#define NETLOGON_VERSION_5EX_WITH_IP ( 0x00000008 )
-#define NETLOGON_VERSION_WITH_CLOSEST_SITE ( 0x00000010 )
-#define NETLOGON_VERSION_AVOID_NT4_EMUL ( 0x01000000 )
-#define NETLOGON_VERSION_PDC ( 0x10000000 )
-#define NETLOGON_VERSION_IP ( 0x20000000 )
-#define NETLOGON_VERSION_LOCAL ( 0x40000000 )
-#define NETLOGON_VERSION_GC ( 0x80000000 )
-
-struct nbt_netlogon_query_for_pdc {
- const char * computer_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
- const char * mailslot_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
- DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN2)] */
- const char * unicode_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
- uint32_t nt_version;
- uint16_t lmnt_token;
- uint16_t lm20_token;
-};
-
-struct nbt_netlogon_query_for_pdc2 {
- uint16_t request_count;
- const char * computer_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
- const char * user_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
- const char * mailslot_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
- uint32_t unknown[2];
- uint32_t nt_version;
- uint16_t lmnt_token;
- uint16_t lm20_token;
-};
-
-struct nbt_netlogon_response_from_pdc {
- const char * pdc_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
- DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN2)] */
- const char * unicode_pdc_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
- const char * domain_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
- uint32_t nt_version;
- uint16_t lmnt_token;
- uint16_t lm20_token;
-};
+struct nbt_sockaddr {
+ uint32_t sockaddr_family;
+ const char * pdc_ip;/* [flag(LIBNDR_FLAG_BIGENDIAN)] */
+ DATA_BLOB remaining;/* [flag(LIBNDR_FLAG_REMAINING)] */
+}/* [gensize,public] */;
/* bitmap nbt_server_type */
#define NBT_SERVER_PDC ( 0x00000001 )
@@ -468,157 +410,90 @@ struct nbt_netlogon_response_from_pdc {
#define NBT_SERVER_SELECT_SECRET_DOMAIN_6 ( 0x00000800 )
#define NBT_SERVER_FULL_SECRET_DOMAIN_6 ( 0x00001000 )
-struct nbt_dc_sock_addr {
- uint32_t family;
- const char * pdc_ip;/* [flag(LIBNDR_FLAG_BIGENDIAN)] */
- DATA_BLOB remaining;/* [flag(LIBNDR_FLAG_REMAINING)] */
-};
-
-struct nbt_netlogon_response_from_pdc2 {
- DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN4)] */
- uint32_t server_type;
- struct GUID domain_uuid;
- const char * forest;
- const char * dns_domain;
- const char * pdc_dns_name;
- const char * domain;
- const char * pdc_name;
- const char * user_name;
- const char * server_site;
- const char * client_site;
- uint8_t dc_sock_addr_size;
- struct nbt_dc_sock_addr dc_sock_addr;/* [subcontext_size(dc_sock_addr_size),subcontext(0)] */
- uint32_t nt_version;
- uint16_t lmnt_token;
- uint16_t lm20_token;
-};
-
-enum netr_SamDatabaseID;
-
-struct nbt_db_change {
- enum netr_SamDatabaseID db_index;
- uint64_t serial;
- NTTIME timestamp;
-};
+/* bitmap netlogon_nt_version_flags */
+#define NETLOGON_NT_VERSION_1 ( 0x00000001 )
+#define NETLOGON_NT_VERSION_5 ( 0x00000002 )
+#define NETLOGON_NT_VERSION_5EX ( 0x00000004 )
+#define NETLOGON_NT_VERSION_5EX_WITH_IP ( 0x00000008 )
+#define NETLOGON_NT_VERSION_WITH_CLOSEST_SITE ( 0x00000010 )
+#define NETLOGON_NT_VERSION_AVIOD_NT4EMUL ( 0x01000000 )
+#define NETLOGON_NT_VERSION_PDC ( 0x10000000 )
+#define NETLOGON_NT_VERSION_IP ( 0x20000000 )
+#define NETLOGON_NT_VERSION_LOCAL ( 0x40000000 )
+#define NETLOGON_NT_VERSION_GC ( 0x80000000 )
+
+enum netlogon_command
+#ifndef USE_UINT_ENUMS
+ {
+ LOGON_PRIMARY_QUERY=7,
+ NETLOGON_ANNOUNCE_UAS=10,
+ NETLOGON_RESPONSE_FROM_PDC=12,
+ LOGON_SAM_LOGON_REQUEST=18,
+ LOGON_SAM_LOGON_RESPONSE=19,
+ LOGON_SAM_LOGON_PAUSE_RESPONSE=20,
+ LOGON_SAM_LOGON_USER_UNKNOWN=21,
+ LOGON_SAM_LOGON_RESPONSE_EX=23,
+ LOGON_SAM_LOGON_PAUSE_RESPONSE_EX=24,
+ LOGON_SAM_LOGON_USER_UNKNOWN_EX=25
+}
+#else
+ { __donnot_use_enum_netlogon_command=0x7FFFFFFF}
+#define LOGON_PRIMARY_QUERY ( 7 )
+#define NETLOGON_ANNOUNCE_UAS ( 10 )
+#define NETLOGON_RESPONSE_FROM_PDC ( 12 )
+#define LOGON_SAM_LOGON_REQUEST ( 18 )
+#define LOGON_SAM_LOGON_RESPONSE ( 19 )
+#define LOGON_SAM_LOGON_PAUSE_RESPONSE ( 20 )
+#define LOGON_SAM_LOGON_USER_UNKNOWN ( 21 )
+#define LOGON_SAM_LOGON_RESPONSE_EX ( 23 )
+#define LOGON_SAM_LOGON_PAUSE_RESPONSE_EX ( 24 )
+#define LOGON_SAM_LOGON_USER_UNKNOWN_EX ( 25 )
+#endif
+;
-struct nbt_netlogon_announce_uas {
- uint32_t serial_lo;
- time_t timestamp;
- uint32_t pulse;
- uint32_t random;
- const char * pdc_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
- const char * domain;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
- DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN2)] */
- const char * unicode_pdc_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
- const char * unicode_domain;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
- uint32_t db_count;
- struct nbt_db_change *dbchange;
+struct NETLOGON_SAM_LOGON_REQUEST {
+ uint16_t request_count;
+ const char * computer_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * user_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * mailslot_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
+ uint32_t acct_control;
uint32_t sid_size;/* [value(ndr_size_dom_sid0(&sid,ndr->flags))] */
+ DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN4)] */
struct dom_sid0 sid;/* [subcontext_size(sid_size),subcontext(0)] */
uint32_t nt_version;
uint16_t lmnt_token;
uint16_t lm20_token;
-};
+}/* [nopull,nopush] */;
-union nbt_netlogon_request {
- struct nbt_netlogon_query_for_pdc pdc;/* [case(NETLOGON_QUERY_FOR_PDC)] */
- struct nbt_netlogon_query_for_pdc2 pdc2;/* [case(NETLOGON_QUERY_FOR_PDC2)] */
- struct nbt_netlogon_announce_uas uas;/* [case(NETLOGON_ANNOUNCE_UAS)] */
- struct nbt_netlogon_response_from_pdc response;/* [case(NETLOGON_RESPONSE_FROM_PDC)] */
- struct nbt_netlogon_response_from_pdc2 response2;/* [case(NETLOGON_RESPONSE_FROM_PDC2)] */
-}/* [nodiscriminant] */;
-
-struct nbt_netlogon_packet {
- enum nbt_netlogon_command command;
- union nbt_netlogon_request req;/* [switch_is(command)] */
-}/* [public,flag(LIBNDR_FLAG_NOALIGN)] */;
-
-struct nbt_cldap_netlogon_1 {
- enum nbt_netlogon_command type;
- const char * pdc_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+struct NETLOGON_SAM_LOGON_RESPONSE_NT40 {
+ enum netlogon_command command;
+ const char * server;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
const char * user_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
- const char * domain_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
- uint32_t nt_version;/* [value] */
+ const char * domain;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ uint32_t nt_version;
uint16_t lmnt_token;
uint16_t lm20_token;
-};
+}/* [public,flag(LIBNDR_FLAG_NOALIGN)] */;
-struct nbt_cldap_netlogon_3 {
- enum nbt_netlogon_command type;
+struct NETLOGON_SAM_LOGON_RESPONSE {
+ enum netlogon_command command;
const char * pdc_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
const char * user_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
const char * domain_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
struct GUID domain_uuid;
- struct GUID unknown_uuid;
+ struct GUID zero_uuid;
const char * forest;
const char * dns_domain;
const char * pdc_dns_name;
const char * pdc_ip;
uint32_t server_type;
- uint32_t nt_version;/* [value(3)] */
- uint16_t lmnt_token;
- uint16_t lm20_token;
-};
-
-struct nbt_cldap_netlogon_5 {
- enum nbt_netlogon_command type;
- uint16_t sbz;
- uint32_t server_type;
- struct GUID domain_uuid;
- const char * forest;
- const char * dns_domain;
- const char * pdc_dns_name;
- const char * domain;
- const char * pdc_name;
- const char * user_name;
- const char * server_site;
- const char * client_site;
- uint32_t nt_version;/* [value(5)] */
- uint16_t lmnt_token;
- uint16_t lm20_token;
-}/* [public] */;
-
-struct nbt_cldap_netlogon_13 {
- enum nbt_netlogon_command type;
- uint16_t sbz;
- uint32_t server_type;
- struct GUID domain_uuid;
- const char * forest;
- const char * dns_domain;
- const char * pdc_dns_name;
- const char * domain;
- const char * pdc_name;
- const char * user_name;
- const char * server_site;
- const char * client_site;
- uint8_t dc_sock_addr_size;
- struct nbt_dc_sock_addr dc_sock_addr;/* [subcontext_size(dc_sock_addr_size),subcontext(0)] */
- uint32_t nt_version;/* [value(13)] */
- uint16_t lmnt_token;
- uint16_t lm20_token;
-};
-
-struct nbt_cldap_netlogon_15 {
- enum nbt_netlogon_command type;
- uint16_t sbz;
- uint32_t server_type;
- struct GUID domain_uuid;
- const char * forest;
- const char * dns_domain;
- const char * pdc_dns_name;
- const char * domain;
- const char * pdc_name;
- const char * user_name;
- const char * server_site;
- const char * client_site;
- const char * next_closest_site;
- uint32_t nt_version;/* [value(15)] */
+ uint32_t nt_version;
uint16_t lmnt_token;
uint16_t lm20_token;
-}/* [public] */;
+}/* [public,flag(LIBNDR_FLAG_NOALIGN)] */;
-struct nbt_cldap_netlogon_29 {
- enum nbt_netlogon_command type;
+struct NETLOGON_SAM_LOGON_RESPONSE_EX {
+ enum netlogon_command command;
uint16_t sbz;
uint32_t server_type;
struct GUID domain_uuid;
@@ -630,71 +505,70 @@ struct nbt_cldap_netlogon_29 {
const char * user_name;
const char * server_site;
const char * client_site;
- uint8_t dc_sock_addr_size;
- struct nbt_dc_sock_addr dc_sock_addr;/* [subcontext_size(dc_sock_addr_size),subcontext(0)] */
+ uint8_t sockaddr_size;/* [value(ndr_size_nbt_sockaddr(&sockaddr,ndr->flags))] */
+ struct nbt_sockaddr sockaddr;/* [subcontext_size(sockaddr_size),subcontext(0)] */
const char * next_closest_site;
- uint32_t nt_version;/* [value(29)] */
+ uint32_t nt_version;
uint16_t lmnt_token;
uint16_t lm20_token;
-}/* [public] */;
-
-union nbt_cldap_netlogon {
- struct nbt_cldap_netlogon_1 logon1;/* [case(0)] */
- struct nbt_cldap_netlogon_3 logon3;/* [case(2)] */
- struct nbt_cldap_netlogon_5 logon5;/* [case(4)] */
- struct nbt_cldap_netlogon_13 logon13;/* [case(8)] */
- struct nbt_cldap_netlogon_15 logon15;/* [case(20)] */
- struct nbt_cldap_netlogon_29 logon29;/* [case(29)] */
-}/* [public,nodiscriminant,flag(LIBNDR_FLAG_NOALIGN)] */;
-
-enum nbt_ntlogon_command
-#ifndef USE_UINT_ENUMS
- {
- NTLOGON_SAM_LOGON=0x12,
- NTLOGON_SAM_LOGON_REPLY=0x13,
- NTLOGON_SAM_LOGON_REPLY15=0x15,
- NTLOGON_RESPONSE_FROM_PDC2=0x17
-}
-#else
- { __donnot_use_enum_nbt_ntlogon_command=0x7FFFFFFF}
-#define NTLOGON_SAM_LOGON ( 0x12 )
-#define NTLOGON_SAM_LOGON_REPLY ( 0x13 )
-#define NTLOGON_SAM_LOGON_REPLY15 ( 0x15 )
-#define NTLOGON_RESPONSE_FROM_PDC2 ( 0x17 )
-#endif
-;
+}/* [public,flag(LIBNDR_FLAG_NOALIGN)] */;
-struct nbt_ntlogon_sam_logon {
- uint16_t request_count;
- const char * computer_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
- const char * user_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+struct nbt_netlogon_query_for_pdc {
+ const char * computer_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
const char * mailslot_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
- uint32_t acct_control;
- uint32_t sid_size;/* [value(ndr_size_dom_sid0(&sid,ndr->flags))] */
- struct dom_sid0 sid;/* [subcontext_size(sid_size),subcontext(0)] */
+ DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN2)] */
+ const char * unicode_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
uint32_t nt_version;
uint16_t lmnt_token;
uint16_t lm20_token;
};
-struct nbt_ntlogon_sam_logon_reply {
- const char * server;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
- const char * user_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
- const char * domain;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+struct nbt_netlogon_response_from_pdc {
+ enum netlogon_command command;
+ const char * pdc_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
+ DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN2)] */
+ const char * unicode_pdc_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * domain_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
uint32_t nt_version;
uint16_t lmnt_token;
uint16_t lm20_token;
+}/* [public,flag(LIBNDR_FLAG_NOALIGN)] */;
+
+enum netr_SamDatabaseID;
+
+struct nbt_db_change_info {
+ enum netr_SamDatabaseID db_index;
+ uint64_t serial;
+ NTTIME timestamp;
+};
+
+struct NETLOGON_DB_CHANGE {
+ uint32_t serial_lo;
+ time_t timestamp;
+ uint32_t pulse;
+ uint32_t random;
+ const char * pdc_name;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * domain;/* [flag(LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM)] */
+ DATA_BLOB _pad;/* [flag(LIBNDR_FLAG_ALIGN2)] */
+ const char * unicode_pdc_name;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ const char * unicode_domain;/* [flag(LIBNDR_FLAG_STR_NULLTERM)] */
+ uint32_t db_count;
+ struct nbt_db_change_info *dbchange;
+ uint32_t sid_size;/* [value(ndr_size_dom_sid0(&sid,ndr->flags))] */
+ struct dom_sid0 sid;/* [subcontext_size(sid_size),subcontext(0)] */
+ uint32_t message_format_version;
+ uint32_t message_token;
};
-union nbt_ntlogon_request {
- struct nbt_ntlogon_sam_logon logon;/* [case(NTLOGON_SAM_LOGON)] */
- struct nbt_ntlogon_sam_logon_reply reply;/* [case(NTLOGON_SAM_LOGON_REPLY)] */
- struct nbt_netlogon_response_from_pdc2 reply2;/* [case(NTLOGON_RESPONSE_FROM_PDC2)] */
+union nbt_netlogon_request {
+ struct NETLOGON_SAM_LOGON_REQUEST logon;/* [case(LOGON_SAM_LOGON_REQUEST)] */
+ struct nbt_netlogon_query_for_pdc pdc;/* [case(LOGON_PRIMARY_QUERY)] */
+ struct NETLOGON_DB_CHANGE uas;/* [case(NETLOGON_ANNOUNCE_UAS)] */
}/* [nodiscriminant] */;
-struct nbt_ntlogon_packet {
- enum nbt_ntlogon_command command;
- union nbt_ntlogon_request req;/* [switch_is(command)] */
+struct nbt_netlogon_packet {
+ enum netlogon_command command;
+ union nbt_netlogon_request req;/* [switch_is(command)] */
}/* [public,flag(LIBNDR_FLAG_NOALIGN)] */;
enum nbt_browse_opcode
diff --git a/source3/librpc/gen_ndr/ndr_dfs.c b/source3/librpc/gen_ndr/ndr_dfs.c
index de3ac48c00..75a0d4b755 100644
--- a/source3/librpc/gen_ndr/ndr_dfs.c
+++ b/source3/librpc/gen_ndr/ndr_dfs.c
@@ -3,6 +3,7 @@
#include "includes.h"
#include "librpc/gen_ndr/ndr_dfs.h"
+#include "librpc/gen_ndr/ndr_misc.h"
static enum ndr_err_code ndr_push_dfs_ManagerVersion(struct ndr_push *ndr, int ndr_flags, enum dfs_ManagerVersion r)
{
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
@@ -544,7 +545,6 @@ static enum ndr_err_code ndr_push_dfs_Info4(struct ndr_push *ndr, int ndr_flags,
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->comment, CH_UTF16)));
NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->comment, ndr_charset_length(r->comment, CH_UTF16), sizeof(uint16_t), CH_UTF16));
}
- NDR_CHECK(ndr_push_GUID(ndr, NDR_BUFFERS, &r->guid));
if (r->stores) {
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_stores));
for (cntr_stores_1 = 0; cntr_stores_1 < r->num_stores; cntr_stores_1++) {
@@ -618,7 +618,6 @@ static enum ndr_err_code ndr_pull_dfs_Info4(struct ndr_pull *ndr, int ndr_flags,
NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->comment, ndr_get_array_length(ndr, &r->comment), sizeof(uint16_t), CH_UTF16));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_comment_0, 0);
}
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_BUFFERS, &r->guid));
if (r->stores) {
_mem_save_stores_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->stores, 0);
@@ -733,7 +732,6 @@ static enum ndr_err_code ndr_push_dfs_Info5(struct ndr_push *ndr, int ndr_flags,
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->comment, CH_UTF16)));
NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->comment, ndr_charset_length(r->comment, CH_UTF16), sizeof(uint16_t), CH_UTF16));
}
- NDR_CHECK(ndr_push_GUID(ndr, NDR_BUFFERS, &r->guid));
}
return NDR_ERR_SUCCESS;
}
@@ -790,7 +788,6 @@ static enum ndr_err_code ndr_pull_dfs_Info5(struct ndr_pull *ndr, int ndr_flags,
NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->comment, ndr_get_array_length(ndr, &r->comment), sizeof(uint16_t), CH_UTF16));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_comment_0, 0);
}
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_BUFFERS, &r->guid));
}
return NDR_ERR_SUCCESS;
}
@@ -948,7 +945,6 @@ static enum ndr_err_code ndr_push_dfs_Info6(struct ndr_push *ndr, int ndr_flags,
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->comment, CH_UTF16)));
NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->comment, ndr_charset_length(r->comment, CH_UTF16), sizeof(uint16_t), CH_UTF16));
}
- NDR_CHECK(ndr_push_GUID(ndr, NDR_BUFFERS, &r->guid));
if (r->stores) {
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_stores));
for (cntr_stores_1 = 0; cntr_stores_1 < r->num_stores; cntr_stores_1++) {
@@ -1024,7 +1020,6 @@ static enum ndr_err_code ndr_pull_dfs_Info6(struct ndr_pull *ndr, int ndr_flags,
NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->comment, ndr_get_array_length(ndr, &r->comment), sizeof(uint16_t), CH_UTF16));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_comment_0, 0);
}
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_BUFFERS, &r->guid));
if (r->stores) {
_mem_save_stores_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->stores, 0);
@@ -1096,7 +1091,6 @@ static enum ndr_err_code ndr_push_dfs_Info7(struct ndr_push *ndr, int ndr_flags,
NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->generation_guid));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_push_GUID(ndr, NDR_BUFFERS, &r->generation_guid));
}
return NDR_ERR_SUCCESS;
}
@@ -1108,7 +1102,6 @@ static enum ndr_err_code ndr_pull_dfs_Info7(struct ndr_pull *ndr, int ndr_flags,
NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->generation_guid));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_BUFFERS, &r->generation_guid));
}
return NDR_ERR_SUCCESS;
}
@@ -1671,7 +1664,7 @@ static enum ndr_err_code ndr_push_dfs_Info(struct ndr_push *ndr, int ndr_flags,
case 7:
if (r->info7) {
- NDR_CHECK(ndr_push_dfs_Info7(ndr, NDR_SCALARS|NDR_BUFFERS, r->info7));
+ NDR_CHECK(ndr_push_dfs_Info7(ndr, NDR_SCALARS, r->info7));
}
break;
@@ -1973,7 +1966,7 @@ static enum ndr_err_code ndr_pull_dfs_Info(struct ndr_pull *ndr, int ndr_flags,
if (r->info7) {
_mem_save_info7_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->info7, 0);
- NDR_CHECK(ndr_pull_dfs_Info7(ndr, NDR_SCALARS|NDR_BUFFERS, r->info7));
+ NDR_CHECK(ndr_pull_dfs_Info7(ndr, NDR_SCALARS, r->info7));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info7_0, 0);
}
break;
diff --git a/source3/librpc/gen_ndr/ndr_drsblobs.c b/source3/librpc/gen_ndr/ndr_drsblobs.c
index 41a448cbe3..dd8d77ea15 100644
--- a/source3/librpc/gen_ndr/ndr_drsblobs.c
+++ b/source3/librpc/gen_ndr/ndr_drsblobs.c
@@ -5,6 +5,8 @@
#include "librpc/gen_ndr/ndr_drsuapi.h"
#include "librpc/gen_ndr/ndr_misc.h"
+#include "librpc/gen_ndr/ndr_samr.h"
+#include "librpc/gen_ndr/ndr_lsa.h"
static enum ndr_err_code ndr_push_replPropertyMetaData1(struct ndr_push *ndr, int ndr_flags, const struct replPropertyMetaData1 *r)
{
if (ndr_flags & NDR_SCALARS) {
@@ -2165,10 +2167,10 @@ _PUBLIC_ enum ndr_err_code ndr_push_package_PrimaryCLEARTEXTBlob(struct ndr_push
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_NOTERM|LIBNDR_FLAG_REMAINING);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->cleartext));
- ndr->flags = _flags_save_string;
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+ NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->cleartext));
+ ndr->flags = _flags_save_DATA_BLOB;
}
}
if (ndr_flags & NDR_BUFFERS) {
@@ -2181,10 +2183,10 @@ _PUBLIC_ enum ndr_err_code ndr_pull_package_PrimaryCLEARTEXTBlob(struct ndr_pull
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_NOTERM|LIBNDR_FLAG_REMAINING);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->cleartext));
- ndr->flags = _flags_save_string;
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+ NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->cleartext));
+ ndr->flags = _flags_save_DATA_BLOB;
}
}
if (ndr_flags & NDR_BUFFERS) {
@@ -2196,7 +2198,7 @@ _PUBLIC_ void ndr_print_package_PrimaryCLEARTEXTBlob(struct ndr_print *ndr, cons
{
ndr_print_struct(ndr, name, "package_PrimaryCLEARTEXTBlob");
ndr->depth++;
- ndr_print_string(ndr, "cleartext", r->cleartext);
+ ndr_print_DATA_BLOB(ndr, "cleartext", r->cleartext);
ndr->depth--;
}
@@ -2311,13 +2313,269 @@ _PUBLIC_ void ndr_print_package_PrimaryWDigestBlob(struct ndr_print *ndr, const
ndr->depth--;
}
-static enum ndr_err_code ndr_push_trustAuthInOutSecret1(struct ndr_push *ndr, int ndr_flags, const struct trustAuthInOutSecret1 *r)
+static enum ndr_err_code ndr_push_AuthInfoNone(struct ndr_push *ndr, int ndr_flags, const struct AuthInfoNone *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_AuthInfoNone(struct ndr_pull *ndr, int ndr_flags, struct AuthInfoNone *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_AuthInfoNone(struct ndr_print *ndr, const char *name, const struct AuthInfoNone *r)
+{
+ ndr_print_struct(ndr, name, "AuthInfoNone");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?0:r->size);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_AuthInfoNT4Owf(struct ndr_push *ndr, int ndr_flags, const struct AuthInfoNT4Owf *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 16));
+ NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, &r->password));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_push_samr_Password(ndr, NDR_BUFFERS, &r->password));
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_AuthInfoNT4Owf(struct ndr_pull *ndr, int ndr_flags, struct AuthInfoNT4Owf *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size));
+ NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, &r->password));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_BUFFERS, &r->password));
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_AuthInfoNT4Owf(struct ndr_print *ndr, const char *name, const struct AuthInfoNT4Owf *r)
+{
+ ndr_print_struct(ndr, name, "AuthInfoNT4Owf");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?16:r->size);
+ ndr_print_samr_Password(ndr, "password", &r->password);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_AuthInfoClear(struct ndr_push *ndr, int ndr_flags, const struct AuthInfoClear *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->password, r->size));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_AuthInfoClear(struct ndr_pull *ndr, int ndr_flags, struct AuthInfoClear *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size));
+ NDR_PULL_ALLOC_N(ndr, r->password, r->size);
+ NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->password, r->size));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_AuthInfoClear(struct ndr_print *ndr, const char *name, const struct AuthInfoClear *r)
+{
+ ndr_print_struct(ndr, name, "AuthInfoClear");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "size", r->size);
+ ndr_print_array_uint8(ndr, "password", r->password, r->size);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_AuthInfoVersion(struct ndr_push *ndr, int ndr_flags, const struct AuthInfoVersion *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->time1));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown1));
- NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->value));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->version));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_AuthInfoVersion(struct ndr_pull *ndr, int ndr_flags, struct AuthInfoVersion *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->version));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_AuthInfoVersion(struct ndr_print *ndr, const char *name, const struct AuthInfoVersion *r)
+{
+ ndr_print_struct(ndr, name, "AuthInfoVersion");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?4:r->size);
+ ndr_print_uint32(ndr, "version", r->version);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_AuthInfo(struct ndr_push *ndr, int ndr_flags, const union AuthInfo *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ int level = ndr_push_get_switch_value(ndr, r);
+ switch (level) {
+ case TRUST_AUTH_TYPE_NONE: {
+ NDR_CHECK(ndr_push_AuthInfoNone(ndr, NDR_SCALARS, &r->none));
+ break; }
+
+ case TRUST_AUTH_TYPE_NT4OWF: {
+ NDR_CHECK(ndr_push_AuthInfoNT4Owf(ndr, NDR_SCALARS, &r->nt4owf));
+ break; }
+
+ case TRUST_AUTH_TYPE_CLEAR: {
+ NDR_CHECK(ndr_push_AuthInfoClear(ndr, NDR_SCALARS, &r->clear));
+ break; }
+
+ case TRUST_AUTH_TYPE_VERSION: {
+ NDR_CHECK(ndr_push_AuthInfoVersion(ndr, NDR_SCALARS, &r->version));
+ 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 TRUST_AUTH_TYPE_NONE:
+ break;
+
+ case TRUST_AUTH_TYPE_NT4OWF:
+ NDR_CHECK(ndr_push_AuthInfoNT4Owf(ndr, NDR_BUFFERS, &r->nt4owf));
+ break;
+
+ case TRUST_AUTH_TYPE_CLEAR:
+ break;
+
+ case TRUST_AUTH_TYPE_VERSION:
+ 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_AuthInfo(struct ndr_pull *ndr, int ndr_flags, union AuthInfo *r)
+{
+ int level;
+ level = ndr_pull_get_switch_value(ndr, r);
+ if (ndr_flags & NDR_SCALARS) {
+ switch (level) {
+ case TRUST_AUTH_TYPE_NONE: {
+ NDR_CHECK(ndr_pull_AuthInfoNone(ndr, NDR_SCALARS, &r->none));
+ break; }
+
+ case TRUST_AUTH_TYPE_NT4OWF: {
+ NDR_CHECK(ndr_pull_AuthInfoNT4Owf(ndr, NDR_SCALARS, &r->nt4owf));
+ break; }
+
+ case TRUST_AUTH_TYPE_CLEAR: {
+ NDR_CHECK(ndr_pull_AuthInfoClear(ndr, NDR_SCALARS, &r->clear));
+ break; }
+
+ case TRUST_AUTH_TYPE_VERSION: {
+ NDR_CHECK(ndr_pull_AuthInfoVersion(ndr, NDR_SCALARS, &r->version));
+ break; }
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ switch (level) {
+ case TRUST_AUTH_TYPE_NONE:
+ break;
+
+ case TRUST_AUTH_TYPE_NT4OWF:
+ NDR_CHECK(ndr_pull_AuthInfoNT4Owf(ndr, NDR_BUFFERS, &r->nt4owf));
+ break;
+
+ case TRUST_AUTH_TYPE_CLEAR:
+ break;
+
+ case TRUST_AUTH_TYPE_VERSION:
+ break;
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_AuthInfo(struct ndr_print *ndr, const char *name, const union AuthInfo *r)
+{
+ int level;
+ level = ndr_print_get_switch_value(ndr, r);
+ ndr_print_union(ndr, name, level, "AuthInfo");
+ switch (level) {
+ case TRUST_AUTH_TYPE_NONE:
+ ndr_print_AuthInfoNone(ndr, "none", &r->none);
+ break;
+
+ case TRUST_AUTH_TYPE_NT4OWF:
+ ndr_print_AuthInfoNT4Owf(ndr, "nt4owf", &r->nt4owf);
+ break;
+
+ case TRUST_AUTH_TYPE_CLEAR:
+ ndr_print_AuthInfoClear(ndr, "clear", &r->clear);
+ break;
+
+ case TRUST_AUTH_TYPE_VERSION:
+ ndr_print_AuthInfoVersion(ndr, "version", &r->version);
+ break;
+
+ default:
+ ndr_print_bad_level(ndr, name, level);
+ }
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_AuthenticationInformation(struct ndr_push *ndr, int ndr_flags, const struct AuthenticationInformation *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->LastUpdateTime));
+ NDR_CHECK(ndr_push_lsa_TrustAuthType(ndr, NDR_SCALARS, r->AuthType));
+ NDR_CHECK(ndr_push_set_switch_value(ndr, &r->AuthInfo, r->AuthType));
+ NDR_CHECK(ndr_push_AuthInfo(ndr, NDR_SCALARS, &r->AuthInfo));
{
uint32_t _flags_save_DATA_BLOB = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
@@ -2326,17 +2584,19 @@ static enum ndr_err_code ndr_push_trustAuthInOutSecret1(struct ndr_push *ndr, in
}
}
if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_push_AuthInfo(ndr, NDR_BUFFERS, &r->AuthInfo));
}
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_trustAuthInOutSecret1(struct ndr_pull *ndr, int ndr_flags, struct trustAuthInOutSecret1 *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_AuthenticationInformation(struct ndr_pull *ndr, int ndr_flags, struct AuthenticationInformation *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->time1));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown1));
- NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->value));
+ NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->LastUpdateTime));
+ NDR_CHECK(ndr_pull_lsa_TrustAuthType(ndr, NDR_SCALARS, &r->AuthType));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->AuthInfo, r->AuthType));
+ NDR_CHECK(ndr_pull_AuthInfo(ndr, NDR_SCALARS, &r->AuthInfo));
{
uint32_t _flags_save_DATA_BLOB = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
@@ -2345,325 +2605,405 @@ static enum ndr_err_code ndr_pull_trustAuthInOutSecret1(struct ndr_pull *ndr, in
}
}
if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_pull_AuthInfo(ndr, NDR_BUFFERS, &r->AuthInfo));
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_trustAuthInOutSecret1(struct ndr_print *ndr, const char *name, const struct trustAuthInOutSecret1 *r)
+_PUBLIC_ void ndr_print_AuthenticationInformation(struct ndr_print *ndr, const char *name, const struct AuthenticationInformation *r)
{
- ndr_print_struct(ndr, name, "trustAuthInOutSecret1");
+ ndr_print_struct(ndr, name, "AuthenticationInformation");
ndr->depth++;
- ndr_print_NTTIME(ndr, "time1", r->time1);
- ndr_print_uint32(ndr, "unknown1", r->unknown1);
- ndr_print_DATA_BLOB(ndr, "value", r->value);
+ ndr_print_NTTIME(ndr, "LastUpdateTime", r->LastUpdateTime);
+ ndr_print_lsa_TrustAuthType(ndr, "AuthType", r->AuthType);
+ ndr_print_set_switch_value(ndr, &r->AuthInfo, r->AuthType);
+ ndr_print_AuthInfo(ndr, "AuthInfo", &r->AuthInfo);
ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
ndr->depth--;
}
-static enum ndr_err_code ndr_push_trustAuthInOutCtr1(struct ndr_push *ndr, int ndr_flags, const struct trustAuthInOutCtr1 *r)
+_PUBLIC_ size_t ndr_size_trustAuthInOutBlob(const struct trustAuthInOutBlob *r, int flags)
{
+ return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_trustAuthInOutBlob);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_trustCurrentPasswords(struct ndr_push *ndr, int ndr_flags, const struct trustCurrentPasswords *r)
+{
+ uint32_t cntr_current_0;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_relative_ptr1(ndr, r->value1));
- NDR_CHECK(ndr_push_relative_ptr1(ndr, r->value2));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
+ for (cntr_current_0 = 0; cntr_current_0 < r->count; cntr_current_0++) {
+ NDR_CHECK(ndr_push_relative_ptr1(ndr, r->current[cntr_current_0]));
+ }
}
if (ndr_flags & NDR_BUFFERS) {
- if (r->value1) {
- NDR_CHECK(ndr_push_relative_ptr2(ndr, r->value1));
- NDR_CHECK(ndr_push_trustAuthInOutSecret1(ndr, NDR_SCALARS, r->value1));
- }
- if (r->value2) {
- NDR_CHECK(ndr_push_relative_ptr2(ndr, r->value2));
- NDR_CHECK(ndr_push_trustAuthInOutSecret1(ndr, NDR_SCALARS, r->value2));
+ for (cntr_current_0 = 0; cntr_current_0 < r->count; cntr_current_0++) {
+ if (r->current[cntr_current_0]) {
+ NDR_CHECK(ndr_push_relative_ptr2(ndr, r->current[cntr_current_0]));
+ NDR_CHECK(ndr_push_AuthenticationInformation(ndr, NDR_SCALARS|NDR_BUFFERS, r->current[cntr_current_0]));
+ }
}
}
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_trustAuthInOutCtr1(struct ndr_pull *ndr, int ndr_flags, struct trustAuthInOutCtr1 *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_trustCurrentPasswords(struct ndr_pull *ndr, int ndr_flags, struct trustCurrentPasswords *r)
{
- uint32_t _ptr_value1;
- TALLOC_CTX *_mem_save_value1_0;
- uint32_t _ptr_value2;
- TALLOC_CTX *_mem_save_value2_0;
+ uint32_t _ptr_current;
+ uint32_t cntr_current_0;
+ TALLOC_CTX *_mem_save_current_0;
+ TALLOC_CTX *_mem_save_current_1;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value1));
- if (_ptr_value1) {
- NDR_PULL_ALLOC(ndr, r->value1);
- NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->value1, _ptr_value1));
- } else {
- r->value1 = NULL;
- }
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value2));
- if (_ptr_value2) {
- NDR_PULL_ALLOC(ndr, r->value2);
- NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->value2, _ptr_value2));
- } else {
- r->value2 = NULL;
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
+ NDR_PULL_ALLOC_N(ndr, r->current, r->count);
+ _mem_save_current_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->current, 0);
+ for (cntr_current_0 = 0; cntr_current_0 < r->count; cntr_current_0++) {
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_current));
+ if (_ptr_current) {
+ NDR_PULL_ALLOC(ndr, r->current[cntr_current_0]);
+ NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->current[cntr_current_0], _ptr_current));
+ } else {
+ r->current[cntr_current_0] = NULL;
+ }
}
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_current_0, 0);
}
if (ndr_flags & NDR_BUFFERS) {
- if (r->value1) {
- uint32_t _relative_save_offset;
- _relative_save_offset = ndr->offset;
- NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->value1));
- _mem_save_value1_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->value1, 0);
- NDR_CHECK(ndr_pull_trustAuthInOutSecret1(ndr, NDR_SCALARS, r->value1));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value1_0, 0);
- ndr->offset = _relative_save_offset;
- }
- if (r->value2) {
- uint32_t _relative_save_offset;
- _relative_save_offset = ndr->offset;
- NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->value2));
- _mem_save_value2_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->value2, 0);
- NDR_CHECK(ndr_pull_trustAuthInOutSecret1(ndr, NDR_SCALARS, r->value2));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value2_0, 0);
- ndr->offset = _relative_save_offset;
+ _mem_save_current_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->current, 0);
+ for (cntr_current_0 = 0; cntr_current_0 < r->count; cntr_current_0++) {
+ if (r->current[cntr_current_0]) {
+ uint32_t _relative_save_offset;
+ _relative_save_offset = ndr->offset;
+ NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->current[cntr_current_0]));
+ _mem_save_current_1 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->current[cntr_current_0], 0);
+ NDR_CHECK(ndr_pull_AuthenticationInformation(ndr, NDR_SCALARS|NDR_BUFFERS, r->current[cntr_current_0]));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_current_1, 0);
+ ndr->offset = _relative_save_offset;
+ }
}
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_current_0, 0);
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_trustAuthInOutCtr1(struct ndr_print *ndr, const char *name, const struct trustAuthInOutCtr1 *r)
+_PUBLIC_ void ndr_print_trustCurrentPasswords(struct ndr_print *ndr, const char *name, const struct trustCurrentPasswords *r)
{
- ndr_print_struct(ndr, name, "trustAuthInOutCtr1");
+ uint32_t cntr_current_0;
+ ndr_print_struct(ndr, name, "trustCurrentPasswords");
ndr->depth++;
- ndr_print_ptr(ndr, "value1", r->value1);
- ndr->depth++;
- if (r->value1) {
- ndr_print_trustAuthInOutSecret1(ndr, "value1", r->value1);
- }
- ndr->depth--;
- ndr_print_ptr(ndr, "value2", r->value2);
+ ndr_print_uint32(ndr, "count", r->count);
+ ndr->print(ndr, "%s: ARRAY(%d)", "current", (int)r->count);
ndr->depth++;
- if (r->value2) {
- ndr_print_trustAuthInOutSecret1(ndr, "value2", r->value2);
+ for (cntr_current_0=0;cntr_current_0<r->count;cntr_current_0++) {
+ char *idx_0=NULL;
+ if (asprintf(&idx_0, "[%d]", cntr_current_0) != -1) {
+ ndr_print_ptr(ndr, "current", r->current[cntr_current_0]);
+ ndr->depth++;
+ if (r->current[cntr_current_0]) {
+ ndr_print_AuthenticationInformation(ndr, "current", r->current[cntr_current_0]);
+ }
+ ndr->depth--;
+ free(idx_0);
+ }
}
ndr->depth--;
ndr->depth--;
}
-static enum ndr_err_code ndr_push_trustAuthInOutSecret2V1(struct ndr_push *ndr, int ndr_flags, const struct trustAuthInOutSecret2V1 *r)
+_PUBLIC_ size_t ndr_size_trustCurrentPasswords(const struct trustCurrentPasswords *r, int flags)
+{
+ return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_trustCurrentPasswords);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_trustDomainPasswords(struct ndr_push *ndr, int ndr_flags, const struct trustDomainPasswords *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->time1));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown1));
- NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->value));
- NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->time2));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown2));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown3));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown4));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->confounder, 512));
{
- uint32_t _flags_save_DATA_BLOB = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
- NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad));
- ndr->flags = _flags_save_DATA_BLOB;
+ struct ndr_push *_ndr_outgoing;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_outgoing, 0, ndr_size_trustCurrentPasswords(&r->outgoing, ndr->flags)));
+ NDR_CHECK(ndr_push_trustCurrentPasswords(_ndr_outgoing, NDR_SCALARS|NDR_BUFFERS, &r->outgoing));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_outgoing, 0, ndr_size_trustCurrentPasswords(&r->outgoing, ndr->flags)));
}
+ {
+ struct ndr_push *_ndr_incoming;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_incoming, 0, ndr_size_trustCurrentPasswords(&r->incoming, ndr->flags)));
+ NDR_CHECK(ndr_push_trustCurrentPasswords(_ndr_incoming, NDR_SCALARS|NDR_BUFFERS, &r->incoming));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_incoming, 0, ndr_size_trustCurrentPasswords(&r->incoming, ndr->flags)));
+ }
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_trustCurrentPasswords(&r->outgoing, ndr->flags)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_trustCurrentPasswords(&r->incoming, ndr->flags)));
}
if (ndr_flags & NDR_BUFFERS) {
}
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_trustAuthInOutSecret2V1(struct ndr_pull *ndr, int ndr_flags, struct trustAuthInOutSecret2V1 *r)
+_PUBLIC_ void ndr_print_trustDomainPasswords(struct ndr_print *ndr, const char *name, const struct trustDomainPasswords *r)
+{
+ ndr_print_struct(ndr, name, "trustDomainPasswords");
+ ndr->depth++;
+ ndr_print_array_uint8(ndr, "confounder", r->confounder, 512);
+ ndr_print_trustCurrentPasswords(ndr, "outgoing", &r->outgoing);
+ ndr_print_trustCurrentPasswords(ndr, "incoming", &r->incoming);
+ ndr_print_uint32(ndr, "outgoing_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_trustCurrentPasswords(&r->outgoing, ndr->flags):r->outgoing_size);
+ ndr_print_uint32(ndr, "incoming_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_trustCurrentPasswords(&r->incoming, ndr->flags):r->incoming_size);
+ ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_DsCompressedChunk(struct ndr_push *ndr, int ndr_flags, const struct DsCompressedChunk *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->marker));
+ NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->data));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_DsCompressedChunk(struct ndr_pull *ndr, int ndr_flags, struct DsCompressedChunk *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->time1));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown1));
- NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->value));
- NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->time2));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown2));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown3));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown4));
- {
- uint32_t _flags_save_DATA_BLOB = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
- NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad));
- ndr->flags = _flags_save_DATA_BLOB;
- }
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->marker));
+ NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->data));
}
if (ndr_flags & NDR_BUFFERS) {
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_trustAuthInOutSecret2V1(struct ndr_print *ndr, const char *name, const struct trustAuthInOutSecret2V1 *r)
+_PUBLIC_ void ndr_print_DsCompressedChunk(struct ndr_print *ndr, const char *name, const struct DsCompressedChunk *r)
{
- ndr_print_struct(ndr, name, "trustAuthInOutSecret2V1");
+ ndr_print_struct(ndr, name, "DsCompressedChunk");
ndr->depth++;
- ndr_print_NTTIME(ndr, "time1", r->time1);
- ndr_print_uint32(ndr, "unknown1", r->unknown1);
- ndr_print_DATA_BLOB(ndr, "value", r->value);
- ndr_print_NTTIME(ndr, "time2", r->time2);
- ndr_print_uint32(ndr, "unknown2", r->unknown2);
- ndr_print_uint32(ndr, "unknown3", r->unknown3);
- ndr_print_uint32(ndr, "unknown4", r->unknown4);
- ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
+ ndr_print_uint32(ndr, "marker", r->marker);
+ ndr_print_DATA_BLOB(ndr, "data", r->data);
ndr->depth--;
}
-static enum ndr_err_code ndr_push_trustAuthInOutSecret2V2(struct ndr_push *ndr, int ndr_flags, const struct trustAuthInOutSecret2V2 *r)
+static enum ndr_err_code ndr_push_ExtendedErrorAString(struct ndr_push *ndr, int ndr_flags, const struct ExtendedErrorAString *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->time1));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown1));
- NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->value));
- NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->time2));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown2));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown3));
- {
- uint32_t _flags_save_DATA_BLOB = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
- NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad));
- ndr->flags = _flags_save_DATA_BLOB;
- }
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->__size));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->string));
}
if (ndr_flags & NDR_BUFFERS) {
+ if (r->string) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->__size));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->string, r->__size, sizeof(uint8_t), CH_DOS));
+ }
}
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_trustAuthInOutSecret2V2(struct ndr_pull *ndr, int ndr_flags, struct trustAuthInOutSecret2V2 *r)
+static enum ndr_err_code ndr_pull_ExtendedErrorAString(struct ndr_pull *ndr, int ndr_flags, struct ExtendedErrorAString *r)
{
+ uint32_t _ptr_string;
+ TALLOC_CTX *_mem_save_string_0;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->time1));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown1));
- NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->value));
- NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->time2));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown2));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown3));
- {
- uint32_t _flags_save_DATA_BLOB = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
- NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad));
- ndr->flags = _flags_save_DATA_BLOB;
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->__size));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_string));
+ if (_ptr_string) {
+ NDR_PULL_ALLOC(ndr, r->string);
+ } else {
+ r->string = NULL;
}
}
if (ndr_flags & NDR_BUFFERS) {
+ if (r->string) {
+ _mem_save_string_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->string, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->string));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->string, ndr_get_array_size(ndr, &r->string), sizeof(uint8_t), CH_DOS));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_string_0, 0);
+ }
+ if (r->string) {
+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->string, r->__size));
+ }
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_trustAuthInOutSecret2V2(struct ndr_print *ndr, const char *name, const struct trustAuthInOutSecret2V2 *r)
+_PUBLIC_ void ndr_print_ExtendedErrorAString(struct ndr_print *ndr, const char *name, const struct ExtendedErrorAString *r)
{
- ndr_print_struct(ndr, name, "trustAuthInOutSecret2V2");
+ ndr_print_struct(ndr, name, "ExtendedErrorAString");
ndr->depth++;
- ndr_print_NTTIME(ndr, "time1", r->time1);
- ndr_print_uint32(ndr, "unknown1", r->unknown1);
- ndr_print_DATA_BLOB(ndr, "value", r->value);
- ndr_print_NTTIME(ndr, "time2", r->time2);
- ndr_print_uint32(ndr, "unknown2", r->unknown2);
- ndr_print_uint32(ndr, "unknown3", r->unknown3);
- ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
+ ndr_print_uint16(ndr, "__size", r->__size);
+ ndr_print_ptr(ndr, "string", r->string);
+ ndr->depth++;
+ if (r->string) {
+ ndr_print_string(ndr, "string", r->string);
+ }
+ ndr->depth--;
ndr->depth--;
}
-static enum ndr_err_code ndr_push_trustAuthInOutCtr2(struct ndr_push *ndr, int ndr_flags, const struct trustAuthInOutCtr2 *r)
+static enum ndr_err_code ndr_push_ExtendedErrorUString(struct ndr_push *ndr, int ndr_flags, const struct ExtendedErrorUString *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_relative_ptr1(ndr, r->value1));
- NDR_CHECK(ndr_push_relative_ptr1(ndr, r->value2));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->__size));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->string));
}
if (ndr_flags & NDR_BUFFERS) {
- if (r->value1) {
- NDR_CHECK(ndr_push_relative_ptr2(ndr, r->value1));
- NDR_CHECK(ndr_push_trustAuthInOutSecret2V1(ndr, NDR_SCALARS, r->value1));
- }
- if (r->value2) {
- NDR_CHECK(ndr_push_relative_ptr2(ndr, r->value2));
- NDR_CHECK(ndr_push_trustAuthInOutSecret2V2(ndr, NDR_SCALARS, r->value2));
+ if (r->string) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->__size));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->string, r->__size, sizeof(uint16_t), CH_UTF16));
}
}
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_trustAuthInOutCtr2(struct ndr_pull *ndr, int ndr_flags, struct trustAuthInOutCtr2 *r)
+static enum ndr_err_code ndr_pull_ExtendedErrorUString(struct ndr_pull *ndr, int ndr_flags, struct ExtendedErrorUString *r)
{
- uint32_t _ptr_value1;
- TALLOC_CTX *_mem_save_value1_0;
- uint32_t _ptr_value2;
- TALLOC_CTX *_mem_save_value2_0;
+ uint32_t _ptr_string;
+ TALLOC_CTX *_mem_save_string_0;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value1));
- if (_ptr_value1) {
- NDR_PULL_ALLOC(ndr, r->value1);
- NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->value1, _ptr_value1));
- } else {
- r->value1 = NULL;
- }
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value2));
- if (_ptr_value2) {
- NDR_PULL_ALLOC(ndr, r->value2);
- NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->value2, _ptr_value2));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->__size));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_string));
+ if (_ptr_string) {
+ NDR_PULL_ALLOC(ndr, r->string);
} else {
- r->value2 = NULL;
+ r->string = NULL;
}
}
if (ndr_flags & NDR_BUFFERS) {
- if (r->value1) {
- uint32_t _relative_save_offset;
- _relative_save_offset = ndr->offset;
- NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->value1));
- _mem_save_value1_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->value1, 0);
- NDR_CHECK(ndr_pull_trustAuthInOutSecret2V1(ndr, NDR_SCALARS, r->value1));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value1_0, 0);
- ndr->offset = _relative_save_offset;
+ if (r->string) {
+ _mem_save_string_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->string, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->string));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->string, ndr_get_array_size(ndr, &r->string), sizeof(uint16_t), CH_UTF16));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_string_0, 0);
}
- if (r->value2) {
- uint32_t _relative_save_offset;
- _relative_save_offset = ndr->offset;
- NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->value2));
- _mem_save_value2_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->value2, 0);
- NDR_CHECK(ndr_pull_trustAuthInOutSecret2V2(ndr, NDR_SCALARS, r->value2));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value2_0, 0);
- ndr->offset = _relative_save_offset;
+ if (r->string) {
+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->string, r->__size));
}
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_trustAuthInOutCtr2(struct ndr_print *ndr, const char *name, const struct trustAuthInOutCtr2 *r)
+_PUBLIC_ void ndr_print_ExtendedErrorUString(struct ndr_print *ndr, const char *name, const struct ExtendedErrorUString *r)
{
- ndr_print_struct(ndr, name, "trustAuthInOutCtr2");
+ ndr_print_struct(ndr, name, "ExtendedErrorUString");
ndr->depth++;
- ndr_print_ptr(ndr, "value1", r->value1);
+ ndr_print_uint16(ndr, "__size", r->__size);
+ ndr_print_ptr(ndr, "string", r->string);
ndr->depth++;
- if (r->value1) {
- ndr_print_trustAuthInOutSecret2V1(ndr, "value1", r->value1);
+ if (r->string) {
+ ndr_print_string(ndr, "string", r->string);
}
ndr->depth--;
- ndr_print_ptr(ndr, "value2", r->value2);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_ExtendedErrorBlob(struct ndr_push *ndr, int ndr_flags, const struct ExtendedErrorBlob *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint16(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_ExtendedErrorBlob(struct ndr_pull *ndr, int ndr_flags, struct ExtendedErrorBlob *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_uint16(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_ExtendedErrorBlob(struct ndr_print *ndr, const char *name, const struct ExtendedErrorBlob *r)
+{
+ ndr_print_struct(ndr, name, "ExtendedErrorBlob");
ndr->depth++;
- if (r->value2) {
- ndr_print_trustAuthInOutSecret2V2(ndr, "value2", r->value2);
+ ndr_print_uint16(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_trustAuthInOutCtr(struct ndr_push *ndr, int ndr_flags, const union trustAuthInOutCtr *r)
+static enum ndr_err_code ndr_push_ExtendedErrorComputerNamePresent(struct ndr_push *ndr, int ndr_flags, enum ExtendedErrorComputerNamePresent r)
+{
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_ExtendedErrorComputerNamePresent(struct ndr_pull *ndr, int ndr_flags, enum ExtendedErrorComputerNamePresent *r)
+{
+ uint16_t v;
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_ExtendedErrorComputerNamePresent(struct ndr_print *ndr, const char *name, enum ExtendedErrorComputerNamePresent r)
+{
+ const char *val = NULL;
+
+ switch (r) {
+ case EXTENDED_ERROR_COMPUTER_NAME_PRESENT: val = "EXTENDED_ERROR_COMPUTER_NAME_PRESENT"; break;
+ case EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT: val = "EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT"; break;
+ }
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_ExtendedErrorComputerNameU(struct ndr_push *ndr, int ndr_flags, const union ExtendedErrorComputerNameU *r)
{
if (ndr_flags & NDR_SCALARS) {
int level = ndr_push_get_switch_value(ndr, r);
+ NDR_CHECK(ndr_push_ExtendedErrorComputerNamePresent(ndr, NDR_SCALARS, level));
switch (level) {
- case 1: {
- NDR_CHECK(ndr_push_trustAuthInOutCtr1(ndr, NDR_SCALARS, &r->ctr1));
+ case EXTENDED_ERROR_COMPUTER_NAME_PRESENT: {
+ NDR_CHECK(ndr_push_ExtendedErrorUString(ndr, NDR_SCALARS, &r->name));
break; }
- case 2: {
- NDR_CHECK(ndr_push_trustAuthInOutCtr2(ndr, NDR_SCALARS, &r->ctr2));
+ case EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT: {
break; }
default:
@@ -2673,12 +3013,11 @@ static enum ndr_err_code ndr_push_trustAuthInOutCtr(struct ndr_push *ndr, int nd
if (ndr_flags & NDR_BUFFERS) {
int level = ndr_push_get_switch_value(ndr, r);
switch (level) {
- case 1:
- NDR_CHECK(ndr_push_trustAuthInOutCtr1(ndr, NDR_BUFFERS, &r->ctr1));
+ case EXTENDED_ERROR_COMPUTER_NAME_PRESENT:
+ NDR_CHECK(ndr_push_ExtendedErrorUString(ndr, NDR_BUFFERS, &r->name));
break;
- case 2:
- NDR_CHECK(ndr_push_trustAuthInOutCtr2(ndr, NDR_BUFFERS, &r->ctr2));
+ case EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT:
break;
default:
@@ -2688,18 +3027,22 @@ static enum ndr_err_code ndr_push_trustAuthInOutCtr(struct ndr_push *ndr, int nd
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_trustAuthInOutCtr(struct ndr_pull *ndr, int ndr_flags, union trustAuthInOutCtr *r)
+static enum ndr_err_code ndr_pull_ExtendedErrorComputerNameU(struct ndr_pull *ndr, int ndr_flags, union ExtendedErrorComputerNameU *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_trustAuthInOutCtr1(ndr, NDR_SCALARS, &r->ctr1));
+ case EXTENDED_ERROR_COMPUTER_NAME_PRESENT: {
+ NDR_CHECK(ndr_pull_ExtendedErrorUString(ndr, NDR_SCALARS, &r->name));
break; }
- case 2: {
- NDR_CHECK(ndr_pull_trustAuthInOutCtr2(ndr, NDR_SCALARS, &r->ctr2));
+ case EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT: {
break; }
default:
@@ -2708,12 +3051,11 @@ static enum ndr_err_code ndr_pull_trustAuthInOutCtr(struct ndr_pull *ndr, int nd
}
if (ndr_flags & NDR_BUFFERS) {
switch (level) {
- case 1:
- NDR_CHECK(ndr_pull_trustAuthInOutCtr1(ndr, NDR_BUFFERS, &r->ctr1));
+ case EXTENDED_ERROR_COMPUTER_NAME_PRESENT:
+ NDR_CHECK(ndr_pull_ExtendedErrorUString(ndr, NDR_BUFFERS, &r->name));
break;
- case 2:
- NDR_CHECK(ndr_pull_trustAuthInOutCtr2(ndr, NDR_BUFFERS, &r->ctr2));
+ case EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT:
break;
default:
@@ -2723,18 +3065,17 @@ static enum ndr_err_code ndr_pull_trustAuthInOutCtr(struct ndr_pull *ndr, int nd
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_trustAuthInOutCtr(struct ndr_print *ndr, const char *name, const union trustAuthInOutCtr *r)
+_PUBLIC_ void ndr_print_ExtendedErrorComputerNameU(struct ndr_print *ndr, const char *name, const union ExtendedErrorComputerNameU *r)
{
int level;
level = ndr_print_get_switch_value(ndr, r);
- ndr_print_union(ndr, name, level, "trustAuthInOutCtr");
+ ndr_print_union(ndr, name, level, "ExtendedErrorComputerNameU");
switch (level) {
- case 1:
- ndr_print_trustAuthInOutCtr1(ndr, "ctr1", &r->ctr1);
+ case EXTENDED_ERROR_COMPUTER_NAME_PRESENT:
+ ndr_print_ExtendedErrorUString(ndr, "name", &r->name);
break;
- case 2:
- ndr_print_trustAuthInOutCtr2(ndr, "ctr2", &r->ctr2);
+ case EXTENDED_ERROR_COMPUTER_NAME_NOT_PRESENT:
break;
default:
@@ -2742,116 +3083,404 @@ _PUBLIC_ void ndr_print_trustAuthInOutCtr(struct ndr_print *ndr, const char *nam
}
}
-_PUBLIC_ enum ndr_err_code ndr_push_trustAuthInOutBlob(struct ndr_push *ndr, int ndr_flags, const struct trustAuthInOutBlob *r)
+static enum ndr_err_code ndr_push_ExtendedErrorComputerName(struct ndr_push *ndr, int ndr_flags, const struct ExtendedErrorComputerName *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->version));
- NDR_CHECK(ndr_push_set_switch_value(ndr, &r->ctr, r->version));
- NDR_CHECK(ndr_push_trustAuthInOutCtr(ndr, NDR_SCALARS, &r->ctr));
+ NDR_CHECK(ndr_push_ExtendedErrorComputerNamePresent(ndr, NDR_SCALARS, r->present));
+ NDR_CHECK(ndr_push_set_switch_value(ndr, &r->n, r->present));
+ NDR_CHECK(ndr_push_ExtendedErrorComputerNameU(ndr, NDR_SCALARS, &r->n));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_push_trustAuthInOutCtr(ndr, NDR_BUFFERS, &r->ctr));
+ NDR_CHECK(ndr_push_ExtendedErrorComputerNameU(ndr, NDR_BUFFERS, &r->n));
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ enum ndr_err_code ndr_pull_trustAuthInOutBlob(struct ndr_pull *ndr, int ndr_flags, struct trustAuthInOutBlob *r)
+static enum ndr_err_code ndr_pull_ExtendedErrorComputerName(struct ndr_pull *ndr, int ndr_flags, struct ExtendedErrorComputerName *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->version));
- NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->ctr, r->version));
- NDR_CHECK(ndr_pull_trustAuthInOutCtr(ndr, NDR_SCALARS, &r->ctr));
+ NDR_CHECK(ndr_pull_ExtendedErrorComputerNamePresent(ndr, NDR_SCALARS, &r->present));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->n, r->present));
+ NDR_CHECK(ndr_pull_ExtendedErrorComputerNameU(ndr, NDR_SCALARS, &r->n));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_pull_trustAuthInOutCtr(ndr, NDR_BUFFERS, &r->ctr));
+ NDR_CHECK(ndr_pull_ExtendedErrorComputerNameU(ndr, NDR_BUFFERS, &r->n));
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_trustAuthInOutBlob(struct ndr_print *ndr, const char *name, const struct trustAuthInOutBlob *r)
+_PUBLIC_ void ndr_print_ExtendedErrorComputerName(struct ndr_print *ndr, const char *name, const struct ExtendedErrorComputerName *r)
{
- ndr_print_struct(ndr, name, "trustAuthInOutBlob");
+ ndr_print_struct(ndr, name, "ExtendedErrorComputerName");
ndr->depth++;
- ndr_print_uint32(ndr, "version", r->version);
- ndr_print_set_switch_value(ndr, &r->ctr, r->version);
- ndr_print_trustAuthInOutCtr(ndr, "ctr", &r->ctr);
+ ndr_print_ExtendedErrorComputerNamePresent(ndr, "present", r->present);
+ ndr_print_set_switch_value(ndr, &r->n, r->present);
+ ndr_print_ExtendedErrorComputerNameU(ndr, "n", &r->n);
ndr->depth--;
}
-_PUBLIC_ enum ndr_err_code ndr_push_DsCompressedChunk(struct ndr_push *ndr, int ndr_flags, const struct DsCompressedChunk *r)
+static enum ndr_err_code ndr_push_ExtendedErrorParamType(struct ndr_push *ndr, int ndr_flags, enum ExtendedErrorParamType r)
+{
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_ExtendedErrorParamType(struct ndr_pull *ndr, int ndr_flags, enum ExtendedErrorParamType *r)
+{
+ uint16_t v;
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_ExtendedErrorParamType(struct ndr_print *ndr, const char *name, enum ExtendedErrorParamType r)
+{
+ const char *val = NULL;
+
+ switch (r) {
+ case EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING: val = "EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING"; break;
+ case EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING: val = "EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING"; break;
+ case EXTENDED_ERROR_PARAM_TYPE_UINT32: val = "EXTENDED_ERROR_PARAM_TYPE_UINT32"; break;
+ case EXTENDED_ERROR_PARAM_TYPE_UINT16: val = "EXTENDED_ERROR_PARAM_TYPE_UINT16"; break;
+ case EXTENDED_ERROR_PARAM_TYPE_UINT64: val = "EXTENDED_ERROR_PARAM_TYPE_UINT64"; break;
+ case EXTENDED_ERROR_PARAM_TYPE_NONE: val = "EXTENDED_ERROR_PARAM_TYPE_NONE"; break;
+ case EXTENDED_ERROR_PARAM_TYPE_BLOB: val = "EXTENDED_ERROR_PARAM_TYPE_BLOB"; break;
+ }
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+static enum ndr_err_code ndr_push_ExtendedErrorParamU(struct ndr_push *ndr, int ndr_flags, const union ExtendedErrorParamU *r)
{
if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->marker));
- NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->data));
+ int level = ndr_push_get_switch_value(ndr, r);
+ NDR_CHECK(ndr_push_ExtendedErrorParamType(ndr, NDR_SCALARS, level));
+ switch (level) {
+ case EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING: {
+ NDR_CHECK(ndr_push_ExtendedErrorAString(ndr, NDR_SCALARS, &r->a_string));
+ break; }
+
+ case EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING: {
+ NDR_CHECK(ndr_push_ExtendedErrorUString(ndr, NDR_SCALARS, &r->u_string));
+ break; }
+
+ case EXTENDED_ERROR_PARAM_TYPE_UINT32: {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->uint32));
+ break; }
+
+ case EXTENDED_ERROR_PARAM_TYPE_UINT16: {
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->uint16));
+ break; }
+
+ case EXTENDED_ERROR_PARAM_TYPE_UINT64: {
+ NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->uint64));
+ break; }
+
+ case EXTENDED_ERROR_PARAM_TYPE_NONE: {
+ break; }
+
+ case EXTENDED_ERROR_PARAM_TYPE_BLOB: {
+ NDR_CHECK(ndr_push_ExtendedErrorBlob(ndr, NDR_SCALARS, &r->blob));
+ 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 EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING:
+ NDR_CHECK(ndr_push_ExtendedErrorAString(ndr, NDR_BUFFERS, &r->a_string));
+ break;
+
+ case EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING:
+ NDR_CHECK(ndr_push_ExtendedErrorUString(ndr, NDR_BUFFERS, &r->u_string));
+ break;
+
+ case EXTENDED_ERROR_PARAM_TYPE_UINT32:
+ break;
+
+ case EXTENDED_ERROR_PARAM_TYPE_UINT16:
+ break;
+
+ case EXTENDED_ERROR_PARAM_TYPE_UINT64:
+ break;
+
+ case EXTENDED_ERROR_PARAM_TYPE_NONE:
+ break;
+
+ case EXTENDED_ERROR_PARAM_TYPE_BLOB:
+ NDR_CHECK(ndr_push_ExtendedErrorBlob(ndr, NDR_BUFFERS, &r->blob));
+ break;
+
+ default:
+ return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ enum ndr_err_code ndr_pull_DsCompressedChunk(struct ndr_pull *ndr, int ndr_flags, struct DsCompressedChunk *r)
+static enum ndr_err_code ndr_pull_ExtendedErrorParamU(struct ndr_pull *ndr, int ndr_flags, union ExtendedErrorParamU *r)
{
+ int level;
+ uint16_t _level;
+ level = ndr_pull_get_switch_value(ndr, r);
if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->marker));
- NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->data));
+ 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 EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING: {
+ NDR_CHECK(ndr_pull_ExtendedErrorAString(ndr, NDR_SCALARS, &r->a_string));
+ break; }
+
+ case EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING: {
+ NDR_CHECK(ndr_pull_ExtendedErrorUString(ndr, NDR_SCALARS, &r->u_string));
+ break; }
+
+ case EXTENDED_ERROR_PARAM_TYPE_UINT32: {
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->uint32));
+ break; }
+
+ case EXTENDED_ERROR_PARAM_TYPE_UINT16: {
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->uint16));
+ break; }
+
+ case EXTENDED_ERROR_PARAM_TYPE_UINT64: {
+ NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->uint64));
+ break; }
+
+ case EXTENDED_ERROR_PARAM_TYPE_NONE: {
+ break; }
+
+ case EXTENDED_ERROR_PARAM_TYPE_BLOB: {
+ NDR_CHECK(ndr_pull_ExtendedErrorBlob(ndr, NDR_SCALARS, &r->blob));
+ break; }
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ switch (level) {
+ case EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING:
+ NDR_CHECK(ndr_pull_ExtendedErrorAString(ndr, NDR_BUFFERS, &r->a_string));
+ break;
+
+ case EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING:
+ NDR_CHECK(ndr_pull_ExtendedErrorUString(ndr, NDR_BUFFERS, &r->u_string));
+ break;
+
+ case EXTENDED_ERROR_PARAM_TYPE_UINT32:
+ break;
+
+ case EXTENDED_ERROR_PARAM_TYPE_UINT16:
+ break;
+
+ case EXTENDED_ERROR_PARAM_TYPE_UINT64:
+ break;
+
+ case EXTENDED_ERROR_PARAM_TYPE_NONE:
+ break;
+
+ case EXTENDED_ERROR_PARAM_TYPE_BLOB:
+ NDR_CHECK(ndr_pull_ExtendedErrorBlob(ndr, NDR_BUFFERS, &r->blob));
+ break;
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_ExtendedErrorParamU(struct ndr_print *ndr, const char *name, const union ExtendedErrorParamU *r)
+{
+ int level;
+ level = ndr_print_get_switch_value(ndr, r);
+ ndr_print_union(ndr, name, level, "ExtendedErrorParamU");
+ switch (level) {
+ case EXTENDED_ERROR_PARAM_TYPE_ASCII_STRING:
+ ndr_print_ExtendedErrorAString(ndr, "a_string", &r->a_string);
+ break;
+
+ case EXTENDED_ERROR_PARAM_TYPE_UNICODE_STRING:
+ ndr_print_ExtendedErrorUString(ndr, "u_string", &r->u_string);
+ break;
+
+ case EXTENDED_ERROR_PARAM_TYPE_UINT32:
+ ndr_print_uint32(ndr, "uint32", r->uint32);
+ break;
+
+ case EXTENDED_ERROR_PARAM_TYPE_UINT16:
+ ndr_print_uint16(ndr, "uint16", r->uint16);
+ break;
+
+ case EXTENDED_ERROR_PARAM_TYPE_UINT64:
+ ndr_print_hyper(ndr, "uint64", r->uint64);
+ break;
+
+ case EXTENDED_ERROR_PARAM_TYPE_NONE:
+ break;
+
+ case EXTENDED_ERROR_PARAM_TYPE_BLOB:
+ ndr_print_ExtendedErrorBlob(ndr, "blob", &r->blob);
+ break;
+
+ default:
+ ndr_print_bad_level(ndr, name, level);
+ }
+}
+
+static enum ndr_err_code ndr_push_ExtendedErrorParam(struct ndr_push *ndr, int ndr_flags, const struct ExtendedErrorParam *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 8));
+ NDR_CHECK(ndr_push_ExtendedErrorParamType(ndr, NDR_SCALARS, r->type));
+ NDR_CHECK(ndr_push_set_switch_value(ndr, &r->p, r->type));
+ NDR_CHECK(ndr_push_ExtendedErrorParamU(ndr, NDR_SCALARS, &r->p));
}
if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_push_ExtendedErrorParamU(ndr, NDR_BUFFERS, &r->p));
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_DsCompressedChunk(struct ndr_print *ndr, const char *name, const struct DsCompressedChunk *r)
+static enum ndr_err_code ndr_pull_ExtendedErrorParam(struct ndr_pull *ndr, int ndr_flags, struct ExtendedErrorParam *r)
{
- ndr_print_struct(ndr, name, "DsCompressedChunk");
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 8));
+ NDR_CHECK(ndr_pull_ExtendedErrorParamType(ndr, NDR_SCALARS, &r->type));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->p, r->type));
+ NDR_CHECK(ndr_pull_ExtendedErrorParamU(ndr, NDR_SCALARS, &r->p));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_pull_ExtendedErrorParamU(ndr, NDR_BUFFERS, &r->p));
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_ExtendedErrorParam(struct ndr_print *ndr, const char *name, const struct ExtendedErrorParam *r)
+{
+ ndr_print_struct(ndr, name, "ExtendedErrorParam");
ndr->depth++;
- ndr_print_uint32(ndr, "marker", r->marker);
- ndr_print_DATA_BLOB(ndr, "data", r->data);
+ ndr_print_ExtendedErrorParamType(ndr, "type", r->type);
+ ndr_print_set_switch_value(ndr, &r->p, r->type);
+ ndr_print_ExtendedErrorParamU(ndr, "p", &r->p);
ndr->depth--;
}
-_PUBLIC_ enum ndr_err_code ndr_push_DsCompressedBlob(struct ndr_push *ndr, int ndr_flags, const struct DsCompressedBlob *r)
+_PUBLIC_ enum ndr_err_code ndr_push_ExtendedErrorInfo(struct ndr_push *ndr, int ndr_flags, const struct ExtendedErrorInfo *r)
{
- uint32_t cntr_chunks_0;
+ uint32_t cntr_params_0;
if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- for (cntr_chunks_0 = 0; cntr_chunks_0 < 5; cntr_chunks_0++) {
- NDR_CHECK(ndr_push_DsCompressedChunk(ndr, NDR_SCALARS, &r->chunks[cntr_chunks_0]));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_params));
+ NDR_CHECK(ndr_push_align(ndr, 8));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->next));
+ NDR_CHECK(ndr_push_ExtendedErrorComputerName(ndr, NDR_SCALARS, &r->computer_name));
+ NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->pid));
+ NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->time));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->generating_component));
+ NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->status));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->detection_location));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->flags));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->num_params));
+ for (cntr_params_0 = 0; cntr_params_0 < r->num_params; cntr_params_0++) {
+ NDR_CHECK(ndr_push_ExtendedErrorParam(ndr, NDR_SCALARS, &r->params[cntr_params_0]));
}
}
if (ndr_flags & NDR_BUFFERS) {
+ if (r->next) {
+ NDR_CHECK(ndr_push_ExtendedErrorInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->next));
+ }
+ NDR_CHECK(ndr_push_ExtendedErrorComputerName(ndr, NDR_BUFFERS, &r->computer_name));
+ for (cntr_params_0 = 0; cntr_params_0 < r->num_params; cntr_params_0++) {
+ NDR_CHECK(ndr_push_ExtendedErrorParam(ndr, NDR_BUFFERS, &r->params[cntr_params_0]));
+ }
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ enum ndr_err_code ndr_pull_DsCompressedBlob(struct ndr_pull *ndr, int ndr_flags, struct DsCompressedBlob *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_ExtendedErrorInfo(struct ndr_pull *ndr, int ndr_flags, struct ExtendedErrorInfo *r)
{
- uint32_t cntr_chunks_0;
+ uint32_t _ptr_next;
+ TALLOC_CTX *_mem_save_next_0;
+ uint32_t cntr_params_0;
+ TALLOC_CTX *_mem_save_params_0;
if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- for (cntr_chunks_0 = 0; cntr_chunks_0 < 5; cntr_chunks_0++) {
- NDR_CHECK(ndr_pull_DsCompressedChunk(ndr, NDR_SCALARS, &r->chunks[cntr_chunks_0]));
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->params));
+ NDR_CHECK(ndr_pull_align(ndr, 8));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_next));
+ if (_ptr_next) {
+ NDR_PULL_ALLOC(ndr, r->next);
+ } else {
+ r->next = NULL;
+ }
+ NDR_CHECK(ndr_pull_ExtendedErrorComputerName(ndr, NDR_SCALARS, &r->computer_name));
+ NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->pid));
+ NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->time));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->generating_component));
+ NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->status));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->detection_location));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->flags));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->num_params));
+ NDR_PULL_ALLOC_N(ndr, r->params, ndr_get_array_size(ndr, &r->params));
+ _mem_save_params_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->params, 0);
+ for (cntr_params_0 = 0; cntr_params_0 < r->num_params; cntr_params_0++) {
+ NDR_CHECK(ndr_pull_ExtendedErrorParam(ndr, NDR_SCALARS, &r->params[cntr_params_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_params_0, 0);
+ if (r->params) {
+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->params, r->num_params));
}
}
if (ndr_flags & NDR_BUFFERS) {
+ if (r->next) {
+ _mem_save_next_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->next, 0);
+ NDR_CHECK(ndr_pull_ExtendedErrorInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->next));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_next_0, 0);
+ }
+ NDR_CHECK(ndr_pull_ExtendedErrorComputerName(ndr, NDR_BUFFERS, &r->computer_name));
+ _mem_save_params_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->params, 0);
+ for (cntr_params_0 = 0; cntr_params_0 < r->num_params; cntr_params_0++) {
+ NDR_CHECK(ndr_pull_ExtendedErrorParam(ndr, NDR_BUFFERS, &r->params[cntr_params_0]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_params_0, 0);
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_DsCompressedBlob(struct ndr_print *ndr, const char *name, const struct DsCompressedBlob *r)
+_PUBLIC_ void ndr_print_ExtendedErrorInfo(struct ndr_print *ndr, const char *name, const struct ExtendedErrorInfo *r)
{
- uint32_t cntr_chunks_0;
- ndr_print_struct(ndr, name, "DsCompressedBlob");
+ uint32_t cntr_params_0;
+ ndr_print_struct(ndr, name, "ExtendedErrorInfo");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "next", r->next);
ndr->depth++;
- ndr->print(ndr, "%s: ARRAY(%d)", "chunks", (int)5);
+ if (r->next) {
+ ndr_print_ExtendedErrorInfo(ndr, "next", r->next);
+ }
+ ndr->depth--;
+ ndr_print_ExtendedErrorComputerName(ndr, "computer_name", &r->computer_name);
+ ndr_print_hyper(ndr, "pid", r->pid);
+ ndr_print_NTTIME(ndr, "time", r->time);
+ ndr_print_uint32(ndr, "generating_component", r->generating_component);
+ ndr_print_WERROR(ndr, "status", r->status);
+ ndr_print_uint16(ndr, "detection_location", r->detection_location);
+ ndr_print_uint16(ndr, "flags", r->flags);
+ ndr_print_uint16(ndr, "num_params", r->num_params);
+ ndr->print(ndr, "%s: ARRAY(%d)", "params", (int)r->num_params);
ndr->depth++;
- for (cntr_chunks_0=0;cntr_chunks_0<5;cntr_chunks_0++) {
+ for (cntr_params_0=0;cntr_params_0<r->num_params;cntr_params_0++) {
char *idx_0=NULL;
- if (asprintf(&idx_0, "[%d]", cntr_chunks_0) != -1) {
- ndr_print_DsCompressedChunk(ndr, "chunks", &r->chunks[cntr_chunks_0]);
+ if (asprintf(&idx_0, "[%d]", cntr_params_0) != -1) {
+ ndr_print_ExtendedErrorParam(ndr, "params", &r->params[cntr_params_0]);
free(idx_0);
}
}
@@ -2859,6 +3488,57 @@ _PUBLIC_ void ndr_print_DsCompressedBlob(struct ndr_print *ndr, const char *name
ndr->depth--;
}
+static enum ndr_err_code ndr_push_ExtendedErrorInfoPtr(struct ndr_push *ndr, int ndr_flags, const struct ExtendedErrorInfoPtr *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->info));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->info) {
+ NDR_CHECK(ndr_push_ExtendedErrorInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->info));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_ExtendedErrorInfoPtr(struct ndr_pull *ndr, int ndr_flags, struct ExtendedErrorInfoPtr *r)
+{
+ uint32_t _ptr_info;
+ TALLOC_CTX *_mem_save_info_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info));
+ if (_ptr_info) {
+ NDR_PULL_ALLOC(ndr, r->info);
+ } else {
+ r->info = NULL;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->info) {
+ _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->info, 0);
+ NDR_CHECK(ndr_pull_ExtendedErrorInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->info));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_ExtendedErrorInfoPtr(struct ndr_print *ndr, const char *name, const struct ExtendedErrorInfoPtr *r)
+{
+ ndr_print_struct(ndr, name, "ExtendedErrorInfoPtr");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "info", r->info);
+ ndr->depth++;
+ if (r->info) {
+ ndr_print_ExtendedErrorInfo(ndr, "info", r->info);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
static enum ndr_err_code ndr_push_decode_replPropertyMetaData(struct ndr_push *ndr, int flags, const struct decode_replPropertyMetaData *r)
{
if (flags & NDR_IN) {
@@ -3351,41 +4031,92 @@ _PUBLIC_ void ndr_print_decode_trustAuthInOut(struct ndr_print *ndr, const char
ndr->depth--;
}
-static enum ndr_err_code ndr_push_decode_DsCompressed(struct ndr_push *ndr, int flags, const struct decode_DsCompressed *r)
+static enum ndr_err_code ndr_push_decode_trustDomainPasswords(struct ndr_push *ndr, int flags, const struct decode_trustDomainPasswords *r)
+{
+ if (flags & NDR_IN) {
+ NDR_CHECK(ndr_push_trustDomainPasswords(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.blob));
+ }
+ if (flags & NDR_OUT) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_decode_trustDomainPasswords(struct ndr_pull *ndr, int flags, struct decode_trustDomainPasswords *r)
+{
+ if (flags & NDR_IN) {
+ NDR_CHECK(ndr_pull_trustDomainPasswords(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.blob));
+ }
+ if (flags & NDR_OUT) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_decode_trustDomainPasswords(struct ndr_print *ndr, const char *name, int flags, const struct decode_trustDomainPasswords *r)
+{
+ ndr_print_struct(ndr, name, "decode_trustDomainPasswords");
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "decode_trustDomainPasswords");
+ ndr->depth++;
+ ndr_print_trustDomainPasswords(ndr, "blob", &r->in.blob);
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "decode_trustDomainPasswords");
+ ndr->depth++;
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_decode_ExtendedErrorInfo(struct ndr_push *ndr, int flags, const struct decode_ExtendedErrorInfo *r)
{
if (flags & NDR_IN) {
- NDR_CHECK(ndr_push_DsCompressedBlob(ndr, NDR_SCALARS, &r->in.blob));
+ {
+ struct ndr_push *_ndr_ptr;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ptr, 0xFFFFFC01, -1));
+ NDR_CHECK(ndr_push_ExtendedErrorInfoPtr(_ndr_ptr, NDR_SCALARS|NDR_BUFFERS, &r->in.ptr));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ptr, 0xFFFFFC01, -1));
+ }
}
if (flags & NDR_OUT) {
}
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_decode_DsCompressed(struct ndr_pull *ndr, int flags, struct decode_DsCompressed *r)
+static enum ndr_err_code ndr_pull_decode_ExtendedErrorInfo(struct ndr_pull *ndr, int flags, struct decode_ExtendedErrorInfo *r)
{
if (flags & NDR_IN) {
- NDR_CHECK(ndr_pull_DsCompressedBlob(ndr, NDR_SCALARS, &r->in.blob));
+ {
+ struct ndr_pull *_ndr_ptr;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_ptr, 0xFFFFFC01, -1));
+ NDR_CHECK(ndr_pull_ExtendedErrorInfoPtr(_ndr_ptr, NDR_SCALARS|NDR_BUFFERS, &r->in.ptr));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_ptr, 0xFFFFFC01, -1));
+ }
}
if (flags & NDR_OUT) {
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_decode_DsCompressed(struct ndr_print *ndr, const char *name, int flags, const struct decode_DsCompressed *r)
+_PUBLIC_ void ndr_print_decode_ExtendedErrorInfo(struct ndr_print *ndr, const char *name, int flags, const struct decode_ExtendedErrorInfo *r)
{
- ndr_print_struct(ndr, name, "decode_DsCompressed");
+ ndr_print_struct(ndr, name, "decode_ExtendedErrorInfo");
ndr->depth++;
if (flags & NDR_SET_VALUES) {
ndr->flags |= LIBNDR_PRINT_SET_VALUES;
}
if (flags & NDR_IN) {
- ndr_print_struct(ndr, "in", "decode_DsCompressed");
+ ndr_print_struct(ndr, "in", "decode_ExtendedErrorInfo");
ndr->depth++;
- ndr_print_DsCompressedBlob(ndr, "blob", &r->in.blob);
+ ndr_print_ExtendedErrorInfoPtr(ndr, "ptr", &r->in.ptr);
ndr->depth--;
}
if (flags & NDR_OUT) {
- ndr_print_struct(ndr, "out", "decode_DsCompressed");
+ ndr_print_struct(ndr, "out", "decode_ExtendedErrorInfo");
ndr->depth++;
ndr->depth--;
}
@@ -3490,11 +4221,19 @@ static const struct ndr_interface_call drsblobs_calls[] = {
false,
},
{
- "decode_DsCompressed",
- sizeof(struct decode_DsCompressed),
- (ndr_push_flags_fn_t) ndr_push_decode_DsCompressed,
- (ndr_pull_flags_fn_t) ndr_pull_decode_DsCompressed,
- (ndr_print_function_t) ndr_print_decode_DsCompressed,
+ "decode_trustDomainPasswords",
+ sizeof(struct decode_trustDomainPasswords),
+ (ndr_push_flags_fn_t) ndr_push_decode_trustDomainPasswords,
+ (ndr_pull_flags_fn_t) ndr_pull_decode_trustDomainPasswords,
+ (ndr_print_function_t) ndr_print_decode_trustDomainPasswords,
+ false,
+ },
+ {
+ "decode_ExtendedErrorInfo",
+ sizeof(struct decode_ExtendedErrorInfo),
+ (ndr_push_flags_fn_t) ndr_push_decode_ExtendedErrorInfo,
+ (ndr_pull_flags_fn_t) ndr_pull_decode_ExtendedErrorInfo,
+ (ndr_print_function_t) ndr_print_decode_ExtendedErrorInfo,
false,
},
{ NULL, 0, NULL, NULL, NULL, false }
@@ -3526,7 +4265,7 @@ const struct ndr_interface_table ndr_table_drsblobs = {
NDR_DRSBLOBS_VERSION
},
.helpstring = NDR_DRSBLOBS_HELPSTRING,
- .num_calls = 13,
+ .num_calls = 14,
.calls = drsblobs_calls,
.endpoints = &drsblobs_endpoints,
.authservices = &drsblobs_authservices
diff --git a/source3/librpc/gen_ndr/ndr_drsblobs.h b/source3/librpc/gen_ndr/ndr_drsblobs.h
index 171e7e25a1..8a5298874a 100644
--- a/source3/librpc/gen_ndr/ndr_drsblobs.h
+++ b/source3/librpc/gen_ndr/ndr_drsblobs.h
@@ -35,9 +35,11 @@ extern const struct ndr_interface_table ndr_table_drsblobs;
#define NDR_DECODE_TRUSTAUTHINOUT (0x0b)
-#define NDR_DECODE_DSCOMPRESSED (0x0c)
+#define NDR_DECODE_TRUSTDOMAINPASSWORDS (0x0c)
-#define NDR_DRSBLOBS_CALL_COUNT (13)
+#define NDR_DECODE_EXTENDEDERRORINFO (0x0d)
+
+#define NDR_DRSBLOBS_CALL_COUNT (14)
void ndr_print_replPropertyMetaData1(struct ndr_print *ndr, const char *name, const struct replPropertyMetaData1 *r);
void ndr_print_replPropertyMetaDataCtr1(struct ndr_print *ndr, const char *name, const struct replPropertyMetaDataCtr1 *r);
void ndr_print_replPropertyMetaDataCtr(struct ndr_print *ndr, const char *name, const union replPropertyMetaDataCtr *r);
@@ -102,21 +104,44 @@ void ndr_print_package_PrimaryWDigestHash(struct ndr_print *ndr, const char *nam
enum ndr_err_code ndr_push_package_PrimaryWDigestBlob(struct ndr_push *ndr, int ndr_flags, const struct package_PrimaryWDigestBlob *r);
enum ndr_err_code ndr_pull_package_PrimaryWDigestBlob(struct ndr_pull *ndr, int ndr_flags, struct package_PrimaryWDigestBlob *r);
void ndr_print_package_PrimaryWDigestBlob(struct ndr_print *ndr, const char *name, const struct package_PrimaryWDigestBlob *r);
-void ndr_print_trustAuthInOutSecret1(struct ndr_print *ndr, const char *name, const struct trustAuthInOutSecret1 *r);
-void ndr_print_trustAuthInOutCtr1(struct ndr_print *ndr, const char *name, const struct trustAuthInOutCtr1 *r);
-void ndr_print_trustAuthInOutSecret2V1(struct ndr_print *ndr, const char *name, const struct trustAuthInOutSecret2V1 *r);
-void ndr_print_trustAuthInOutSecret2V2(struct ndr_print *ndr, const char *name, const struct trustAuthInOutSecret2V2 *r);
-void ndr_print_trustAuthInOutCtr2(struct ndr_print *ndr, const char *name, const struct trustAuthInOutCtr2 *r);
-void ndr_print_trustAuthInOutCtr(struct ndr_print *ndr, const char *name, const union trustAuthInOutCtr *r);
+void ndr_print_AuthInfoNone(struct ndr_print *ndr, const char *name, const struct AuthInfoNone *r);
+void ndr_print_AuthInfoNT4Owf(struct ndr_print *ndr, const char *name, const struct AuthInfoNT4Owf *r);
+void ndr_print_AuthInfoClear(struct ndr_print *ndr, const char *name, const struct AuthInfoClear *r);
+void ndr_print_AuthInfoVersion(struct ndr_print *ndr, const char *name, const struct AuthInfoVersion *r);
+void ndr_print_AuthInfo(struct ndr_print *ndr, const char *name, const union AuthInfo *r);
+enum ndr_err_code ndr_push_AuthenticationInformation(struct ndr_push *ndr, int ndr_flags, const struct AuthenticationInformation *r);
+enum ndr_err_code ndr_pull_AuthenticationInformation(struct ndr_pull *ndr, int ndr_flags, struct AuthenticationInformation *r);
+void ndr_print_AuthenticationInformation(struct ndr_print *ndr, const char *name, const struct AuthenticationInformation *r);
+enum ndr_err_code ndr_push_AuthenticationInformationArray(struct ndr_push *ndr, int ndr_flags, const struct AuthenticationInformationArray *r);
+enum ndr_err_code ndr_pull_AuthenticationInformationArray(struct ndr_pull *ndr, int ndr_flags, struct AuthenticationInformationArray *r);
+void ndr_print_AuthenticationInformationArray(struct ndr_print *ndr, const char *name, const struct AuthenticationInformationArray *r);
enum ndr_err_code ndr_push_trustAuthInOutBlob(struct ndr_push *ndr, int ndr_flags, const struct trustAuthInOutBlob *r);
enum ndr_err_code ndr_pull_trustAuthInOutBlob(struct ndr_pull *ndr, int ndr_flags, struct trustAuthInOutBlob *r);
void ndr_print_trustAuthInOutBlob(struct ndr_print *ndr, const char *name, const struct trustAuthInOutBlob *r);
+size_t ndr_size_trustAuthInOutBlob(const struct trustAuthInOutBlob *r, int flags);
+enum ndr_err_code ndr_push_trustCurrentPasswords(struct ndr_push *ndr, int ndr_flags, const struct trustCurrentPasswords *r);
+enum ndr_err_code ndr_pull_trustCurrentPasswords(struct ndr_pull *ndr, int ndr_flags, struct trustCurrentPasswords *r);
+void ndr_print_trustCurrentPasswords(struct ndr_print *ndr, const char *name, const struct trustCurrentPasswords *r);
+size_t ndr_size_trustCurrentPasswords(const struct trustCurrentPasswords *r, int flags);
+enum ndr_err_code ndr_push_trustDomainPasswords(struct ndr_push *ndr, int ndr_flags, const struct trustDomainPasswords *r);
+enum ndr_err_code ndr_pull_trustDomainPasswords(struct ndr_pull *ndr, int ndr_flags, struct trustDomainPasswords *r);
+void ndr_print_trustDomainPasswords(struct ndr_print *ndr, const char *name, const struct trustDomainPasswords *r);
enum ndr_err_code ndr_push_DsCompressedChunk(struct ndr_push *ndr, int ndr_flags, const struct DsCompressedChunk *r);
enum ndr_err_code ndr_pull_DsCompressedChunk(struct ndr_pull *ndr, int ndr_flags, struct DsCompressedChunk *r);
void ndr_print_DsCompressedChunk(struct ndr_print *ndr, const char *name, const struct DsCompressedChunk *r);
-enum ndr_err_code ndr_push_DsCompressedBlob(struct ndr_push *ndr, int ndr_flags, const struct DsCompressedBlob *r);
-enum ndr_err_code ndr_pull_DsCompressedBlob(struct ndr_pull *ndr, int ndr_flags, struct DsCompressedBlob *r);
-void ndr_print_DsCompressedBlob(struct ndr_print *ndr, const char *name, const struct DsCompressedBlob *r);
+void ndr_print_ExtendedErrorAString(struct ndr_print *ndr, const char *name, const struct ExtendedErrorAString *r);
+void ndr_print_ExtendedErrorUString(struct ndr_print *ndr, const char *name, const struct ExtendedErrorUString *r);
+void ndr_print_ExtendedErrorBlob(struct ndr_print *ndr, const char *name, const struct ExtendedErrorBlob *r);
+void ndr_print_ExtendedErrorComputerNamePresent(struct ndr_print *ndr, const char *name, enum ExtendedErrorComputerNamePresent r);
+void ndr_print_ExtendedErrorComputerNameU(struct ndr_print *ndr, const char *name, const union ExtendedErrorComputerNameU *r);
+void ndr_print_ExtendedErrorComputerName(struct ndr_print *ndr, const char *name, const struct ExtendedErrorComputerName *r);
+void ndr_print_ExtendedErrorParamType(struct ndr_print *ndr, const char *name, enum ExtendedErrorParamType r);
+void ndr_print_ExtendedErrorParamU(struct ndr_print *ndr, const char *name, const union ExtendedErrorParamU *r);
+void ndr_print_ExtendedErrorParam(struct ndr_print *ndr, const char *name, const struct ExtendedErrorParam *r);
+enum ndr_err_code ndr_push_ExtendedErrorInfo(struct ndr_push *ndr, int ndr_flags, const struct ExtendedErrorInfo *r);
+enum ndr_err_code ndr_pull_ExtendedErrorInfo(struct ndr_pull *ndr, int ndr_flags, struct ExtendedErrorInfo *r);
+void ndr_print_ExtendedErrorInfo(struct ndr_print *ndr, const char *name, const struct ExtendedErrorInfo *r);
+void ndr_print_ExtendedErrorInfoPtr(struct ndr_print *ndr, const char *name, const struct ExtendedErrorInfoPtr *r);
void ndr_print_decode_replPropertyMetaData(struct ndr_print *ndr, const char *name, int flags, const struct decode_replPropertyMetaData *r);
void ndr_print_decode_replUpToDateVector(struct ndr_print *ndr, const char *name, int flags, const struct decode_replUpToDateVector *r);
void ndr_print_decode_repsFromTo(struct ndr_print *ndr, const char *name, int flags, const struct decode_repsFromTo *r);
@@ -129,5 +154,6 @@ void ndr_print_decode_PrimaryKerberos(struct ndr_print *ndr, const char *name, i
void ndr_print_decode_PrimaryCLEARTEXT(struct ndr_print *ndr, const char *name, int flags, const struct decode_PrimaryCLEARTEXT *r);
void ndr_print_decode_PrimaryWDigest(struct ndr_print *ndr, const char *name, int flags, const struct decode_PrimaryWDigest *r);
void ndr_print_decode_trustAuthInOut(struct ndr_print *ndr, const char *name, int flags, const struct decode_trustAuthInOut *r);
-void ndr_print_decode_DsCompressed(struct ndr_print *ndr, const char *name, int flags, const struct decode_DsCompressed *r);
+void ndr_print_decode_trustDomainPasswords(struct ndr_print *ndr, const char *name, int flags, const struct decode_trustDomainPasswords *r);
+void ndr_print_decode_ExtendedErrorInfo(struct ndr_print *ndr, const char *name, int flags, const struct decode_ExtendedErrorInfo *r);
#endif /* _HEADER_NDR_drsblobs */
diff --git a/source3/librpc/gen_ndr/ndr_drsuapi.c b/source3/librpc/gen_ndr/ndr_drsuapi.c
index 38b88f643c..c2a4aee180 100644
--- a/source3/librpc/gen_ndr/ndr_drsuapi.c
+++ b/source3/librpc/gen_ndr/ndr_drsuapi.c
@@ -2823,217 +2823,219 @@ _PUBLIC_ size_t ndr_size_drsuapi_DsGetNCChangesCtr6(const struct drsuapi_DsGetNC
return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_drsuapi_DsGetNCChangesCtr6);
}
-static enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesMSZIPCtr1(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesMSZIPCtr1 *r)
+_PUBLIC_ enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesCtr1TS(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesCtr1TS *r)
{
if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->decompressed_length));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->compressed_length));
- NDR_CHECK(ndr_push_unique_ptr(ndr, r->ctr1));
+ NDR_CHECK(ndr_push_align(ndr, 1));
+ {
+ struct ndr_push *_ndr_ctr1;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ctr1, 0xFFFFFC01, -1));
+ NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1(_ndr_ctr1, NDR_SCALARS|NDR_BUFFERS, &r->ctr1));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ctr1, 0xFFFFFC01, -1));
+ }
}
if (ndr_flags & NDR_BUFFERS) {
- if (r->ctr1) {
- {
- struct ndr_push *_ndr_ctr1;
- NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ctr1, 4, r->compressed_length));
- {
- struct ndr_push *_ndr_ctr1_compressed;
- NDR_CHECK(ndr_push_compression_start(_ndr_ctr1, &_ndr_ctr1_compressed, NDR_COMPRESSION_MSZIP, r->decompressed_length));
- NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1(_ndr_ctr1_compressed, NDR_SCALARS|NDR_BUFFERS, r->ctr1));
- NDR_CHECK(ndr_push_compression_end(_ndr_ctr1, _ndr_ctr1_compressed, NDR_COMPRESSION_MSZIP, r->decompressed_length));
- }
- NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ctr1, 4, r->compressed_length));
- }
- }
}
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_drsuapi_DsGetNCChangesMSZIPCtr1(struct ndr_pull *ndr, int ndr_flags, struct drsuapi_DsGetNCChangesMSZIPCtr1 *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_drsuapi_DsGetNCChangesCtr1TS(struct ndr_pull *ndr, int ndr_flags, struct drsuapi_DsGetNCChangesCtr1TS *r)
{
- uint32_t _ptr_ctr1;
- TALLOC_CTX *_mem_save_ctr1_0;
if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->decompressed_length));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->compressed_length));
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_ctr1));
- if (_ptr_ctr1) {
- NDR_PULL_ALLOC(ndr, r->ctr1);
- } else {
- r->ctr1 = NULL;
+ NDR_CHECK(ndr_pull_align(ndr, 1));
+ {
+ struct ndr_pull *_ndr_ctr1;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_ctr1, 0xFFFFFC01, -1));
+ NDR_CHECK(ndr_pull_drsuapi_DsGetNCChangesCtr1(_ndr_ctr1, NDR_SCALARS|NDR_BUFFERS, &r->ctr1));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_ctr1, 0xFFFFFC01, -1));
}
}
if (ndr_flags & NDR_BUFFERS) {
- if (r->ctr1) {
- _mem_save_ctr1_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->ctr1, 0);
- {
- struct ndr_pull *_ndr_ctr1;
- NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_ctr1, 4, r->compressed_length));
- {
- struct ndr_pull *_ndr_ctr1_compressed;
- NDR_CHECK(ndr_pull_compression_start(_ndr_ctr1, &_ndr_ctr1_compressed, NDR_COMPRESSION_MSZIP, r->decompressed_length));
- NDR_CHECK(ndr_pull_drsuapi_DsGetNCChangesCtr1(_ndr_ctr1_compressed, NDR_SCALARS|NDR_BUFFERS, r->ctr1));
- NDR_CHECK(ndr_pull_compression_end(_ndr_ctr1, _ndr_ctr1_compressed, NDR_COMPRESSION_MSZIP, r->decompressed_length));
- }
- NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_ctr1, 4, r->compressed_length));
- }
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr1_0, 0);
- }
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_drsuapi_DsGetNCChangesMSZIPCtr1(struct ndr_print *ndr, const char *name, const struct drsuapi_DsGetNCChangesMSZIPCtr1 *r)
+_PUBLIC_ void ndr_print_drsuapi_DsGetNCChangesCtr1TS(struct ndr_print *ndr, const char *name, const struct drsuapi_DsGetNCChangesCtr1TS *r)
{
- ndr_print_struct(ndr, name, "drsuapi_DsGetNCChangesMSZIPCtr1");
- ndr->depth++;
- ndr_print_uint32(ndr, "decompressed_length", r->decompressed_length);
- ndr_print_uint32(ndr, "compressed_length", r->compressed_length);
- ndr_print_ptr(ndr, "ctr1", r->ctr1);
+ ndr_print_struct(ndr, name, "drsuapi_DsGetNCChangesCtr1TS");
ndr->depth++;
- if (r->ctr1) {
- ndr_print_drsuapi_DsGetNCChangesCtr1(ndr, "ctr1", r->ctr1);
- }
- ndr->depth--;
+ ndr_print_drsuapi_DsGetNCChangesCtr1(ndr, "ctr1", &r->ctr1);
ndr->depth--;
}
-static enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesMSZIPCtr6(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesMSZIPCtr6 *r)
+_PUBLIC_ enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesCtr6TS(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesCtr6TS *r)
{
if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->decompressed_length));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->compressed_length));
- NDR_CHECK(ndr_push_unique_ptr(ndr, r->ctr6));
+ NDR_CHECK(ndr_push_align(ndr, 1));
+ {
+ struct ndr_push *_ndr_ctr6;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ctr6, 0xFFFFFC01, -1));
+ NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6(_ndr_ctr6, NDR_SCALARS|NDR_BUFFERS, &r->ctr6));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ctr6, 0xFFFFFC01, -1));
+ }
}
if (ndr_flags & NDR_BUFFERS) {
- if (r->ctr6) {
- {
- struct ndr_push *_ndr_ctr6;
- NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ctr6, 4, r->compressed_length));
- {
- struct ndr_push *_ndr_ctr6_compressed;
- NDR_CHECK(ndr_push_compression_start(_ndr_ctr6, &_ndr_ctr6_compressed, NDR_COMPRESSION_MSZIP, r->decompressed_length));
- NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6(_ndr_ctr6_compressed, NDR_SCALARS|NDR_BUFFERS, r->ctr6));
- NDR_CHECK(ndr_push_compression_end(_ndr_ctr6, _ndr_ctr6_compressed, NDR_COMPRESSION_MSZIP, r->decompressed_length));
- }
- NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ctr6, 4, r->compressed_length));
- }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_drsuapi_DsGetNCChangesCtr6TS(struct ndr_pull *ndr, int ndr_flags, struct drsuapi_DsGetNCChangesCtr6TS *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 1));
+ {
+ struct ndr_pull *_ndr_ctr6;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_ctr6, 0xFFFFFC01, -1));
+ NDR_CHECK(ndr_pull_drsuapi_DsGetNCChangesCtr6(_ndr_ctr6, NDR_SCALARS|NDR_BUFFERS, &r->ctr6));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_ctr6, 0xFFFFFC01, -1));
}
}
+ if (ndr_flags & NDR_BUFFERS) {
+ }
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_drsuapi_DsGetNCChangesMSZIPCtr6(struct ndr_pull *ndr, int ndr_flags, struct drsuapi_DsGetNCChangesMSZIPCtr6 *r)
+_PUBLIC_ void ndr_print_drsuapi_DsGetNCChangesCtr6TS(struct ndr_print *ndr, const char *name, const struct drsuapi_DsGetNCChangesCtr6TS *r)
+{
+ ndr_print_struct(ndr, name, "drsuapi_DsGetNCChangesCtr6TS");
+ ndr->depth++;
+ ndr_print_drsuapi_DsGetNCChangesCtr6(ndr, "ctr6", &r->ctr6);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_pull_drsuapi_DsGetNCChangesMSZIPCtr1(struct ndr_pull *ndr, int ndr_flags, struct drsuapi_DsGetNCChangesMSZIPCtr1 *r)
{
- uint32_t _ptr_ctr6;
- TALLOC_CTX *_mem_save_ctr6_0;
+ uint32_t _ptr_ts;
+ TALLOC_CTX *_mem_save_ts_0;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->decompressed_length));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->compressed_length));
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_ctr6));
- if (_ptr_ctr6) {
- NDR_PULL_ALLOC(ndr, r->ctr6);
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_ts));
+ if (_ptr_ts) {
+ NDR_PULL_ALLOC(ndr, r->ts);
} else {
- r->ctr6 = NULL;
+ r->ts = NULL;
}
}
if (ndr_flags & NDR_BUFFERS) {
- if (r->ctr6) {
- _mem_save_ctr6_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->ctr6, 0);
+ if (r->ts) {
+ _mem_save_ts_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->ts, 0);
{
- struct ndr_pull *_ndr_ctr6;
- NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_ctr6, 4, r->compressed_length));
+ struct ndr_pull *_ndr_ts;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_ts, 4, r->compressed_length));
{
- struct ndr_pull *_ndr_ctr6_compressed;
- NDR_CHECK(ndr_pull_compression_start(_ndr_ctr6, &_ndr_ctr6_compressed, NDR_COMPRESSION_MSZIP, r->decompressed_length));
- NDR_CHECK(ndr_pull_drsuapi_DsGetNCChangesCtr6(_ndr_ctr6_compressed, NDR_SCALARS|NDR_BUFFERS, r->ctr6));
- NDR_CHECK(ndr_pull_compression_end(_ndr_ctr6, _ndr_ctr6_compressed, NDR_COMPRESSION_MSZIP, r->decompressed_length));
+ struct ndr_pull *_ndr_ts_compressed;
+ NDR_CHECK(ndr_pull_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_MSZIP, r->decompressed_length));
+ NDR_CHECK(ndr_pull_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
+ NDR_CHECK(ndr_pull_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_MSZIP, r->decompressed_length));
}
- NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_ctr6, 4, r->compressed_length));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_ts, 4, r->compressed_length));
}
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr6_0, 0);
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ts_0, 0);
}
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_drsuapi_DsGetNCChangesMSZIPCtr6(struct ndr_print *ndr, const char *name, const struct drsuapi_DsGetNCChangesMSZIPCtr6 *r)
+_PUBLIC_ void ndr_print_drsuapi_DsGetNCChangesMSZIPCtr1(struct ndr_print *ndr, const char *name, const struct drsuapi_DsGetNCChangesMSZIPCtr1 *r)
{
- ndr_print_struct(ndr, name, "drsuapi_DsGetNCChangesMSZIPCtr6");
+ ndr_print_struct(ndr, name, "drsuapi_DsGetNCChangesMSZIPCtr1");
ndr->depth++;
ndr_print_uint32(ndr, "decompressed_length", r->decompressed_length);
ndr_print_uint32(ndr, "compressed_length", r->compressed_length);
- ndr_print_ptr(ndr, "ctr6", r->ctr6);
+ ndr_print_ptr(ndr, "ts", r->ts);
ndr->depth++;
- if (r->ctr6) {
- ndr_print_drsuapi_DsGetNCChangesCtr6(ndr, "ctr6", r->ctr6);
+ if (r->ts) {
+ ndr_print_drsuapi_DsGetNCChangesCtr1TS(ndr, "ts", r->ts);
}
ndr->depth--;
ndr->depth--;
}
-static enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesXPRESSCtr1(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesXPRESSCtr1 *r)
+static enum ndr_err_code ndr_pull_drsuapi_DsGetNCChangesMSZIPCtr6(struct ndr_pull *ndr, int ndr_flags, struct drsuapi_DsGetNCChangesMSZIPCtr6 *r)
{
+ uint32_t _ptr_ts;
+ TALLOC_CTX *_mem_save_ts_0;
if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->decompressed_length));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->compressed_length));
- NDR_CHECK(ndr_push_unique_ptr(ndr, r->ctr1));
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->decompressed_length));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->compressed_length));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_ts));
+ if (_ptr_ts) {
+ NDR_PULL_ALLOC(ndr, r->ts);
+ } else {
+ r->ts = NULL;
+ }
}
if (ndr_flags & NDR_BUFFERS) {
- if (r->ctr1) {
+ if (r->ts) {
+ _mem_save_ts_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->ts, 0);
{
- struct ndr_push *_ndr_ctr1;
- NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ctr1, 4, r->compressed_length));
+ struct ndr_pull *_ndr_ts;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_ts, 4, r->compressed_length));
{
- struct ndr_push *_ndr_ctr1_compressed;
- NDR_CHECK(ndr_push_compression_start(_ndr_ctr1, &_ndr_ctr1_compressed, NDR_COMPRESSION_XPRESS, r->decompressed_length));
- NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1(_ndr_ctr1_compressed, NDR_SCALARS|NDR_BUFFERS, r->ctr1));
- NDR_CHECK(ndr_push_compression_end(_ndr_ctr1, _ndr_ctr1_compressed, NDR_COMPRESSION_XPRESS, r->decompressed_length));
+ struct ndr_pull *_ndr_ts_compressed;
+ NDR_CHECK(ndr_pull_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_MSZIP, r->decompressed_length));
+ NDR_CHECK(ndr_pull_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
+ NDR_CHECK(ndr_pull_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_MSZIP, r->decompressed_length));
}
- NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ctr1, 4, r->compressed_length));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_ts, 4, r->compressed_length));
}
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ts_0, 0);
}
}
return NDR_ERR_SUCCESS;
}
+_PUBLIC_ void ndr_print_drsuapi_DsGetNCChangesMSZIPCtr6(struct ndr_print *ndr, const char *name, const struct drsuapi_DsGetNCChangesMSZIPCtr6 *r)
+{
+ ndr_print_struct(ndr, name, "drsuapi_DsGetNCChangesMSZIPCtr6");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "decompressed_length", r->decompressed_length);
+ ndr_print_uint32(ndr, "compressed_length", r->compressed_length);
+ ndr_print_ptr(ndr, "ts", r->ts);
+ ndr->depth++;
+ if (r->ts) {
+ ndr_print_drsuapi_DsGetNCChangesCtr6TS(ndr, "ts", r->ts);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
static enum ndr_err_code ndr_pull_drsuapi_DsGetNCChangesXPRESSCtr1(struct ndr_pull *ndr, int ndr_flags, struct drsuapi_DsGetNCChangesXPRESSCtr1 *r)
{
- uint32_t _ptr_ctr1;
- TALLOC_CTX *_mem_save_ctr1_0;
+ uint32_t _ptr_ts;
+ TALLOC_CTX *_mem_save_ts_0;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->decompressed_length));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->compressed_length));
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_ctr1));
- if (_ptr_ctr1) {
- NDR_PULL_ALLOC(ndr, r->ctr1);
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_ts));
+ if (_ptr_ts) {
+ NDR_PULL_ALLOC(ndr, r->ts);
} else {
- r->ctr1 = NULL;
+ r->ts = NULL;
}
}
if (ndr_flags & NDR_BUFFERS) {
- if (r->ctr1) {
- _mem_save_ctr1_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->ctr1, 0);
+ if (r->ts) {
+ _mem_save_ts_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->ts, 0);
{
- struct ndr_pull *_ndr_ctr1;
- NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_ctr1, 4, r->compressed_length));
+ struct ndr_pull *_ndr_ts;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_ts, 4, r->compressed_length));
{
- struct ndr_pull *_ndr_ctr1_compressed;
- NDR_CHECK(ndr_pull_compression_start(_ndr_ctr1, &_ndr_ctr1_compressed, NDR_COMPRESSION_XPRESS, r->decompressed_length));
- NDR_CHECK(ndr_pull_drsuapi_DsGetNCChangesCtr1(_ndr_ctr1_compressed, NDR_SCALARS|NDR_BUFFERS, r->ctr1));
- NDR_CHECK(ndr_pull_compression_end(_ndr_ctr1, _ndr_ctr1_compressed, NDR_COMPRESSION_XPRESS, r->decompressed_length));
+ struct ndr_pull *_ndr_ts_compressed;
+ NDR_CHECK(ndr_pull_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_XPRESS, r->decompressed_length));
+ NDR_CHECK(ndr_pull_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
+ NDR_CHECK(ndr_pull_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_XPRESS, r->decompressed_length));
}
- NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_ctr1, 4, r->compressed_length));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_ts, 4, r->compressed_length));
}
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr1_0, 0);
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ts_0, 0);
}
}
return NDR_ERR_SUCCESS;
@@ -3045,72 +3047,46 @@ _PUBLIC_ void ndr_print_drsuapi_DsGetNCChangesXPRESSCtr1(struct ndr_print *ndr,
ndr->depth++;
ndr_print_uint32(ndr, "decompressed_length", r->decompressed_length);
ndr_print_uint32(ndr, "compressed_length", r->compressed_length);
- ndr_print_ptr(ndr, "ctr1", r->ctr1);
+ ndr_print_ptr(ndr, "ts", r->ts);
ndr->depth++;
- if (r->ctr1) {
- ndr_print_drsuapi_DsGetNCChangesCtr1(ndr, "ctr1", r->ctr1);
+ if (r->ts) {
+ ndr_print_drsuapi_DsGetNCChangesCtr1TS(ndr, "ts", r->ts);
}
ndr->depth--;
ndr->depth--;
}
-static enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesXPRESSCtr6(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesXPRESSCtr6 *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->decompressed_length));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->compressed_length));
- NDR_CHECK(ndr_push_unique_ptr(ndr, r->ctr6));
- }
- if (ndr_flags & NDR_BUFFERS) {
- if (r->ctr6) {
- {
- struct ndr_push *_ndr_ctr6;
- NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ctr6, 4, r->compressed_length));
- {
- struct ndr_push *_ndr_ctr6_compressed;
- NDR_CHECK(ndr_push_compression_start(_ndr_ctr6, &_ndr_ctr6_compressed, NDR_COMPRESSION_XPRESS, r->decompressed_length));
- NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6(_ndr_ctr6_compressed, NDR_SCALARS|NDR_BUFFERS, r->ctr6));
- NDR_CHECK(ndr_push_compression_end(_ndr_ctr6, _ndr_ctr6_compressed, NDR_COMPRESSION_XPRESS, r->decompressed_length));
- }
- NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ctr6, 4, r->compressed_length));
- }
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
static enum ndr_err_code ndr_pull_drsuapi_DsGetNCChangesXPRESSCtr6(struct ndr_pull *ndr, int ndr_flags, struct drsuapi_DsGetNCChangesXPRESSCtr6 *r)
{
- uint32_t _ptr_ctr6;
- TALLOC_CTX *_mem_save_ctr6_0;
+ uint32_t _ptr_ts;
+ TALLOC_CTX *_mem_save_ts_0;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->decompressed_length));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->compressed_length));
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_ctr6));
- if (_ptr_ctr6) {
- NDR_PULL_ALLOC(ndr, r->ctr6);
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_ts));
+ if (_ptr_ts) {
+ NDR_PULL_ALLOC(ndr, r->ts);
} else {
- r->ctr6 = NULL;
+ r->ts = NULL;
}
}
if (ndr_flags & NDR_BUFFERS) {
- if (r->ctr6) {
- _mem_save_ctr6_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->ctr6, 0);
+ if (r->ts) {
+ _mem_save_ts_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->ts, 0);
{
- struct ndr_pull *_ndr_ctr6;
- NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_ctr6, 4, r->compressed_length));
+ struct ndr_pull *_ndr_ts;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_ts, 4, r->compressed_length));
{
- struct ndr_pull *_ndr_ctr6_compressed;
- NDR_CHECK(ndr_pull_compression_start(_ndr_ctr6, &_ndr_ctr6_compressed, NDR_COMPRESSION_XPRESS, r->decompressed_length));
- NDR_CHECK(ndr_pull_drsuapi_DsGetNCChangesCtr6(_ndr_ctr6_compressed, NDR_SCALARS|NDR_BUFFERS, r->ctr6));
- NDR_CHECK(ndr_pull_compression_end(_ndr_ctr6, _ndr_ctr6_compressed, NDR_COMPRESSION_XPRESS, r->decompressed_length));
+ struct ndr_pull *_ndr_ts_compressed;
+ NDR_CHECK(ndr_pull_compression_start(_ndr_ts, &_ndr_ts_compressed, NDR_COMPRESSION_XPRESS, r->decompressed_length));
+ NDR_CHECK(ndr_pull_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
+ NDR_CHECK(ndr_pull_compression_end(_ndr_ts, _ndr_ts_compressed, NDR_COMPRESSION_XPRESS, r->decompressed_length));
}
- NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_ctr6, 4, r->compressed_length));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_ts, 4, r->compressed_length));
}
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr6_0, 0);
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ts_0, 0);
}
}
return NDR_ERR_SUCCESS;
@@ -3122,10 +3098,10 @@ _PUBLIC_ void ndr_print_drsuapi_DsGetNCChangesXPRESSCtr6(struct ndr_print *ndr,
ndr->depth++;
ndr_print_uint32(ndr, "decompressed_length", r->decompressed_length);
ndr_print_uint32(ndr, "compressed_length", r->compressed_length);
- ndr_print_ptr(ndr, "ctr6", r->ctr6);
+ ndr_print_ptr(ndr, "ts", r->ts);
ndr->depth++;
- if (r->ctr6) {
- ndr_print_drsuapi_DsGetNCChangesCtr6(ndr, "ctr6", r->ctr6);
+ if (r->ts) {
+ ndr_print_drsuapi_DsGetNCChangesCtr6TS(ndr, "ts", r->ts);
}
ndr->depth--;
ndr->depth--;
@@ -3304,11 +3280,10 @@ static enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesCtr2(struct ndr_push *nd
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_set_switch_value(ndr, &r->ctr, 1 | (DRSUAPI_COMPRESSION_TYPE_MSZIP << 16)));
- NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCompressedCtr(ndr, NDR_SCALARS, &r->ctr));
+ NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesMSZIPCtr1(ndr, NDR_SCALARS, &r->mszip1));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCompressedCtr(ndr, NDR_BUFFERS, &r->ctr));
+ NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesMSZIPCtr1(ndr, NDR_BUFFERS, &r->mszip1));
}
return NDR_ERR_SUCCESS;
}
@@ -3317,11 +3292,10 @@ static enum ndr_err_code ndr_pull_drsuapi_DsGetNCChangesCtr2(struct ndr_pull *nd
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->ctr, 1 | (DRSUAPI_COMPRESSION_TYPE_MSZIP << 16)));
- NDR_CHECK(ndr_pull_drsuapi_DsGetNCChangesCompressedCtr(ndr, NDR_SCALARS, &r->ctr));
+ NDR_CHECK(ndr_pull_drsuapi_DsGetNCChangesMSZIPCtr1(ndr, NDR_SCALARS, &r->mszip1));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_pull_drsuapi_DsGetNCChangesCompressedCtr(ndr, NDR_BUFFERS, &r->ctr));
+ NDR_CHECK(ndr_pull_drsuapi_DsGetNCChangesMSZIPCtr1(ndr, NDR_BUFFERS, &r->mszip1));
}
return NDR_ERR_SUCCESS;
}
@@ -3330,8 +3304,7 @@ _PUBLIC_ void ndr_print_drsuapi_DsGetNCChangesCtr2(struct ndr_print *ndr, const
{
ndr_print_struct(ndr, name, "drsuapi_DsGetNCChangesCtr2");
ndr->depth++;
- ndr_print_set_switch_value(ndr, &r->ctr, 1 | (DRSUAPI_COMPRESSION_TYPE_MSZIP << 16));
- ndr_print_drsuapi_DsGetNCChangesCompressedCtr(ndr, "ctr", &r->ctr);
+ ndr_print_drsuapi_DsGetNCChangesMSZIPCtr1(ndr, "mszip1", &r->mszip1);
ndr->depth--;
}
@@ -4741,7 +4714,7 @@ _PUBLIC_ void ndr_print_drsuapi_DsNameFormat(struct ndr_print *ndr, const char *
const char *val = NULL;
switch (r) {
- case DRSUAPI_DS_NAME_FORMAT_UKNOWN: val = "DRSUAPI_DS_NAME_FORMAT_UKNOWN"; break;
+ case DRSUAPI_DS_NAME_FORMAT_UNKNOWN: val = "DRSUAPI_DS_NAME_FORMAT_UNKNOWN"; break;
case DRSUAPI_DS_NAME_FORMAT_FQDN_1779: val = "DRSUAPI_DS_NAME_FORMAT_FQDN_1779"; break;
case DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT: val = "DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT"; break;
case DRSUAPI_DS_NAME_FORMAT_DISPLAY: val = "DRSUAPI_DS_NAME_FORMAT_DISPLAY"; break;
@@ -5609,7 +5582,7 @@ static enum ndr_err_code ndr_push_drsuapi_DsRemoveDSServerRequest1(struct ndr_pu
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->server_dn));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->domain_dn));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->commit));
}
if (ndr_flags & NDR_BUFFERS) {
if (r->server_dn) {
@@ -5648,7 +5621,7 @@ static enum ndr_err_code ndr_pull_drsuapi_DsRemoveDSServerRequest1(struct ndr_pu
} else {
r->domain_dn = NULL;
}
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->commit));
}
if (ndr_flags & NDR_BUFFERS) {
if (r->server_dn) {
@@ -5695,7 +5668,7 @@ _PUBLIC_ void ndr_print_drsuapi_DsRemoveDSServerRequest1(struct ndr_print *ndr,
ndr_print_string(ndr, "domain_dn", r->domain_dn);
}
ndr->depth--;
- ndr_print_uint32(ndr, "unknown", r->unknown);
+ ndr_print_uint32(ndr, "commit", r->commit);
ndr->depth--;
}
@@ -5778,7 +5751,7 @@ static enum ndr_err_code ndr_push_drsuapi_DsRemoveDSServerResult1(struct ndr_pus
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->status));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->last_dc_in_domain));
}
if (ndr_flags & NDR_BUFFERS) {
}
@@ -5789,7 +5762,7 @@ static enum ndr_err_code ndr_pull_drsuapi_DsRemoveDSServerResult1(struct ndr_pul
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->status));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->last_dc_in_domain));
}
if (ndr_flags & NDR_BUFFERS) {
}
@@ -5800,7 +5773,7 @@ _PUBLIC_ void ndr_print_drsuapi_DsRemoveDSServerResult1(struct ndr_print *ndr, c
{
ndr_print_struct(ndr, name, "drsuapi_DsRemoveDSServerResult1");
ndr->depth++;
- ndr_print_WERROR(ndr, "status", r->status);
+ ndr_print_uint32(ndr, "last_dc_in_domain", r->last_dc_in_domain);
ndr->depth--;
}
diff --git a/source3/librpc/gen_ndr/ndr_drsuapi.h b/source3/librpc/gen_ndr/ndr_drsuapi.h
index 6b6a0b5670..4b5ead467f 100644
--- a/source3/librpc/gen_ndr/ndr_drsuapi.h
+++ b/source3/librpc/gen_ndr/ndr_drsuapi.h
@@ -6,7 +6,7 @@
#ifndef _HEADER_NDR_drsuapi
#define _HEADER_NDR_drsuapi
-#include "librpc/ndr/ndr_drsuapi.h"
+#include "../librpc/ndr/ndr_drsuapi.h"
#define NDR_DRSUAPI_UUID "e3514235-4b06-11d1-ab04-00c04fc2dcd2"
#define NDR_DRSUAPI_VERSION 4.0
#define NDR_DRSUAPI_NAME "drsuapi"
@@ -151,9 +151,19 @@ enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesCtr6(struct ndr_push *ndr, int
enum ndr_err_code ndr_pull_drsuapi_DsGetNCChangesCtr6(struct ndr_pull *ndr, int ndr_flags, struct drsuapi_DsGetNCChangesCtr6 *r);
void ndr_print_drsuapi_DsGetNCChangesCtr6(struct ndr_print *ndr, const char *name, const struct drsuapi_DsGetNCChangesCtr6 *r);
size_t ndr_size_drsuapi_DsGetNCChangesCtr6(const struct drsuapi_DsGetNCChangesCtr6 *r, int flags);
+enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesCtr1TS(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesCtr1TS *r);
+enum ndr_err_code ndr_pull_drsuapi_DsGetNCChangesCtr1TS(struct ndr_pull *ndr, int ndr_flags, struct drsuapi_DsGetNCChangesCtr1TS *r);
+void ndr_print_drsuapi_DsGetNCChangesCtr1TS(struct ndr_print *ndr, const char *name, const struct drsuapi_DsGetNCChangesCtr1TS *r);
+enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesCtr6TS(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesCtr6TS *r);
+enum ndr_err_code ndr_pull_drsuapi_DsGetNCChangesCtr6TS(struct ndr_pull *ndr, int ndr_flags, struct drsuapi_DsGetNCChangesCtr6TS *r);
+void ndr_print_drsuapi_DsGetNCChangesCtr6TS(struct ndr_print *ndr, const char *name, const struct drsuapi_DsGetNCChangesCtr6TS *r);
+enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesMSZIPCtr1(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesMSZIPCtr1 *r);
void ndr_print_drsuapi_DsGetNCChangesMSZIPCtr1(struct ndr_print *ndr, const char *name, const struct drsuapi_DsGetNCChangesMSZIPCtr1 *r);
+enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesMSZIPCtr6(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesMSZIPCtr6 *r);
void ndr_print_drsuapi_DsGetNCChangesMSZIPCtr6(struct ndr_print *ndr, const char *name, const struct drsuapi_DsGetNCChangesMSZIPCtr6 *r);
+enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesXPRESSCtr1(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesXPRESSCtr1 *r);
void ndr_print_drsuapi_DsGetNCChangesXPRESSCtr1(struct ndr_print *ndr, const char *name, const struct drsuapi_DsGetNCChangesXPRESSCtr1 *r);
+enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesXPRESSCtr6(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsGetNCChangesXPRESSCtr6 *r);
void ndr_print_drsuapi_DsGetNCChangesXPRESSCtr6(struct ndr_print *ndr, const char *name, const struct drsuapi_DsGetNCChangesXPRESSCtr6 *r);
void ndr_print_drsuapi_DsGetNCChangesCompressionType(struct ndr_print *ndr, const char *name, enum drsuapi_DsGetNCChangesCompressionType r);
void ndr_print_drsuapi_DsGetNCChangesCompressedCtr(struct ndr_print *ndr, const char *name, const union drsuapi_DsGetNCChangesCompressedCtr *r);
diff --git a/source3/librpc/gen_ndr/ndr_echo.c b/source3/librpc/gen_ndr/ndr_echo.c
index 93a8464c7b..99556e1bff 100644
--- a/source3/librpc/gen_ndr/ndr_echo.c
+++ b/source3/librpc/gen_ndr/ndr_echo.c
@@ -3,7 +3,7 @@
#include "includes.h"
#include "librpc/gen_ndr/ndr_echo.h"
-static enum ndr_err_code ndr_push_echo_info1(struct ndr_push *ndr, int ndr_flags, const struct echo_info1 *r)
+_PUBLIC_ enum ndr_err_code ndr_push_echo_info1(struct ndr_push *ndr, int ndr_flags, const struct echo_info1 *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 1));
@@ -14,7 +14,7 @@ static enum ndr_err_code ndr_push_echo_info1(struct ndr_push *ndr, int ndr_flags
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_echo_info1(struct ndr_pull *ndr, int ndr_flags, struct echo_info1 *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_echo_info1(struct ndr_pull *ndr, int ndr_flags, struct echo_info1 *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 1));
diff --git a/source3/librpc/gen_ndr/ndr_echo.h b/source3/librpc/gen_ndr/ndr_echo.h
index 7af1c7446b..c1c7716573 100644
--- a/source3/librpc/gen_ndr/ndr_echo.h
+++ b/source3/librpc/gen_ndr/ndr_echo.h
@@ -32,6 +32,8 @@ extern const struct ndr_interface_table ndr_table_rpcecho;
#define NDR_ECHO_TESTDOUBLEPOINTER (0x09)
#define NDR_RPCECHO_CALL_COUNT (10)
+enum ndr_err_code ndr_push_echo_info1(struct ndr_push *ndr, int ndr_flags, const struct echo_info1 *r);
+enum ndr_err_code ndr_pull_echo_info1(struct ndr_pull *ndr, int ndr_flags, struct echo_info1 *r);
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);
diff --git a/source3/librpc/gen_ndr/ndr_epmapper.c b/source3/librpc/gen_ndr/ndr_epmapper.c
index ab84d289cf..0f1005dda7 100644
--- a/source3/librpc/gen_ndr/ndr_epmapper.c
+++ b/source3/librpc/gen_ndr/ndr_epmapper.c
@@ -3,6 +3,7 @@
#include "includes.h"
#include "librpc/gen_ndr/ndr_epmapper.h"
+#include "librpc/gen_ndr/ndr_misc.h"
static enum ndr_err_code ndr_push_epm_protocol(struct ndr_push *ndr, int ndr_flags, enum epm_protocol r)
{
NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
@@ -1632,15 +1633,11 @@ static enum ndr_err_code ndr_push_epm_entry_t(struct ndr_push *ndr, int ndr_flag
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->object));
NDR_CHECK(ndr_push_full_ptr(ndr, r->tower));
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_LEN4);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->annotation));
- ndr->flags = _flags_save_string;
- }
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, strlen(r->annotation) + 1));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->annotation, strlen(r->annotation) + 1, sizeof(uint8_t), CH_DOS));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_push_GUID(ndr, NDR_BUFFERS, &r->object));
if (r->tower) {
NDR_CHECK(ndr_push_epm_twr_t(ndr, NDR_SCALARS, r->tower));
}
@@ -1661,15 +1658,11 @@ static enum ndr_err_code ndr_pull_epm_entry_t(struct ndr_pull *ndr, int ndr_flag
} else {
r->tower = NULL;
}
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_LEN4);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->annotation));
- ndr->flags = _flags_save_string;
- }
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->__annotation_offset));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->__annotation_length));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->annotation, r->__annotation_length, sizeof(uint8_t), CH_DOS));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_BUFFERS, &r->object));
if (r->tower) {
_mem_save_tower_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->tower, 0);
@@ -1691,6 +1684,8 @@ _PUBLIC_ void ndr_print_epm_entry_t(struct ndr_print *ndr, const char *name, con
ndr_print_epm_twr_t(ndr, "tower", r->tower);
}
ndr->depth--;
+ ndr_print_uint32(ndr, "__annotation_offset", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?0:r->__annotation_offset);
+ ndr_print_uint32(ndr, "__annotation_length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen(r->annotation) + 1:r->__annotation_length);
ndr_print_string(ndr, "annotation", r->annotation);
ndr->depth--;
}
@@ -1704,7 +1699,6 @@ static enum ndr_err_code ndr_push_rpc_if_id_t(struct ndr_push *ndr, int ndr_flag
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->vers_minor));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_push_GUID(ndr, NDR_BUFFERS, &r->uuid));
}
return NDR_ERR_SUCCESS;
}
@@ -1718,7 +1712,6 @@ static enum ndr_err_code ndr_pull_rpc_if_id_t(struct ndr_pull *ndr, int ndr_flag
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->vers_minor));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_BUFFERS, &r->uuid));
}
return NDR_ERR_SUCCESS;
}
@@ -1952,24 +1945,24 @@ static enum ndr_err_code ndr_push_epm_Lookup(struct ndr_push *ndr, int flags, co
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.inquiry_type));
NDR_CHECK(ndr_push_full_ptr(ndr, r->in.object));
if (r->in.object) {
- NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.object));
+ NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, r->in.object));
}
NDR_CHECK(ndr_push_full_ptr(ndr, r->in.interface_id));
if (r->in.interface_id) {
- NDR_CHECK(ndr_push_rpc_if_id_t(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.interface_id));
+ NDR_CHECK(ndr_push_rpc_if_id_t(ndr, NDR_SCALARS, r->in.interface_id));
}
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.vers_option));
if (r->in.entry_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.entry_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.entry_handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.max_ents));
}
if (flags & NDR_OUT) {
if (r->out.entry_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->out.entry_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.entry_handle));
if (r->out.num_ents == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -2011,7 +2004,7 @@ static enum ndr_err_code ndr_pull_epm_Lookup(struct ndr_pull *ndr, int flags, st
if (r->in.object) {
_mem_save_object_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.object, 0);
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.object));
+ NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, r->in.object));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_object_0, 0);
}
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_interface_id));
@@ -2023,7 +2016,7 @@ static enum ndr_err_code ndr_pull_epm_Lookup(struct ndr_pull *ndr, int flags, st
if (r->in.interface_id) {
_mem_save_interface_id_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.interface_id, 0);
- NDR_CHECK(ndr_pull_rpc_if_id_t(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.interface_id));
+ NDR_CHECK(ndr_pull_rpc_if_id_t(ndr, NDR_SCALARS, r->in.interface_id));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_interface_id_0, 0);
}
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.vers_option));
@@ -2032,7 +2025,7 @@ static enum ndr_err_code ndr_pull_epm_Lookup(struct ndr_pull *ndr, int flags, st
}
_mem_save_entry_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.entry_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.entry_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.entry_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entry_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.max_ents));
NDR_PULL_ALLOC(ndr, r->out.entry_handle);
@@ -2046,7 +2039,7 @@ static enum ndr_err_code ndr_pull_epm_Lookup(struct ndr_pull *ndr, int flags, st
}
_mem_save_entry_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.entry_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.entry_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.entry_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entry_handle_0, LIBNDR_FLAG_REF_ALLOC);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->out.num_ents);
@@ -2146,7 +2139,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_epm_Map(struct ndr_push *ndr, int flags, con
if (flags & NDR_IN) {
NDR_CHECK(ndr_push_full_ptr(ndr, r->in.object));
if (r->in.object) {
- NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.object));
+ NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, r->in.object));
}
NDR_CHECK(ndr_push_full_ptr(ndr, r->in.map_tower));
if (r->in.map_tower) {
@@ -2155,14 +2148,14 @@ _PUBLIC_ enum ndr_err_code ndr_push_epm_Map(struct ndr_push *ndr, int flags, con
if (r->in.entry_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.entry_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.entry_handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.max_towers));
}
if (flags & NDR_OUT) {
if (r->out.entry_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->out.entry_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.entry_handle));
if (r->out.num_towers == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -2203,7 +2196,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_epm_Map(struct ndr_pull *ndr, int flags, str
if (r->in.object) {
_mem_save_object_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.object, 0);
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.object));
+ NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, r->in.object));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_object_0, 0);
}
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_map_tower));
@@ -2223,7 +2216,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_epm_Map(struct ndr_pull *ndr, int flags, str
}
_mem_save_entry_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.entry_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.entry_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.entry_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entry_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.max_towers));
NDR_PULL_ALLOC(ndr, r->out.entry_handle);
@@ -2237,7 +2230,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_epm_Map(struct ndr_pull *ndr, int flags, str
}
_mem_save_entry_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.entry_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.entry_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.entry_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entry_handle_0, LIBNDR_FLAG_REF_ALLOC);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->out.num_towers);
@@ -2335,13 +2328,13 @@ static enum ndr_err_code ndr_push_epm_LookupHandleFree(struct ndr_push *ndr, int
if (r->in.entry_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.entry_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.entry_handle));
}
if (flags & NDR_OUT) {
if (r->out.entry_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->out.entry_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.entry_handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -2358,7 +2351,7 @@ static enum ndr_err_code ndr_pull_epm_LookupHandleFree(struct ndr_pull *ndr, int
}
_mem_save_entry_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.entry_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.entry_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.entry_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entry_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_PULL_ALLOC(ndr, r->out.entry_handle);
*r->out.entry_handle = *r->in.entry_handle;
@@ -2369,7 +2362,7 @@ static enum ndr_err_code ndr_pull_epm_LookupHandleFree(struct ndr_pull *ndr, int
}
_mem_save_entry_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.entry_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.entry_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.entry_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entry_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->out.result));
}
@@ -2411,7 +2404,7 @@ static enum ndr_err_code ndr_push_epm_InqObject(struct ndr_push *ndr, int flags,
if (r->in.epm_object == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
- NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.epm_object));
+ NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, r->in.epm_object));
}
if (flags & NDR_OUT) {
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->out.result));
@@ -2428,7 +2421,7 @@ static enum ndr_err_code ndr_pull_epm_InqObject(struct ndr_pull *ndr, int flags,
}
_mem_save_epm_object_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.epm_object, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.epm_object));
+ NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, r->in.epm_object));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_epm_object_0, LIBNDR_FLAG_REF_ALLOC);
}
if (flags & NDR_OUT) {
@@ -2468,7 +2461,7 @@ static enum ndr_err_code ndr_push_epm_MgmtDelete(struct ndr_push *ndr, int flags
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.object_speced));
NDR_CHECK(ndr_push_full_ptr(ndr, r->in.object));
if (r->in.object) {
- NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.object));
+ NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, r->in.object));
}
NDR_CHECK(ndr_push_full_ptr(ndr, r->in.tower));
if (r->in.tower) {
@@ -2498,7 +2491,7 @@ static enum ndr_err_code ndr_pull_epm_MgmtDelete(struct ndr_pull *ndr, int flags
if (r->in.object) {
_mem_save_object_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.object, 0);
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.object));
+ NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, r->in.object));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_object_0, 0);
}
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_tower));
diff --git a/source3/librpc/gen_ndr/ndr_eventlog.c b/source3/librpc/gen_ndr/ndr_eventlog.c
index 2eb26c4bc4..f0c7ee4d61 100644
--- a/source3/librpc/gen_ndr/ndr_eventlog.c
+++ b/source3/librpc/gen_ndr/ndr_eventlog.c
@@ -192,7 +192,7 @@ static enum ndr_err_code ndr_push_eventlog_ClearEventLogW(struct ndr_push *ndr,
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.backupfile));
if (r->in.backupfile) {
NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.backupfile));
@@ -215,7 +215,7 @@ static enum ndr_err_code ndr_pull_eventlog_ClearEventLogW(struct ndr_pull *ndr,
}
_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_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_generic_ptr(ndr, &_ptr_backupfile));
if (_ptr_backupfile) {
@@ -314,13 +314,13 @@ static enum ndr_err_code ndr_push_eventlog_CloseEventLog(struct ndr_push *ndr, i
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_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|NDR_BUFFERS, r->out.handle));
+ 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;
@@ -337,7 +337,7 @@ static enum ndr_err_code ndr_pull_eventlog_CloseEventLog(struct ndr_pull *ndr, i
}
_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_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;
@@ -348,7 +348,7 @@ static enum ndr_err_code ndr_pull_eventlog_CloseEventLog(struct ndr_pull *ndr, i
}
_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|NDR_BUFFERS, r->out.handle));
+ 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));
}
@@ -431,7 +431,7 @@ static enum ndr_err_code ndr_push_eventlog_GetNumRecords(struct ndr_push *ndr, i
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
}
if (flags & NDR_OUT) {
if (r->out.number == NULL) {
@@ -455,7 +455,7 @@ static enum ndr_err_code ndr_pull_eventlog_GetNumRecords(struct ndr_pull *ndr, i
}
_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_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.number);
ZERO_STRUCTP(r->out.number);
@@ -508,7 +508,7 @@ static enum ndr_err_code ndr_push_eventlog_GetOldestRecord(struct ndr_push *ndr,
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
}
if (flags & NDR_OUT) {
if (r->out.oldest_entry == NULL) {
@@ -532,7 +532,7 @@ static enum ndr_err_code ndr_pull_eventlog_GetOldestRecord(struct ndr_pull *ndr,
}
_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_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.oldest_entry);
ZERO_STRUCTP(r->out.oldest_entry);
@@ -642,7 +642,7 @@ static enum ndr_err_code ndr_push_eventlog_OpenEventLogW(struct ndr_push *ndr, i
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|NDR_BUFFERS, r->out.handle));
+ 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;
@@ -695,7 +695,7 @@ static enum ndr_err_code ndr_pull_eventlog_OpenEventLogW(struct ndr_pull *ndr, i
}
_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|NDR_BUFFERS, r->out.handle));
+ 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));
}
@@ -831,7 +831,7 @@ static enum ndr_err_code ndr_push_eventlog_ReadEventLogW(struct ndr_push *ndr, i
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.offset));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.number_of_bytes));
@@ -868,7 +868,7 @@ static enum ndr_err_code ndr_pull_eventlog_ReadEventLogW(struct ndr_pull *ndr, i
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.flags));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.offset));
@@ -1449,7 +1449,7 @@ static enum ndr_err_code ndr_push_eventlog_FlushEventLog(struct ndr_push *ndr, i
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
}
if (flags & NDR_OUT) {
NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
@@ -1466,7 +1466,7 @@ static enum ndr_err_code ndr_pull_eventlog_FlushEventLog(struct ndr_pull *ndr, i
}
_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_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);
}
if (flags & NDR_OUT) {
diff --git a/source3/librpc/gen_ndr/ndr_initshutdown.c b/source3/librpc/gen_ndr/ndr_initshutdown.c
index 5d6c0c3c08..62a19af3a2 100644
--- a/source3/librpc/gen_ndr/ndr_initshutdown.c
+++ b/source3/librpc/gen_ndr/ndr_initshutdown.c
@@ -3,106 +3,7 @@
#include "includes.h"
#include "librpc/gen_ndr/ndr_initshutdown.h"
-static enum ndr_err_code ndr_push_initshutdown_String_sub(struct ndr_push *ndr, int ndr_flags, const struct initshutdown_String_sub *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, strlen_m_term(r->name)));
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_NOTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->name));
- ndr->flags = _flags_save_string;
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_initshutdown_String_sub(struct ndr_pull *ndr, int ndr_flags, struct initshutdown_String_sub *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->name_size));
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_LEN4|LIBNDR_FLAG_STR_NOTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->name));
- ndr->flags = _flags_save_string;
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_initshutdown_String_sub(struct ndr_print *ndr, const char *name, const struct initshutdown_String_sub *r)
-{
- ndr_print_struct(ndr, name, "initshutdown_String_sub");
- ndr->depth++;
- ndr_print_uint32(ndr, "name_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m_term(r->name):r->name_size);
- ndr_print_string(ndr, "name", r->name);
- ndr->depth--;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_push_initshutdown_String(struct ndr_push *ndr, int ndr_flags, const struct initshutdown_String *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m(r->name->name) * 2));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m_term(r->name->name) * 2));
- NDR_CHECK(ndr_push_unique_ptr(ndr, r->name));
- }
- if (ndr_flags & NDR_BUFFERS) {
- if (r->name) {
- NDR_CHECK(ndr_push_initshutdown_String_sub(ndr, NDR_SCALARS, r->name));
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_pull_initshutdown_String(struct ndr_pull *ndr, int ndr_flags, struct initshutdown_String *r)
-{
- uint32_t _ptr_name;
- TALLOC_CTX *_mem_save_name_0;
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->name_len));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->name_size));
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name));
- if (_ptr_name) {
- NDR_PULL_ALLOC(ndr, r->name);
- } else {
- r->name = NULL;
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- if (r->name) {
- _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->name, 0);
- NDR_CHECK(ndr_pull_initshutdown_String_sub(ndr, NDR_SCALARS, r->name));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, 0);
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_initshutdown_String(struct ndr_print *ndr, const char *name, const struct initshutdown_String *r)
-{
- ndr_print_struct(ndr, name, "initshutdown_String");
- ndr->depth++;
- ndr_print_uint16(ndr, "name_len", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m(r->name->name) * 2:r->name_len);
- ndr_print_uint16(ndr, "name_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m_term(r->name->name) * 2:r->name_size);
- ndr_print_ptr(ndr, "name", r->name);
- ndr->depth++;
- if (r->name) {
- ndr_print_initshutdown_String_sub(ndr, "name", r->name);
- }
- ndr->depth--;
- ndr->depth--;
-}
-
+#include "librpc/gen_ndr/ndr_lsa.h"
static enum ndr_err_code ndr_push_initshutdown_Init(struct ndr_push *ndr, int flags, const struct initshutdown_Init *r)
{
if (flags & NDR_IN) {
@@ -112,7 +13,7 @@ static enum ndr_err_code ndr_push_initshutdown_Init(struct ndr_push *ndr, int fl
}
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.message));
if (r->in.message) {
- NDR_CHECK(ndr_push_initshutdown_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message));
+ NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message));
}
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.timeout));
NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.force_apps));
@@ -152,7 +53,7 @@ static enum ndr_err_code ndr_pull_initshutdown_Init(struct ndr_pull *ndr, int fl
if (r->in.message) {
_mem_save_message_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.message, 0);
- NDR_CHECK(ndr_pull_initshutdown_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message));
+ NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_message_0, 0);
}
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.timeout));
@@ -184,7 +85,7 @@ _PUBLIC_ void ndr_print_initshutdown_Init(struct ndr_print *ndr, const char *nam
ndr_print_ptr(ndr, "message", r->in.message);
ndr->depth++;
if (r->in.message) {
- ndr_print_initshutdown_String(ndr, "message", r->in.message);
+ ndr_print_lsa_StringLarge(ndr, "message", r->in.message);
}
ndr->depth--;
ndr_print_uint32(ndr, "timeout", r->in.timeout);
@@ -275,7 +176,7 @@ static enum ndr_err_code ndr_push_initshutdown_InitEx(struct ndr_push *ndr, int
}
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.message));
if (r->in.message) {
- NDR_CHECK(ndr_push_initshutdown_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message));
+ NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message));
}
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.timeout));
NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.force_apps));
@@ -316,7 +217,7 @@ static enum ndr_err_code ndr_pull_initshutdown_InitEx(struct ndr_pull *ndr, int
if (r->in.message) {
_mem_save_message_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.message, 0);
- NDR_CHECK(ndr_pull_initshutdown_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message));
+ NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_message_0, 0);
}
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.timeout));
@@ -349,7 +250,7 @@ _PUBLIC_ void ndr_print_initshutdown_InitEx(struct ndr_print *ndr, const char *n
ndr_print_ptr(ndr, "message", r->in.message);
ndr->depth++;
if (r->in.message) {
- ndr_print_initshutdown_String(ndr, "message", r->in.message);
+ ndr_print_lsa_StringLarge(ndr, "message", r->in.message);
}
ndr->depth--;
ndr_print_uint32(ndr, "timeout", r->in.timeout);
diff --git a/source3/librpc/gen_ndr/ndr_initshutdown.h b/source3/librpc/gen_ndr/ndr_initshutdown.h
index 9a19432678..2cb5a530b0 100644
--- a/source3/librpc/gen_ndr/ndr_initshutdown.h
+++ b/source3/librpc/gen_ndr/ndr_initshutdown.h
@@ -18,10 +18,6 @@ extern const struct ndr_interface_table ndr_table_initshutdown;
#define NDR_INITSHUTDOWN_INITEX (0x02)
#define NDR_INITSHUTDOWN_CALL_COUNT (3)
-void ndr_print_initshutdown_String_sub(struct ndr_print *ndr, const char *name, const struct initshutdown_String_sub *r);
-enum ndr_err_code ndr_push_initshutdown_String(struct ndr_push *ndr, int ndr_flags, const struct initshutdown_String *r);
-enum ndr_err_code ndr_pull_initshutdown_String(struct ndr_pull *ndr, int ndr_flags, struct initshutdown_String *r);
-void ndr_print_initshutdown_String(struct ndr_print *ndr, const char *name, const struct initshutdown_String *r);
void ndr_print_initshutdown_Init(struct ndr_print *ndr, const char *name, int flags, const struct initshutdown_Init *r);
void ndr_print_initshutdown_Abort(struct ndr_print *ndr, const char *name, int flags, const struct initshutdown_Abort *r);
void ndr_print_initshutdown_InitEx(struct ndr_print *ndr, const char *name, int flags, const struct initshutdown_InitEx *r);
diff --git a/source3/librpc/gen_ndr/ndr_krb5pac.c b/source3/librpc/gen_ndr/ndr_krb5pac.c
index 6e06f90a68..f9e93e5210 100644
--- a/source3/librpc/gen_ndr/ndr_krb5pac.c
+++ b/source3/librpc/gen_ndr/ndr_krb5pac.c
@@ -170,10 +170,6 @@ _PUBLIC_ enum ndr_err_code ndr_push_PAC_LOGON_INFO_CTR(struct ndr_push *ndr, int
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0x00081001));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0xCCCCCCCC));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, NDR_ROUND(ndr_size_PAC_LOGON_INFO(r->info, ndr->flags) + 4, 8)));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0x00000000));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->info));
}
if (ndr_flags & NDR_BUFFERS) {
@@ -190,10 +186,6 @@ _PUBLIC_ enum ndr_err_code ndr_pull_PAC_LOGON_INFO_CTR(struct ndr_pull *ndr, int
TALLOC_CTX *_mem_save_info_0;
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));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->_ndr_size));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown3));
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info));
if (_ptr_info) {
NDR_PULL_ALLOC(ndr, r->info);
@@ -216,10 +208,6 @@ _PUBLIC_ void ndr_print_PAC_LOGON_INFO_CTR(struct ndr_print *ndr, const char *na
{
ndr_print_struct(ndr, name, "PAC_LOGON_INFO_CTR");
ndr->depth++;
- ndr_print_uint32(ndr, "unknown1", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?0x00081001:r->unknown1);
- ndr_print_uint32(ndr, "unknown2", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?0xCCCCCCCC:r->unknown2);
- ndr_print_uint32(ndr, "_ndr_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?NDR_ROUND(ndr_size_PAC_LOGON_INFO(r->info, ndr->flags) + 4, 8):r->_ndr_size);
- ndr_print_uint32(ndr, "unknown3", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?0x00000000:r->unknown3);
ndr_print_ptr(ndr, "info", r->info);
ndr->depth++;
if (r->info) {
@@ -304,7 +292,12 @@ _PUBLIC_ enum ndr_err_code ndr_push_PAC_INFO(struct ndr_push *ndr, int ndr_flags
int level = ndr_push_get_switch_value(ndr, r);
switch (level) {
case PAC_TYPE_LOGON_INFO: {
- NDR_CHECK(ndr_push_PAC_LOGON_INFO_CTR(ndr, NDR_SCALARS, &r->logon_info));
+ {
+ struct ndr_push *_ndr_logon_info;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_logon_info, 0xFFFFFC01, -1));
+ NDR_CHECK(ndr_push_PAC_LOGON_INFO_CTR(_ndr_logon_info, NDR_SCALARS|NDR_BUFFERS, &r->logon_info));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_logon_info, 0xFFFFFC01, -1));
+ }
break; }
case PAC_TYPE_SRV_CHECKSUM: {
@@ -334,7 +327,6 @@ _PUBLIC_ enum ndr_err_code ndr_push_PAC_INFO(struct ndr_push *ndr, int ndr_flags
int level = ndr_push_get_switch_value(ndr, r);
switch (level) {
case PAC_TYPE_LOGON_INFO:
- NDR_CHECK(ndr_push_PAC_LOGON_INFO_CTR(ndr, NDR_BUFFERS, &r->logon_info));
break;
case PAC_TYPE_SRV_CHECKSUM:
@@ -361,7 +353,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_PAC_INFO(struct ndr_pull *ndr, int ndr_flags
if (ndr_flags & NDR_SCALARS) {
switch (level) {
case PAC_TYPE_LOGON_INFO: {
- NDR_CHECK(ndr_pull_PAC_LOGON_INFO_CTR(ndr, NDR_SCALARS, &r->logon_info));
+ {
+ struct ndr_pull *_ndr_logon_info;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_logon_info, 0xFFFFFC01, -1));
+ NDR_CHECK(ndr_pull_PAC_LOGON_INFO_CTR(_ndr_logon_info, NDR_SCALARS|NDR_BUFFERS, &r->logon_info));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_logon_info, 0xFFFFFC01, -1));
+ }
break; }
case PAC_TYPE_SRV_CHECKSUM: {
@@ -390,7 +387,6 @@ _PUBLIC_ enum ndr_err_code ndr_pull_PAC_INFO(struct ndr_pull *ndr, int ndr_flags
if (ndr_flags & NDR_BUFFERS) {
switch (level) {
case PAC_TYPE_LOGON_INFO:
- NDR_CHECK(ndr_pull_PAC_LOGON_INFO_CTR(ndr, NDR_BUFFERS, &r->logon_info));
break;
case PAC_TYPE_SRV_CHECKSUM:
@@ -672,6 +668,58 @@ _PUBLIC_ void ndr_print_PAC_DATA_RAW(struct ndr_print *ndr, const char *name, co
ndr->depth--;
}
+_PUBLIC_ enum ndr_err_code ndr_push_PAC_Validate(struct ndr_push *ndr, int ndr_flags, const struct PAC_Validate *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, NETLOGON_GENERIC_KRB5_PAC_VALIDATE));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ChecksumLength));
+ NDR_CHECK(ndr_push_int32(ndr, NDR_SCALARS, r->SignatureType));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->SignatureLength));
+ {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+ NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->ChecksumAndSignature));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_PAC_Validate(struct ndr_pull *ndr, int ndr_flags, struct PAC_Validate *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->MessageType));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ChecksumLength));
+ NDR_CHECK(ndr_pull_int32(ndr, NDR_SCALARS, &r->SignatureType));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->SignatureLength));
+ {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+ NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->ChecksumAndSignature));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_PAC_Validate(struct ndr_print *ndr, const char *name, const struct PAC_Validate *r)
+{
+ ndr_print_struct(ndr, name, "PAC_Validate");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "MessageType", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?NETLOGON_GENERIC_KRB5_PAC_VALIDATE:r->MessageType);
+ ndr_print_uint32(ndr, "ChecksumLength", r->ChecksumLength);
+ ndr_print_int32(ndr, "SignatureType", r->SignatureType);
+ ndr_print_uint32(ndr, "SignatureLength", r->SignatureLength);
+ ndr_print_DATA_BLOB(ndr, "ChecksumAndSignature", r->ChecksumAndSignature);
+ ndr->depth--;
+}
+
_PUBLIC_ enum ndr_err_code ndr_push_netsamlogoncache_entry(struct ndr_push *ndr, int ndr_flags, const struct netsamlogoncache_entry *r)
{
if (ndr_flags & NDR_SCALARS) {
@@ -830,6 +878,47 @@ _PUBLIC_ void ndr_print_decode_login_info(struct ndr_print *ndr, const char *nam
ndr->depth--;
}
+static enum ndr_err_code ndr_push_decode_pac_validate(struct ndr_push *ndr, int flags, const struct decode_pac_validate *r)
+{
+ if (flags & NDR_IN) {
+ NDR_CHECK(ndr_push_PAC_Validate(ndr, NDR_SCALARS, &r->in.pac_validate));
+ }
+ if (flags & NDR_OUT) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_decode_pac_validate(struct ndr_pull *ndr, int flags, struct decode_pac_validate *r)
+{
+ if (flags & NDR_IN) {
+ NDR_CHECK(ndr_pull_PAC_Validate(ndr, NDR_SCALARS, &r->in.pac_validate));
+ }
+ if (flags & NDR_OUT) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_decode_pac_validate(struct ndr_print *ndr, const char *name, int flags, const struct decode_pac_validate *r)
+{
+ ndr_print_struct(ndr, name, "decode_pac_validate");
+ ndr->depth++;
+ if (flags & NDR_SET_VALUES) {
+ ndr->flags |= LIBNDR_PRINT_SET_VALUES;
+ }
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "decode_pac_validate");
+ ndr->depth++;
+ ndr_print_PAC_Validate(ndr, "pac_validate", &r->in.pac_validate);
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "decode_pac_validate");
+ ndr->depth++;
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
static const struct ndr_interface_call krb5pac_calls[] = {
{
"decode_pac",
@@ -855,6 +944,14 @@ static const struct ndr_interface_call krb5pac_calls[] = {
(ndr_print_function_t) ndr_print_decode_login_info,
false,
},
+ {
+ "decode_pac_validate",
+ sizeof(struct decode_pac_validate),
+ (ndr_push_flags_fn_t) ndr_push_decode_pac_validate,
+ (ndr_pull_flags_fn_t) ndr_pull_decode_pac_validate,
+ (ndr_print_function_t) ndr_print_decode_pac_validate,
+ false,
+ },
{ NULL, 0, NULL, NULL, NULL, false }
};
@@ -884,7 +981,7 @@ const struct ndr_interface_table ndr_table_krb5pac = {
NDR_KRB5PAC_VERSION
},
.helpstring = NDR_KRB5PAC_HELPSTRING,
- .num_calls = 3,
+ .num_calls = 4,
.calls = krb5pac_calls,
.endpoints = &krb5pac_endpoints,
.authservices = &krb5pac_authservices
diff --git a/source3/librpc/gen_ndr/ndr_krb5pac.h b/source3/librpc/gen_ndr/ndr_krb5pac.h
index 7f03106879..bf09e3fad5 100644
--- a/source3/librpc/gen_ndr/ndr_krb5pac.h
+++ b/source3/librpc/gen_ndr/ndr_krb5pac.h
@@ -17,7 +17,9 @@ extern const struct ndr_interface_table ndr_table_krb5pac;
#define NDR_DECODE_LOGIN_INFO (0x02)
-#define NDR_KRB5PAC_CALL_COUNT (3)
+#define NDR_DECODE_PAC_VALIDATE (0x03)
+
+#define NDR_KRB5PAC_CALL_COUNT (4)
void ndr_print_PAC_LOGON_NAME(struct ndr_print *ndr, const char *name, const struct PAC_LOGON_NAME *r);
enum ndr_err_code ndr_push_PAC_SIGNATURE_DATA(struct ndr_push *ndr, int ndr_flags, const struct PAC_SIGNATURE_DATA *r);
enum ndr_err_code ndr_pull_PAC_SIGNATURE_DATA(struct ndr_pull *ndr, int ndr_flags, struct PAC_SIGNATURE_DATA *r);
@@ -46,10 +48,14 @@ void ndr_print_PAC_BUFFER_RAW(struct ndr_print *ndr, const char *name, const str
enum ndr_err_code ndr_push_PAC_DATA_RAW(struct ndr_push *ndr, int ndr_flags, const struct PAC_DATA_RAW *r);
enum ndr_err_code ndr_pull_PAC_DATA_RAW(struct ndr_pull *ndr, int ndr_flags, struct PAC_DATA_RAW *r);
void ndr_print_PAC_DATA_RAW(struct ndr_print *ndr, const char *name, const struct PAC_DATA_RAW *r);
+enum ndr_err_code ndr_push_PAC_Validate(struct ndr_push *ndr, int ndr_flags, const struct PAC_Validate *r);
+enum ndr_err_code ndr_pull_PAC_Validate(struct ndr_pull *ndr, int ndr_flags, struct PAC_Validate *r);
+void ndr_print_PAC_Validate(struct ndr_print *ndr, const char *name, const struct PAC_Validate *r);
enum ndr_err_code ndr_push_netsamlogoncache_entry(struct ndr_push *ndr, int ndr_flags, const struct netsamlogoncache_entry *r);
enum ndr_err_code ndr_pull_netsamlogoncache_entry(struct ndr_pull *ndr, int ndr_flags, struct netsamlogoncache_entry *r);
void ndr_print_netsamlogoncache_entry(struct ndr_print *ndr, const char *name, const struct netsamlogoncache_entry *r);
void ndr_print_decode_pac(struct ndr_print *ndr, const char *name, int flags, const struct decode_pac *r);
void ndr_print_decode_pac_raw(struct ndr_print *ndr, const char *name, int flags, const struct decode_pac_raw *r);
void ndr_print_decode_login_info(struct ndr_print *ndr, const char *name, int flags, const struct decode_login_info *r);
+void ndr_print_decode_pac_validate(struct ndr_print *ndr, const char *name, int flags, const struct decode_pac_validate *r);
#endif /* _HEADER_NDR_krb5pac */
diff --git a/source3/librpc/gen_ndr/ndr_libnetapi.c b/source3/librpc/gen_ndr/ndr_libnetapi.c
index a5266827b6..d7bf63e62f 100644
--- a/source3/librpc/gen_ndr/ndr_libnetapi.c
+++ b/source3/librpc/gen_ndr/ndr_libnetapi.c
@@ -1895,7 +1895,9 @@ _PUBLIC_ enum ndr_err_code ndr_push_USER_INFO_X(struct ndr_push *ndr, int ndr_fl
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->usriX_code_page));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->usriX_profile));
NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->usriX_home_dir_drive));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->usriX_user_id));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->usriX_primary_group_id));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->usriX_password_expired));
}
if (ndr_flags & NDR_BUFFERS) {
if (r->usriX_logon_hours) {
@@ -1942,7 +1944,9 @@ _PUBLIC_ enum ndr_err_code ndr_pull_USER_INFO_X(struct ndr_pull *ndr, int ndr_fl
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->usriX_code_page));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->usriX_profile));
NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->usriX_home_dir_drive));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->usriX_user_id));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->usriX_primary_group_id));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->usriX_password_expired));
}
if (ndr_flags & NDR_BUFFERS) {
if (r->usriX_logon_hours) {
@@ -1990,7 +1994,9 @@ _PUBLIC_ void ndr_print_USER_INFO_X(struct ndr_print *ndr, const char *name, con
ndr_print_uint32(ndr, "usriX_code_page", r->usriX_code_page);
ndr_print_string(ndr, "usriX_profile", r->usriX_profile);
ndr_print_string(ndr, "usriX_home_dir_drive", r->usriX_home_dir_drive);
+ ndr_print_uint32(ndr, "usriX_user_id", r->usriX_user_id);
ndr_print_uint32(ndr, "usriX_primary_group_id", r->usriX_primary_group_id);
+ ndr_print_uint32(ndr, "usriX_password_expired", r->usriX_password_expired);
ndr->depth--;
}
diff --git a/source3/librpc/gen_ndr/ndr_lsa.c b/source3/librpc/gen_ndr/ndr_lsa.c
index f25410ad27..926903865e 100644
--- a/source3/librpc/gen_ndr/ndr_lsa.c
+++ b/source3/librpc/gen_ndr/ndr_lsa.c
@@ -3,6 +3,7 @@
#include "includes.h"
#include "librpc/gen_ndr/ndr_lsa.h"
+#include "librpc/gen_ndr/ndr_misc.h"
#include "librpc/gen_ndr/ndr_security.h"
_PUBLIC_ enum ndr_err_code ndr_push_lsa_String(struct ndr_push *ndr, int ndr_flags, const struct lsa_String *r)
{
@@ -833,14 +834,13 @@ _PUBLIC_ void ndr_print_lsa_PolicyAccessMask(struct ndr_print *ndr, const char *
static enum ndr_err_code ndr_push_lsa_AuditLogInfo(struct ndr_push *ndr, int ndr_flags, const struct lsa_AuditLogInfo *r)
{
if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_align(ndr, 8));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->percent_full));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->log_size));
- NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->retention_time));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->maximum_log_size));
+ NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->retention_time));
NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->shutdown_in_progress));
- NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->time_to_shutdown));
+ NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->time_to_shutdown));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->next_audit_record));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown));
}
if (ndr_flags & NDR_BUFFERS) {
}
@@ -850,14 +850,13 @@ static enum ndr_err_code ndr_push_lsa_AuditLogInfo(struct ndr_push *ndr, int ndr
static enum ndr_err_code ndr_pull_lsa_AuditLogInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_AuditLogInfo *r)
{
if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_align(ndr, 8));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->percent_full));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->log_size));
- NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->retention_time));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->maximum_log_size));
+ NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->retention_time));
NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->shutdown_in_progress));
- NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->time_to_shutdown));
+ NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->time_to_shutdown));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->next_audit_record));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown));
}
if (ndr_flags & NDR_BUFFERS) {
}
@@ -869,12 +868,11 @@ _PUBLIC_ void ndr_print_lsa_AuditLogInfo(struct ndr_print *ndr, const char *name
ndr_print_struct(ndr, name, "lsa_AuditLogInfo");
ndr->depth++;
ndr_print_uint32(ndr, "percent_full", r->percent_full);
- ndr_print_uint32(ndr, "log_size", r->log_size);
- ndr_print_NTTIME(ndr, "retention_time", r->retention_time);
+ ndr_print_uint32(ndr, "maximum_log_size", r->maximum_log_size);
+ ndr_print_hyper(ndr, "retention_time", r->retention_time);
ndr_print_uint8(ndr, "shutdown_in_progress", r->shutdown_in_progress);
- ndr_print_NTTIME(ndr, "time_to_shutdown", r->time_to_shutdown);
+ ndr_print_hyper(ndr, "time_to_shutdown", r->time_to_shutdown);
ndr_print_uint32(ndr, "next_audit_record", r->next_audit_record);
- ndr_print_uint32(ndr, "unknown", r->unknown);
ndr->depth--;
}
@@ -1077,12 +1075,36 @@ _PUBLIC_ void ndr_print_lsa_PDAccountInfo(struct ndr_print *ndr, const char *nam
ndr->depth--;
}
+static enum ndr_err_code ndr_push_lsa_Role(struct ndr_push *ndr, int ndr_flags, enum lsa_Role r)
+{
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_lsa_Role(struct ndr_pull *ndr, int ndr_flags, enum lsa_Role *r)
+{
+ uint32_t v;
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_lsa_Role(struct ndr_print *ndr, const char *name, enum lsa_Role r)
+{
+ const char *val = NULL;
+
+ switch (r) {
+ case LSA_ROLE_BACKUP: val = "LSA_ROLE_BACKUP"; break;
+ case LSA_ROLE_PRIMARY: val = "LSA_ROLE_PRIMARY"; break;
+ }
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
static enum ndr_err_code ndr_push_lsa_ServerRole(struct ndr_push *ndr, int ndr_flags, const struct lsa_ServerRole *r)
{
if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 2));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->unknown));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->role));
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_lsa_Role(ndr, NDR_SCALARS, r->role));
}
if (ndr_flags & NDR_BUFFERS) {
}
@@ -1092,9 +1114,8 @@ static enum ndr_err_code ndr_push_lsa_ServerRole(struct ndr_push *ndr, int ndr_f
static enum ndr_err_code ndr_pull_lsa_ServerRole(struct ndr_pull *ndr, int ndr_flags, struct lsa_ServerRole *r)
{
if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 2));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->unknown));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->role));
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_lsa_Role(ndr, NDR_SCALARS, &r->role));
}
if (ndr_flags & NDR_BUFFERS) {
}
@@ -1105,8 +1126,7 @@ _PUBLIC_ void ndr_print_lsa_ServerRole(struct ndr_print *ndr, const char *name,
{
ndr_print_struct(ndr, name, "lsa_ServerRole");
ndr->depth++;
- ndr_print_uint16(ndr, "unknown", r->unknown);
- ndr_print_uint16(ndr, "role", r->role);
+ ndr_print_lsa_Role(ndr, "role", r->role);
ndr->depth--;
}
@@ -1197,7 +1217,7 @@ static enum ndr_err_code ndr_push_lsa_ModificationInfo(struct ndr_push *ndr, int
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 8));
NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->modified_id));
- NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->db_create_time));
+ NDR_CHECK(ndr_push_NTTIME_hyper(ndr, NDR_SCALARS, r->db_create_time));
}
if (ndr_flags & NDR_BUFFERS) {
}
@@ -1209,7 +1229,7 @@ static enum ndr_err_code ndr_pull_lsa_ModificationInfo(struct ndr_pull *ndr, int
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 8));
NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->modified_id));
- NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->db_create_time));
+ NDR_CHECK(ndr_pull_NTTIME_hyper(ndr, NDR_SCALARS, &r->db_create_time));
}
if (ndr_flags & NDR_BUFFERS) {
}
@@ -1221,7 +1241,7 @@ _PUBLIC_ void ndr_print_lsa_ModificationInfo(struct ndr_print *ndr, const char *
ndr_print_struct(ndr, name, "lsa_ModificationInfo");
ndr->depth++;
ndr_print_hyper(ndr, "modified_id", r->modified_id);
- ndr_print_NTTIME(ndr, "db_create_time", r->db_create_time);
+ ndr_print_NTTIME_hyper(ndr, "db_create_time", r->db_create_time);
ndr->depth--;
}
@@ -1258,8 +1278,7 @@ _PUBLIC_ void ndr_print_lsa_AuditFullSetInfo(struct ndr_print *ndr, const char *
static enum ndr_err_code ndr_push_lsa_AuditFullQueryInfo(struct ndr_push *ndr, int ndr_flags, const struct lsa_AuditFullQueryInfo *r)
{
if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 2));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->unknown));
+ NDR_CHECK(ndr_push_align(ndr, 1));
NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->shutdown_on_full));
NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->log_is_full));
}
@@ -1271,8 +1290,7 @@ static enum ndr_err_code ndr_push_lsa_AuditFullQueryInfo(struct ndr_push *ndr, i
static enum ndr_err_code ndr_pull_lsa_AuditFullQueryInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_AuditFullQueryInfo *r)
{
if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 2));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->unknown));
+ NDR_CHECK(ndr_pull_align(ndr, 1));
NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->shutdown_on_full));
NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->log_is_full));
}
@@ -1285,7 +1303,6 @@ _PUBLIC_ void ndr_print_lsa_AuditFullQueryInfo(struct ndr_print *ndr, const char
{
ndr_print_struct(ndr, name, "lsa_AuditFullQueryInfo");
ndr->depth++;
- ndr_print_uint16(ndr, "unknown", r->unknown);
ndr_print_uint8(ndr, "shutdown_on_full", r->shutdown_on_full);
ndr_print_uint8(ndr, "log_is_full", r->log_is_full);
ndr->depth--;
@@ -1305,7 +1322,6 @@ static enum ndr_err_code ndr_push_lsa_DnsDomainInfo(struct ndr_push *ndr, int nd
NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->name));
NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->dns_domain));
NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->dns_forest));
- NDR_CHECK(ndr_push_GUID(ndr, NDR_BUFFERS, &r->domain_guid));
if (r->sid) {
NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->sid));
}
@@ -1334,7 +1350,6 @@ static enum ndr_err_code ndr_pull_lsa_DnsDomainInfo(struct ndr_pull *ndr, int nd
NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->name));
NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->dns_domain));
NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->dns_forest));
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_BUFFERS, &r->domain_guid));
if (r->sid) {
_mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->sid, 0);
@@ -1389,10 +1404,12 @@ _PUBLIC_ void ndr_print_lsa_PolicyInfo(struct ndr_print *ndr, const char *name,
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_MOD: val = "LSA_POLICY_INFO_MOD"; 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;
+ case LSA_POLICY_INFO_DNS_INT: val = "LSA_POLICY_INFO_DNS_INT"; break;
+ case LSA_POLICY_INFO_L_ACCOUNT_DOMAIN: val = "LSA_POLICY_INFO_L_ACCOUNT_DOMAIN"; break;
}
ndr_print_enum(ndr, name, "ENUM", val, r);
}
@@ -1435,8 +1452,8 @@ static enum ndr_err_code ndr_push_lsa_PolicyInformation(struct ndr_push *ndr, in
NDR_CHECK(ndr_push_lsa_DefaultQuotaInfo(ndr, NDR_SCALARS, &r->quota));
break; }
- case LSA_POLICY_INFO_DB: {
- NDR_CHECK(ndr_push_lsa_ModificationInfo(ndr, NDR_SCALARS, &r->db));
+ case LSA_POLICY_INFO_MOD: {
+ NDR_CHECK(ndr_push_lsa_ModificationInfo(ndr, NDR_SCALARS, &r->mod));
break; }
case LSA_POLICY_INFO_AUDIT_FULL_SET: {
@@ -1451,6 +1468,14 @@ static enum ndr_err_code ndr_push_lsa_PolicyInformation(struct ndr_push *ndr, in
NDR_CHECK(ndr_push_lsa_DnsDomainInfo(ndr, NDR_SCALARS, &r->dns));
break; }
+ case LSA_POLICY_INFO_DNS_INT: {
+ NDR_CHECK(ndr_push_lsa_DnsDomainInfo(ndr, NDR_SCALARS, &r->dns));
+ break; }
+
+ case LSA_POLICY_INFO_L_ACCOUNT_DOMAIN: {
+ NDR_CHECK(ndr_push_lsa_DomainInfo(ndr, NDR_SCALARS, &r->l_account_domain));
+ break; }
+
default:
return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
@@ -1487,7 +1512,7 @@ static enum ndr_err_code ndr_push_lsa_PolicyInformation(struct ndr_push *ndr, in
case LSA_POLICY_INFO_QUOTA:
break;
- case LSA_POLICY_INFO_DB:
+ case LSA_POLICY_INFO_MOD:
break;
case LSA_POLICY_INFO_AUDIT_FULL_SET:
@@ -1500,6 +1525,14 @@ static enum ndr_err_code ndr_push_lsa_PolicyInformation(struct ndr_push *ndr, in
NDR_CHECK(ndr_push_lsa_DnsDomainInfo(ndr, NDR_BUFFERS, &r->dns));
break;
+ case LSA_POLICY_INFO_DNS_INT:
+ NDR_CHECK(ndr_push_lsa_DnsDomainInfo(ndr, NDR_BUFFERS, &r->dns));
+ break;
+
+ case LSA_POLICY_INFO_L_ACCOUNT_DOMAIN:
+ NDR_CHECK(ndr_push_lsa_DomainInfo(ndr, NDR_BUFFERS, &r->l_account_domain));
+ break;
+
default:
return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
@@ -1550,8 +1583,8 @@ static enum ndr_err_code ndr_pull_lsa_PolicyInformation(struct ndr_pull *ndr, in
NDR_CHECK(ndr_pull_lsa_DefaultQuotaInfo(ndr, NDR_SCALARS, &r->quota));
break; }
- case LSA_POLICY_INFO_DB: {
- NDR_CHECK(ndr_pull_lsa_ModificationInfo(ndr, NDR_SCALARS, &r->db));
+ case LSA_POLICY_INFO_MOD: {
+ NDR_CHECK(ndr_pull_lsa_ModificationInfo(ndr, NDR_SCALARS, &r->mod));
break; }
case LSA_POLICY_INFO_AUDIT_FULL_SET: {
@@ -1566,6 +1599,14 @@ static enum ndr_err_code ndr_pull_lsa_PolicyInformation(struct ndr_pull *ndr, in
NDR_CHECK(ndr_pull_lsa_DnsDomainInfo(ndr, NDR_SCALARS, &r->dns));
break; }
+ case LSA_POLICY_INFO_DNS_INT: {
+ NDR_CHECK(ndr_pull_lsa_DnsDomainInfo(ndr, NDR_SCALARS, &r->dns));
+ break; }
+
+ case LSA_POLICY_INFO_L_ACCOUNT_DOMAIN: {
+ NDR_CHECK(ndr_pull_lsa_DomainInfo(ndr, NDR_SCALARS, &r->l_account_domain));
+ break; }
+
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
@@ -1601,7 +1642,7 @@ static enum ndr_err_code ndr_pull_lsa_PolicyInformation(struct ndr_pull *ndr, in
case LSA_POLICY_INFO_QUOTA:
break;
- case LSA_POLICY_INFO_DB:
+ case LSA_POLICY_INFO_MOD:
break;
case LSA_POLICY_INFO_AUDIT_FULL_SET:
@@ -1614,6 +1655,14 @@ static enum ndr_err_code ndr_pull_lsa_PolicyInformation(struct ndr_pull *ndr, in
NDR_CHECK(ndr_pull_lsa_DnsDomainInfo(ndr, NDR_BUFFERS, &r->dns));
break;
+ case LSA_POLICY_INFO_DNS_INT:
+ NDR_CHECK(ndr_pull_lsa_DnsDomainInfo(ndr, NDR_BUFFERS, &r->dns));
+ break;
+
+ case LSA_POLICY_INFO_L_ACCOUNT_DOMAIN:
+ NDR_CHECK(ndr_pull_lsa_DomainInfo(ndr, NDR_BUFFERS, &r->l_account_domain));
+ break;
+
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
@@ -1659,8 +1708,8 @@ _PUBLIC_ void ndr_print_lsa_PolicyInformation(struct ndr_print *ndr, const char
ndr_print_lsa_DefaultQuotaInfo(ndr, "quota", &r->quota);
break;
- case LSA_POLICY_INFO_DB:
- ndr_print_lsa_ModificationInfo(ndr, "db", &r->db);
+ case LSA_POLICY_INFO_MOD:
+ ndr_print_lsa_ModificationInfo(ndr, "mod", &r->mod);
break;
case LSA_POLICY_INFO_AUDIT_FULL_SET:
@@ -1675,6 +1724,14 @@ _PUBLIC_ void ndr_print_lsa_PolicyInformation(struct ndr_print *ndr, const char
ndr_print_lsa_DnsDomainInfo(ndr, "dns", &r->dns);
break;
+ case LSA_POLICY_INFO_DNS_INT:
+ ndr_print_lsa_DnsDomainInfo(ndr, "dns", &r->dns);
+ break;
+
+ case LSA_POLICY_INFO_L_ACCOUNT_DOMAIN:
+ ndr_print_lsa_DomainInfo(ndr, "l_account_domain", &r->l_account_domain);
+ break;
+
default:
ndr_print_bad_level(ndr, name, level);
}
@@ -1906,13 +1963,13 @@ _PUBLIC_ void ndr_print_lsa_DomainList(struct ndr_print *ndr, const char *name,
ndr->depth--;
}
-static enum ndr_err_code ndr_push_lsa_SidType(struct ndr_push *ndr, int ndr_flags, enum lsa_SidType r)
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_SidType(struct ndr_push *ndr, int ndr_flags, enum lsa_SidType r)
{
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_lsa_SidType(struct ndr_pull *ndr, int ndr_flags, enum lsa_SidType *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_lsa_SidType(struct ndr_pull *ndr, int ndr_flags, enum lsa_SidType *r)
{
uint16_t v;
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
@@ -2175,6 +2232,7 @@ _PUBLIC_ void ndr_print_lsa_LookupNamesLevel(struct ndr_print *ndr, const char *
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;
+ case LSA_LOOKUP_NAMES_RODC_REFERRAL_TO_FULL_DC: val = "LSA_LOOKUP_NAMES_RODC_REFERRAL_TO_FULL_DC"; break;
}
ndr_print_enum(ndr, name, "ENUM", val, r);
}
@@ -2589,19 +2647,100 @@ _PUBLIC_ void ndr_print_lsa_TrustDomInfoEnum(struct ndr_print *ndr, const char *
switch (r) {
case LSA_TRUSTED_DOMAIN_INFO_NAME: val = "LSA_TRUSTED_DOMAIN_INFO_NAME"; break;
- case LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS_INFO: val = "LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS_INFO"; break;
+ case LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS: val = "LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS"; break;
case LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET: val = "LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET"; break;
case LSA_TRUSTED_DOMAIN_INFO_PASSWORD: val = "LSA_TRUSTED_DOMAIN_INFO_PASSWORD"; break;
case LSA_TRUSTED_DOMAIN_INFO_BASIC: val = "LSA_TRUSTED_DOMAIN_INFO_BASIC"; break;
case LSA_TRUSTED_DOMAIN_INFO_INFO_EX: val = "LSA_TRUSTED_DOMAIN_INFO_INFO_EX"; break;
case LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO: val = "LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO"; break;
case LSA_TRUSTED_DOMAIN_INFO_FULL_INFO: val = "LSA_TRUSTED_DOMAIN_INFO_FULL_INFO"; break;
- case LSA_TRUSTED_DOMAIN_INFO_11: val = "LSA_TRUSTED_DOMAIN_INFO_11"; break;
- case LSA_TRUSTED_DOMAIN_INFO_INFO_ALL: val = "LSA_TRUSTED_DOMAIN_INFO_INFO_ALL"; break;
+ case LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL: val = "LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL"; break;
+ case LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL: val = "LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL"; break;
+ case LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL: val = "LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL"; break;
+ case LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL: val = "LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL"; break;
+ case LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES: val = "LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES"; break;
}
ndr_print_enum(ndr, name, "ENUM", val, r);
}
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_TrustDirection(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_lsa_TrustDirection(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_lsa_TrustDirection(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), "LSA_TRUST_DIRECTION_INBOUND", LSA_TRUST_DIRECTION_INBOUND, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUST_DIRECTION_OUTBOUND", LSA_TRUST_DIRECTION_OUTBOUND, r);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_lsa_TrustType(struct ndr_push *ndr, int ndr_flags, enum lsa_TrustType r)
+{
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_lsa_TrustType(struct ndr_pull *ndr, int ndr_flags, enum lsa_TrustType *r)
+{
+ uint32_t v;
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_lsa_TrustType(struct ndr_print *ndr, const char *name, enum lsa_TrustType r)
+{
+ const char *val = NULL;
+
+ switch (r) {
+ case LSA_TRUST_TYPE_DOWNLEVEL: val = "LSA_TRUST_TYPE_DOWNLEVEL"; break;
+ case LSA_TRUST_TYPE_UPLEVEL: val = "LSA_TRUST_TYPE_UPLEVEL"; break;
+ case LSA_TRUST_TYPE_MIT: val = "LSA_TRUST_TYPE_MIT"; break;
+ }
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_TrustAttributes(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_lsa_TrustAttributes(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_lsa_TrustAttributes(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), "LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE", LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUST_ATTRIBUTE_UPLEVEL_ONLY", LSA_TRUST_ATTRIBUTE_UPLEVEL_ONLY, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN", LSA_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE", LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION", LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUST_ATTRIBUTE_WITHIN_FOREST", LSA_TRUST_ATTRIBUTE_WITHIN_FOREST, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL", LSA_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION", LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION, r);
+ ndr->depth--;
+}
+
static enum ndr_err_code ndr_push_lsa_TrustDomainInfoName(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoName *r)
{
if (ndr_flags & NDR_SCALARS) {
@@ -2634,6 +2773,92 @@ _PUBLIC_ void ndr_print_lsa_TrustDomainInfoName(struct ndr_print *ndr, const cha
ndr->depth--;
}
+static enum ndr_err_code ndr_push_lsa_TrustDomainInfoControllers(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoControllers *r)
+{
+ uint32_t cntr_netbios_names_1;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->entries));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->netbios_names));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->netbios_names) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->entries));
+ for (cntr_netbios_names_1 = 0; cntr_netbios_names_1 < r->entries; cntr_netbios_names_1++) {
+ NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->netbios_names[cntr_netbios_names_1]));
+ }
+ for (cntr_netbios_names_1 = 0; cntr_netbios_names_1 < r->entries; cntr_netbios_names_1++) {
+ NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->netbios_names[cntr_netbios_names_1]));
+ }
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoControllers(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfoControllers *r)
+{
+ uint32_t _ptr_netbios_names;
+ uint32_t cntr_netbios_names_1;
+ TALLOC_CTX *_mem_save_netbios_names_0;
+ TALLOC_CTX *_mem_save_netbios_names_1;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->entries));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_netbios_names));
+ if (_ptr_netbios_names) {
+ NDR_PULL_ALLOC(ndr, r->netbios_names);
+ } else {
+ r->netbios_names = NULL;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->netbios_names) {
+ _mem_save_netbios_names_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->netbios_names, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->netbios_names));
+ NDR_PULL_ALLOC_N(ndr, r->netbios_names, ndr_get_array_size(ndr, &r->netbios_names));
+ _mem_save_netbios_names_1 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->netbios_names, 0);
+ for (cntr_netbios_names_1 = 0; cntr_netbios_names_1 < r->entries; cntr_netbios_names_1++) {
+ NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->netbios_names[cntr_netbios_names_1]));
+ }
+ for (cntr_netbios_names_1 = 0; cntr_netbios_names_1 < r->entries; cntr_netbios_names_1++) {
+ NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->netbios_names[cntr_netbios_names_1]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_netbios_names_1, 0);
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_netbios_names_0, 0);
+ }
+ if (r->netbios_names) {
+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->netbios_names, r->entries));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_lsa_TrustDomainInfoControllers(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoControllers *r)
+{
+ uint32_t cntr_netbios_names_1;
+ ndr_print_struct(ndr, name, "lsa_TrustDomainInfoControllers");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "entries", r->entries);
+ ndr_print_ptr(ndr, "netbios_names", r->netbios_names);
+ ndr->depth++;
+ if (r->netbios_names) {
+ ndr->print(ndr, "%s: ARRAY(%d)", "netbios_names", (int)r->entries);
+ ndr->depth++;
+ for (cntr_netbios_names_1=0;cntr_netbios_names_1<r->entries;cntr_netbios_names_1++) {
+ char *idx_1=NULL;
+ if (asprintf(&idx_1, "[%d]", cntr_netbios_names_1) != -1) {
+ ndr_print_lsa_StringLarge(ndr, "netbios_names", &r->netbios_names[cntr_netbios_names_1]);
+ free(idx_1);
+ }
+ }
+ ndr->depth--;
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
static enum ndr_err_code ndr_push_lsa_TrustDomainInfoPosixOffset(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoPosixOffset *r)
{
if (ndr_flags & NDR_SCALARS) {
@@ -2802,9 +3027,9 @@ static enum ndr_err_code ndr_push_lsa_TrustDomainInfoInfoEx(struct ndr_push *ndr
NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->domain_name));
NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->netbios_name));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->sid));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->trust_direction));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->trust_type));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->trust_attributes));
+ NDR_CHECK(ndr_push_lsa_TrustDirection(ndr, NDR_SCALARS, r->trust_direction));
+ NDR_CHECK(ndr_push_lsa_TrustType(ndr, NDR_SCALARS, r->trust_type));
+ NDR_CHECK(ndr_push_lsa_TrustAttributes(ndr, NDR_SCALARS, r->trust_attributes));
}
if (ndr_flags & NDR_BUFFERS) {
NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->domain_name));
@@ -2830,9 +3055,9 @@ static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoInfoEx(struct ndr_pull *ndr
} else {
r->sid = NULL;
}
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->trust_direction));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->trust_type));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->trust_attributes));
+ NDR_CHECK(ndr_pull_lsa_TrustDirection(ndr, NDR_SCALARS, &r->trust_direction));
+ NDR_CHECK(ndr_pull_lsa_TrustType(ndr, NDR_SCALARS, &r->trust_type));
+ NDR_CHECK(ndr_pull_lsa_TrustAttributes(ndr, NDR_SCALARS, &r->trust_attributes));
}
if (ndr_flags & NDR_BUFFERS) {
NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->domain_name));
@@ -2859,18 +3084,45 @@ _PUBLIC_ void ndr_print_lsa_TrustDomainInfoInfoEx(struct ndr_print *ndr, const c
ndr_print_dom_sid2(ndr, "sid", r->sid);
}
ndr->depth--;
- ndr_print_uint32(ndr, "trust_direction", r->trust_direction);
- ndr_print_uint32(ndr, "trust_type", r->trust_type);
- ndr_print_uint32(ndr, "trust_attributes", r->trust_attributes);
+ ndr_print_lsa_TrustDirection(ndr, "trust_direction", r->trust_direction);
+ ndr_print_lsa_TrustType(ndr, "trust_type", r->trust_type);
+ ndr_print_lsa_TrustAttributes(ndr, "trust_attributes", r->trust_attributes);
ndr->depth--;
}
+_PUBLIC_ enum ndr_err_code ndr_push_lsa_TrustAuthType(struct ndr_push *ndr, int ndr_flags, enum lsa_TrustAuthType r)
+{
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_lsa_TrustAuthType(struct ndr_pull *ndr, int ndr_flags, enum lsa_TrustAuthType *r)
+{
+ uint32_t v;
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_lsa_TrustAuthType(struct ndr_print *ndr, const char *name, enum lsa_TrustAuthType r)
+{
+ const char *val = NULL;
+
+ switch (r) {
+ case TRUST_AUTH_TYPE_NONE: val = "TRUST_AUTH_TYPE_NONE"; break;
+ case TRUST_AUTH_TYPE_NT4OWF: val = "TRUST_AUTH_TYPE_NT4OWF"; break;
+ case TRUST_AUTH_TYPE_CLEAR: val = "TRUST_AUTH_TYPE_CLEAR"; break;
+ case TRUST_AUTH_TYPE_VERSION: val = "TRUST_AUTH_TYPE_VERSION"; break;
+ }
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
static enum ndr_err_code ndr_push_lsa_TrustDomainInfoBuffer(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoBuffer *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 8));
NDR_CHECK(ndr_push_NTTIME_hyper(ndr, NDR_SCALARS, r->last_update_time));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->secret_type));
+ NDR_CHECK(ndr_push_lsa_TrustAuthType(ndr, NDR_SCALARS, r->AuthType));
NDR_CHECK(ndr_push_lsa_DATA_BUF2(ndr, NDR_SCALARS, &r->data));
}
if (ndr_flags & NDR_BUFFERS) {
@@ -2884,7 +3136,7 @@ static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoBuffer(struct ndr_pull *ndr
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 8));
NDR_CHECK(ndr_pull_NTTIME_hyper(ndr, NDR_SCALARS, &r->last_update_time));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->secret_type));
+ NDR_CHECK(ndr_pull_lsa_TrustAuthType(ndr, NDR_SCALARS, &r->AuthType));
NDR_CHECK(ndr_pull_lsa_DATA_BUF2(ndr, NDR_SCALARS, &r->data));
}
if (ndr_flags & NDR_BUFFERS) {
@@ -2898,7 +3150,7 @@ _PUBLIC_ void ndr_print_lsa_TrustDomainInfoBuffer(struct ndr_print *ndr, const c
ndr_print_struct(ndr, name, "lsa_TrustDomainInfoBuffer");
ndr->depth++;
ndr_print_NTTIME_hyper(ndr, "last_update_time", r->last_update_time);
- ndr_print_uint32(ndr, "secret_type", r->secret_type);
+ ndr_print_lsa_TrustAuthType(ndr, "AuthType", r->AuthType);
ndr_print_lsa_DATA_BUF2(ndr, "data", &r->data);
ndr->depth--;
}
@@ -3072,88 +3324,213 @@ _PUBLIC_ void ndr_print_lsa_TrustDomainInfoFullInfo(struct ndr_print *ndr, const
ndr->depth--;
}
-static enum ndr_err_code ndr_push_lsa_TrustDomainInfo11(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfo11 *r)
+static enum ndr_err_code ndr_push_lsa_TrustDomainInfoAuthInfoInternal(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoAuthInfoInternal *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_lsa_DATA_BUF2(ndr, NDR_SCALARS, &r->auth_blob));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_push_lsa_DATA_BUF2(ndr, NDR_BUFFERS, &r->auth_blob));
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoAuthInfoInternal(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfoAuthInfoInternal *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_lsa_DATA_BUF2(ndr, NDR_SCALARS, &r->auth_blob));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_pull_lsa_DATA_BUF2(ndr, NDR_BUFFERS, &r->auth_blob));
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_lsa_TrustDomainInfoAuthInfoInternal(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoAuthInfoInternal *r)
+{
+ ndr_print_struct(ndr, name, "lsa_TrustDomainInfoAuthInfoInternal");
+ ndr->depth++;
+ ndr_print_lsa_DATA_BUF2(ndr, "auth_blob", &r->auth_blob);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_lsa_TrustDomainInfoFullInfoInternal(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoFullInfoInternal *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoEx(ndr, NDR_SCALARS, &r->info_ex));
- NDR_CHECK(ndr_push_lsa_DATA_BUF2(ndr, NDR_SCALARS, &r->data1));
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoPosixOffset(ndr, NDR_SCALARS, &r->posix_offset));
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoAuthInfoInternal(ndr, NDR_SCALARS, &r->auth_info));
}
if (ndr_flags & NDR_BUFFERS) {
NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoEx(ndr, NDR_BUFFERS, &r->info_ex));
- NDR_CHECK(ndr_push_lsa_DATA_BUF2(ndr, NDR_BUFFERS, &r->data1));
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoAuthInfoInternal(ndr, NDR_BUFFERS, &r->auth_info));
}
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_lsa_TrustDomainInfo11(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfo11 *r)
+static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoFullInfoInternal(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfoFullInfoInternal *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
NDR_CHECK(ndr_pull_lsa_TrustDomainInfoInfoEx(ndr, NDR_SCALARS, &r->info_ex));
- NDR_CHECK(ndr_pull_lsa_DATA_BUF2(ndr, NDR_SCALARS, &r->data1));
+ NDR_CHECK(ndr_pull_lsa_TrustDomainInfoPosixOffset(ndr, NDR_SCALARS, &r->posix_offset));
+ NDR_CHECK(ndr_pull_lsa_TrustDomainInfoAuthInfoInternal(ndr, NDR_SCALARS, &r->auth_info));
}
if (ndr_flags & NDR_BUFFERS) {
NDR_CHECK(ndr_pull_lsa_TrustDomainInfoInfoEx(ndr, NDR_BUFFERS, &r->info_ex));
- NDR_CHECK(ndr_pull_lsa_DATA_BUF2(ndr, NDR_BUFFERS, &r->data1));
+ NDR_CHECK(ndr_pull_lsa_TrustDomainInfoAuthInfoInternal(ndr, NDR_BUFFERS, &r->auth_info));
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_lsa_TrustDomainInfo11(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfo11 *r)
+_PUBLIC_ void ndr_print_lsa_TrustDomainInfoFullInfoInternal(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoFullInfoInternal *r)
{
- ndr_print_struct(ndr, name, "lsa_TrustDomainInfo11");
+ ndr_print_struct(ndr, name, "lsa_TrustDomainInfoFullInfoInternal");
ndr->depth++;
ndr_print_lsa_TrustDomainInfoInfoEx(ndr, "info_ex", &r->info_ex);
- ndr_print_lsa_DATA_BUF2(ndr, "data1", &r->data1);
+ ndr_print_lsa_TrustDomainInfoPosixOffset(ndr, "posix_offset", &r->posix_offset);
+ ndr_print_lsa_TrustDomainInfoAuthInfoInternal(ndr, "auth_info", &r->auth_info);
ndr->depth--;
}
-static enum ndr_err_code ndr_push_lsa_TrustDomainInfoInfoAll(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoInfoAll *r)
+static enum ndr_err_code ndr_push_lsa_TrustDomainInfoInfoEx2Internal(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoInfoEx2Internal *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoEx(ndr, NDR_SCALARS, &r->info_ex));
- NDR_CHECK(ndr_push_lsa_DATA_BUF2(ndr, NDR_SCALARS, &r->data1));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->forest_trust_length));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->forest_trust_data));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoEx(ndr, NDR_BUFFERS, &r->info_ex));
+ if (r->forest_trust_data) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->forest_trust_length));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->forest_trust_data, r->forest_trust_length));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoInfoEx2Internal(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfoInfoEx2Internal *r)
+{
+ uint32_t _ptr_forest_trust_data;
+ TALLOC_CTX *_mem_save_forest_trust_data_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_lsa_TrustDomainInfoInfoEx(ndr, NDR_SCALARS, &r->info_ex));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->forest_trust_length));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_forest_trust_data));
+ if (_ptr_forest_trust_data) {
+ NDR_PULL_ALLOC(ndr, r->forest_trust_data);
+ } else {
+ r->forest_trust_data = NULL;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_pull_lsa_TrustDomainInfoInfoEx(ndr, NDR_BUFFERS, &r->info_ex));
+ if (r->forest_trust_data) {
+ _mem_save_forest_trust_data_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->forest_trust_data, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->forest_trust_data));
+ NDR_PULL_ALLOC_N(ndr, r->forest_trust_data, ndr_get_array_size(ndr, &r->forest_trust_data));
+ NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->forest_trust_data, ndr_get_array_size(ndr, &r->forest_trust_data)));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_data_0, 0);
+ }
+ if (r->forest_trust_data) {
+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->forest_trust_data, r->forest_trust_length));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_lsa_TrustDomainInfoInfoEx2Internal(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoInfoEx2Internal *r)
+{
+ ndr_print_struct(ndr, name, "lsa_TrustDomainInfoInfoEx2Internal");
+ ndr->depth++;
+ ndr_print_lsa_TrustDomainInfoInfoEx(ndr, "info_ex", &r->info_ex);
+ ndr_print_uint32(ndr, "forest_trust_length", r->forest_trust_length);
+ ndr_print_ptr(ndr, "forest_trust_data", r->forest_trust_data);
+ ndr->depth++;
+ if (r->forest_trust_data) {
+ ndr_print_array_uint8(ndr, "forest_trust_data", r->forest_trust_data, r->forest_trust_length);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_lsa_TrustDomainInfoFullInfo2Internal(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoFullInfo2Internal *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoEx2Internal(ndr, NDR_SCALARS, &r->info));
NDR_CHECK(ndr_push_lsa_TrustDomainInfoPosixOffset(ndr, NDR_SCALARS, &r->posix_offset));
NDR_CHECK(ndr_push_lsa_TrustDomainInfoAuthInfo(ndr, NDR_SCALARS, &r->auth_info));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoEx(ndr, NDR_BUFFERS, &r->info_ex));
- NDR_CHECK(ndr_push_lsa_DATA_BUF2(ndr, NDR_BUFFERS, &r->data1));
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoEx2Internal(ndr, NDR_BUFFERS, &r->info));
NDR_CHECK(ndr_push_lsa_TrustDomainInfoAuthInfo(ndr, NDR_BUFFERS, &r->auth_info));
}
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoInfoAll(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfoInfoAll *r)
+static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoFullInfo2Internal(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfoFullInfo2Internal *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_lsa_TrustDomainInfoInfoEx(ndr, NDR_SCALARS, &r->info_ex));
- NDR_CHECK(ndr_pull_lsa_DATA_BUF2(ndr, NDR_SCALARS, &r->data1));
+ NDR_CHECK(ndr_pull_lsa_TrustDomainInfoInfoEx2Internal(ndr, NDR_SCALARS, &r->info));
NDR_CHECK(ndr_pull_lsa_TrustDomainInfoPosixOffset(ndr, NDR_SCALARS, &r->posix_offset));
NDR_CHECK(ndr_pull_lsa_TrustDomainInfoAuthInfo(ndr, NDR_SCALARS, &r->auth_info));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_pull_lsa_TrustDomainInfoInfoEx(ndr, NDR_BUFFERS, &r->info_ex));
- NDR_CHECK(ndr_pull_lsa_DATA_BUF2(ndr, NDR_BUFFERS, &r->data1));
+ NDR_CHECK(ndr_pull_lsa_TrustDomainInfoInfoEx2Internal(ndr, NDR_BUFFERS, &r->info));
NDR_CHECK(ndr_pull_lsa_TrustDomainInfoAuthInfo(ndr, NDR_BUFFERS, &r->auth_info));
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_lsa_TrustDomainInfoInfoAll(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoInfoAll *r)
+_PUBLIC_ void ndr_print_lsa_TrustDomainInfoFullInfo2Internal(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoFullInfo2Internal *r)
{
- ndr_print_struct(ndr, name, "lsa_TrustDomainInfoInfoAll");
+ ndr_print_struct(ndr, name, "lsa_TrustDomainInfoFullInfo2Internal");
ndr->depth++;
- ndr_print_lsa_TrustDomainInfoInfoEx(ndr, "info_ex", &r->info_ex);
- ndr_print_lsa_DATA_BUF2(ndr, "data1", &r->data1);
+ ndr_print_lsa_TrustDomainInfoInfoEx2Internal(ndr, "info", &r->info);
ndr_print_lsa_TrustDomainInfoPosixOffset(ndr, "posix_offset", &r->posix_offset);
ndr_print_lsa_TrustDomainInfoAuthInfo(ndr, "auth_info", &r->auth_info);
ndr->depth--;
}
+static enum ndr_err_code ndr_push_lsa_TrustDomainInfoSupportedEncTypes(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoSupportedEncTypes *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_kerb_EncTypes(ndr, NDR_SCALARS, r->enc_types));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoSupportedEncTypes(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfoSupportedEncTypes *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_kerb_EncTypes(ndr, NDR_SCALARS, &r->enc_types));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_lsa_TrustDomainInfoSupportedEncTypes(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoSupportedEncTypes *r)
+{
+ ndr_print_struct(ndr, name, "lsa_TrustDomainInfoSupportedEncTypes");
+ ndr->depth++;
+ ndr_print_kerb_EncTypes(ndr, "enc_types", r->enc_types);
+ ndr->depth--;
+}
+
static enum ndr_err_code ndr_push_lsa_TrustedDomainInfo(struct ndr_push *ndr, int ndr_flags, const union lsa_TrustedDomainInfo *r)
{
if (ndr_flags & NDR_SCALARS) {
@@ -3164,6 +3541,10 @@ static enum ndr_err_code ndr_push_lsa_TrustedDomainInfo(struct ndr_push *ndr, in
NDR_CHECK(ndr_push_lsa_TrustDomainInfoName(ndr, NDR_SCALARS, &r->name));
break; }
+ case LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS: {
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoControllers(ndr, NDR_SCALARS, &r->controllers));
+ break; }
+
case LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET: {
NDR_CHECK(ndr_push_lsa_TrustDomainInfoPosixOffset(ndr, NDR_SCALARS, &r->posix_offset));
break; }
@@ -3188,12 +3569,24 @@ static enum ndr_err_code ndr_push_lsa_TrustedDomainInfo(struct ndr_push *ndr, in
NDR_CHECK(ndr_push_lsa_TrustDomainInfoFullInfo(ndr, NDR_SCALARS, &r->full_info));
break; }
- case LSA_TRUSTED_DOMAIN_INFO_11: {
- NDR_CHECK(ndr_push_lsa_TrustDomainInfo11(ndr, NDR_SCALARS, &r->info11));
+ case LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL: {
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoAuthInfoInternal(ndr, NDR_SCALARS, &r->auth_info_internal));
+ break; }
+
+ case LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL: {
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoFullInfoInternal(ndr, NDR_SCALARS, &r->full_info_internal));
+ break; }
+
+ case LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL: {
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoEx2Internal(ndr, NDR_SCALARS, &r->info_ex2_internal));
+ break; }
+
+ case LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL: {
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoFullInfo2Internal(ndr, NDR_SCALARS, &r->full_info2_internal));
break; }
- case LSA_TRUSTED_DOMAIN_INFO_INFO_ALL: {
- NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoAll(ndr, NDR_SCALARS, &r->info_all));
+ case LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES: {
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoSupportedEncTypes(ndr, NDR_SCALARS, &r->enc_types));
break; }
default:
@@ -3207,6 +3600,10 @@ static enum ndr_err_code ndr_push_lsa_TrustedDomainInfo(struct ndr_push *ndr, in
NDR_CHECK(ndr_push_lsa_TrustDomainInfoName(ndr, NDR_BUFFERS, &r->name));
break;
+ case LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS:
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoControllers(ndr, NDR_BUFFERS, &r->controllers));
+ break;
+
case LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET:
break;
@@ -3230,12 +3627,23 @@ static enum ndr_err_code ndr_push_lsa_TrustedDomainInfo(struct ndr_push *ndr, in
NDR_CHECK(ndr_push_lsa_TrustDomainInfoFullInfo(ndr, NDR_BUFFERS, &r->full_info));
break;
- case LSA_TRUSTED_DOMAIN_INFO_11:
- NDR_CHECK(ndr_push_lsa_TrustDomainInfo11(ndr, NDR_BUFFERS, &r->info11));
+ case LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL:
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoAuthInfoInternal(ndr, NDR_BUFFERS, &r->auth_info_internal));
+ break;
+
+ case LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL:
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoFullInfoInternal(ndr, NDR_BUFFERS, &r->full_info_internal));
+ break;
+
+ case LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL:
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoEx2Internal(ndr, NDR_BUFFERS, &r->info_ex2_internal));
+ break;
+
+ case LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL:
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoFullInfo2Internal(ndr, NDR_BUFFERS, &r->full_info2_internal));
break;
- case LSA_TRUSTED_DOMAIN_INFO_INFO_ALL:
- NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoAll(ndr, NDR_BUFFERS, &r->info_all));
+ case LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES:
break;
default:
@@ -3260,6 +3668,10 @@ static enum ndr_err_code ndr_pull_lsa_TrustedDomainInfo(struct ndr_pull *ndr, in
NDR_CHECK(ndr_pull_lsa_TrustDomainInfoName(ndr, NDR_SCALARS, &r->name));
break; }
+ case LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS: {
+ NDR_CHECK(ndr_pull_lsa_TrustDomainInfoControllers(ndr, NDR_SCALARS, &r->controllers));
+ break; }
+
case LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET: {
NDR_CHECK(ndr_pull_lsa_TrustDomainInfoPosixOffset(ndr, NDR_SCALARS, &r->posix_offset));
break; }
@@ -3284,12 +3696,24 @@ static enum ndr_err_code ndr_pull_lsa_TrustedDomainInfo(struct ndr_pull *ndr, in
NDR_CHECK(ndr_pull_lsa_TrustDomainInfoFullInfo(ndr, NDR_SCALARS, &r->full_info));
break; }
- case LSA_TRUSTED_DOMAIN_INFO_11: {
- NDR_CHECK(ndr_pull_lsa_TrustDomainInfo11(ndr, NDR_SCALARS, &r->info11));
+ case LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL: {
+ NDR_CHECK(ndr_pull_lsa_TrustDomainInfoAuthInfoInternal(ndr, NDR_SCALARS, &r->auth_info_internal));
+ break; }
+
+ case LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL: {
+ NDR_CHECK(ndr_pull_lsa_TrustDomainInfoFullInfoInternal(ndr, NDR_SCALARS, &r->full_info_internal));
+ break; }
+
+ case LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL: {
+ NDR_CHECK(ndr_pull_lsa_TrustDomainInfoInfoEx2Internal(ndr, NDR_SCALARS, &r->info_ex2_internal));
+ break; }
+
+ case LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL: {
+ NDR_CHECK(ndr_pull_lsa_TrustDomainInfoFullInfo2Internal(ndr, NDR_SCALARS, &r->full_info2_internal));
break; }
- case LSA_TRUSTED_DOMAIN_INFO_INFO_ALL: {
- NDR_CHECK(ndr_pull_lsa_TrustDomainInfoInfoAll(ndr, NDR_SCALARS, &r->info_all));
+ case LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES: {
+ NDR_CHECK(ndr_pull_lsa_TrustDomainInfoSupportedEncTypes(ndr, NDR_SCALARS, &r->enc_types));
break; }
default:
@@ -3302,6 +3726,10 @@ static enum ndr_err_code ndr_pull_lsa_TrustedDomainInfo(struct ndr_pull *ndr, in
NDR_CHECK(ndr_pull_lsa_TrustDomainInfoName(ndr, NDR_BUFFERS, &r->name));
break;
+ case LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS:
+ NDR_CHECK(ndr_pull_lsa_TrustDomainInfoControllers(ndr, NDR_BUFFERS, &r->controllers));
+ break;
+
case LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET:
break;
@@ -3325,12 +3753,23 @@ static enum ndr_err_code ndr_pull_lsa_TrustedDomainInfo(struct ndr_pull *ndr, in
NDR_CHECK(ndr_pull_lsa_TrustDomainInfoFullInfo(ndr, NDR_BUFFERS, &r->full_info));
break;
- case LSA_TRUSTED_DOMAIN_INFO_11:
- NDR_CHECK(ndr_pull_lsa_TrustDomainInfo11(ndr, NDR_BUFFERS, &r->info11));
+ case LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL:
+ NDR_CHECK(ndr_pull_lsa_TrustDomainInfoAuthInfoInternal(ndr, NDR_BUFFERS, &r->auth_info_internal));
+ break;
+
+ case LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL:
+ NDR_CHECK(ndr_pull_lsa_TrustDomainInfoFullInfoInternal(ndr, NDR_BUFFERS, &r->full_info_internal));
+ break;
+
+ case LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL:
+ NDR_CHECK(ndr_pull_lsa_TrustDomainInfoInfoEx2Internal(ndr, NDR_BUFFERS, &r->info_ex2_internal));
+ break;
+
+ case LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL:
+ NDR_CHECK(ndr_pull_lsa_TrustDomainInfoFullInfo2Internal(ndr, NDR_BUFFERS, &r->full_info2_internal));
break;
- case LSA_TRUSTED_DOMAIN_INFO_INFO_ALL:
- NDR_CHECK(ndr_pull_lsa_TrustDomainInfoInfoAll(ndr, NDR_BUFFERS, &r->info_all));
+ case LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES:
break;
default:
@@ -3350,6 +3789,10 @@ _PUBLIC_ void ndr_print_lsa_TrustedDomainInfo(struct ndr_print *ndr, const char
ndr_print_lsa_TrustDomainInfoName(ndr, "name", &r->name);
break;
+ case LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS:
+ ndr_print_lsa_TrustDomainInfoControllers(ndr, "controllers", &r->controllers);
+ break;
+
case LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET:
ndr_print_lsa_TrustDomainInfoPosixOffset(ndr, "posix_offset", &r->posix_offset);
break;
@@ -3374,12 +3817,24 @@ _PUBLIC_ void ndr_print_lsa_TrustedDomainInfo(struct ndr_print *ndr, const char
ndr_print_lsa_TrustDomainInfoFullInfo(ndr, "full_info", &r->full_info);
break;
- case LSA_TRUSTED_DOMAIN_INFO_11:
- ndr_print_lsa_TrustDomainInfo11(ndr, "info11", &r->info11);
+ case LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL:
+ ndr_print_lsa_TrustDomainInfoAuthInfoInternal(ndr, "auth_info_internal", &r->auth_info_internal);
+ break;
+
+ case LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL:
+ ndr_print_lsa_TrustDomainInfoFullInfoInternal(ndr, "full_info_internal", &r->full_info_internal);
+ break;
+
+ case LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL:
+ ndr_print_lsa_TrustDomainInfoInfoEx2Internal(ndr, "info_ex2_internal", &r->info_ex2_internal);
+ break;
+
+ case LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL:
+ ndr_print_lsa_TrustDomainInfoFullInfo2Internal(ndr, "full_info2_internal", &r->full_info2_internal);
break;
- case LSA_TRUSTED_DOMAIN_INFO_INFO_ALL:
- ndr_print_lsa_TrustDomainInfoInfoAll(ndr, "info_all", &r->info_all);
+ case LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES:
+ ndr_print_lsa_TrustDomainInfoSupportedEncTypes(ndr, "enc_types", &r->enc_types);
break;
default:
@@ -4070,7 +4525,7 @@ static enum ndr_err_code ndr_push_lsa_TranslatedSid3(struct ndr_push *ndr, int n
NDR_CHECK(ndr_push_lsa_SidType(ndr, NDR_SCALARS, r->sid_type));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->sid));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->sid_index));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->flags));
}
if (ndr_flags & NDR_BUFFERS) {
if (r->sid) {
@@ -4094,7 +4549,7 @@ static enum ndr_err_code ndr_pull_lsa_TranslatedSid3(struct ndr_pull *ndr, int n
r->sid = NULL;
}
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sid_index));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->flags));
}
if (ndr_flags & NDR_BUFFERS) {
if (r->sid) {
@@ -4119,7 +4574,7 @@ _PUBLIC_ void ndr_print_lsa_TranslatedSid3(struct ndr_print *ndr, const char *na
}
ndr->depth--;
ndr_print_uint32(ndr, "sid_index", r->sid_index);
- ndr_print_uint32(ndr, "unknown", r->unknown);
+ ndr_print_uint32(ndr, "flags", r->flags);
ndr->depth--;
}
@@ -4645,13 +5100,13 @@ static enum ndr_err_code ndr_push_lsa_Close(struct ndr_push *ndr, int flags, con
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_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|NDR_BUFFERS, r->out.handle));
+ 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;
@@ -4668,7 +5123,7 @@ static enum ndr_err_code ndr_pull_lsa_Close(struct ndr_pull *ndr, int flags, str
}
_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_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;
@@ -4679,7 +5134,7 @@ static enum ndr_err_code ndr_pull_lsa_Close(struct ndr_pull *ndr, int flags, str
}
_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|NDR_BUFFERS, r->out.handle));
+ 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));
}
@@ -4721,7 +5176,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_Delete(struct ndr_push *ndr, int flags,
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
}
if (flags & NDR_OUT) {
NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
@@ -4738,7 +5193,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_Delete(struct ndr_pull *ndr, int flags,
}
_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_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);
}
if (flags & NDR_OUT) {
@@ -4778,7 +5233,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_EnumPrivs(struct ndr_push *ndr, int flag
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.resume_handle == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -4812,7 +5267,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_EnumPrivs(struct ndr_pull *ndr, int flag
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.resume_handle);
@@ -4891,7 +5346,7 @@ static enum ndr_err_code ndr_push_lsa_QuerySecurity(struct ndr_push *ndr, int fl
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_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) {
@@ -4921,7 +5376,7 @@ static enum ndr_err_code ndr_pull_lsa_QuerySecurity(struct ndr_pull *ndr, int fl
}
_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_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);
@@ -4992,7 +5447,7 @@ static enum ndr_err_code ndr_push_lsa_SetSecObj(struct ndr_push *ndr, int flags,
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_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");
@@ -5015,7 +5470,7 @@ static enum ndr_err_code ndr_pull_lsa_SetSecObj(struct ndr_pull *ndr, int flags,
}
_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_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) {
@@ -5120,7 +5575,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_OpenPolicy(struct ndr_push *ndr, int fla
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|NDR_BUFFERS, r->out.handle));
+ 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;
@@ -5164,7 +5619,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_OpenPolicy(struct ndr_pull *ndr, int fla
}
_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|NDR_BUFFERS, r->out.handle));
+ 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));
}
@@ -5213,7 +5668,7 @@ static enum ndr_err_code ndr_push_lsa_QueryInfoPolicy(struct ndr_push *ndr, int
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_lsa_PolicyInfo(ndr, NDR_SCALARS, r->in.level));
}
if (flags & NDR_OUT) {
@@ -5244,7 +5699,7 @@ static enum ndr_err_code ndr_pull_lsa_QueryInfoPolicy(struct ndr_pull *ndr, int
}
_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_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_lsa_PolicyInfo(ndr, NDR_SCALARS, &r->in.level));
NDR_PULL_ALLOC(ndr, r->out.info);
@@ -5317,7 +5772,7 @@ static enum ndr_err_code ndr_push_lsa_SetInfoPolicy(struct ndr_push *ndr, int fl
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_policy_handle(ndr, NDR_SCALARS, 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");
@@ -5341,7 +5796,7 @@ static enum ndr_err_code ndr_pull_lsa_SetInfoPolicy(struct ndr_pull *ndr, int fl
}
_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_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_lsa_PolicyInfo(ndr, NDR_SCALARS, &r->in.level));
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
@@ -5437,7 +5892,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateAccount(struct ndr_push *ndr, int
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.sid == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -5448,7 +5903,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateAccount(struct ndr_push *ndr, int
if (r->out.acct_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->out.acct_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.acct_handle));
NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -5467,7 +5922,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_CreateAccount(struct ndr_pull *ndr, int
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.sid);
@@ -5486,7 +5941,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_CreateAccount(struct ndr_pull *ndr, int
}
_mem_save_acct_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.acct_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.acct_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.acct_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_acct_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
}
@@ -5533,7 +5988,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_EnumAccounts(struct ndr_push *ndr, int f
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.resume_handle == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -5567,7 +6022,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_EnumAccounts(struct ndr_pull *ndr, int f
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.resume_handle);
@@ -5646,10 +6101,10 @@ _PUBLIC_ void ndr_print_lsa_EnumAccounts(struct ndr_print *ndr, const char *name
_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) {
+ if (r->in.policy_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_policy_handle(ndr, NDR_SCALARS, r->in.policy_handle));
if (r->in.info == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -5660,7 +6115,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateTrustedDomain(struct ndr_push *ndr
if (r->out.trustdom_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->out.trustdom_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.trustdom_handle));
NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -5668,19 +6123,19 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateTrustedDomain(struct ndr_push *ndr
_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_policy_handle_0;
TALLOC_CTX *_mem_save_info_0;
TALLOC_CTX *_mem_save_trustdom_handle_0;
if (flags & NDR_IN) {
ZERO_STRUCT(r->out);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
- NDR_PULL_ALLOC(ndr, r->in.handle);
+ NDR_PULL_ALLOC(ndr, r->in.policy_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);
+ _mem_save_policy_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.policy_handle, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.policy_handle));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_policy_handle_0, LIBNDR_FLAG_REF_ALLOC);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.info);
}
@@ -5698,7 +6153,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_CreateTrustedDomain(struct ndr_pull *ndr
}
_mem_save_trustdom_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.trustdom_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.trustdom_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.trustdom_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trustdom_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
}
@@ -5715,9 +6170,9 @@ _PUBLIC_ void ndr_print_lsa_CreateTrustedDomain(struct ndr_print *ndr, const cha
if (flags & NDR_IN) {
ndr_print_struct(ndr, "in", "lsa_CreateTrustedDomain");
ndr->depth++;
- ndr_print_ptr(ndr, "handle", r->in.handle);
+ ndr_print_ptr(ndr, "policy_handle", r->in.policy_handle);
ndr->depth++;
- ndr_print_policy_handle(ndr, "handle", r->in.handle);
+ ndr_print_policy_handle(ndr, "policy_handle", r->in.policy_handle);
ndr->depth--;
ndr_print_ptr(ndr, "info", r->in.info);
ndr->depth++;
@@ -5745,7 +6200,7 @@ static enum ndr_err_code ndr_push_lsa_EnumTrustDom(struct ndr_push *ndr, int fla
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.resume_handle == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -5779,7 +6234,7 @@ static enum ndr_err_code ndr_pull_lsa_EnumTrustDom(struct ndr_pull *ndr, int fla
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.resume_handle);
@@ -5859,7 +6314,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupNames(struct ndr_push *ndr, int fl
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_names));
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++) {
@@ -5917,7 +6372,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupNames(struct ndr_pull *ndr, int fl
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.num_names));
if (r->in.num_names < 0 || r->in.num_names > 1000) {
@@ -6066,7 +6521,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupSids(struct ndr_push *ndr, int fla
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.sids == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -6119,7 +6574,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupSids(struct ndr_pull *ndr, int fla
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.sids);
@@ -6249,7 +6704,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateSecret(struct ndr_push *ndr, int f
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.access_mask));
}
@@ -6257,7 +6712,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateSecret(struct ndr_push *ndr, int f
if (r->out.sec_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->out.sec_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.sec_handle));
NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -6275,7 +6730,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_CreateSecret(struct ndr_pull *ndr, int f
}
_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_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_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.access_mask));
@@ -6288,7 +6743,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_CreateSecret(struct ndr_pull *ndr, int f
}
_mem_save_sec_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.sec_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sec_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.sec_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sec_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
}
@@ -6332,7 +6787,7 @@ static enum ndr_err_code ndr_push_lsa_OpenAccount(struct ndr_push *ndr, int flag
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.sid == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -6343,7 +6798,7 @@ static enum ndr_err_code ndr_push_lsa_OpenAccount(struct ndr_push *ndr, int flag
if (r->out.acct_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->out.acct_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.acct_handle));
NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -6362,7 +6817,7 @@ static enum ndr_err_code ndr_pull_lsa_OpenAccount(struct ndr_pull *ndr, int flag
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.sid);
@@ -6381,7 +6836,7 @@ static enum ndr_err_code ndr_pull_lsa_OpenAccount(struct ndr_pull *ndr, int flag
}
_mem_save_acct_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.acct_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.acct_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.acct_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_acct_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
}
@@ -6428,7 +6883,7 @@ static enum ndr_err_code ndr_push_lsa_EnumPrivsAccount(struct ndr_push *ndr, int
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
}
if (flags & NDR_OUT) {
if (r->out.privs == NULL) {
@@ -6457,7 +6912,7 @@ static enum ndr_err_code ndr_pull_lsa_EnumPrivsAccount(struct ndr_pull *ndr, int
}
_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_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.privs);
ZERO_STRUCTP(r->out.privs);
@@ -6526,7 +6981,7 @@ static enum ndr_err_code ndr_push_lsa_AddPrivilegesToAccount(struct ndr_push *nd
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.privs == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -6548,7 +7003,7 @@ static enum ndr_err_code ndr_pull_lsa_AddPrivilegesToAccount(struct ndr_pull *nd
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.privs);
@@ -6599,7 +7054,7 @@ static enum ndr_err_code ndr_push_lsa_RemovePrivilegesFromAccount(struct ndr_pus
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.remove_all));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.privs));
if (r->in.privs) {
@@ -6623,7 +7078,7 @@ static enum ndr_err_code ndr_pull_lsa_RemovePrivilegesFromAccount(struct ndr_pul
}
_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_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_uint8(ndr, NDR_SCALARS, &r->in.remove_all));
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_privs));
@@ -6765,7 +7220,7 @@ static enum ndr_err_code ndr_push_lsa_GetSystemAccessAccount(struct ndr_push *nd
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
}
if (flags & NDR_OUT) {
if (r->out.access_mask == NULL) {
@@ -6789,7 +7244,7 @@ static enum ndr_err_code ndr_pull_lsa_GetSystemAccessAccount(struct ndr_pull *nd
}
_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_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.access_mask);
ZERO_STRUCTP(r->out.access_mask);
@@ -6842,7 +7297,7 @@ static enum ndr_err_code ndr_push_lsa_SetSystemAccessAccount(struct ndr_push *nd
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.access_mask));
}
if (flags & NDR_OUT) {
@@ -6860,7 +7315,7 @@ static enum ndr_err_code ndr_pull_lsa_SetSystemAccessAccount(struct ndr_pull *nd
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.access_mask));
}
@@ -6902,7 +7357,7 @@ static enum ndr_err_code ndr_push_lsa_OpenTrustedDomain(struct ndr_push *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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.sid == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -6913,7 +7368,7 @@ static enum ndr_err_code ndr_push_lsa_OpenTrustedDomain(struct ndr_push *ndr, in
if (r->out.trustdom_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->out.trustdom_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.trustdom_handle));
NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -6932,7 +7387,7 @@ static enum ndr_err_code ndr_pull_lsa_OpenTrustedDomain(struct ndr_pull *ndr, in
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.sid);
@@ -6951,7 +7406,7 @@ static enum ndr_err_code ndr_pull_lsa_OpenTrustedDomain(struct ndr_pull *ndr, in
}
_mem_save_trustdom_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.trustdom_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.trustdom_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.trustdom_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trustdom_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
}
@@ -6998,7 +7453,7 @@ static enum ndr_err_code ndr_push_lsa_QueryTrustedDomainInfo(struct ndr_push *nd
if (r->in.trustdom_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.trustdom_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.trustdom_handle));
NDR_CHECK(ndr_push_lsa_TrustDomInfoEnum(ndr, NDR_SCALARS, r->in.level));
}
if (flags & NDR_OUT) {
@@ -7029,7 +7484,7 @@ static enum ndr_err_code ndr_pull_lsa_QueryTrustedDomainInfo(struct ndr_pull *nd
}
_mem_save_trustdom_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.trustdom_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.trustdom_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.trustdom_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trustdom_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_lsa_TrustDomInfoEnum(ndr, NDR_SCALARS, &r->in.level));
NDR_PULL_ALLOC(ndr, r->out.info);
@@ -7099,6 +7554,16 @@ _PUBLIC_ void ndr_print_lsa_QueryTrustedDomainInfo(struct ndr_print *ndr, const
static enum ndr_err_code ndr_push_lsa_SetInformationTrustedDomain(struct ndr_push *ndr, int flags, const struct lsa_SetInformationTrustedDomain *r)
{
if (flags & NDR_IN) {
+ if (r->in.trustdom_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.trustdom_handle));
+ NDR_CHECK(ndr_push_lsa_TrustDomInfoEnum(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_TrustedDomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
}
if (flags & NDR_OUT) {
NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
@@ -7108,7 +7573,25 @@ static enum ndr_err_code ndr_push_lsa_SetInformationTrustedDomain(struct ndr_pus
static enum ndr_err_code ndr_pull_lsa_SetInformationTrustedDomain(struct ndr_pull *ndr, int flags, struct lsa_SetInformationTrustedDomain *r)
{
+ TALLOC_CTX *_mem_save_trustdom_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.trustdom_handle);
+ }
+ _mem_save_trustdom_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.trustdom_handle, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.trustdom_handle));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trustdom_handle_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_lsa_TrustDomInfoEnum(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_TrustedDomainInfo(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));
@@ -7126,6 +7609,16 @@ _PUBLIC_ void ndr_print_lsa_SetInformationTrustedDomain(struct ndr_print *ndr, c
if (flags & NDR_IN) {
ndr_print_struct(ndr, "in", "lsa_SetInformationTrustedDomain");
ndr->depth++;
+ ndr_print_ptr(ndr, "trustdom_handle", r->in.trustdom_handle);
+ ndr->depth++;
+ ndr_print_policy_handle(ndr, "trustdom_handle", r->in.trustdom_handle);
+ ndr->depth--;
+ ndr_print_lsa_TrustDomInfoEnum(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_TrustedDomainInfo(ndr, "info", r->in.info);
+ ndr->depth--;
ndr->depth--;
}
if (flags & NDR_OUT) {
@@ -7143,7 +7636,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_OpenSecret(struct ndr_push *ndr, int fla
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.access_mask));
}
@@ -7151,7 +7644,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_OpenSecret(struct ndr_push *ndr, int fla
if (r->out.sec_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->out.sec_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.sec_handle));
NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -7169,7 +7662,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_OpenSecret(struct ndr_pull *ndr, int fla
}
_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_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_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.access_mask));
@@ -7182,7 +7675,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_OpenSecret(struct ndr_pull *ndr, int fla
}
_mem_save_sec_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.sec_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sec_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.sec_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sec_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
}
@@ -7226,7 +7719,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_SetSecret(struct ndr_push *ndr, int flag
if (r->in.sec_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.sec_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.sec_handle));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.new_val));
if (r->in.new_val) {
NDR_CHECK(ndr_push_lsa_DATA_BUF(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.new_val));
@@ -7255,7 +7748,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_SetSecret(struct ndr_pull *ndr, int flag
}
_mem_save_sec_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.sec_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sec_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.sec_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sec_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_new_val));
if (_ptr_new_val) {
@@ -7331,7 +7824,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_QuerySecret(struct ndr_push *ndr, int fl
if (r->in.sec_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.sec_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.sec_handle));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.new_val));
if (r->in.new_val) {
NDR_CHECK(ndr_push_lsa_DATA_BUF_PTR(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.new_val));
@@ -7390,7 +7883,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_QuerySecret(struct ndr_pull *ndr, int fl
}
_mem_save_sec_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.sec_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sec_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.sec_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sec_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_new_val));
if (_ptr_new_val) {
@@ -7574,7 +8067,7 @@ static enum ndr_err_code ndr_push_lsa_LookupPrivValue(struct ndr_push *ndr, int
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.name == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -7603,7 +8096,7 @@ static enum ndr_err_code ndr_pull_lsa_LookupPrivValue(struct ndr_pull *ndr, int
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.name);
@@ -7667,7 +8160,7 @@ static enum ndr_err_code ndr_push_lsa_LookupPrivName(struct ndr_push *ndr, int f
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.luid == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -7701,7 +8194,7 @@ static enum ndr_err_code ndr_pull_lsa_LookupPrivName(struct ndr_pull *ndr, int f
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.luid);
@@ -7781,7 +8274,7 @@ static enum ndr_err_code ndr_push_lsa_LookupPrivDisplayName(struct ndr_push *ndr
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.name == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -7822,7 +8315,7 @@ static enum ndr_err_code ndr_pull_lsa_LookupPrivDisplayName(struct ndr_pull *ndr
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.name);
@@ -7919,13 +8412,13 @@ static enum ndr_err_code ndr_push_lsa_DeleteObject(struct ndr_push *ndr, int fla
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_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|NDR_BUFFERS, r->out.handle));
+ 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;
@@ -7942,7 +8435,7 @@ static enum ndr_err_code ndr_pull_lsa_DeleteObject(struct ndr_pull *ndr, int fla
}
_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_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;
@@ -7953,7 +8446,7 @@ static enum ndr_err_code ndr_pull_lsa_DeleteObject(struct ndr_pull *ndr, int fla
}
_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|NDR_BUFFERS, r->out.handle));
+ 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));
}
@@ -7995,7 +8488,7 @@ static enum ndr_err_code ndr_push_lsa_EnumAccountsWithUserRight(struct ndr_push
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
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));
@@ -8025,7 +8518,7 @@ static enum ndr_err_code ndr_pull_lsa_EnumAccountsWithUserRight(struct ndr_pull
}
_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_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_generic_ptr(ndr, &_ptr_name));
if (_ptr_name) {
@@ -8096,7 +8589,7 @@ static enum ndr_err_code ndr_push_lsa_EnumAccountRights(struct ndr_push *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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.sid == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -8125,7 +8618,7 @@ static enum ndr_err_code ndr_pull_lsa_EnumAccountRights(struct ndr_pull *ndr, in
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.sid);
@@ -8189,7 +8682,7 @@ static enum ndr_err_code ndr_push_lsa_AddAccountRights(struct ndr_push *ndr, int
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.sid == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -8216,7 +8709,7 @@ static enum ndr_err_code ndr_pull_lsa_AddAccountRights(struct ndr_pull *ndr, int
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.sid);
@@ -8278,7 +8771,7 @@ static enum ndr_err_code ndr_push_lsa_RemoveAccountRights(struct ndr_push *ndr,
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.sid == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -8306,7 +8799,7 @@ static enum ndr_err_code ndr_pull_lsa_RemoveAccountRights(struct ndr_pull *ndr,
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.sid);
@@ -8370,7 +8863,7 @@ static enum ndr_err_code ndr_push_lsa_QueryTrustedDomainInfoBySid(struct ndr_pus
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.dom_sid == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -8406,7 +8899,7 @@ static enum ndr_err_code ndr_pull_lsa_QueryTrustedDomainInfoBySid(struct ndr_pul
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.dom_sid);
@@ -8487,6 +8980,20 @@ _PUBLIC_ void ndr_print_lsa_QueryTrustedDomainInfoBySid(struct ndr_print *ndr, c
static enum ndr_err_code ndr_push_lsa_SetTrustedDomainInfo(struct ndr_push *ndr, int flags, const struct lsa_SetTrustedDomainInfo *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 (r->in.dom_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.dom_sid));
+ NDR_CHECK(ndr_push_lsa_TrustDomInfoEnum(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_TrustedDomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
}
if (flags & NDR_OUT) {
NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
@@ -8496,7 +9003,33 @@ static enum ndr_err_code ndr_push_lsa_SetTrustedDomainInfo(struct ndr_push *ndr,
static enum ndr_err_code ndr_pull_lsa_SetTrustedDomainInfo(struct ndr_pull *ndr, int flags, struct lsa_SetTrustedDomainInfo *r)
{
+ TALLOC_CTX *_mem_save_handle_0;
+ TALLOC_CTX *_mem_save_dom_sid_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, 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.dom_sid);
+ }
+ _mem_save_dom_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.dom_sid, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.dom_sid));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dom_sid_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_lsa_TrustDomInfoEnum(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_TrustedDomainInfo(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));
@@ -8514,6 +9047,20 @@ _PUBLIC_ void ndr_print_lsa_SetTrustedDomainInfo(struct ndr_print *ndr, const ch
if (flags & NDR_IN) {
ndr_print_struct(ndr, "in", "lsa_SetTrustedDomainInfo");
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, "dom_sid", r->in.dom_sid);
+ ndr->depth++;
+ ndr_print_dom_sid2(ndr, "dom_sid", r->in.dom_sid);
+ ndr->depth--;
+ ndr_print_lsa_TrustDomInfoEnum(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_TrustedDomainInfo(ndr, "info", r->in.info);
+ ndr->depth--;
ndr->depth--;
}
if (flags & NDR_OUT) {
@@ -8531,7 +9078,7 @@ static enum ndr_err_code ndr_push_lsa_DeleteTrustedDomain(struct ndr_push *ndr,
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.dom_sid == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -8553,7 +9100,7 @@ static enum ndr_err_code ndr_pull_lsa_DeleteTrustedDomain(struct ndr_pull *ndr,
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.dom_sid);
@@ -8700,7 +9247,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_OpenPolicy2(struct ndr_push *ndr, int fl
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|NDR_BUFFERS, r->out.handle));
+ 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;
@@ -8750,7 +9297,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_OpenPolicy2(struct ndr_pull *ndr, int fl
}
_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|NDR_BUFFERS, r->out.handle));
+ 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));
}
@@ -9033,7 +9580,7 @@ static enum ndr_err_code ndr_push_lsa_QueryInfoPolicy2(struct ndr_push *ndr, int
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_lsa_PolicyInfo(ndr, NDR_SCALARS, r->in.level));
}
if (flags & NDR_OUT) {
@@ -9064,7 +9611,7 @@ static enum ndr_err_code ndr_pull_lsa_QueryInfoPolicy2(struct ndr_pull *ndr, int
}
_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_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_lsa_PolicyInfo(ndr, NDR_SCALARS, &r->in.level));
NDR_PULL_ALLOC(ndr, r->out.info);
@@ -9137,7 +9684,7 @@ static enum ndr_err_code ndr_push_lsa_SetInfoPolicy2(struct ndr_push *ndr, int f
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_policy_handle(ndr, NDR_SCALARS, 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");
@@ -9161,7 +9708,7 @@ static enum ndr_err_code ndr_pull_lsa_SetInfoPolicy2(struct ndr_pull *ndr, int f
}
_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_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_lsa_PolicyInfo(ndr, NDR_SCALARS, &r->in.level));
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
@@ -9216,7 +9763,7 @@ static enum ndr_err_code ndr_push_lsa_QueryTrustedDomainInfoByName(struct ndr_pu
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.trusted_domain == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -9252,7 +9799,7 @@ static enum ndr_err_code ndr_pull_lsa_QueryTrustedDomainInfoByName(struct ndr_pu
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.trusted_domain);
@@ -9336,7 +9883,7 @@ static enum ndr_err_code ndr_push_lsa_SetTrustedDomainInfoByName(struct ndr_push
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.trusted_domain));
NDR_CHECK(ndr_push_lsa_TrustDomInfoEnum(ndr, NDR_SCALARS, r->in.level));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.info));
@@ -9362,7 +9909,7 @@ static enum ndr_err_code ndr_pull_lsa_SetTrustedDomainInfoByName(struct ndr_pull
}
_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_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_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.trusted_domain));
NDR_CHECK(ndr_pull_lsa_TrustDomInfoEnum(ndr, NDR_SCALARS, &r->in.level));
@@ -9426,7 +9973,7 @@ static enum ndr_err_code ndr_push_lsa_EnumTrustedDomainsEx(struct ndr_push *ndr,
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.resume_handle == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -9460,7 +10007,7 @@ static enum ndr_err_code ndr_pull_lsa_EnumTrustedDomainsEx(struct ndr_pull *ndr,
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.resume_handle);
@@ -9536,8 +10083,25 @@ _PUBLIC_ void ndr_print_lsa_EnumTrustedDomainsEx(struct ndr_print *ndr, const ch
static enum ndr_err_code ndr_push_lsa_CreateTrustedDomainEx(struct ndr_push *ndr, int flags, const struct lsa_CreateTrustedDomainEx *r)
{
if (flags & NDR_IN) {
+ if (r->in.policy_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.policy_handle));
+ if (r->in.info == NULL) {
+ return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+ }
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoEx(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
+ if (r->in.auth_info == NULL) {
+ return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+ }
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoAuthInfoInternal(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.auth_info));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.access_mask));
}
if (flags & NDR_OUT) {
+ if (r->out.trustdom_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.trustdom_handle));
NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -9545,9 +10109,46 @@ static enum ndr_err_code ndr_push_lsa_CreateTrustedDomainEx(struct ndr_push *ndr
static enum ndr_err_code ndr_pull_lsa_CreateTrustedDomainEx(struct ndr_pull *ndr, int flags, struct lsa_CreateTrustedDomainEx *r)
{
+ TALLOC_CTX *_mem_save_policy_handle_0;
+ TALLOC_CTX *_mem_save_info_0;
+ TALLOC_CTX *_mem_save_auth_info_0;
+ TALLOC_CTX *_mem_save_trustdom_handle_0;
if (flags & NDR_IN) {
+ ZERO_STRUCT(r->out);
+
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->in.policy_handle);
+ }
+ _mem_save_policy_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.policy_handle, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.policy_handle));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_policy_handle_0, LIBNDR_FLAG_REF_ALLOC);
+ 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_lsa_TrustDomainInfoInfoEx(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->in.auth_info);
+ }
+ _mem_save_auth_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.auth_info, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_lsa_TrustDomainInfoAuthInfoInternal(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.auth_info));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_auth_info_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.access_mask));
+ NDR_PULL_ALLOC(ndr, r->out.trustdom_handle);
+ ZERO_STRUCTP(r->out.trustdom_handle);
}
if (flags & NDR_OUT) {
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.trustdom_handle);
+ }
+ _mem_save_trustdom_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.trustdom_handle, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.trustdom_handle));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trustdom_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -9563,11 +10164,28 @@ _PUBLIC_ void ndr_print_lsa_CreateTrustedDomainEx(struct ndr_print *ndr, const c
if (flags & NDR_IN) {
ndr_print_struct(ndr, "in", "lsa_CreateTrustedDomainEx");
ndr->depth++;
+ ndr_print_ptr(ndr, "policy_handle", r->in.policy_handle);
+ ndr->depth++;
+ ndr_print_policy_handle(ndr, "policy_handle", r->in.policy_handle);
+ ndr->depth--;
+ ndr_print_ptr(ndr, "info", r->in.info);
+ ndr->depth++;
+ ndr_print_lsa_TrustDomainInfoInfoEx(ndr, "info", r->in.info);
+ ndr->depth--;
+ ndr_print_ptr(ndr, "auth_info", r->in.auth_info);
+ ndr->depth++;
+ ndr_print_lsa_TrustDomainInfoAuthInfoInternal(ndr, "auth_info", r->in.auth_info);
+ ndr->depth--;
+ ndr_print_uint32(ndr, "access_mask", r->in.access_mask);
ndr->depth--;
}
if (flags & NDR_OUT) {
ndr_print_struct(ndr, "out", "lsa_CreateTrustedDomainEx");
ndr->depth++;
+ ndr_print_ptr(ndr, "trustdom_handle", r->out.trustdom_handle);
+ ndr->depth++;
+ ndr_print_policy_handle(ndr, "trustdom_handle", r->out.trustdom_handle);
+ ndr->depth--;
ndr_print_NTSTATUS(ndr, "result", r->out.result);
ndr->depth--;
}
@@ -9580,13 +10198,13 @@ static enum ndr_err_code ndr_push_lsa_CloseTrustedDomainEx(struct ndr_push *ndr,
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_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|NDR_BUFFERS, r->out.handle));
+ 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;
@@ -9603,7 +10221,7 @@ static enum ndr_err_code ndr_pull_lsa_CloseTrustedDomainEx(struct ndr_pull *ndr,
}
_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_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;
@@ -9614,7 +10232,7 @@ static enum ndr_err_code ndr_pull_lsa_CloseTrustedDomainEx(struct ndr_pull *ndr,
}
_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|NDR_BUFFERS, r->out.handle));
+ 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));
}
@@ -9656,7 +10274,7 @@ static enum ndr_err_code ndr_push_lsa_QueryDomainInformationPolicy(struct ndr_pu
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level));
}
if (flags & NDR_OUT) {
@@ -9687,7 +10305,7 @@ static enum ndr_err_code ndr_pull_lsa_QueryDomainInformationPolicy(struct ndr_pu
}
_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_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_uint16(ndr, NDR_SCALARS, &r->in.level));
NDR_PULL_ALLOC(ndr, r->out.info);
@@ -9760,7 +10378,7 @@ static enum ndr_err_code ndr_push_lsa_SetDomainInformationPolicy(struct ndr_push
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.info));
if (r->in.info) {
@@ -9785,7 +10403,7 @@ static enum ndr_err_code ndr_pull_lsa_SetDomainInformationPolicy(struct ndr_pull
}
_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_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_uint16(ndr, NDR_SCALARS, &r->in.level));
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info));
@@ -9847,7 +10465,7 @@ static enum ndr_err_code ndr_push_lsa_OpenTrustedDomainByName(struct ndr_push *n
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.access_mask));
}
@@ -9855,7 +10473,7 @@ static enum ndr_err_code ndr_push_lsa_OpenTrustedDomainByName(struct ndr_push *n
if (r->out.trustdom_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->out.trustdom_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.trustdom_handle));
NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -9873,7 +10491,7 @@ static enum ndr_err_code ndr_pull_lsa_OpenTrustedDomainByName(struct ndr_pull *n
}
_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_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_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.access_mask));
@@ -9886,7 +10504,7 @@ static enum ndr_err_code ndr_pull_lsa_OpenTrustedDomainByName(struct ndr_pull *n
}
_mem_save_trustdom_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.trustdom_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.trustdom_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.trustdom_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trustdom_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
}
@@ -9971,7 +10589,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupSids2(struct ndr_push *ndr, int fl
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.sids == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -10026,7 +10644,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupSids2(struct ndr_pull *ndr, int fl
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.sids);
@@ -10161,7 +10779,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupNames2(struct ndr_push *ndr, int f
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_names));
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++) {
@@ -10179,8 +10797,8 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupNames2(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->in.count));
- 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.lookup_options));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.client_revision));
}
if (flags & NDR_OUT) {
if (r->out.domains == NULL) {
@@ -10221,7 +10839,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupNames2(struct ndr_pull *ndr, int f
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.num_names));
if (r->in.num_names < 0 || r->in.num_names > 1000) {
@@ -10253,8 +10871,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupNames2(struct ndr_pull *ndr, int f
NDR_PULL_SET_MEM_CTX(ndr, r->in.count, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.count));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_count_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.lookup_options));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.client_revision));
NDR_PULL_ALLOC(ndr, r->out.domains);
ZERO_STRUCTP(r->out.domains);
NDR_PULL_ALLOC(ndr, r->out.sids);
@@ -10338,8 +10956,8 @@ _PUBLIC_ void ndr_print_lsa_LookupNames2(struct ndr_print *ndr, const char *name
ndr->depth++;
ndr_print_uint32(ndr, "count", *r->in.count);
ndr->depth--;
- ndr_print_uint32(ndr, "unknown1", r->in.unknown1);
- ndr_print_uint32(ndr, "unknown2", r->in.unknown2);
+ ndr_print_uint32(ndr, "lookup_options", r->in.lookup_options);
+ ndr_print_uint32(ndr, "client_revision", r->in.client_revision);
ndr->depth--;
}
if (flags & NDR_OUT) {
@@ -10371,8 +10989,25 @@ _PUBLIC_ void ndr_print_lsa_LookupNames2(struct ndr_print *ndr, const char *name
static enum ndr_err_code ndr_push_lsa_CreateTrustedDomainEx2(struct ndr_push *ndr, int flags, const struct lsa_CreateTrustedDomainEx2 *r)
{
if (flags & NDR_IN) {
+ if (r->in.policy_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.policy_handle));
+ if (r->in.info == NULL) {
+ return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+ }
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoEx(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
+ if (r->in.auth_info == NULL) {
+ return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+ }
+ NDR_CHECK(ndr_push_lsa_TrustDomainInfoAuthInfoInternal(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.auth_info));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.access_mask));
}
if (flags & NDR_OUT) {
+ if (r->out.trustdom_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.trustdom_handle));
NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -10380,9 +11015,46 @@ static enum ndr_err_code ndr_push_lsa_CreateTrustedDomainEx2(struct ndr_push *nd
static enum ndr_err_code ndr_pull_lsa_CreateTrustedDomainEx2(struct ndr_pull *ndr, int flags, struct lsa_CreateTrustedDomainEx2 *r)
{
+ TALLOC_CTX *_mem_save_policy_handle_0;
+ TALLOC_CTX *_mem_save_info_0;
+ TALLOC_CTX *_mem_save_auth_info_0;
+ TALLOC_CTX *_mem_save_trustdom_handle_0;
if (flags & NDR_IN) {
+ ZERO_STRUCT(r->out);
+
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->in.policy_handle);
+ }
+ _mem_save_policy_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.policy_handle, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.policy_handle));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_policy_handle_0, LIBNDR_FLAG_REF_ALLOC);
+ 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_lsa_TrustDomainInfoInfoEx(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC);
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->in.auth_info);
+ }
+ _mem_save_auth_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.auth_info, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_lsa_TrustDomainInfoAuthInfoInternal(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.auth_info));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_auth_info_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.access_mask));
+ NDR_PULL_ALLOC(ndr, r->out.trustdom_handle);
+ ZERO_STRUCTP(r->out.trustdom_handle);
}
if (flags & NDR_OUT) {
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.trustdom_handle);
+ }
+ _mem_save_trustdom_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.trustdom_handle, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.trustdom_handle));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trustdom_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -10398,11 +11070,28 @@ _PUBLIC_ void ndr_print_lsa_CreateTrustedDomainEx2(struct ndr_print *ndr, const
if (flags & NDR_IN) {
ndr_print_struct(ndr, "in", "lsa_CreateTrustedDomainEx2");
ndr->depth++;
+ ndr_print_ptr(ndr, "policy_handle", r->in.policy_handle);
+ ndr->depth++;
+ ndr_print_policy_handle(ndr, "policy_handle", r->in.policy_handle);
+ ndr->depth--;
+ ndr_print_ptr(ndr, "info", r->in.info);
+ ndr->depth++;
+ ndr_print_lsa_TrustDomainInfoInfoEx(ndr, "info", r->in.info);
+ ndr->depth--;
+ ndr_print_ptr(ndr, "auth_info", r->in.auth_info);
+ ndr->depth++;
+ ndr_print_lsa_TrustDomainInfoAuthInfoInternal(ndr, "auth_info", r->in.auth_info);
+ ndr->depth--;
+ ndr_print_uint32(ndr, "access_mask", r->in.access_mask);
ndr->depth--;
}
if (flags & NDR_OUT) {
ndr_print_struct(ndr, "out", "lsa_CreateTrustedDomainEx2");
ndr->depth++;
+ ndr_print_ptr(ndr, "trustdom_handle", r->out.trustdom_handle);
+ ndr->depth++;
+ ndr_print_policy_handle(ndr, "trustdom_handle", r->out.trustdom_handle);
+ ndr->depth--;
ndr_print_NTSTATUS(ndr, "result", r->out.result);
ndr->depth--;
}
@@ -10744,7 +11433,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupNames3(struct ndr_push *ndr, int f
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_names));
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++) {
@@ -10762,8 +11451,8 @@ _PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupNames3(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->in.count));
- 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.lookup_options));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.client_revision));
}
if (flags & NDR_OUT) {
if (r->out.domains == NULL) {
@@ -10804,7 +11493,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupNames3(struct ndr_pull *ndr, int f
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.num_names));
if (r->in.num_names < 0 || r->in.num_names > 1000) {
@@ -10836,8 +11525,8 @@ _PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupNames3(struct ndr_pull *ndr, int f
NDR_PULL_SET_MEM_CTX(ndr, r->in.count, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.count));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_count_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.lookup_options));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.client_revision));
NDR_PULL_ALLOC(ndr, r->out.domains);
ZERO_STRUCTP(r->out.domains);
NDR_PULL_ALLOC(ndr, r->out.sids);
@@ -10921,8 +11610,8 @@ _PUBLIC_ void ndr_print_lsa_LookupNames3(struct ndr_print *ndr, const char *name
ndr->depth++;
ndr_print_uint32(ndr, "count", *r->in.count);
ndr->depth--;
- ndr_print_uint32(ndr, "unknown1", r->in.unknown1);
- ndr_print_uint32(ndr, "unknown2", r->in.unknown2);
+ ndr_print_uint32(ndr, "lookup_options", r->in.lookup_options);
+ ndr_print_uint32(ndr, "client_revision", r->in.client_revision);
ndr->depth--;
}
if (flags & NDR_OUT) {
@@ -11121,7 +11810,7 @@ static enum ndr_err_code ndr_push_lsa_lsaRQueryForestTrustInformation(struct ndr
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.trusted_domain_name == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -11156,7 +11845,7 @@ static enum ndr_err_code ndr_pull_lsa_lsaRQueryForestTrustInformation(struct ndr
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.trusted_domain_name);
@@ -11508,8 +12197,8 @@ 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_uint32(ndr, NDR_SCALARS, *r->in.count));
- 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.lookup_options));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.client_revision));
}
if (flags & NDR_OUT) {
if (r->out.domains == NULL) {
@@ -11574,8 +12263,8 @@ static enum ndr_err_code ndr_pull_lsa_LookupNames4(struct ndr_pull *ndr, int fla
NDR_PULL_SET_MEM_CTX(ndr, r->in.count, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.count));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_count_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.lookup_options));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.client_revision));
NDR_PULL_ALLOC(ndr, r->out.domains);
ZERO_STRUCTP(r->out.domains);
NDR_PULL_ALLOC(ndr, r->out.sids);
@@ -11655,8 +12344,8 @@ _PUBLIC_ void ndr_print_lsa_LookupNames4(struct ndr_print *ndr, const char *name
ndr->depth++;
ndr_print_uint32(ndr, "count", *r->in.count);
ndr->depth--;
- ndr_print_uint32(ndr, "unknown1", r->in.unknown1);
- ndr_print_uint32(ndr, "unknown2", r->in.unknown2);
+ ndr_print_uint32(ndr, "lookup_options", r->in.lookup_options);
+ ndr_print_uint32(ndr, "client_revision", r->in.client_revision);
ndr->depth--;
}
if (flags & NDR_OUT) {
diff --git a/source3/librpc/gen_ndr/ndr_lsa.h b/source3/librpc/gen_ndr/ndr_lsa.h
index a489b5423e..2f623c2ba9 100644
--- a/source3/librpc/gen_ndr/ndr_lsa.h
+++ b/source3/librpc/gen_ndr/ndr_lsa.h
@@ -207,6 +207,7 @@ void ndr_print_lsa_PolicyAuditPolicy(struct ndr_print *ndr, const char *name, en
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);
+void ndr_print_lsa_Role(struct ndr_print *ndr, const char *name, enum lsa_Role r);
void ndr_print_lsa_ServerRole(struct ndr_print *ndr, const char *name, const struct lsa_ServerRole *r);
void ndr_print_lsa_ReplicaSourceInfo(struct ndr_print *ndr, const char *name, const struct lsa_ReplicaSourceInfo *r);
void ndr_print_lsa_DefaultQuotaInfo(struct ndr_print *ndr, const char *name, const struct lsa_DefaultQuotaInfo *r);
@@ -221,6 +222,8 @@ enum ndr_err_code ndr_push_lsa_SidArray(struct ndr_push *ndr, int ndr_flags, con
enum ndr_err_code ndr_pull_lsa_SidArray(struct ndr_pull *ndr, int ndr_flags, struct lsa_SidArray *r);
void ndr_print_lsa_SidArray(struct ndr_print *ndr, const char *name, const struct lsa_SidArray *r);
void ndr_print_lsa_DomainList(struct ndr_print *ndr, const char *name, const struct lsa_DomainList *r);
+enum ndr_err_code ndr_push_lsa_SidType(struct ndr_push *ndr, int ndr_flags, enum lsa_SidType r);
+enum ndr_err_code ndr_pull_lsa_SidType(struct ndr_pull *ndr, int ndr_flags, enum lsa_SidType *r);
void ndr_print_lsa_SidType(struct ndr_print *ndr, const char *name, enum lsa_SidType r);
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);
@@ -233,16 +236,30 @@ void ndr_print_lsa_PrivilegeSet(struct ndr_print *ndr, const char *name, const s
void ndr_print_lsa_DATA_BUF(struct ndr_print *ndr, const char *name, const struct lsa_DATA_BUF *r);
void ndr_print_lsa_DATA_BUF2(struct ndr_print *ndr, const char *name, const struct lsa_DATA_BUF2 *r);
void ndr_print_lsa_TrustDomInfoEnum(struct ndr_print *ndr, const char *name, enum lsa_TrustDomInfoEnum r);
+enum ndr_err_code ndr_push_lsa_TrustDirection(struct ndr_push *ndr, int ndr_flags, uint32_t r);
+enum ndr_err_code ndr_pull_lsa_TrustDirection(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
+void ndr_print_lsa_TrustDirection(struct ndr_print *ndr, const char *name, uint32_t r);
+void ndr_print_lsa_TrustType(struct ndr_print *ndr, const char *name, enum lsa_TrustType r);
+enum ndr_err_code ndr_push_lsa_TrustAttributes(struct ndr_push *ndr, int ndr_flags, uint32_t r);
+enum ndr_err_code ndr_pull_lsa_TrustAttributes(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
+void ndr_print_lsa_TrustAttributes(struct ndr_print *ndr, const char *name, uint32_t r);
void ndr_print_lsa_TrustDomainInfoName(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoName *r);
+void ndr_print_lsa_TrustDomainInfoControllers(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoControllers *r);
void ndr_print_lsa_TrustDomainInfoPosixOffset(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoPosixOffset *r);
void ndr_print_lsa_TrustDomainInfoPassword(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoPassword *r);
void ndr_print_lsa_TrustDomainInfoBasic(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoBasic *r);
void ndr_print_lsa_TrustDomainInfoInfoEx(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoInfoEx *r);
+enum ndr_err_code ndr_push_lsa_TrustAuthType(struct ndr_push *ndr, int ndr_flags, enum lsa_TrustAuthType r);
+enum ndr_err_code ndr_pull_lsa_TrustAuthType(struct ndr_pull *ndr, int ndr_flags, enum lsa_TrustAuthType *r);
+void ndr_print_lsa_TrustAuthType(struct ndr_print *ndr, const char *name, enum lsa_TrustAuthType r);
void ndr_print_lsa_TrustDomainInfoBuffer(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoBuffer *r);
void ndr_print_lsa_TrustDomainInfoAuthInfo(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoAuthInfo *r);
void ndr_print_lsa_TrustDomainInfoFullInfo(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoFullInfo *r);
-void ndr_print_lsa_TrustDomainInfo11(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfo11 *r);
-void ndr_print_lsa_TrustDomainInfoInfoAll(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoInfoAll *r);
+void ndr_print_lsa_TrustDomainInfoAuthInfoInternal(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoAuthInfoInternal *r);
+void ndr_print_lsa_TrustDomainInfoFullInfoInternal(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoFullInfoInternal *r);
+void ndr_print_lsa_TrustDomainInfoInfoEx2Internal(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoInfoEx2Internal *r);
+void ndr_print_lsa_TrustDomainInfoFullInfo2Internal(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoFullInfo2Internal *r);
+void ndr_print_lsa_TrustDomainInfoSupportedEncTypes(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoSupportedEncTypes *r);
void ndr_print_lsa_TrustedDomainInfo(struct ndr_print *ndr, const char *name, const union lsa_TrustedDomainInfo *r);
void ndr_print_lsa_DATA_BUF_PTR(struct ndr_print *ndr, const char *name, const struct lsa_DATA_BUF_PTR *r);
void ndr_print_lsa_RightSet(struct ndr_print *ndr, const char *name, const struct lsa_RightSet *r);
diff --git a/source3/librpc/gen_ndr/ndr_misc.c b/source3/librpc/gen_ndr/ndr_misc.c
index 56105d499f..22c416a0d7 100644
--- a/source3/librpc/gen_ndr/ndr_misc.c
+++ b/source3/librpc/gen_ndr/ndr_misc.c
@@ -123,7 +123,9 @@ _PUBLIC_ void ndr_print_netr_SchannelType(struct ndr_print *ndr, const char *nam
const char *val = NULL;
switch (r) {
+ case SEC_CHAN_NULL: val = "SEC_CHAN_NULL"; break;
case SEC_CHAN_WKSTA: val = "SEC_CHAN_WKSTA"; break;
+ case SEC_CHAN_DNS_DOMAIN: val = "SEC_CHAN_DNS_DOMAIN"; break;
case SEC_CHAN_DOMAIN: val = "SEC_CHAN_DOMAIN"; break;
case SEC_CHAN_BDC: val = "SEC_CHAN_BDC"; break;
}
diff --git a/source3/librpc/gen_ndr/ndr_nbt.c b/source3/librpc/gen_ndr/ndr_nbt.c
index 75667183a8..c02b539da5 100644
--- a/source3/librpc/gen_ndr/ndr_nbt.c
+++ b/source3/librpc/gen_ndr/ndr_nbt.c
@@ -77,13 +77,13 @@ _PUBLIC_ void ndr_print_nbt_name(struct ndr_print *ndr, const char *name, const
ndr->depth--;
}
-static enum ndr_err_code ndr_push_nbt_qclass(struct ndr_push *ndr, int ndr_flags, enum nbt_qclass r)
+_PUBLIC_ enum ndr_err_code ndr_push_nbt_qclass(struct ndr_push *ndr, int ndr_flags, enum nbt_qclass r)
{
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_nbt_qclass(struct ndr_pull *ndr, int ndr_flags, enum nbt_qclass *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_nbt_qclass(struct ndr_pull *ndr, int ndr_flags, enum nbt_qclass *r)
{
uint16_t v;
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
@@ -101,13 +101,13 @@ _PUBLIC_ void ndr_print_nbt_qclass(struct ndr_print *ndr, const char *name, enum
ndr_print_enum(ndr, name, "ENUM", val, r);
}
-static enum ndr_err_code ndr_push_nbt_qtype(struct ndr_push *ndr, int ndr_flags, enum nbt_qtype r)
+_PUBLIC_ enum ndr_err_code ndr_push_nbt_qtype(struct ndr_push *ndr, int ndr_flags, enum nbt_qtype r)
{
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_nbt_qtype(struct ndr_pull *ndr, int ndr_flags, enum nbt_qtype *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_nbt_qtype(struct ndr_pull *ndr, int ndr_flags, enum nbt_qtype *r)
{
uint16_t v;
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
@@ -496,7 +496,7 @@ _PUBLIC_ void ndr_print_nbt_rdata_data(struct ndr_print *ndr, const char *name,
ndr->depth--;
}
-static enum ndr_err_code ndr_push_nbt_rdata(struct ndr_push *ndr, int ndr_flags, const union nbt_rdata *r)
+_PUBLIC_ enum ndr_err_code ndr_push_nbt_rdata(struct ndr_push *ndr, int ndr_flags, const union nbt_rdata *r)
{
if (ndr_flags & NDR_SCALARS) {
int level = ndr_push_get_switch_value(ndr, r);
@@ -532,7 +532,7 @@ static enum ndr_err_code ndr_push_nbt_rdata(struct ndr_push *ndr, int ndr_flags,
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_nbt_rdata(struct ndr_pull *ndr, int ndr_flags, union nbt_rdata *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_nbt_rdata(struct ndr_pull *ndr, int ndr_flags, union nbt_rdata *r)
{
int level;
level = ndr_pull_get_switch_value(ndr, r);
@@ -589,27 +589,6 @@ _PUBLIC_ void ndr_print_nbt_rdata(struct ndr_print *ndr, const char *name, const
}
}
-static enum ndr_err_code ndr_push_nbt_res_rec(struct ndr_push *ndr, int ndr_flags, const struct nbt_res_rec *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_nbt_name(ndr, NDR_SCALARS, &r->name));
- NDR_CHECK(ndr_push_nbt_qtype(ndr, NDR_SCALARS, r->rr_type));
- NDR_CHECK(ndr_push_nbt_qclass(ndr, NDR_SCALARS, r->rr_class));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ttl));
- NDR_CHECK(ndr_push_set_switch_value(ndr, &r->rdata, ((((r->rr_type) == NBT_QTYPE_NETBIOS) && talloc_check_name(ndr, "struct ndr_push") && ((r->rdata).data.length == 2))?0:r->rr_type)));
- NDR_CHECK(ndr_push_nbt_rdata(ndr, NDR_SCALARS, &r->rdata));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- ndr->flags = _flags_save_STRUCT;
- }
- return NDR_ERR_SUCCESS;
-}
-
static enum ndr_err_code ndr_pull_nbt_res_rec(struct ndr_pull *ndr, int ndr_flags, struct nbt_res_rec *r)
{
{
@@ -621,7 +600,7 @@ static enum ndr_err_code ndr_pull_nbt_res_rec(struct ndr_pull *ndr, int ndr_flag
NDR_CHECK(ndr_pull_nbt_qtype(ndr, NDR_SCALARS, &r->rr_type));
NDR_CHECK(ndr_pull_nbt_qclass(ndr, NDR_SCALARS, &r->rr_class));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ttl));
- NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->rdata, ((((r->rr_type) == NBT_QTYPE_NETBIOS) && talloc_check_name(ndr, "struct ndr_push") && ((r->rdata).data.length == 2))?0:r->rr_type)));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->rdata, r->rr_type));
NDR_CHECK(ndr_pull_nbt_rdata(ndr, NDR_SCALARS, &r->rdata));
}
if (ndr_flags & NDR_BUFFERS) {
@@ -642,7 +621,7 @@ _PUBLIC_ void ndr_print_nbt_res_rec(struct ndr_print *ndr, const char *name, con
ndr_print_nbt_qtype(ndr, "rr_type", r->rr_type);
ndr_print_nbt_qclass(ndr, "rr_class", r->rr_class);
ndr_print_uint32(ndr, "ttl", r->ttl);
- ndr_print_set_switch_value(ndr, &r->rdata, ((((r->rr_type) == NBT_QTYPE_NETBIOS) && talloc_check_name(ndr, "struct ndr_push") && ((r->rdata).data.length == 2))?0:r->rr_type));
+ ndr_print_set_switch_value(ndr, &r->rdata, r->rr_type);
ndr_print_nbt_rdata(ndr, "rdata", &r->rdata);
ndr->depth--;
ndr->flags = _flags_save_STRUCT;
@@ -1548,13 +1527,138 @@ _PUBLIC_ void ndr_print_nbt_dgram_packet(struct ndr_print *ndr, const char *name
}
}
-static enum ndr_err_code ndr_push_nbt_netlogon_command(struct ndr_push *ndr, int ndr_flags, enum nbt_netlogon_command r)
+_PUBLIC_ enum ndr_err_code ndr_push_nbt_sockaddr(struct ndr_push *ndr, int ndr_flags, const struct nbt_sockaddr *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->sockaddr_family));
+ {
+ uint32_t _flags_save_ipv4address = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_BIGENDIAN);
+ NDR_CHECK(ndr_push_ipv4address(ndr, NDR_SCALARS, r->pdc_ip));
+ ndr->flags = _flags_save_ipv4address;
+ }
+ {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+ NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->remaining));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_nbt_sockaddr(struct ndr_pull *ndr, int ndr_flags, struct nbt_sockaddr *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sockaddr_family));
+ {
+ uint32_t _flags_save_ipv4address = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_BIGENDIAN);
+ NDR_CHECK(ndr_pull_ipv4address(ndr, NDR_SCALARS, &r->pdc_ip));
+ ndr->flags = _flags_save_ipv4address;
+ }
+ {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
+ NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->remaining));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_nbt_sockaddr(struct ndr_print *ndr, const char *name, const struct nbt_sockaddr *r)
+{
+ ndr_print_struct(ndr, name, "nbt_sockaddr");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "sockaddr_family", r->sockaddr_family);
+ ndr_print_ipv4address(ndr, "pdc_ip", r->pdc_ip);
+ ndr_print_DATA_BLOB(ndr, "remaining", r->remaining);
+ ndr->depth--;
+}
+
+_PUBLIC_ size_t ndr_size_nbt_sockaddr(const struct nbt_sockaddr *r, int flags)
+{
+ return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_nbt_sockaddr);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_nbt_server_type(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_nbt_server_type(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_nbt_server_type(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), "NBT_SERVER_PDC", NBT_SERVER_PDC, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_GC", NBT_SERVER_GC, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_LDAP", NBT_SERVER_LDAP, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_DS", NBT_SERVER_DS, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_KDC", NBT_SERVER_KDC, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_TIMESERV", NBT_SERVER_TIMESERV, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_CLOSEST", NBT_SERVER_CLOSEST, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_WRITABLE", NBT_SERVER_WRITABLE, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_GOOD_TIMESERV", NBT_SERVER_GOOD_TIMESERV, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_NDNC", NBT_SERVER_NDNC, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_SELECT_SECRET_DOMAIN_6", NBT_SERVER_SELECT_SECRET_DOMAIN_6, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_FULL_SECRET_DOMAIN_6", NBT_SERVER_FULL_SECRET_DOMAIN_6, r);
+ ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_netlogon_nt_version_flags(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_netlogon_nt_version_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_netlogon_nt_version_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), "NETLOGON_NT_VERSION_1", NETLOGON_NT_VERSION_1, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NT_VERSION_5", NETLOGON_NT_VERSION_5, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NT_VERSION_5EX", NETLOGON_NT_VERSION_5EX, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NT_VERSION_5EX_WITH_IP", NETLOGON_NT_VERSION_5EX_WITH_IP, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NT_VERSION_WITH_CLOSEST_SITE", NETLOGON_NT_VERSION_WITH_CLOSEST_SITE, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NT_VERSION_AVIOD_NT4EMUL", NETLOGON_NT_VERSION_AVIOD_NT4EMUL, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NT_VERSION_PDC", NETLOGON_NT_VERSION_PDC, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NT_VERSION_IP", NETLOGON_NT_VERSION_IP, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NT_VERSION_LOCAL", NETLOGON_NT_VERSION_LOCAL, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NT_VERSION_GC", NETLOGON_NT_VERSION_GC, r);
+ ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_netlogon_command(struct ndr_push *ndr, int ndr_flags, enum netlogon_command r)
{
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_nbt_netlogon_command(struct ndr_pull *ndr, int ndr_flags, enum nbt_netlogon_command *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_netlogon_command(struct ndr_pull *ndr, int ndr_flags, enum netlogon_command *r)
{
uint16_t v;
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
@@ -1562,260 +1666,370 @@ static enum ndr_err_code ndr_pull_nbt_netlogon_command(struct ndr_pull *ndr, int
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_nbt_netlogon_command(struct ndr_print *ndr, const char *name, enum nbt_netlogon_command r)
+_PUBLIC_ void ndr_print_netlogon_command(struct ndr_print *ndr, const char *name, enum netlogon_command r)
{
const char *val = NULL;
switch (r) {
- case NETLOGON_QUERY_FOR_PDC: val = "NETLOGON_QUERY_FOR_PDC"; break;
+ case LOGON_PRIMARY_QUERY: val = "LOGON_PRIMARY_QUERY"; break;
case NETLOGON_ANNOUNCE_UAS: val = "NETLOGON_ANNOUNCE_UAS"; break;
case NETLOGON_RESPONSE_FROM_PDC: val = "NETLOGON_RESPONSE_FROM_PDC"; break;
- case NETLOGON_QUERY_FOR_PDC2: val = "NETLOGON_QUERY_FOR_PDC2"; break;
- case NETLOGON_RESPONSE_FROM_PDC2: val = "NETLOGON_RESPONSE_FROM_PDC2"; break;
- case NETLOGON_RESPONSE_FROM_PDC_USER: val = "NETLOGON_RESPONSE_FROM_PDC_USER"; break;
+ case LOGON_SAM_LOGON_REQUEST: val = "LOGON_SAM_LOGON_REQUEST"; break;
+ case LOGON_SAM_LOGON_RESPONSE: val = "LOGON_SAM_LOGON_RESPONSE"; break;
+ case LOGON_SAM_LOGON_PAUSE_RESPONSE: val = "LOGON_SAM_LOGON_PAUSE_RESPONSE"; break;
+ case LOGON_SAM_LOGON_USER_UNKNOWN: val = "LOGON_SAM_LOGON_USER_UNKNOWN"; break;
+ case LOGON_SAM_LOGON_RESPONSE_EX: val = "LOGON_SAM_LOGON_RESPONSE_EX"; break;
+ case LOGON_SAM_LOGON_PAUSE_RESPONSE_EX: val = "LOGON_SAM_LOGON_PAUSE_RESPONSE_EX"; break;
+ case LOGON_SAM_LOGON_USER_UNKNOWN_EX: val = "LOGON_SAM_LOGON_USER_UNKNOWN_EX"; break;
}
ndr_print_enum(ndr, name, "ENUM", val, r);
}
-static enum ndr_err_code ndr_push_nbt_netlogon_version(struct ndr_push *ndr, int ndr_flags, uint32_t r)
+_PUBLIC_ void ndr_print_NETLOGON_SAM_LOGON_REQUEST(struct ndr_print *ndr, const char *name, const struct NETLOGON_SAM_LOGON_REQUEST *r)
+{
+ ndr_print_struct(ndr, name, "NETLOGON_SAM_LOGON_REQUEST");
+ ndr->depth++;
+ ndr_print_uint16(ndr, "request_count", r->request_count);
+ ndr_print_string(ndr, "computer_name", r->computer_name);
+ ndr_print_string(ndr, "user_name", r->user_name);
+ ndr_print_string(ndr, "mailslot_name", r->mailslot_name);
+ ndr_print_samr_AcctFlags(ndr, "acct_control", r->acct_control);
+ ndr_print_uint32(ndr, "sid_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_dom_sid0(&r->sid, ndr->flags):r->sid_size);
+ ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
+ ndr_print_dom_sid0(ndr, "sid", &r->sid);
+ ndr_print_netlogon_nt_version_flags(ndr, "nt_version", r->nt_version);
+ ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
+ ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
+ ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_RESPONSE_NT40(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_RESPONSE_NT40 *r)
{
{
- uint32_t _flags_save_BITMAP = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
- ndr->flags = _flags_save_BITMAP;
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_netlogon_command(ndr, NDR_SCALARS, r->command));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->server));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->user_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->domain));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr, NDR_SCALARS, r->nt_version));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
}
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_nbt_netlogon_version(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_NETLOGON_SAM_LOGON_RESPONSE_NT40(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_SAM_LOGON_RESPONSE_NT40 *r)
{
- uint32_t v;
{
- uint32_t _flags_save_BITMAP = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
- *r = v;
- ndr->flags = _flags_save_BITMAP;
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_netlogon_command(ndr, NDR_SCALARS, &r->command));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->server));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->user_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->domain));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr, NDR_SCALARS, &r->nt_version));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ ndr->flags = _flags_save_STRUCT;
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_nbt_netlogon_version(struct ndr_print *ndr, const char *name, uint32_t r)
+_PUBLIC_ void ndr_print_NETLOGON_SAM_LOGON_RESPONSE_NT40(struct ndr_print *ndr, const char *name, const struct NETLOGON_SAM_LOGON_RESPONSE_NT40 *r)
{
+ ndr_print_struct(ndr, name, "NETLOGON_SAM_LOGON_RESPONSE_NT40");
{
- uint32_t _flags_save_BITMAP = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_LITTLE_ENDIAN);
- ndr_print_uint32(ndr, name, r);
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
ndr->depth++;
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_VERSION_1", NETLOGON_VERSION_1, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_VERSION_5", NETLOGON_VERSION_5, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_VERSION_5EX", NETLOGON_VERSION_5EX, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_VERSION_5EX_WITH_IP", NETLOGON_VERSION_5EX_WITH_IP, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_VERSION_WITH_CLOSEST_SITE", NETLOGON_VERSION_WITH_CLOSEST_SITE, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_VERSION_AVOID_NT4_EMUL", NETLOGON_VERSION_AVOID_NT4_EMUL, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_VERSION_PDC", NETLOGON_VERSION_PDC, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_VERSION_IP", NETLOGON_VERSION_IP, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_VERSION_LOCAL", NETLOGON_VERSION_LOCAL, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_VERSION_GC", NETLOGON_VERSION_GC, r);
+ ndr_print_netlogon_command(ndr, "command", r->command);
+ ndr_print_string(ndr, "server", r->server);
+ ndr_print_string(ndr, "user_name", r->user_name);
+ ndr_print_string(ndr, "domain", r->domain);
+ ndr_print_netlogon_nt_version_flags(ndr, "nt_version", r->nt_version);
+ ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
+ ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
ndr->depth--;
- ndr->flags = _flags_save_BITMAP;
+ ndr->flags = _flags_save_STRUCT;
}
}
-static enum ndr_err_code ndr_push_nbt_netlogon_query_for_pdc(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_query_for_pdc *r)
+_PUBLIC_ enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_RESPONSE(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_RESPONSE *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_ASCII|LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->computer_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->mailslot_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_DATA_BLOB = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2);
- NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad));
- ndr->flags = _flags_save_DATA_BLOB;
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_netlogon_command(ndr, NDR_SCALARS, r->command));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->pdc_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->user_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->domain_name));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
+ NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->zero_uuid));
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->forest));
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->dns_domain));
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_dns_name));
+ NDR_CHECK(ndr_push_ipv4address(ndr, NDR_SCALARS, r->pdc_ip));
+ NDR_CHECK(ndr_push_nbt_server_type(ndr, NDR_SCALARS, r->server_type));
+ NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr, NDR_SCALARS, r->nt_version));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
}
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->unicode_name));
- ndr->flags = _flags_save_string;
+ if (ndr_flags & NDR_BUFFERS) {
}
- NDR_CHECK(ndr_push_nbt_netlogon_version(ndr, NDR_SCALARS, r->nt_version));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
+ ndr->flags = _flags_save_STRUCT;
}
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_nbt_netlogon_query_for_pdc(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_query_for_pdc *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_NETLOGON_SAM_LOGON_RESPONSE(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_SAM_LOGON_RESPONSE *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_ASCII|LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->computer_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->mailslot_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_DATA_BLOB = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2);
- NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad));
- ndr->flags = _flags_save_DATA_BLOB;
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_netlogon_command(ndr, NDR_SCALARS, &r->command));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->pdc_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->user_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->domain_name));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
+ NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->zero_uuid));
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->forest));
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->dns_domain));
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_dns_name));
+ NDR_CHECK(ndr_pull_ipv4address(ndr, NDR_SCALARS, &r->pdc_ip));
+ NDR_CHECK(ndr_pull_nbt_server_type(ndr, NDR_SCALARS, &r->server_type));
+ NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr, NDR_SCALARS, &r->nt_version));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
}
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->unicode_name));
- ndr->flags = _flags_save_string;
+ if (ndr_flags & NDR_BUFFERS) {
}
- NDR_CHECK(ndr_pull_nbt_netlogon_version(ndr, NDR_SCALARS, &r->nt_version));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
+ ndr->flags = _flags_save_STRUCT;
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_nbt_netlogon_query_for_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_query_for_pdc *r)
+_PUBLIC_ void ndr_print_NETLOGON_SAM_LOGON_RESPONSE(struct ndr_print *ndr, const char *name, const struct NETLOGON_SAM_LOGON_RESPONSE *r)
{
- ndr_print_struct(ndr, name, "nbt_netlogon_query_for_pdc");
- ndr->depth++;
- ndr_print_string(ndr, "computer_name", r->computer_name);
- ndr_print_string(ndr, "mailslot_name", r->mailslot_name);
- ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
- ndr_print_string(ndr, "unicode_name", r->unicode_name);
- ndr_print_nbt_netlogon_version(ndr, "nt_version", r->nt_version);
- ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
- ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
- ndr->depth--;
+ ndr_print_struct(ndr, name, "NETLOGON_SAM_LOGON_RESPONSE");
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ ndr->depth++;
+ ndr_print_netlogon_command(ndr, "command", r->command);
+ ndr_print_string(ndr, "pdc_name", r->pdc_name);
+ ndr_print_string(ndr, "user_name", r->user_name);
+ ndr_print_string(ndr, "domain_name", r->domain_name);
+ ndr_print_GUID(ndr, "domain_uuid", &r->domain_uuid);
+ ndr_print_GUID(ndr, "zero_uuid", &r->zero_uuid);
+ ndr_print_nbt_string(ndr, "forest", r->forest);
+ ndr_print_nbt_string(ndr, "dns_domain", r->dns_domain);
+ ndr_print_nbt_string(ndr, "pdc_dns_name", r->pdc_dns_name);
+ ndr_print_ipv4address(ndr, "pdc_ip", r->pdc_ip);
+ ndr_print_nbt_server_type(ndr, "server_type", r->server_type);
+ ndr_print_netlogon_nt_version_flags(ndr, "nt_version", r->nt_version);
+ ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
+ ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
+ ndr->depth--;
+ ndr->flags = _flags_save_STRUCT;
+ }
}
-static enum ndr_err_code ndr_push_nbt_netlogon_query_for_pdc2(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_query_for_pdc2 *r)
+_PUBLIC_ enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_RESPONSE_EX(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_RESPONSE_EX *r)
{
- uint32_t cntr_unknown_0;
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->request_count));
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->computer_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->user_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->mailslot_name));
- ndr->flags = _flags_save_string;
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_netlogon_command(ndr, NDR_SCALARS, r->command));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->sbz));
+ NDR_CHECK(ndr_push_nbt_server_type(ndr, NDR_SCALARS, r->server_type));
+ NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->forest));
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->dns_domain));
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_dns_name));
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->domain));
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_name));
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->user_name));
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->server_site));
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->client_site));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, ndr_size_nbt_sockaddr(&r->sockaddr, ndr->flags)));
+ {
+ struct ndr_push *_ndr_sockaddr;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sockaddr, 0, ndr_size_nbt_sockaddr(&r->sockaddr, ndr->flags)));
+ NDR_CHECK(ndr_push_nbt_sockaddr(_ndr_sockaddr, NDR_SCALARS, &r->sockaddr));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sockaddr, 0, ndr_size_nbt_sockaddr(&r->sockaddr, ndr->flags)));
+ }
+ NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->next_closest_site));
+ NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr, NDR_SCALARS, r->nt_version));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
}
- for (cntr_unknown_0 = 0; cntr_unknown_0 < 2; cntr_unknown_0++) {
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown[cntr_unknown_0]));
+ if (ndr_flags & NDR_BUFFERS) {
}
- NDR_CHECK(ndr_push_nbt_netlogon_version(ndr, NDR_SCALARS, r->nt_version));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
+ ndr->flags = _flags_save_STRUCT;
}
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_nbt_netlogon_query_for_pdc2(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_query_for_pdc2 *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_NETLOGON_SAM_LOGON_RESPONSE_EX(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_SAM_LOGON_RESPONSE_EX *r)
{
- uint32_t cntr_unknown_0;
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->request_count));
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->computer_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->user_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->mailslot_name));
- ndr->flags = _flags_save_string;
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_netlogon_command(ndr, NDR_SCALARS, &r->command));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->sbz));
+ NDR_CHECK(ndr_pull_nbt_server_type(ndr, NDR_SCALARS, &r->server_type));
+ NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->forest));
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->dns_domain));
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_dns_name));
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->domain));
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_name));
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->user_name));
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->server_site));
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->client_site));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->sockaddr_size));
+ {
+ struct ndr_pull *_ndr_sockaddr;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sockaddr, 0, r->sockaddr_size));
+ NDR_CHECK(ndr_pull_nbt_sockaddr(_ndr_sockaddr, NDR_SCALARS, &r->sockaddr));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sockaddr, 0, r->sockaddr_size));
+ }
+ NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->next_closest_site));
+ NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr, NDR_SCALARS, &r->nt_version));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
}
- for (cntr_unknown_0 = 0; cntr_unknown_0 < 2; cntr_unknown_0++) {
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown[cntr_unknown_0]));
+ if (ndr_flags & NDR_BUFFERS) {
}
- NDR_CHECK(ndr_pull_nbt_netlogon_version(ndr, NDR_SCALARS, &r->nt_version));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
+ ndr->flags = _flags_save_STRUCT;
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_nbt_netlogon_query_for_pdc2(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_query_for_pdc2 *r)
+_PUBLIC_ void ndr_print_NETLOGON_SAM_LOGON_RESPONSE_EX(struct ndr_print *ndr, const char *name, const struct NETLOGON_SAM_LOGON_RESPONSE_EX *r)
{
- uint32_t cntr_unknown_0;
- ndr_print_struct(ndr, name, "nbt_netlogon_query_for_pdc2");
- ndr->depth++;
- ndr_print_uint16(ndr, "request_count", r->request_count);
- ndr_print_string(ndr, "computer_name", r->computer_name);
- ndr_print_string(ndr, "user_name", r->user_name);
- ndr_print_string(ndr, "mailslot_name", r->mailslot_name);
- ndr->print(ndr, "%s: ARRAY(%d)", "unknown", (int)2);
- ndr->depth++;
- for (cntr_unknown_0=0;cntr_unknown_0<2;cntr_unknown_0++) {
- char *idx_0=NULL;
- if (asprintf(&idx_0, "[%d]", cntr_unknown_0) != -1) {
- ndr_print_uint32(ndr, "unknown", r->unknown[cntr_unknown_0]);
- free(idx_0);
- }
+ ndr_print_struct(ndr, name, "NETLOGON_SAM_LOGON_RESPONSE_EX");
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ ndr->depth++;
+ ndr_print_netlogon_command(ndr, "command", r->command);
+ ndr_print_uint16(ndr, "sbz", r->sbz);
+ ndr_print_nbt_server_type(ndr, "server_type", r->server_type);
+ ndr_print_GUID(ndr, "domain_uuid", &r->domain_uuid);
+ ndr_print_nbt_string(ndr, "forest", r->forest);
+ ndr_print_nbt_string(ndr, "dns_domain", r->dns_domain);
+ ndr_print_nbt_string(ndr, "pdc_dns_name", r->pdc_dns_name);
+ ndr_print_nbt_string(ndr, "domain", r->domain);
+ ndr_print_nbt_string(ndr, "pdc_name", r->pdc_name);
+ ndr_print_nbt_string(ndr, "user_name", r->user_name);
+ ndr_print_nbt_string(ndr, "server_site", r->server_site);
+ ndr_print_nbt_string(ndr, "client_site", r->client_site);
+ ndr_print_uint8(ndr, "sockaddr_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_nbt_sockaddr(&r->sockaddr, ndr->flags):r->sockaddr_size);
+ ndr_print_nbt_sockaddr(ndr, "sockaddr", &r->sockaddr);
+ ndr_print_nbt_string(ndr, "next_closest_site", r->next_closest_site);
+ ndr_print_netlogon_nt_version_flags(ndr, "nt_version", r->nt_version);
+ ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
+ ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
+ ndr->depth--;
+ ndr->flags = _flags_save_STRUCT;
}
- ndr->depth--;
- ndr_print_nbt_netlogon_version(ndr, "nt_version", r->nt_version);
- ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
- ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
- ndr->depth--;
}
-static enum ndr_err_code ndr_push_nbt_netlogon_response_from_pdc(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_response_from_pdc *r)
+static enum ndr_err_code ndr_push_nbt_netlogon_query_for_pdc(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_query_for_pdc *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_ASCII|LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->pdc_name));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->computer_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->mailslot_name));
ndr->flags = _flags_save_string;
}
{
@@ -1827,16 +2041,10 @@ static enum ndr_err_code ndr_push_nbt_netlogon_response_from_pdc(struct ndr_push
{
uint32_t _flags_save_string = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->unicode_pdc_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->domain_name));
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->unicode_name));
ndr->flags = _flags_save_string;
}
- NDR_CHECK(ndr_push_nbt_netlogon_version(ndr, NDR_SCALARS, r->nt_version));
+ NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr, NDR_SCALARS, r->nt_version));
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
}
@@ -1845,14 +2053,20 @@ static enum ndr_err_code ndr_push_nbt_netlogon_response_from_pdc(struct ndr_push
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_nbt_netlogon_response_from_pdc(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_response_from_pdc *r)
+static enum ndr_err_code ndr_pull_nbt_netlogon_query_for_pdc(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_query_for_pdc *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_ASCII|LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->pdc_name));
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->computer_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->mailslot_name));
ndr->flags = _flags_save_string;
}
{
@@ -1864,16 +2078,10 @@ static enum ndr_err_code ndr_pull_nbt_netlogon_response_from_pdc(struct ndr_pull
{
uint32_t _flags_save_string = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->unicode_pdc_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->domain_name));
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->unicode_name));
ndr->flags = _flags_save_string;
}
- NDR_CHECK(ndr_pull_nbt_netlogon_version(ndr, NDR_SCALARS, &r->nt_version));
+ NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr, NDR_SCALARS, &r->nt_version));
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
}
@@ -1882,205 +2090,127 @@ static enum ndr_err_code ndr_pull_nbt_netlogon_response_from_pdc(struct ndr_pull
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_nbt_netlogon_response_from_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_response_from_pdc *r)
+_PUBLIC_ void ndr_print_nbt_netlogon_query_for_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_query_for_pdc *r)
{
- ndr_print_struct(ndr, name, "nbt_netlogon_response_from_pdc");
+ ndr_print_struct(ndr, name, "nbt_netlogon_query_for_pdc");
ndr->depth++;
- ndr_print_string(ndr, "pdc_name", r->pdc_name);
+ ndr_print_string(ndr, "computer_name", r->computer_name);
+ ndr_print_string(ndr, "mailslot_name", r->mailslot_name);
ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
- ndr_print_string(ndr, "unicode_pdc_name", r->unicode_pdc_name);
- ndr_print_string(ndr, "domain_name", r->domain_name);
- ndr_print_nbt_netlogon_version(ndr, "nt_version", r->nt_version);
+ ndr_print_string(ndr, "unicode_name", r->unicode_name);
+ ndr_print_netlogon_nt_version_flags(ndr, "nt_version", r->nt_version);
ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
ndr->depth--;
}
-static enum ndr_err_code ndr_push_nbt_server_type(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_nbt_server_type(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_nbt_server_type(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), "NBT_SERVER_PDC", NBT_SERVER_PDC, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_GC", NBT_SERVER_GC, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_LDAP", NBT_SERVER_LDAP, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_DS", NBT_SERVER_DS, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_KDC", NBT_SERVER_KDC, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_TIMESERV", NBT_SERVER_TIMESERV, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_CLOSEST", NBT_SERVER_CLOSEST, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_WRITABLE", NBT_SERVER_WRITABLE, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_GOOD_TIMESERV", NBT_SERVER_GOOD_TIMESERV, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_NDNC", NBT_SERVER_NDNC, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_SELECT_SECRET_DOMAIN_6", NBT_SERVER_SELECT_SECRET_DOMAIN_6, r);
- ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NBT_SERVER_FULL_SECRET_DOMAIN_6", NBT_SERVER_FULL_SECRET_DOMAIN_6, r);
- ndr->depth--;
-}
-
-static enum ndr_err_code ndr_push_nbt_dc_sock_addr(struct ndr_push *ndr, int ndr_flags, const struct nbt_dc_sock_addr *r)
+_PUBLIC_ enum ndr_err_code ndr_push_nbt_netlogon_response_from_pdc(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_response_from_pdc *r)
{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->family));
- {
- uint32_t _flags_save_ipv4address = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_BIGENDIAN);
- NDR_CHECK(ndr_push_ipv4address(ndr, NDR_SCALARS, r->pdc_ip));
- ndr->flags = _flags_save_ipv4address;
- }
- {
- uint32_t _flags_save_DATA_BLOB = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
- NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->remaining));
- ndr->flags = _flags_save_DATA_BLOB;
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_nbt_dc_sock_addr(struct ndr_pull *ndr, int ndr_flags, struct nbt_dc_sock_addr *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->family));
- {
- uint32_t _flags_save_ipv4address = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_BIGENDIAN);
- NDR_CHECK(ndr_pull_ipv4address(ndr, NDR_SCALARS, &r->pdc_ip));
- ndr->flags = _flags_save_ipv4address;
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_netlogon_command(ndr, NDR_SCALARS, r->command));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->pdc_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2);
+ NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->unicode_pdc_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->domain_name));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_push_netlogon_nt_version_flags(ndr, NDR_SCALARS, r->nt_version));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
}
- {
- uint32_t _flags_save_DATA_BLOB = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
- NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->remaining));
- ndr->flags = _flags_save_DATA_BLOB;
+ if (ndr_flags & NDR_BUFFERS) {
}
- }
- if (ndr_flags & NDR_BUFFERS) {
+ ndr->flags = _flags_save_STRUCT;
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_nbt_dc_sock_addr(struct ndr_print *ndr, const char *name, const struct nbt_dc_sock_addr *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_nbt_netlogon_response_from_pdc(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_response_from_pdc *r)
{
- ndr_print_struct(ndr, name, "nbt_dc_sock_addr");
- ndr->depth++;
- ndr_print_uint32(ndr, "family", r->family);
- ndr_print_ipv4address(ndr, "pdc_ip", r->pdc_ip);
- ndr_print_DATA_BLOB(ndr, "remaining", r->remaining);
- ndr->depth--;
-}
-
-static enum ndr_err_code ndr_push_nbt_netlogon_response_from_pdc2(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_response_from_pdc2 *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- {
- uint32_t _flags_save_DATA_BLOB = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
- NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad));
- ndr->flags = _flags_save_DATA_BLOB;
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_netlogon_command(ndr, NDR_SCALARS, &r->command));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->pdc_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_DATA_BLOB = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN2);
+ NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad));
+ ndr->flags = _flags_save_DATA_BLOB;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->unicode_pdc_name));
+ ndr->flags = _flags_save_string;
+ }
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->domain_name));
+ ndr->flags = _flags_save_string;
+ }
+ NDR_CHECK(ndr_pull_netlogon_nt_version_flags(ndr, NDR_SCALARS, &r->nt_version));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
}
- NDR_CHECK(ndr_push_nbt_server_type(ndr, NDR_SCALARS, r->server_type));
- NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->forest));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->dns_domain));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_dns_name));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->domain));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_name));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->user_name));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->server_site));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->client_site));
- NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->dc_sock_addr_size));
- {
- struct ndr_push *_ndr_dc_sock_addr;
- NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_dc_sock_addr, 0, r->dc_sock_addr_size));
- NDR_CHECK(ndr_push_nbt_dc_sock_addr(_ndr_dc_sock_addr, NDR_SCALARS, &r->dc_sock_addr));
- NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_dc_sock_addr, 0, r->dc_sock_addr_size));
+ if (ndr_flags & NDR_BUFFERS) {
}
- NDR_CHECK(ndr_push_nbt_netlogon_version(ndr, NDR_SCALARS, r->nt_version));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
+ ndr->flags = _flags_save_STRUCT;
}
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_nbt_netlogon_response_from_pdc2(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_response_from_pdc2 *r)
+_PUBLIC_ void ndr_print_nbt_netlogon_response_from_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_response_from_pdc *r)
{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- {
- uint32_t _flags_save_DATA_BLOB = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4);
- NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad));
- ndr->flags = _flags_save_DATA_BLOB;
- }
- NDR_CHECK(ndr_pull_nbt_server_type(ndr, NDR_SCALARS, &r->server_type));
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->forest));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->dns_domain));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_dns_name));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->domain));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_name));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->user_name));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->server_site));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->client_site));
- NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->dc_sock_addr_size));
- {
- struct ndr_pull *_ndr_dc_sock_addr;
- NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_dc_sock_addr, 0, r->dc_sock_addr_size));
- NDR_CHECK(ndr_pull_nbt_dc_sock_addr(_ndr_dc_sock_addr, NDR_SCALARS, &r->dc_sock_addr));
- NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_dc_sock_addr, 0, r->dc_sock_addr_size));
- }
- NDR_CHECK(ndr_pull_nbt_netlogon_version(ndr, NDR_SCALARS, &r->nt_version));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
+ ndr_print_struct(ndr, name, "nbt_netlogon_response_from_pdc");
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
+ ndr->depth++;
+ ndr_print_netlogon_command(ndr, "command", r->command);
+ ndr_print_string(ndr, "pdc_name", r->pdc_name);
+ ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
+ ndr_print_string(ndr, "unicode_pdc_name", r->unicode_pdc_name);
+ ndr_print_string(ndr, "domain_name", r->domain_name);
+ ndr_print_netlogon_nt_version_flags(ndr, "nt_version", r->nt_version);
+ ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
+ ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
+ ndr->depth--;
+ ndr->flags = _flags_save_STRUCT;
}
- return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_nbt_netlogon_response_from_pdc2(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_response_from_pdc2 *r)
-{
- ndr_print_struct(ndr, name, "nbt_netlogon_response_from_pdc2");
- ndr->depth++;
- ndr_print_DATA_BLOB(ndr, "_pad", r->_pad);
- ndr_print_nbt_server_type(ndr, "server_type", r->server_type);
- ndr_print_GUID(ndr, "domain_uuid", &r->domain_uuid);
- ndr_print_nbt_string(ndr, "forest", r->forest);
- ndr_print_nbt_string(ndr, "dns_domain", r->dns_domain);
- ndr_print_nbt_string(ndr, "pdc_dns_name", r->pdc_dns_name);
- ndr_print_nbt_string(ndr, "domain", r->domain);
- ndr_print_nbt_string(ndr, "pdc_name", r->pdc_name);
- ndr_print_nbt_string(ndr, "user_name", r->user_name);
- ndr_print_nbt_string(ndr, "server_site", r->server_site);
- ndr_print_nbt_string(ndr, "client_site", r->client_site);
- ndr_print_uint8(ndr, "dc_sock_addr_size", r->dc_sock_addr_size);
- ndr_print_nbt_dc_sock_addr(ndr, "dc_sock_addr", &r->dc_sock_addr);
- ndr_print_nbt_netlogon_version(ndr, "nt_version", r->nt_version);
- ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
- ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
- ndr->depth--;
-}
-
-static enum ndr_err_code ndr_push_nbt_db_change(struct ndr_push *ndr, int ndr_flags, const struct nbt_db_change *r)
+static enum ndr_err_code ndr_push_nbt_db_change_info(struct ndr_push *ndr, int ndr_flags, const struct nbt_db_change_info *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 8));
@@ -2093,7 +2223,7 @@ static enum ndr_err_code ndr_push_nbt_db_change(struct ndr_push *ndr, int ndr_fl
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_nbt_db_change(struct ndr_pull *ndr, int ndr_flags, struct nbt_db_change *r)
+static enum ndr_err_code ndr_pull_nbt_db_change_info(struct ndr_pull *ndr, int ndr_flags, struct nbt_db_change_info *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 8));
@@ -2106,9 +2236,9 @@ static enum ndr_err_code ndr_pull_nbt_db_change(struct ndr_pull *ndr, int ndr_fl
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_nbt_db_change(struct ndr_print *ndr, const char *name, const struct nbt_db_change *r)
+_PUBLIC_ void ndr_print_nbt_db_change_info(struct ndr_print *ndr, const char *name, const struct nbt_db_change_info *r)
{
- ndr_print_struct(ndr, name, "nbt_db_change");
+ ndr_print_struct(ndr, name, "nbt_db_change_info");
ndr->depth++;
ndr_print_netr_SamDatabaseID(ndr, "db_index", r->db_index);
ndr_print_hyper(ndr, "serial", r->serial);
@@ -2116,7 +2246,7 @@ _PUBLIC_ void ndr_print_nbt_db_change(struct ndr_print *ndr, const char *name, c
ndr->depth--;
}
-static enum ndr_err_code ndr_push_nbt_netlogon_announce_uas(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_announce_uas *r)
+static enum ndr_err_code ndr_push_NETLOGON_DB_CHANGE(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_DB_CHANGE *r)
{
uint32_t cntr_dbchange_0;
if (ndr_flags & NDR_SCALARS) {
@@ -2157,7 +2287,7 @@ static enum ndr_err_code ndr_push_nbt_netlogon_announce_uas(struct ndr_push *ndr
}
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->db_count));
for (cntr_dbchange_0 = 0; cntr_dbchange_0 < r->db_count; cntr_dbchange_0++) {
- NDR_CHECK(ndr_push_nbt_db_change(ndr, NDR_SCALARS, &r->dbchange[cntr_dbchange_0]));
+ NDR_CHECK(ndr_push_nbt_db_change_info(ndr, NDR_SCALARS, &r->dbchange[cntr_dbchange_0]));
}
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_dom_sid0(&r->sid, ndr->flags)));
{
@@ -2166,16 +2296,15 @@ static enum ndr_err_code ndr_push_nbt_netlogon_announce_uas(struct ndr_push *ndr
NDR_CHECK(ndr_push_dom_sid0(_ndr_sid, NDR_SCALARS|NDR_BUFFERS, &r->sid));
NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags)));
}
- NDR_CHECK(ndr_push_nbt_netlogon_version(ndr, NDR_SCALARS, r->nt_version));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->message_format_version));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->message_token));
}
if (ndr_flags & NDR_BUFFERS) {
}
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_nbt_netlogon_announce_uas(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_announce_uas *r)
+static enum ndr_err_code ndr_pull_NETLOGON_DB_CHANGE(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_DB_CHANGE *r)
{
uint32_t cntr_dbchange_0;
TALLOC_CTX *_mem_save_dbchange_0;
@@ -2220,7 +2349,7 @@ static enum ndr_err_code ndr_pull_nbt_netlogon_announce_uas(struct ndr_pull *ndr
_mem_save_dbchange_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->dbchange, 0);
for (cntr_dbchange_0 = 0; cntr_dbchange_0 < r->db_count; cntr_dbchange_0++) {
- NDR_CHECK(ndr_pull_nbt_db_change(ndr, NDR_SCALARS, &r->dbchange[cntr_dbchange_0]));
+ NDR_CHECK(ndr_pull_nbt_db_change_info(ndr, NDR_SCALARS, &r->dbchange[cntr_dbchange_0]));
}
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dbchange_0, 0);
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sid_size));
@@ -2230,19 +2359,18 @@ static enum ndr_err_code ndr_pull_nbt_netlogon_announce_uas(struct ndr_pull *ndr
NDR_CHECK(ndr_pull_dom_sid0(_ndr_sid, NDR_SCALARS|NDR_BUFFERS, &r->sid));
NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sid, 0, r->sid_size));
}
- NDR_CHECK(ndr_pull_nbt_netlogon_version(ndr, NDR_SCALARS, &r->nt_version));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->message_format_version));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->message_token));
}
if (ndr_flags & NDR_BUFFERS) {
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_nbt_netlogon_announce_uas(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_announce_uas *r)
+_PUBLIC_ void ndr_print_NETLOGON_DB_CHANGE(struct ndr_print *ndr, const char *name, const struct NETLOGON_DB_CHANGE *r)
{
uint32_t cntr_dbchange_0;
- ndr_print_struct(ndr, name, "nbt_netlogon_announce_uas");
+ ndr_print_struct(ndr, name, "NETLOGON_DB_CHANGE");
ndr->depth++;
ndr_print_uint32(ndr, "serial_lo", r->serial_lo);
ndr_print_time_t(ndr, "timestamp", r->timestamp);
@@ -2259,16 +2387,15 @@ _PUBLIC_ void ndr_print_nbt_netlogon_announce_uas(struct ndr_print *ndr, const c
for (cntr_dbchange_0=0;cntr_dbchange_0<r->db_count;cntr_dbchange_0++) {
char *idx_0=NULL;
if (asprintf(&idx_0, "[%d]", cntr_dbchange_0) != -1) {
- ndr_print_nbt_db_change(ndr, "dbchange", &r->dbchange[cntr_dbchange_0]);
+ ndr_print_nbt_db_change_info(ndr, "dbchange", &r->dbchange[cntr_dbchange_0]);
free(idx_0);
}
}
ndr->depth--;
ndr_print_uint32(ndr, "sid_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_dom_sid0(&r->sid, ndr->flags):r->sid_size);
ndr_print_dom_sid0(ndr, "sid", &r->sid);
- ndr_print_nbt_netlogon_version(ndr, "nt_version", r->nt_version);
- ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
- ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
+ ndr_print_uint32(ndr, "message_format_version", r->message_format_version);
+ ndr_print_uint32(ndr, "message_token", r->message_token);
ndr->depth--;
}
@@ -2277,28 +2404,16 @@ static enum ndr_err_code ndr_push_nbt_netlogon_request(struct ndr_push *ndr, int
if (ndr_flags & NDR_SCALARS) {
int level = ndr_push_get_switch_value(ndr, r);
switch (level) {
- case NETLOGON_QUERY_FOR_PDC: {
- NDR_CHECK(ndr_push_nbt_netlogon_query_for_pdc(ndr, NDR_SCALARS, &r->pdc));
+ case LOGON_SAM_LOGON_REQUEST: {
+ NDR_CHECK(ndr_push_NETLOGON_SAM_LOGON_REQUEST(ndr, NDR_SCALARS, &r->logon));
break; }
- case NETLOGON_QUERY_FOR_PDC2: {
- NDR_CHECK(ndr_push_nbt_netlogon_query_for_pdc2(ndr, NDR_SCALARS, &r->pdc2));
+ case LOGON_PRIMARY_QUERY: {
+ NDR_CHECK(ndr_push_nbt_netlogon_query_for_pdc(ndr, NDR_SCALARS, &r->pdc));
break; }
case NETLOGON_ANNOUNCE_UAS: {
- NDR_CHECK(ndr_push_nbt_netlogon_announce_uas(ndr, NDR_SCALARS, &r->uas));
- break; }
-
- case NETLOGON_RESPONSE_FROM_PDC: {
- NDR_CHECK(ndr_push_nbt_netlogon_response_from_pdc(ndr, NDR_SCALARS, &r->response));
- break; }
-
- case NETLOGON_RESPONSE_FROM_PDC2: {
- NDR_CHECK(ndr_push_nbt_netlogon_response_from_pdc2(ndr, NDR_SCALARS, &r->response2));
- break; }
-
- case NETLOGON_RESPONSE_FROM_PDC_USER: {
- NDR_CHECK(ndr_push_nbt_netlogon_response_from_pdc2(ndr, NDR_SCALARS, &r->response2));
+ NDR_CHECK(ndr_push_NETLOGON_DB_CHANGE(ndr, NDR_SCALARS, &r->uas));
break; }
default:
@@ -2308,23 +2423,15 @@ static enum ndr_err_code ndr_push_nbt_netlogon_request(struct ndr_push *ndr, int
if (ndr_flags & NDR_BUFFERS) {
int level = ndr_push_get_switch_value(ndr, r);
switch (level) {
- case NETLOGON_QUERY_FOR_PDC:
+ case LOGON_SAM_LOGON_REQUEST:
+ NDR_CHECK(ndr_push_NETLOGON_SAM_LOGON_REQUEST(ndr, NDR_BUFFERS, &r->logon));
break;
- case NETLOGON_QUERY_FOR_PDC2:
+ case LOGON_PRIMARY_QUERY:
break;
case NETLOGON_ANNOUNCE_UAS:
- NDR_CHECK(ndr_push_nbt_netlogon_announce_uas(ndr, NDR_BUFFERS, &r->uas));
- break;
-
- case NETLOGON_RESPONSE_FROM_PDC:
- break;
-
- case NETLOGON_RESPONSE_FROM_PDC2:
- break;
-
- case NETLOGON_RESPONSE_FROM_PDC_USER:
+ NDR_CHECK(ndr_push_NETLOGON_DB_CHANGE(ndr, NDR_BUFFERS, &r->uas));
break;
default:
@@ -2340,28 +2447,16 @@ static enum ndr_err_code ndr_pull_nbt_netlogon_request(struct ndr_pull *ndr, int
level = ndr_pull_get_switch_value(ndr, r);
if (ndr_flags & NDR_SCALARS) {
switch (level) {
- case NETLOGON_QUERY_FOR_PDC: {
- NDR_CHECK(ndr_pull_nbt_netlogon_query_for_pdc(ndr, NDR_SCALARS, &r->pdc));
+ case LOGON_SAM_LOGON_REQUEST: {
+ NDR_CHECK(ndr_pull_NETLOGON_SAM_LOGON_REQUEST(ndr, NDR_SCALARS, &r->logon));
break; }
- case NETLOGON_QUERY_FOR_PDC2: {
- NDR_CHECK(ndr_pull_nbt_netlogon_query_for_pdc2(ndr, NDR_SCALARS, &r->pdc2));
+ case LOGON_PRIMARY_QUERY: {
+ NDR_CHECK(ndr_pull_nbt_netlogon_query_for_pdc(ndr, NDR_SCALARS, &r->pdc));
break; }
case NETLOGON_ANNOUNCE_UAS: {
- NDR_CHECK(ndr_pull_nbt_netlogon_announce_uas(ndr, NDR_SCALARS, &r->uas));
- break; }
-
- case NETLOGON_RESPONSE_FROM_PDC: {
- NDR_CHECK(ndr_pull_nbt_netlogon_response_from_pdc(ndr, NDR_SCALARS, &r->response));
- break; }
-
- case NETLOGON_RESPONSE_FROM_PDC2: {
- NDR_CHECK(ndr_pull_nbt_netlogon_response_from_pdc2(ndr, NDR_SCALARS, &r->response2));
- break; }
-
- case NETLOGON_RESPONSE_FROM_PDC_USER: {
- NDR_CHECK(ndr_pull_nbt_netlogon_response_from_pdc2(ndr, NDR_SCALARS, &r->response2));
+ NDR_CHECK(ndr_pull_NETLOGON_DB_CHANGE(ndr, NDR_SCALARS, &r->uas));
break; }
default:
@@ -2370,23 +2465,15 @@ static enum ndr_err_code ndr_pull_nbt_netlogon_request(struct ndr_pull *ndr, int
}
if (ndr_flags & NDR_BUFFERS) {
switch (level) {
- case NETLOGON_QUERY_FOR_PDC:
+ case LOGON_SAM_LOGON_REQUEST:
+ NDR_CHECK(ndr_pull_NETLOGON_SAM_LOGON_REQUEST(ndr, NDR_BUFFERS, &r->logon));
break;
- case NETLOGON_QUERY_FOR_PDC2:
+ case LOGON_PRIMARY_QUERY:
break;
case NETLOGON_ANNOUNCE_UAS:
- NDR_CHECK(ndr_pull_nbt_netlogon_announce_uas(ndr, NDR_BUFFERS, &r->uas));
- break;
-
- case NETLOGON_RESPONSE_FROM_PDC:
- break;
-
- case NETLOGON_RESPONSE_FROM_PDC2:
- break;
-
- case NETLOGON_RESPONSE_FROM_PDC_USER:
+ NDR_CHECK(ndr_pull_NETLOGON_DB_CHANGE(ndr, NDR_BUFFERS, &r->uas));
break;
default:
@@ -2402,28 +2489,16 @@ _PUBLIC_ void ndr_print_nbt_netlogon_request(struct ndr_print *ndr, const char *
level = ndr_print_get_switch_value(ndr, r);
ndr_print_union(ndr, name, level, "nbt_netlogon_request");
switch (level) {
- case NETLOGON_QUERY_FOR_PDC:
- ndr_print_nbt_netlogon_query_for_pdc(ndr, "pdc", &r->pdc);
+ case LOGON_SAM_LOGON_REQUEST:
+ ndr_print_NETLOGON_SAM_LOGON_REQUEST(ndr, "logon", &r->logon);
break;
- case NETLOGON_QUERY_FOR_PDC2:
- ndr_print_nbt_netlogon_query_for_pdc2(ndr, "pdc2", &r->pdc2);
+ case LOGON_PRIMARY_QUERY:
+ ndr_print_nbt_netlogon_query_for_pdc(ndr, "pdc", &r->pdc);
break;
case NETLOGON_ANNOUNCE_UAS:
- ndr_print_nbt_netlogon_announce_uas(ndr, "uas", &r->uas);
- break;
-
- case NETLOGON_RESPONSE_FROM_PDC:
- ndr_print_nbt_netlogon_response_from_pdc(ndr, "response", &r->response);
- break;
-
- case NETLOGON_RESPONSE_FROM_PDC2:
- ndr_print_nbt_netlogon_response_from_pdc2(ndr, "response2", &r->response2);
- break;
-
- case NETLOGON_RESPONSE_FROM_PDC_USER:
- ndr_print_nbt_netlogon_response_from_pdc2(ndr, "response2", &r->response2);
+ ndr_print_NETLOGON_DB_CHANGE(ndr, "uas", &r->uas);
break;
default:
@@ -2438,7 +2513,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_nbt_netlogon_packet(struct ndr_push *ndr, in
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 8));
- NDR_CHECK(ndr_push_nbt_netlogon_command(ndr, NDR_SCALARS, r->command));
+ NDR_CHECK(ndr_push_netlogon_command(ndr, NDR_SCALARS, r->command));
NDR_CHECK(ndr_push_set_switch_value(ndr, &r->req, r->command));
NDR_CHECK(ndr_push_nbt_netlogon_request(ndr, NDR_SCALARS, &r->req));
}
@@ -2457,7 +2532,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_nbt_netlogon_packet(struct ndr_pull *ndr, in
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 8));
- NDR_CHECK(ndr_pull_nbt_netlogon_command(ndr, NDR_SCALARS, &r->command));
+ NDR_CHECK(ndr_pull_netlogon_command(ndr, NDR_SCALARS, &r->command));
NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->req, r->command));
NDR_CHECK(ndr_pull_nbt_netlogon_request(ndr, NDR_SCALARS, &r->req));
}
@@ -2476,7 +2551,7 @@ _PUBLIC_ void ndr_print_nbt_netlogon_packet(struct ndr_print *ndr, const char *n
uint32_t _flags_save_STRUCT = ndr->flags;
ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
ndr->depth++;
- ndr_print_nbt_netlogon_command(ndr, "command", r->command);
+ ndr_print_netlogon_command(ndr, "command", r->command);
ndr_print_set_switch_value(ndr, &r->req, r->command);
ndr_print_nbt_netlogon_request(ndr, "req", &r->req);
ndr->depth--;
@@ -2484,1524 +2559,6 @@ _PUBLIC_ void ndr_print_nbt_netlogon_packet(struct ndr_print *ndr, const char *n
}
}
-static enum ndr_err_code ndr_push_nbt_cldap_netlogon_1(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_1 *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_nbt_netlogon_command(ndr, NDR_SCALARS, r->type));
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->pdc_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->user_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->domain_name));
- ndr->flags = _flags_save_string;
- }
- NDR_CHECK(ndr_push_nbt_netlogon_version(ndr, NDR_SCALARS, 1));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_nbt_cldap_netlogon_1(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_1 *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_nbt_netlogon_command(ndr, NDR_SCALARS, &r->type));
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->pdc_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->user_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->domain_name));
- ndr->flags = _flags_save_string;
- }
- NDR_CHECK(ndr_pull_nbt_netlogon_version(ndr, NDR_SCALARS, &r->nt_version));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon_1(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_1 *r)
-{
- ndr_print_struct(ndr, name, "nbt_cldap_netlogon_1");
- ndr->depth++;
- ndr_print_nbt_netlogon_command(ndr, "type", r->type);
- ndr_print_string(ndr, "pdc_name", r->pdc_name);
- ndr_print_string(ndr, "user_name", r->user_name);
- ndr_print_string(ndr, "domain_name", r->domain_name);
- ndr_print_nbt_netlogon_version(ndr, "nt_version", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?1:r->nt_version);
- ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
- ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
- ndr->depth--;
-}
-
-static enum ndr_err_code ndr_push_nbt_cldap_netlogon_3(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_3 *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_nbt_netlogon_command(ndr, NDR_SCALARS, r->type));
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->pdc_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->user_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->domain_name));
- ndr->flags = _flags_save_string;
- }
- NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
- NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->unknown_uuid));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->forest));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->dns_domain));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_dns_name));
- NDR_CHECK(ndr_push_ipv4address(ndr, NDR_SCALARS, r->pdc_ip));
- NDR_CHECK(ndr_push_nbt_server_type(ndr, NDR_SCALARS, r->server_type));
- NDR_CHECK(ndr_push_nbt_netlogon_version(ndr, NDR_SCALARS, 3));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_nbt_cldap_netlogon_3(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_3 *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_nbt_netlogon_command(ndr, NDR_SCALARS, &r->type));
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->pdc_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->user_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->domain_name));
- ndr->flags = _flags_save_string;
- }
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->unknown_uuid));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->forest));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->dns_domain));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_dns_name));
- NDR_CHECK(ndr_pull_ipv4address(ndr, NDR_SCALARS, &r->pdc_ip));
- NDR_CHECK(ndr_pull_nbt_server_type(ndr, NDR_SCALARS, &r->server_type));
- NDR_CHECK(ndr_pull_nbt_netlogon_version(ndr, NDR_SCALARS, &r->nt_version));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon_3(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_3 *r)
-{
- ndr_print_struct(ndr, name, "nbt_cldap_netlogon_3");
- ndr->depth++;
- ndr_print_nbt_netlogon_command(ndr, "type", r->type);
- ndr_print_string(ndr, "pdc_name", r->pdc_name);
- ndr_print_string(ndr, "user_name", r->user_name);
- ndr_print_string(ndr, "domain_name", r->domain_name);
- ndr_print_GUID(ndr, "domain_uuid", &r->domain_uuid);
- ndr_print_GUID(ndr, "unknown_uuid", &r->unknown_uuid);
- ndr_print_nbt_string(ndr, "forest", r->forest);
- ndr_print_nbt_string(ndr, "dns_domain", r->dns_domain);
- ndr_print_nbt_string(ndr, "pdc_dns_name", r->pdc_dns_name);
- ndr_print_ipv4address(ndr, "pdc_ip", r->pdc_ip);
- ndr_print_nbt_server_type(ndr, "server_type", r->server_type);
- ndr_print_nbt_netlogon_version(ndr, "nt_version", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?3:r->nt_version);
- ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
- ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
- ndr->depth--;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_cldap_netlogon_5(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_5 *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_nbt_netlogon_command(ndr, NDR_SCALARS, r->type));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->sbz));
- NDR_CHECK(ndr_push_nbt_server_type(ndr, NDR_SCALARS, r->server_type));
- NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->forest));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->dns_domain));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_dns_name));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->domain));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_name));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->user_name));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->server_site));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->client_site));
- NDR_CHECK(ndr_push_nbt_netlogon_version(ndr, NDR_SCALARS, 5));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_cldap_netlogon_5(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_5 *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_nbt_netlogon_command(ndr, NDR_SCALARS, &r->type));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->sbz));
- NDR_CHECK(ndr_pull_nbt_server_type(ndr, NDR_SCALARS, &r->server_type));
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->forest));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->dns_domain));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_dns_name));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->domain));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_name));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->user_name));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->server_site));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->client_site));
- NDR_CHECK(ndr_pull_nbt_netlogon_version(ndr, NDR_SCALARS, &r->nt_version));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon_5(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_5 *r)
-{
- ndr_print_struct(ndr, name, "nbt_cldap_netlogon_5");
- ndr->depth++;
- ndr_print_nbt_netlogon_command(ndr, "type", r->type);
- ndr_print_uint16(ndr, "sbz", r->sbz);
- ndr_print_nbt_server_type(ndr, "server_type", r->server_type);
- ndr_print_GUID(ndr, "domain_uuid", &r->domain_uuid);
- ndr_print_nbt_string(ndr, "forest", r->forest);
- ndr_print_nbt_string(ndr, "dns_domain", r->dns_domain);
- ndr_print_nbt_string(ndr, "pdc_dns_name", r->pdc_dns_name);
- ndr_print_nbt_string(ndr, "domain", r->domain);
- ndr_print_nbt_string(ndr, "pdc_name", r->pdc_name);
- ndr_print_nbt_string(ndr, "user_name", r->user_name);
- ndr_print_nbt_string(ndr, "server_site", r->server_site);
- ndr_print_nbt_string(ndr, "client_site", r->client_site);
- ndr_print_nbt_netlogon_version(ndr, "nt_version", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?5:r->nt_version);
- ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
- ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
- ndr->depth--;
-}
-
-static enum ndr_err_code ndr_push_nbt_cldap_netlogon_13(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_13 *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_nbt_netlogon_command(ndr, NDR_SCALARS, r->type));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->sbz));
- NDR_CHECK(ndr_push_nbt_server_type(ndr, NDR_SCALARS, r->server_type));
- NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->forest));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->dns_domain));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_dns_name));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->domain));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_name));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->user_name));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->server_site));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->client_site));
- NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->dc_sock_addr_size));
- {
- struct ndr_push *_ndr_dc_sock_addr;
- NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_dc_sock_addr, 0, r->dc_sock_addr_size));
- NDR_CHECK(ndr_push_nbt_dc_sock_addr(_ndr_dc_sock_addr, NDR_SCALARS, &r->dc_sock_addr));
- NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_dc_sock_addr, 0, r->dc_sock_addr_size));
- }
- NDR_CHECK(ndr_push_nbt_netlogon_version(ndr, NDR_SCALARS, 13));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_nbt_cldap_netlogon_13(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_13 *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_nbt_netlogon_command(ndr, NDR_SCALARS, &r->type));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->sbz));
- NDR_CHECK(ndr_pull_nbt_server_type(ndr, NDR_SCALARS, &r->server_type));
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->forest));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->dns_domain));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_dns_name));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->domain));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_name));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->user_name));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->server_site));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->client_site));
- NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->dc_sock_addr_size));
- {
- struct ndr_pull *_ndr_dc_sock_addr;
- NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_dc_sock_addr, 0, r->dc_sock_addr_size));
- NDR_CHECK(ndr_pull_nbt_dc_sock_addr(_ndr_dc_sock_addr, NDR_SCALARS, &r->dc_sock_addr));
- NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_dc_sock_addr, 0, r->dc_sock_addr_size));
- }
- NDR_CHECK(ndr_pull_nbt_netlogon_version(ndr, NDR_SCALARS, &r->nt_version));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon_13(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_13 *r)
-{
- ndr_print_struct(ndr, name, "nbt_cldap_netlogon_13");
- ndr->depth++;
- ndr_print_nbt_netlogon_command(ndr, "type", r->type);
- ndr_print_uint16(ndr, "sbz", r->sbz);
- ndr_print_nbt_server_type(ndr, "server_type", r->server_type);
- ndr_print_GUID(ndr, "domain_uuid", &r->domain_uuid);
- ndr_print_nbt_string(ndr, "forest", r->forest);
- ndr_print_nbt_string(ndr, "dns_domain", r->dns_domain);
- ndr_print_nbt_string(ndr, "pdc_dns_name", r->pdc_dns_name);
- ndr_print_nbt_string(ndr, "domain", r->domain);
- ndr_print_nbt_string(ndr, "pdc_name", r->pdc_name);
- ndr_print_nbt_string(ndr, "user_name", r->user_name);
- ndr_print_nbt_string(ndr, "server_site", r->server_site);
- ndr_print_nbt_string(ndr, "client_site", r->client_site);
- ndr_print_uint8(ndr, "dc_sock_addr_size", r->dc_sock_addr_size);
- ndr_print_nbt_dc_sock_addr(ndr, "dc_sock_addr", &r->dc_sock_addr);
- ndr_print_nbt_netlogon_version(ndr, "nt_version", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?13:r->nt_version);
- ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
- ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
- ndr->depth--;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_cldap_netlogon_15(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_15 *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_nbt_netlogon_command(ndr, NDR_SCALARS, r->type));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->sbz));
- NDR_CHECK(ndr_push_nbt_server_type(ndr, NDR_SCALARS, r->server_type));
- NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->forest));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->dns_domain));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_dns_name));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->domain));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_name));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->user_name));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->server_site));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->client_site));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->next_closest_site));
- NDR_CHECK(ndr_push_nbt_netlogon_version(ndr, NDR_SCALARS, 15));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_cldap_netlogon_15(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_15 *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_nbt_netlogon_command(ndr, NDR_SCALARS, &r->type));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->sbz));
- NDR_CHECK(ndr_pull_nbt_server_type(ndr, NDR_SCALARS, &r->server_type));
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->forest));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->dns_domain));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_dns_name));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->domain));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_name));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->user_name));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->server_site));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->client_site));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->next_closest_site));
- NDR_CHECK(ndr_pull_nbt_netlogon_version(ndr, NDR_SCALARS, &r->nt_version));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon_15(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_15 *r)
-{
- ndr_print_struct(ndr, name, "nbt_cldap_netlogon_15");
- ndr->depth++;
- ndr_print_nbt_netlogon_command(ndr, "type", r->type);
- ndr_print_uint16(ndr, "sbz", r->sbz);
- ndr_print_nbt_server_type(ndr, "server_type", r->server_type);
- ndr_print_GUID(ndr, "domain_uuid", &r->domain_uuid);
- ndr_print_nbt_string(ndr, "forest", r->forest);
- ndr_print_nbt_string(ndr, "dns_domain", r->dns_domain);
- ndr_print_nbt_string(ndr, "pdc_dns_name", r->pdc_dns_name);
- ndr_print_nbt_string(ndr, "domain", r->domain);
- ndr_print_nbt_string(ndr, "pdc_name", r->pdc_name);
- ndr_print_nbt_string(ndr, "user_name", r->user_name);
- ndr_print_nbt_string(ndr, "server_site", r->server_site);
- ndr_print_nbt_string(ndr, "client_site", r->client_site);
- ndr_print_nbt_string(ndr, "next_closest_site", r->next_closest_site);
- ndr_print_nbt_netlogon_version(ndr, "nt_version", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?15:r->nt_version);
- ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
- ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
- ndr->depth--;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_cldap_netlogon_29(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_29 *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_nbt_netlogon_command(ndr, NDR_SCALARS, r->type));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->sbz));
- NDR_CHECK(ndr_push_nbt_server_type(ndr, NDR_SCALARS, r->server_type));
- NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->forest));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->dns_domain));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_dns_name));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->domain));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->pdc_name));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->user_name));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->server_site));
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->client_site));
- NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->dc_sock_addr_size));
- {
- struct ndr_push *_ndr_dc_sock_addr;
- NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_dc_sock_addr, 0, r->dc_sock_addr_size));
- NDR_CHECK(ndr_push_nbt_dc_sock_addr(_ndr_dc_sock_addr, NDR_SCALARS, &r->dc_sock_addr));
- NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_dc_sock_addr, 0, r->dc_sock_addr_size));
- }
- NDR_CHECK(ndr_push_nbt_string(ndr, NDR_SCALARS, r->next_closest_site));
- NDR_CHECK(ndr_push_nbt_netlogon_version(ndr, NDR_SCALARS, 29));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_cldap_netlogon_29(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_29 *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_nbt_netlogon_command(ndr, NDR_SCALARS, &r->type));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->sbz));
- NDR_CHECK(ndr_pull_nbt_server_type(ndr, NDR_SCALARS, &r->server_type));
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_uuid));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->forest));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->dns_domain));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_dns_name));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->domain));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->pdc_name));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->user_name));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->server_site));
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->client_site));
- NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->dc_sock_addr_size));
- {
- struct ndr_pull *_ndr_dc_sock_addr;
- NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_dc_sock_addr, 0, r->dc_sock_addr_size));
- NDR_CHECK(ndr_pull_nbt_dc_sock_addr(_ndr_dc_sock_addr, NDR_SCALARS, &r->dc_sock_addr));
- NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_dc_sock_addr, 0, r->dc_sock_addr_size));
- }
- NDR_CHECK(ndr_pull_nbt_string(ndr, NDR_SCALARS, &r->next_closest_site));
- NDR_CHECK(ndr_pull_nbt_netlogon_version(ndr, NDR_SCALARS, &r->nt_version));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon_29(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_29 *r)
-{
- ndr_print_struct(ndr, name, "nbt_cldap_netlogon_29");
- ndr->depth++;
- ndr_print_nbt_netlogon_command(ndr, "type", r->type);
- ndr_print_uint16(ndr, "sbz", r->sbz);
- ndr_print_nbt_server_type(ndr, "server_type", r->server_type);
- ndr_print_GUID(ndr, "domain_uuid", &r->domain_uuid);
- ndr_print_nbt_string(ndr, "forest", r->forest);
- ndr_print_nbt_string(ndr, "dns_domain", r->dns_domain);
- ndr_print_nbt_string(ndr, "pdc_dns_name", r->pdc_dns_name);
- ndr_print_nbt_string(ndr, "domain", r->domain);
- ndr_print_nbt_string(ndr, "pdc_name", r->pdc_name);
- ndr_print_nbt_string(ndr, "user_name", r->user_name);
- ndr_print_nbt_string(ndr, "server_site", r->server_site);
- ndr_print_nbt_string(ndr, "client_site", r->client_site);
- ndr_print_uint8(ndr, "dc_sock_addr_size", r->dc_sock_addr_size);
- ndr_print_nbt_dc_sock_addr(ndr, "dc_sock_addr", &r->dc_sock_addr);
- ndr_print_nbt_string(ndr, "next_closest_site", r->next_closest_site);
- ndr_print_nbt_netlogon_version(ndr, "nt_version", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?29:r->nt_version);
- ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
- ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
- ndr->depth--;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_cldap_netlogon(struct ndr_push *ndr, int ndr_flags, const union nbt_cldap_netlogon *r)
-{
- {
- uint32_t _flags_save_UNION = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
- if (ndr_flags & NDR_SCALARS) {
- int level = ndr_push_get_switch_value(ndr, r);
- switch (level) {
- case 0: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_1(ndr, NDR_SCALARS, &r->logon1));
- break; }
-
- case 1: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_1(ndr, NDR_SCALARS, &r->logon1));
- break; }
-
- case 2: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_3(ndr, NDR_SCALARS, &r->logon3));
- break; }
-
- case 3: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_3(ndr, NDR_SCALARS, &r->logon3));
- break; }
-
- case 4: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5));
- break; }
-
- case 5: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5));
- break; }
-
- case 6: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5));
- break; }
-
- case 7: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5));
- break; }
-
- case 8: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_13(ndr, NDR_SCALARS, &r->logon13));
- break; }
-
- case 9: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_13(ndr, NDR_SCALARS, &r->logon13));
- break; }
-
- case 10: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_13(ndr, NDR_SCALARS, &r->logon13));
- break; }
-
- case 11: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_13(ndr, NDR_SCALARS, &r->logon13));
- break; }
-
- case 12: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_13(ndr, NDR_SCALARS, &r->logon13));
- break; }
-
- case 13: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_13(ndr, NDR_SCALARS, &r->logon13));
- break; }
-
- case 14: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_13(ndr, NDR_SCALARS, &r->logon13));
- break; }
-
- case 15: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_13(ndr, NDR_SCALARS, &r->logon13));
- break; }
-
- case 16: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_1(ndr, NDR_SCALARS, &r->logon1));
- break; }
-
- case 17: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_1(ndr, NDR_SCALARS, &r->logon1));
- break; }
-
- case 18: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_3(ndr, NDR_SCALARS, &r->logon3));
- break; }
-
- case 19: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_3(ndr, NDR_SCALARS, &r->logon3));
- break; }
-
- case 20: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_15(ndr, NDR_SCALARS, &r->logon15));
- break; }
-
- case 21: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_15(ndr, NDR_SCALARS, &r->logon15));
- break; }
-
- case 22: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_15(ndr, NDR_SCALARS, &r->logon15));
- break; }
-
- case 23: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_15(ndr, NDR_SCALARS, &r->logon15));
- break; }
-
- case 24: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_15(ndr, NDR_SCALARS, &r->logon15));
- break; }
-
- case 25: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_15(ndr, NDR_SCALARS, &r->logon15));
- break; }
-
- case 26: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_15(ndr, NDR_SCALARS, &r->logon15));
- break; }
-
- case 27: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_15(ndr, NDR_SCALARS, &r->logon15));
- break; }
-
- case 28: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_15(ndr, NDR_SCALARS, &r->logon15));
- break; }
-
- case 29: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_29(ndr, NDR_SCALARS, &r->logon29));
- break; }
-
- case 30: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_29(ndr, NDR_SCALARS, &r->logon29));
- break; }
-
- case 31: {
- NDR_CHECK(ndr_push_nbt_cldap_netlogon_29(ndr, NDR_SCALARS, &r->logon29));
- 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 0:
- break;
-
- case 1:
- break;
-
- case 2:
- break;
-
- case 3:
- break;
-
- case 4:
- break;
-
- case 5:
- break;
-
- case 6:
- break;
-
- case 7:
- break;
-
- case 8:
- break;
-
- case 9:
- break;
-
- case 10:
- break;
-
- case 11:
- break;
-
- case 12:
- break;
-
- case 13:
- break;
-
- case 14:
- break;
-
- case 15:
- break;
-
- case 16:
- break;
-
- case 17:
- break;
-
- case 18:
- break;
-
- case 19:
- break;
-
- case 20:
- break;
-
- case 21:
- break;
-
- case 22:
- break;
-
- case 23:
- break;
-
- case 24:
- break;
-
- case 25:
- break;
-
- case 26:
- break;
-
- case 27:
- break;
-
- case 28:
- break;
-
- case 29:
- break;
-
- case 30:
- break;
-
- case 31:
- break;
-
- default:
- return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
- }
- }
- ndr->flags = _flags_save_UNION;
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_cldap_netlogon(struct ndr_pull *ndr, int ndr_flags, union nbt_cldap_netlogon *r)
-{
- int level;
- {
- uint32_t _flags_save_UNION = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
- level = ndr_pull_get_switch_value(ndr, r);
- if (ndr_flags & NDR_SCALARS) {
- switch (level) {
- case 0: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_1(ndr, NDR_SCALARS, &r->logon1));
- break; }
-
- case 1: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_1(ndr, NDR_SCALARS, &r->logon1));
- break; }
-
- case 2: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_3(ndr, NDR_SCALARS, &r->logon3));
- break; }
-
- case 3: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_3(ndr, NDR_SCALARS, &r->logon3));
- break; }
-
- case 4: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5));
- break; }
-
- case 5: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5));
- break; }
-
- case 6: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5));
- break; }
-
- case 7: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_5(ndr, NDR_SCALARS, &r->logon5));
- break; }
-
- case 8: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_13(ndr, NDR_SCALARS, &r->logon13));
- break; }
-
- case 9: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_13(ndr, NDR_SCALARS, &r->logon13));
- break; }
-
- case 10: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_13(ndr, NDR_SCALARS, &r->logon13));
- break; }
-
- case 11: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_13(ndr, NDR_SCALARS, &r->logon13));
- break; }
-
- case 12: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_13(ndr, NDR_SCALARS, &r->logon13));
- break; }
-
- case 13: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_13(ndr, NDR_SCALARS, &r->logon13));
- break; }
-
- case 14: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_13(ndr, NDR_SCALARS, &r->logon13));
- break; }
-
- case 15: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_13(ndr, NDR_SCALARS, &r->logon13));
- break; }
-
- case 16: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_1(ndr, NDR_SCALARS, &r->logon1));
- break; }
-
- case 17: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_1(ndr, NDR_SCALARS, &r->logon1));
- break; }
-
- case 18: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_3(ndr, NDR_SCALARS, &r->logon3));
- break; }
-
- case 19: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_3(ndr, NDR_SCALARS, &r->logon3));
- break; }
-
- case 20: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_15(ndr, NDR_SCALARS, &r->logon15));
- break; }
-
- case 21: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_15(ndr, NDR_SCALARS, &r->logon15));
- break; }
-
- case 22: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_15(ndr, NDR_SCALARS, &r->logon15));
- break; }
-
- case 23: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_15(ndr, NDR_SCALARS, &r->logon15));
- break; }
-
- case 24: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_15(ndr, NDR_SCALARS, &r->logon15));
- break; }
-
- case 25: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_15(ndr, NDR_SCALARS, &r->logon15));
- break; }
-
- case 26: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_15(ndr, NDR_SCALARS, &r->logon15));
- break; }
-
- case 27: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_15(ndr, NDR_SCALARS, &r->logon15));
- break; }
-
- case 28: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_15(ndr, NDR_SCALARS, &r->logon15));
- break; }
-
- case 29: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_29(ndr, NDR_SCALARS, &r->logon29));
- break; }
-
- case 30: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_29(ndr, NDR_SCALARS, &r->logon29));
- break; }
-
- case 31: {
- NDR_CHECK(ndr_pull_nbt_cldap_netlogon_29(ndr, NDR_SCALARS, &r->logon29));
- break; }
-
- default:
- return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- switch (level) {
- case 0:
- break;
-
- case 1:
- break;
-
- case 2:
- break;
-
- case 3:
- break;
-
- case 4:
- break;
-
- case 5:
- break;
-
- case 6:
- break;
-
- case 7:
- break;
-
- case 8:
- break;
-
- case 9:
- break;
-
- case 10:
- break;
-
- case 11:
- break;
-
- case 12:
- break;
-
- case 13:
- break;
-
- case 14:
- break;
-
- case 15:
- break;
-
- case 16:
- break;
-
- case 17:
- break;
-
- case 18:
- break;
-
- case 19:
- break;
-
- case 20:
- break;
-
- case 21:
- break;
-
- case 22:
- break;
-
- case 23:
- break;
-
- case 24:
- break;
-
- case 25:
- break;
-
- case 26:
- break;
-
- case 27:
- break;
-
- case 28:
- break;
-
- case 29:
- break;
-
- case 30:
- break;
-
- case 31:
- break;
-
- default:
- return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
- }
- }
- ndr->flags = _flags_save_UNION;
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_nbt_cldap_netlogon(struct ndr_print *ndr, const char *name, const union nbt_cldap_netlogon *r)
-{
- int level;
- {
- uint32_t _flags_save_UNION = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
- level = ndr_print_get_switch_value(ndr, r);
- ndr_print_union(ndr, name, level, "nbt_cldap_netlogon");
- switch (level) {
- case 0:
- ndr_print_nbt_cldap_netlogon_1(ndr, "logon1", &r->logon1);
- break;
-
- case 1:
- ndr_print_nbt_cldap_netlogon_1(ndr, "logon1", &r->logon1);
- break;
-
- case 2:
- ndr_print_nbt_cldap_netlogon_3(ndr, "logon3", &r->logon3);
- break;
-
- case 3:
- ndr_print_nbt_cldap_netlogon_3(ndr, "logon3", &r->logon3);
- break;
-
- case 4:
- ndr_print_nbt_cldap_netlogon_5(ndr, "logon5", &r->logon5);
- break;
-
- case 5:
- ndr_print_nbt_cldap_netlogon_5(ndr, "logon5", &r->logon5);
- break;
-
- case 6:
- ndr_print_nbt_cldap_netlogon_5(ndr, "logon5", &r->logon5);
- break;
-
- case 7:
- ndr_print_nbt_cldap_netlogon_5(ndr, "logon5", &r->logon5);
- break;
-
- case 8:
- ndr_print_nbt_cldap_netlogon_13(ndr, "logon13", &r->logon13);
- break;
-
- case 9:
- ndr_print_nbt_cldap_netlogon_13(ndr, "logon13", &r->logon13);
- break;
-
- case 10:
- ndr_print_nbt_cldap_netlogon_13(ndr, "logon13", &r->logon13);
- break;
-
- case 11:
- ndr_print_nbt_cldap_netlogon_13(ndr, "logon13", &r->logon13);
- break;
-
- case 12:
- ndr_print_nbt_cldap_netlogon_13(ndr, "logon13", &r->logon13);
- break;
-
- case 13:
- ndr_print_nbt_cldap_netlogon_13(ndr, "logon13", &r->logon13);
- break;
-
- case 14:
- ndr_print_nbt_cldap_netlogon_13(ndr, "logon13", &r->logon13);
- break;
-
- case 15:
- ndr_print_nbt_cldap_netlogon_13(ndr, "logon13", &r->logon13);
- break;
-
- case 16:
- ndr_print_nbt_cldap_netlogon_1(ndr, "logon1", &r->logon1);
- break;
-
- case 17:
- ndr_print_nbt_cldap_netlogon_1(ndr, "logon1", &r->logon1);
- break;
-
- case 18:
- ndr_print_nbt_cldap_netlogon_3(ndr, "logon3", &r->logon3);
- break;
-
- case 19:
- ndr_print_nbt_cldap_netlogon_3(ndr, "logon3", &r->logon3);
- break;
-
- case 20:
- ndr_print_nbt_cldap_netlogon_15(ndr, "logon15", &r->logon15);
- break;
-
- case 21:
- ndr_print_nbt_cldap_netlogon_15(ndr, "logon15", &r->logon15);
- break;
-
- case 22:
- ndr_print_nbt_cldap_netlogon_15(ndr, "logon15", &r->logon15);
- break;
-
- case 23:
- ndr_print_nbt_cldap_netlogon_15(ndr, "logon15", &r->logon15);
- break;
-
- case 24:
- ndr_print_nbt_cldap_netlogon_15(ndr, "logon15", &r->logon15);
- break;
-
- case 25:
- ndr_print_nbt_cldap_netlogon_15(ndr, "logon15", &r->logon15);
- break;
-
- case 26:
- ndr_print_nbt_cldap_netlogon_15(ndr, "logon15", &r->logon15);
- break;
-
- case 27:
- ndr_print_nbt_cldap_netlogon_15(ndr, "logon15", &r->logon15);
- break;
-
- case 28:
- ndr_print_nbt_cldap_netlogon_15(ndr, "logon15", &r->logon15);
- break;
-
- case 29:
- ndr_print_nbt_cldap_netlogon_29(ndr, "logon29", &r->logon29);
- break;
-
- case 30:
- ndr_print_nbt_cldap_netlogon_29(ndr, "logon29", &r->logon29);
- break;
-
- case 31:
- ndr_print_nbt_cldap_netlogon_29(ndr, "logon29", &r->logon29);
- break;
-
- default:
- ndr_print_bad_level(ndr, name, level);
- }
- ndr->flags = _flags_save_UNION;
- }
-}
-
-static enum ndr_err_code ndr_push_nbt_ntlogon_command(struct ndr_push *ndr, int ndr_flags, enum nbt_ntlogon_command r)
-{
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_nbt_ntlogon_command(struct ndr_pull *ndr, int ndr_flags, enum nbt_ntlogon_command *r)
-{
- uint16_t v;
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
- *r = v;
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_nbt_ntlogon_command(struct ndr_print *ndr, const char *name, enum nbt_ntlogon_command r)
-{
- const char *val = NULL;
-
- switch (r) {
- case NTLOGON_SAM_LOGON: val = "NTLOGON_SAM_LOGON"; break;
- case NTLOGON_SAM_LOGON_REPLY: val = "NTLOGON_SAM_LOGON_REPLY"; break;
- case NTLOGON_SAM_LOGON_REPLY15: val = "NTLOGON_SAM_LOGON_REPLY15"; break;
- case NTLOGON_RESPONSE_FROM_PDC2: val = "NTLOGON_RESPONSE_FROM_PDC2"; break;
- }
- ndr_print_enum(ndr, name, "ENUM", val, r);
-}
-
-static enum ndr_err_code ndr_push_nbt_ntlogon_sam_logon(struct ndr_push *ndr, int ndr_flags, const struct nbt_ntlogon_sam_logon *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->request_count));
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->computer_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->user_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->mailslot_name));
- ndr->flags = _flags_save_string;
- }
- NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->acct_control));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_dom_sid0(&r->sid, ndr->flags)));
- {
- struct ndr_push *_ndr_sid;
- NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags)));
- NDR_CHECK(ndr_push_dom_sid0(_ndr_sid, NDR_SCALARS|NDR_BUFFERS, &r->sid));
- NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_sid, 0, ndr_size_dom_sid0(&r->sid, ndr->flags)));
- }
- NDR_CHECK(ndr_push_nbt_netlogon_version(ndr, NDR_SCALARS, r->nt_version));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_nbt_ntlogon_sam_logon(struct ndr_pull *ndr, int ndr_flags, struct nbt_ntlogon_sam_logon *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->request_count));
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->computer_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->user_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->mailslot_name));
- ndr->flags = _flags_save_string;
- }
- NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->acct_control));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sid_size));
- {
- struct ndr_pull *_ndr_sid;
- NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_sid, 0, r->sid_size));
- NDR_CHECK(ndr_pull_dom_sid0(_ndr_sid, NDR_SCALARS|NDR_BUFFERS, &r->sid));
- NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_sid, 0, r->sid_size));
- }
- NDR_CHECK(ndr_pull_nbt_netlogon_version(ndr, NDR_SCALARS, &r->nt_version));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_nbt_ntlogon_sam_logon(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_sam_logon *r)
-{
- ndr_print_struct(ndr, name, "nbt_ntlogon_sam_logon");
- ndr->depth++;
- ndr_print_uint16(ndr, "request_count", r->request_count);
- ndr_print_string(ndr, "computer_name", r->computer_name);
- ndr_print_string(ndr, "user_name", r->user_name);
- ndr_print_string(ndr, "mailslot_name", r->mailslot_name);
- ndr_print_samr_AcctFlags(ndr, "acct_control", r->acct_control);
- ndr_print_uint32(ndr, "sid_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_dom_sid0(&r->sid, ndr->flags):r->sid_size);
- ndr_print_dom_sid0(ndr, "sid", &r->sid);
- ndr_print_nbt_netlogon_version(ndr, "nt_version", r->nt_version);
- ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
- ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
- ndr->depth--;
-}
-
-static enum ndr_err_code ndr_push_nbt_ntlogon_sam_logon_reply(struct ndr_push *ndr, int ndr_flags, const struct nbt_ntlogon_sam_logon_reply *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_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->server));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->user_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->domain));
- ndr->flags = _flags_save_string;
- }
- NDR_CHECK(ndr_push_nbt_netlogon_version(ndr, NDR_SCALARS, r->nt_version));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lmnt_token));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_nbt_ntlogon_sam_logon_reply(struct ndr_pull *ndr, int ndr_flags, struct nbt_ntlogon_sam_logon_reply *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_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->server));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->user_name));
- ndr->flags = _flags_save_string;
- }
- {
- uint32_t _flags_save_string = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
- NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->domain));
- ndr->flags = _flags_save_string;
- }
- NDR_CHECK(ndr_pull_nbt_netlogon_version(ndr, NDR_SCALARS, &r->nt_version));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lmnt_token));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lm20_token));
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_nbt_ntlogon_sam_logon_reply(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_sam_logon_reply *r)
-{
- ndr_print_struct(ndr, name, "nbt_ntlogon_sam_logon_reply");
- ndr->depth++;
- ndr_print_string(ndr, "server", r->server);
- ndr_print_string(ndr, "user_name", r->user_name);
- ndr_print_string(ndr, "domain", r->domain);
- ndr_print_nbt_netlogon_version(ndr, "nt_version", r->nt_version);
- ndr_print_uint16(ndr, "lmnt_token", r->lmnt_token);
- ndr_print_uint16(ndr, "lm20_token", r->lm20_token);
- ndr->depth--;
-}
-
-static enum ndr_err_code ndr_push_nbt_ntlogon_request(struct ndr_push *ndr, int ndr_flags, const union nbt_ntlogon_request *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- int level = ndr_push_get_switch_value(ndr, r);
- switch (level) {
- case NTLOGON_SAM_LOGON: {
- NDR_CHECK(ndr_push_nbt_ntlogon_sam_logon(ndr, NDR_SCALARS, &r->logon));
- break; }
-
- case NTLOGON_SAM_LOGON_REPLY: {
- NDR_CHECK(ndr_push_nbt_ntlogon_sam_logon_reply(ndr, NDR_SCALARS, &r->reply));
- break; }
-
- case NTLOGON_SAM_LOGON_REPLY15: {
- NDR_CHECK(ndr_push_nbt_ntlogon_sam_logon_reply(ndr, NDR_SCALARS, &r->reply));
- break; }
-
- case NTLOGON_RESPONSE_FROM_PDC2: {
- NDR_CHECK(ndr_push_nbt_netlogon_response_from_pdc2(ndr, NDR_SCALARS, &r->reply2));
- 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 NTLOGON_SAM_LOGON:
- NDR_CHECK(ndr_push_nbt_ntlogon_sam_logon(ndr, NDR_BUFFERS, &r->logon));
- break;
-
- case NTLOGON_SAM_LOGON_REPLY:
- break;
-
- case NTLOGON_SAM_LOGON_REPLY15:
- break;
-
- case NTLOGON_RESPONSE_FROM_PDC2:
- 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_nbt_ntlogon_request(struct ndr_pull *ndr, int ndr_flags, union nbt_ntlogon_request *r)
-{
- int level;
- level = ndr_pull_get_switch_value(ndr, r);
- if (ndr_flags & NDR_SCALARS) {
- switch (level) {
- case NTLOGON_SAM_LOGON: {
- NDR_CHECK(ndr_pull_nbt_ntlogon_sam_logon(ndr, NDR_SCALARS, &r->logon));
- break; }
-
- case NTLOGON_SAM_LOGON_REPLY: {
- NDR_CHECK(ndr_pull_nbt_ntlogon_sam_logon_reply(ndr, NDR_SCALARS, &r->reply));
- break; }
-
- case NTLOGON_SAM_LOGON_REPLY15: {
- NDR_CHECK(ndr_pull_nbt_ntlogon_sam_logon_reply(ndr, NDR_SCALARS, &r->reply));
- break; }
-
- case NTLOGON_RESPONSE_FROM_PDC2: {
- NDR_CHECK(ndr_pull_nbt_netlogon_response_from_pdc2(ndr, NDR_SCALARS, &r->reply2));
- break; }
-
- default:
- return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- switch (level) {
- case NTLOGON_SAM_LOGON:
- NDR_CHECK(ndr_pull_nbt_ntlogon_sam_logon(ndr, NDR_BUFFERS, &r->logon));
- break;
-
- case NTLOGON_SAM_LOGON_REPLY:
- break;
-
- case NTLOGON_SAM_LOGON_REPLY15:
- break;
-
- case NTLOGON_RESPONSE_FROM_PDC2:
- break;
-
- default:
- return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_nbt_ntlogon_request(struct ndr_print *ndr, const char *name, const union nbt_ntlogon_request *r)
-{
- int level;
- level = ndr_print_get_switch_value(ndr, r);
- ndr_print_union(ndr, name, level, "nbt_ntlogon_request");
- switch (level) {
- case NTLOGON_SAM_LOGON:
- ndr_print_nbt_ntlogon_sam_logon(ndr, "logon", &r->logon);
- break;
-
- case NTLOGON_SAM_LOGON_REPLY:
- ndr_print_nbt_ntlogon_sam_logon_reply(ndr, "reply", &r->reply);
- break;
-
- case NTLOGON_SAM_LOGON_REPLY15:
- ndr_print_nbt_ntlogon_sam_logon_reply(ndr, "reply", &r->reply);
- break;
-
- case NTLOGON_RESPONSE_FROM_PDC2:
- ndr_print_nbt_netlogon_response_from_pdc2(ndr, "reply2", &r->reply2);
- break;
-
- default:
- ndr_print_bad_level(ndr, name, level);
- }
-}
-
-_PUBLIC_ enum ndr_err_code ndr_push_nbt_ntlogon_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_ntlogon_packet *r)
-{
- {
- uint32_t _flags_save_STRUCT = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_nbt_ntlogon_command(ndr, NDR_SCALARS, r->command));
- NDR_CHECK(ndr_push_set_switch_value(ndr, &r->req, r->command));
- NDR_CHECK(ndr_push_nbt_ntlogon_request(ndr, NDR_SCALARS, &r->req));
- }
- if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_push_nbt_ntlogon_request(ndr, NDR_BUFFERS, &r->req));
- }
- ndr->flags = _flags_save_STRUCT;
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_pull_nbt_ntlogon_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_ntlogon_packet *r)
-{
- {
- uint32_t _flags_save_STRUCT = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_nbt_ntlogon_command(ndr, NDR_SCALARS, &r->command));
- NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->req, r->command));
- NDR_CHECK(ndr_pull_nbt_ntlogon_request(ndr, NDR_SCALARS, &r->req));
- }
- if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_pull_nbt_ntlogon_request(ndr, NDR_BUFFERS, &r->req));
- }
- ndr->flags = _flags_save_STRUCT;
- }
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_nbt_ntlogon_packet(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_packet *r)
-{
- ndr_print_struct(ndr, name, "nbt_ntlogon_packet");
- {
- uint32_t _flags_save_STRUCT = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
- ndr->depth++;
- ndr_print_nbt_ntlogon_command(ndr, "command", r->command);
- ndr_print_set_switch_value(ndr, &r->req, r->command);
- ndr_print_nbt_ntlogon_request(ndr, "req", &r->req);
- ndr->depth--;
- ndr->flags = _flags_save_STRUCT;
- }
-}
-
static enum ndr_err_code ndr_push_nbt_browse_opcode(struct ndr_push *ndr, int ndr_flags, enum nbt_browse_opcode r)
{
NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
diff --git a/source3/librpc/gen_ndr/ndr_nbt.h b/source3/librpc/gen_ndr/ndr_nbt.h
index 6e9702d5d5..1a0ca0c302 100644
--- a/source3/librpc/gen_ndr/ndr_nbt.h
+++ b/source3/librpc/gen_ndr/ndr_nbt.h
@@ -6,14 +6,19 @@
#ifndef _HEADER_NDR_nbt
#define _HEADER_NDR_nbt
-#include "libcli/nbt/libnbt.h"
+#include "../libcli/netlogon.h"
+#include "../libcli/nbt/libnbt.h"
#define NDR_NBT_CALL_COUNT (0)
void ndr_print_nbt_operation(struct ndr_print *ndr, const char *name, uint16_t r);
void ndr_print_nbt_name_type(struct ndr_print *ndr, const char *name, enum nbt_name_type r);
enum ndr_err_code ndr_push_nbt_name(struct ndr_push *ndr, int ndr_flags, const struct nbt_name *r);
enum ndr_err_code ndr_pull_nbt_name(struct ndr_pull *ndr, int ndr_flags, struct nbt_name *r);
void ndr_print_nbt_name(struct ndr_print *ndr, const char *name, const struct nbt_name *r);
+enum ndr_err_code ndr_push_nbt_qclass(struct ndr_push *ndr, int ndr_flags, enum nbt_qclass r);
+enum ndr_err_code ndr_pull_nbt_qclass(struct ndr_pull *ndr, int ndr_flags, enum nbt_qclass *r);
void ndr_print_nbt_qclass(struct ndr_print *ndr, const char *name, enum nbt_qclass r);
+enum ndr_err_code ndr_push_nbt_qtype(struct ndr_push *ndr, int ndr_flags, enum nbt_qtype r);
+enum ndr_err_code ndr_pull_nbt_qtype(struct ndr_pull *ndr, int ndr_flags, enum nbt_qtype *r);
void ndr_print_nbt_qtype(struct ndr_print *ndr, const char *name, enum nbt_qtype r);
void ndr_print_nbt_name_question(struct ndr_print *ndr, const char *name, const struct nbt_name_question *r);
void ndr_print_nb_flags(struct ndr_print *ndr, const char *name, uint16_t r);
@@ -23,7 +28,10 @@ void ndr_print_nbt_statistics(struct ndr_print *ndr, const char *name, const str
void ndr_print_nbt_status_name(struct ndr_print *ndr, const char *name, const struct nbt_status_name *r);
void ndr_print_nbt_rdata_status(struct ndr_print *ndr, const char *name, const struct nbt_rdata_status *r);
void ndr_print_nbt_rdata_data(struct ndr_print *ndr, const char *name, const struct nbt_rdata_data *r);
+enum ndr_err_code ndr_push_nbt_rdata(struct ndr_push *ndr, int ndr_flags, const union nbt_rdata *r);
+enum ndr_err_code ndr_pull_nbt_rdata(struct ndr_pull *ndr, int ndr_flags, union nbt_rdata *r);
void ndr_print_nbt_rdata(struct ndr_print *ndr, const char *name, const union nbt_rdata *r);
+enum ndr_err_code ndr_push_nbt_res_rec(struct ndr_push *ndr, int ndr_flags, const struct nbt_res_rec *r);
void ndr_print_nbt_res_rec(struct ndr_print *ndr, const char *name, const struct nbt_res_rec *r);
enum ndr_err_code ndr_push_nbt_name_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_name_packet *r);
enum ndr_err_code ndr_pull_nbt_name_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_name_packet *r);
@@ -43,42 +51,41 @@ void ndr_print_dgram_data(struct ndr_print *ndr, const char *name, const union d
enum ndr_err_code ndr_push_nbt_dgram_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_dgram_packet *r);
enum ndr_err_code ndr_pull_nbt_dgram_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_dgram_packet *r);
void ndr_print_nbt_dgram_packet(struct ndr_print *ndr, const char *name, const struct nbt_dgram_packet *r);
-void ndr_print_nbt_netlogon_command(struct ndr_print *ndr, const char *name, enum nbt_netlogon_command r);
-void ndr_print_nbt_netlogon_version(struct ndr_print *ndr, const char *name, uint32_t r);
+enum ndr_err_code ndr_push_nbt_sockaddr(struct ndr_push *ndr, int ndr_flags, const struct nbt_sockaddr *r);
+enum ndr_err_code ndr_pull_nbt_sockaddr(struct ndr_pull *ndr, int ndr_flags, struct nbt_sockaddr *r);
+void ndr_print_nbt_sockaddr(struct ndr_print *ndr, const char *name, const struct nbt_sockaddr *r);
+size_t ndr_size_nbt_sockaddr(const struct nbt_sockaddr *r, int flags);
+enum ndr_err_code ndr_push_nbt_server_type(struct ndr_push *ndr, int ndr_flags, uint32_t r);
+enum ndr_err_code ndr_pull_nbt_server_type(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
+void ndr_print_nbt_server_type(struct ndr_print *ndr, const char *name, uint32_t r);
+enum ndr_err_code ndr_push_netlogon_nt_version_flags(struct ndr_push *ndr, int ndr_flags, uint32_t r);
+enum ndr_err_code ndr_pull_netlogon_nt_version_flags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
+void ndr_print_netlogon_nt_version_flags(struct ndr_print *ndr, const char *name, uint32_t r);
+enum ndr_err_code ndr_push_netlogon_command(struct ndr_push *ndr, int ndr_flags, enum netlogon_command r);
+enum ndr_err_code ndr_pull_netlogon_command(struct ndr_pull *ndr, int ndr_flags, enum netlogon_command *r);
+void ndr_print_netlogon_command(struct ndr_print *ndr, const char *name, enum netlogon_command r);
+enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_REQUEST(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_REQUEST *r);
+enum ndr_err_code ndr_pull_NETLOGON_SAM_LOGON_REQUEST(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_SAM_LOGON_REQUEST *r);
+void ndr_print_NETLOGON_SAM_LOGON_REQUEST(struct ndr_print *ndr, const char *name, const struct NETLOGON_SAM_LOGON_REQUEST *r);
+enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_RESPONSE_NT40(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_RESPONSE_NT40 *r);
+enum ndr_err_code ndr_pull_NETLOGON_SAM_LOGON_RESPONSE_NT40(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_SAM_LOGON_RESPONSE_NT40 *r);
+void ndr_print_NETLOGON_SAM_LOGON_RESPONSE_NT40(struct ndr_print *ndr, const char *name, const struct NETLOGON_SAM_LOGON_RESPONSE_NT40 *r);
+enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_RESPONSE(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_RESPONSE *r);
+enum ndr_err_code ndr_pull_NETLOGON_SAM_LOGON_RESPONSE(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_SAM_LOGON_RESPONSE *r);
+void ndr_print_NETLOGON_SAM_LOGON_RESPONSE(struct ndr_print *ndr, const char *name, const struct NETLOGON_SAM_LOGON_RESPONSE *r);
+enum ndr_err_code ndr_push_NETLOGON_SAM_LOGON_RESPONSE_EX(struct ndr_push *ndr, int ndr_flags, const struct NETLOGON_SAM_LOGON_RESPONSE_EX *r);
+enum ndr_err_code ndr_pull_NETLOGON_SAM_LOGON_RESPONSE_EX(struct ndr_pull *ndr, int ndr_flags, struct NETLOGON_SAM_LOGON_RESPONSE_EX *r);
+void ndr_print_NETLOGON_SAM_LOGON_RESPONSE_EX(struct ndr_print *ndr, const char *name, const struct NETLOGON_SAM_LOGON_RESPONSE_EX *r);
void ndr_print_nbt_netlogon_query_for_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_query_for_pdc *r);
-void ndr_print_nbt_netlogon_query_for_pdc2(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_query_for_pdc2 *r);
+enum ndr_err_code ndr_push_nbt_netlogon_response_from_pdc(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_response_from_pdc *r);
+enum ndr_err_code ndr_pull_nbt_netlogon_response_from_pdc(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_response_from_pdc *r);
void ndr_print_nbt_netlogon_response_from_pdc(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_response_from_pdc *r);
-void ndr_print_nbt_server_type(struct ndr_print *ndr, const char *name, uint32_t r);
-void ndr_print_nbt_dc_sock_addr(struct ndr_print *ndr, const char *name, const struct nbt_dc_sock_addr *r);
-void ndr_print_nbt_netlogon_response_from_pdc2(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_response_from_pdc2 *r);
-void ndr_print_nbt_db_change(struct ndr_print *ndr, const char *name, const struct nbt_db_change *r);
-void ndr_print_nbt_netlogon_announce_uas(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_announce_uas *r);
+void ndr_print_nbt_db_change_info(struct ndr_print *ndr, const char *name, const struct nbt_db_change_info *r);
+void ndr_print_NETLOGON_DB_CHANGE(struct ndr_print *ndr, const char *name, const struct NETLOGON_DB_CHANGE *r);
void ndr_print_nbt_netlogon_request(struct ndr_print *ndr, const char *name, const union nbt_netlogon_request *r);
enum ndr_err_code ndr_push_nbt_netlogon_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_netlogon_packet *r);
enum ndr_err_code ndr_pull_nbt_netlogon_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_netlogon_packet *r);
void ndr_print_nbt_netlogon_packet(struct ndr_print *ndr, const char *name, const struct nbt_netlogon_packet *r);
-void ndr_print_nbt_cldap_netlogon_1(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_1 *r);
-void ndr_print_nbt_cldap_netlogon_3(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_3 *r);
-enum ndr_err_code ndr_push_nbt_cldap_netlogon_5(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_5 *r);
-enum ndr_err_code ndr_pull_nbt_cldap_netlogon_5(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_5 *r);
-void ndr_print_nbt_cldap_netlogon_5(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_5 *r);
-void ndr_print_nbt_cldap_netlogon_13(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_13 *r);
-enum ndr_err_code ndr_push_nbt_cldap_netlogon_15(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_15 *r);
-enum ndr_err_code ndr_pull_nbt_cldap_netlogon_15(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_15 *r);
-void ndr_print_nbt_cldap_netlogon_15(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_15 *r);
-enum ndr_err_code ndr_push_nbt_cldap_netlogon_29(struct ndr_push *ndr, int ndr_flags, const struct nbt_cldap_netlogon_29 *r);
-enum ndr_err_code ndr_pull_nbt_cldap_netlogon_29(struct ndr_pull *ndr, int ndr_flags, struct nbt_cldap_netlogon_29 *r);
-void ndr_print_nbt_cldap_netlogon_29(struct ndr_print *ndr, const char *name, const struct nbt_cldap_netlogon_29 *r);
-enum ndr_err_code ndr_push_nbt_cldap_netlogon(struct ndr_push *ndr, int ndr_flags, const union nbt_cldap_netlogon *r);
-enum ndr_err_code ndr_pull_nbt_cldap_netlogon(struct ndr_pull *ndr, int ndr_flags, union nbt_cldap_netlogon *r);
-void ndr_print_nbt_cldap_netlogon(struct ndr_print *ndr, const char *name, const union nbt_cldap_netlogon *r);
-void ndr_print_nbt_ntlogon_command(struct ndr_print *ndr, const char *name, enum nbt_ntlogon_command r);
-void ndr_print_nbt_ntlogon_sam_logon(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_sam_logon *r);
-void ndr_print_nbt_ntlogon_sam_logon_reply(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_sam_logon_reply *r);
-void ndr_print_nbt_ntlogon_request(struct ndr_print *ndr, const char *name, const union nbt_ntlogon_request *r);
-enum ndr_err_code ndr_push_nbt_ntlogon_packet(struct ndr_push *ndr, int ndr_flags, const struct nbt_ntlogon_packet *r);
-enum ndr_err_code ndr_pull_nbt_ntlogon_packet(struct ndr_pull *ndr, int ndr_flags, struct nbt_ntlogon_packet *r);
-void ndr_print_nbt_ntlogon_packet(struct ndr_print *ndr, const char *name, const struct nbt_ntlogon_packet *r);
void ndr_print_nbt_browse_opcode(struct ndr_print *ndr, const char *name, enum nbt_browse_opcode r);
void ndr_print_nbt_browse_host_announcement(struct ndr_print *ndr, const char *name, const struct nbt_browse_host_announcement *r);
void ndr_print_nbt_browse_announcement_request(struct ndr_print *ndr, const char *name, const struct nbt_browse_announcement_request *r);
diff --git a/source3/librpc/gen_ndr/ndr_netlogon.c b/source3/librpc/gen_ndr/ndr_netlogon.c
index b43a157997..169d35e326 100644
--- a/source3/librpc/gen_ndr/ndr_netlogon.c
+++ b/source3/librpc/gen_ndr/ndr_netlogon.c
@@ -3,6 +3,7 @@
#include "includes.h"
#include "librpc/gen_ndr/ndr_netlogon.h"
+#include "librpc/gen_ndr/ndr_misc.h"
#include "librpc/gen_ndr/ndr_lsa.h"
#include "librpc/gen_ndr/ndr_samr.h"
#include "librpc/gen_ndr/ndr_security.h"
@@ -362,8 +363,6 @@ static enum ndr_err_code ndr_push_netr_PasswordInfo(struct ndr_push *ndr, int nd
}
if (ndr_flags & NDR_BUFFERS) {
NDR_CHECK(ndr_push_netr_IdentityInfo(ndr, NDR_BUFFERS, &r->identity_info));
- NDR_CHECK(ndr_push_samr_Password(ndr, NDR_BUFFERS, &r->lmpassword));
- NDR_CHECK(ndr_push_samr_Password(ndr, NDR_BUFFERS, &r->ntpassword));
}
return NDR_ERR_SUCCESS;
}
@@ -378,8 +377,6 @@ static enum ndr_err_code ndr_pull_netr_PasswordInfo(struct ndr_pull *ndr, int nd
}
if (ndr_flags & NDR_BUFFERS) {
NDR_CHECK(ndr_pull_netr_IdentityInfo(ndr, NDR_BUFFERS, &r->identity_info));
- NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_BUFFERS, &r->lmpassword));
- NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_BUFFERS, &r->ntpassword));
}
return NDR_ERR_SUCCESS;
}
@@ -541,32 +538,155 @@ _PUBLIC_ void ndr_print_netr_NetworkInfo(struct ndr_print *ndr, const char *name
}
}
-_PUBLIC_ enum ndr_err_code ndr_push_netr_LogonInfo(struct ndr_push *ndr, int ndr_flags, const union netr_LogonInfo *r)
+static enum ndr_err_code ndr_push_netr_GenericInfo(struct ndr_push *ndr, int ndr_flags, const struct netr_GenericInfo *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_netr_IdentityInfo(ndr, NDR_SCALARS, &r->identity_info));
+ NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->package_name));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->data));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_push_netr_IdentityInfo(ndr, NDR_BUFFERS, &r->identity_info));
+ NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->package_name));
+ 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));
+ }
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_netr_GenericInfo(struct ndr_pull *ndr, int ndr_flags, struct netr_GenericInfo *r)
+{
+ uint32_t _ptr_data;
+ TALLOC_CTX *_mem_save_data_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_netr_IdentityInfo(ndr, NDR_SCALARS, &r->identity_info));
+ NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->package_name));
+ 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) {
+ NDR_CHECK(ndr_pull_netr_IdentityInfo(ndr, NDR_BUFFERS, &r->identity_info));
+ NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->package_name));
+ 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));
+ }
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_netr_GenericInfo(struct ndr_print *ndr, const char *name, const struct netr_GenericInfo *r)
+{
+ ndr_print_struct(ndr, name, "netr_GenericInfo");
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+ ndr->depth++;
+ ndr_print_netr_IdentityInfo(ndr, "identity_info", &r->identity_info);
+ ndr_print_lsa_String(ndr, "package_name", &r->package_name);
+ 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--;
+ ndr->flags = _flags_save_STRUCT;
+ }
+}
+
+static enum ndr_err_code ndr_push_netr_LogonInfoClass(struct ndr_push *ndr, int ndr_flags, enum netr_LogonInfoClass r)
+{
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_netr_LogonInfoClass(struct ndr_pull *ndr, int ndr_flags, enum netr_LogonInfoClass *r)
+{
+ uint16_t v;
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
+ *r = v;
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_netr_LogonInfoClass(struct ndr_print *ndr, const char *name, enum netr_LogonInfoClass r)
+{
+ const char *val = NULL;
+
+ switch (r) {
+ case NetlogonInteractiveInformation: val = "NetlogonInteractiveInformation"; break;
+ case NetlogonNetworkInformation: val = "NetlogonNetworkInformation"; break;
+ case NetlogonServiceInformation: val = "NetlogonServiceInformation"; break;
+ case NetlogonGenericInformation: val = "NetlogonGenericInformation"; break;
+ case NetlogonInteractiveTransitiveInformation: val = "NetlogonInteractiveTransitiveInformation"; break;
+ case NetlogonNetworkTransitiveInformation: val = "NetlogonNetworkTransitiveInformation"; break;
+ case NetlogonServiceTransitiveInformation: val = "NetlogonServiceTransitiveInformation"; break;
+ }
+ ndr_print_enum(ndr, name, "ENUM", val, r);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_netr_LogonLevel(struct ndr_push *ndr, int ndr_flags, const union netr_LogonLevel *r)
{
if (ndr_flags & NDR_SCALARS) {
int level = ndr_push_get_switch_value(ndr, r);
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, level));
+ NDR_CHECK(ndr_push_netr_LogonInfoClass(ndr, NDR_SCALARS, level));
switch (level) {
- case 1: {
+ case NetlogonInteractiveInformation: {
NDR_CHECK(ndr_push_unique_ptr(ndr, r->password));
break; }
- case 2: {
+ case NetlogonNetworkInformation: {
NDR_CHECK(ndr_push_unique_ptr(ndr, r->network));
break; }
- case 3: {
+ case NetlogonServiceInformation: {
NDR_CHECK(ndr_push_unique_ptr(ndr, r->password));
break; }
- case 5: {
+ case NetlogonGenericInformation: {
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->generic));
+ break; }
+
+ case NetlogonInteractiveTransitiveInformation: {
NDR_CHECK(ndr_push_unique_ptr(ndr, r->password));
break; }
- case 6: {
+ case NetlogonNetworkTransitiveInformation: {
NDR_CHECK(ndr_push_unique_ptr(ndr, r->network));
break; }
+ case NetlogonServiceTransitiveInformation: {
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->password));
+ break; }
+
default:
return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
@@ -574,36 +694,48 @@ _PUBLIC_ enum ndr_err_code ndr_push_netr_LogonInfo(struct ndr_push *ndr, int ndr
if (ndr_flags & NDR_BUFFERS) {
int level = ndr_push_get_switch_value(ndr, r);
switch (level) {
- case 1:
+ case NetlogonInteractiveInformation:
if (r->password) {
NDR_CHECK(ndr_push_netr_PasswordInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->password));
}
break;
- case 2:
+ case NetlogonNetworkInformation:
if (r->network) {
NDR_CHECK(ndr_push_netr_NetworkInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->network));
}
break;
- case 3:
+ case NetlogonServiceInformation:
if (r->password) {
NDR_CHECK(ndr_push_netr_PasswordInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->password));
}
break;
- case 5:
+ case NetlogonGenericInformation:
+ if (r->generic) {
+ NDR_CHECK(ndr_push_netr_GenericInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->generic));
+ }
+ break;
+
+ case NetlogonInteractiveTransitiveInformation:
if (r->password) {
NDR_CHECK(ndr_push_netr_PasswordInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->password));
}
break;
- case 6:
+ case NetlogonNetworkTransitiveInformation:
if (r->network) {
NDR_CHECK(ndr_push_netr_NetworkInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->network));
}
break;
+ case NetlogonServiceTransitiveInformation:
+ if (r->password) {
+ NDR_CHECK(ndr_push_netr_PasswordInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->password));
+ }
+ break;
+
default:
return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
@@ -611,12 +743,13 @@ _PUBLIC_ enum ndr_err_code ndr_push_netr_LogonInfo(struct ndr_push *ndr, int ndr
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ enum ndr_err_code ndr_pull_netr_LogonInfo(struct ndr_pull *ndr, int ndr_flags, union netr_LogonInfo *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_netr_LogonLevel(struct ndr_pull *ndr, int ndr_flags, union netr_LogonLevel *r)
{
int level;
uint16_t _level;
TALLOC_CTX *_mem_save_password_0;
TALLOC_CTX *_mem_save_network_0;
+ TALLOC_CTX *_mem_save_generic_0;
level = ndr_pull_get_switch_value(ndr, r);
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level));
@@ -624,7 +757,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_LogonInfo(struct ndr_pull *ndr, int ndr
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level);
}
switch (level) {
- case 1: {
+ case NetlogonInteractiveInformation: {
uint32_t _ptr_password;
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_password));
if (_ptr_password) {
@@ -634,7 +767,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_LogonInfo(struct ndr_pull *ndr, int ndr
}
break; }
- case 2: {
+ case NetlogonNetworkInformation: {
uint32_t _ptr_network;
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_network));
if (_ptr_network) {
@@ -644,7 +777,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_LogonInfo(struct ndr_pull *ndr, int ndr
}
break; }
- case 3: {
+ case NetlogonServiceInformation: {
uint32_t _ptr_password;
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_password));
if (_ptr_password) {
@@ -654,7 +787,17 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_LogonInfo(struct ndr_pull *ndr, int ndr
}
break; }
- case 5: {
+ case NetlogonGenericInformation: {
+ uint32_t _ptr_generic;
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_generic));
+ if (_ptr_generic) {
+ NDR_PULL_ALLOC(ndr, r->generic);
+ } else {
+ r->generic = NULL;
+ }
+ break; }
+
+ case NetlogonInteractiveTransitiveInformation: {
uint32_t _ptr_password;
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_password));
if (_ptr_password) {
@@ -664,7 +807,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_LogonInfo(struct ndr_pull *ndr, int ndr
}
break; }
- case 6: {
+ case NetlogonNetworkTransitiveInformation: {
uint32_t _ptr_network;
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_network));
if (_ptr_network) {
@@ -674,13 +817,23 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_LogonInfo(struct ndr_pull *ndr, int ndr
}
break; }
+ case NetlogonServiceTransitiveInformation: {
+ uint32_t _ptr_password;
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_password));
+ if (_ptr_password) {
+ NDR_PULL_ALLOC(ndr, r->password);
+ } else {
+ r->password = NULL;
+ }
+ 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:
+ case NetlogonInteractiveInformation:
if (r->password) {
_mem_save_password_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->password, 0);
@@ -689,7 +842,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_LogonInfo(struct ndr_pull *ndr, int ndr
}
break;
- case 2:
+ case NetlogonNetworkInformation:
if (r->network) {
_mem_save_network_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->network, 0);
@@ -698,7 +851,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_LogonInfo(struct ndr_pull *ndr, int ndr
}
break;
- case 3:
+ case NetlogonServiceInformation:
if (r->password) {
_mem_save_password_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->password, 0);
@@ -707,7 +860,16 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_LogonInfo(struct ndr_pull *ndr, int ndr
}
break;
- case 5:
+ case NetlogonGenericInformation:
+ if (r->generic) {
+ _mem_save_generic_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->generic, 0);
+ NDR_CHECK(ndr_pull_netr_GenericInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->generic));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_generic_0, 0);
+ }
+ break;
+
+ case NetlogonInteractiveTransitiveInformation:
if (r->password) {
_mem_save_password_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->password, 0);
@@ -716,7 +878,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_LogonInfo(struct ndr_pull *ndr, int ndr
}
break;
- case 6:
+ case NetlogonNetworkTransitiveInformation:
if (r->network) {
_mem_save_network_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->network, 0);
@@ -725,6 +887,15 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_LogonInfo(struct ndr_pull *ndr, int ndr
}
break;
+ case NetlogonServiceTransitiveInformation:
+ if (r->password) {
+ _mem_save_password_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->password, 0);
+ NDR_CHECK(ndr_pull_netr_PasswordInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->password));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_password_0, 0);
+ }
+ break;
+
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
}
@@ -732,13 +903,13 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_LogonInfo(struct ndr_pull *ndr, int ndr
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_netr_LogonInfo(struct ndr_print *ndr, const char *name, const union netr_LogonInfo *r)
+_PUBLIC_ void ndr_print_netr_LogonLevel(struct ndr_print *ndr, const char *name, const union netr_LogonLevel *r)
{
int level;
level = ndr_print_get_switch_value(ndr, r);
- ndr_print_union(ndr, name, level, "netr_LogonInfo");
+ ndr_print_union(ndr, name, level, "netr_LogonLevel");
switch (level) {
- case 1:
+ case NetlogonInteractiveInformation:
ndr_print_ptr(ndr, "password", r->password);
ndr->depth++;
if (r->password) {
@@ -747,7 +918,7 @@ _PUBLIC_ void ndr_print_netr_LogonInfo(struct ndr_print *ndr, const char *name,
ndr->depth--;
break;
- case 2:
+ case NetlogonNetworkInformation:
ndr_print_ptr(ndr, "network", r->network);
ndr->depth++;
if (r->network) {
@@ -756,7 +927,7 @@ _PUBLIC_ void ndr_print_netr_LogonInfo(struct ndr_print *ndr, const char *name,
ndr->depth--;
break;
- case 3:
+ case NetlogonServiceInformation:
ndr_print_ptr(ndr, "password", r->password);
ndr->depth++;
if (r->password) {
@@ -765,7 +936,16 @@ _PUBLIC_ void ndr_print_netr_LogonInfo(struct ndr_print *ndr, const char *name,
ndr->depth--;
break;
- case 5:
+ case NetlogonGenericInformation:
+ ndr_print_ptr(ndr, "generic", r->generic);
+ ndr->depth++;
+ if (r->generic) {
+ ndr_print_netr_GenericInfo(ndr, "generic", r->generic);
+ }
+ ndr->depth--;
+ break;
+
+ case NetlogonInteractiveTransitiveInformation:
ndr_print_ptr(ndr, "password", r->password);
ndr->depth++;
if (r->password) {
@@ -774,7 +954,7 @@ _PUBLIC_ void ndr_print_netr_LogonInfo(struct ndr_print *ndr, const char *name,
ndr->depth--;
break;
- case 6:
+ case NetlogonNetworkTransitiveInformation:
ndr_print_ptr(ndr, "network", r->network);
ndr->depth++;
if (r->network) {
@@ -783,6 +963,15 @@ _PUBLIC_ void ndr_print_netr_LogonInfo(struct ndr_print *ndr, const char *name,
ndr->depth--;
break;
+ case NetlogonServiceTransitiveInformation:
+ ndr_print_ptr(ndr, "password", r->password);
+ ndr->depth++;
+ if (r->password) {
+ ndr_print_netr_PasswordInfo(ndr, "password", r->password);
+ }
+ ndr->depth--;
+ break;
+
default:
ndr_print_bad_level(ndr, name, level);
}
@@ -1514,17 +1703,92 @@ _PUBLIC_ void ndr_print_netr_PacInfo(struct ndr_print *ndr, const char *name, co
ndr->depth--;
}
+static enum ndr_err_code ndr_push_netr_GenericInfo2(struct ndr_push *ndr, int ndr_flags, const struct netr_GenericInfo2 *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_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));
+ }
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_netr_GenericInfo2(struct ndr_pull *ndr, int ndr_flags, struct netr_GenericInfo2 *r)
+{
+ uint32_t _ptr_data;
+ TALLOC_CTX *_mem_save_data_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_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));
+ }
+ }
+ ndr->flags = _flags_save_STRUCT;
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_netr_GenericInfo2(struct ndr_print *ndr, const char *name, const struct netr_GenericInfo2 *r)
+{
+ ndr_print_struct(ndr, name, "netr_GenericInfo2");
+ {
+ uint32_t _flags_save_STRUCT = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
+ 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--;
+ ndr->flags = _flags_save_STRUCT;
+ }
+}
+
_PUBLIC_ enum ndr_err_code ndr_push_netr_Validation(struct ndr_push *ndr, int ndr_flags, const union netr_Validation *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 2: {
+ case NetlogonValidationSamInfo: {
NDR_CHECK(ndr_push_unique_ptr(ndr, r->sam2));
break; }
- case 3: {
+ case NetlogonValidationSamInfo2: {
NDR_CHECK(ndr_push_unique_ptr(ndr, r->sam3));
break; }
@@ -1532,11 +1796,11 @@ _PUBLIC_ enum ndr_err_code ndr_push_netr_Validation(struct ndr_push *ndr, int nd
NDR_CHECK(ndr_push_unique_ptr(ndr, r->pac));
break; }
- case 5: {
- NDR_CHECK(ndr_push_unique_ptr(ndr, r->pac));
+ case NetlogonValidationGenericInfo2: {
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->generic));
break; }
- case 6: {
+ case NetlogonValidationSamInfo4: {
NDR_CHECK(ndr_push_unique_ptr(ndr, r->sam6));
break; }
@@ -1547,13 +1811,13 @@ _PUBLIC_ enum ndr_err_code ndr_push_netr_Validation(struct ndr_push *ndr, int nd
if (ndr_flags & NDR_BUFFERS) {
int level = ndr_push_get_switch_value(ndr, r);
switch (level) {
- case 2:
+ case NetlogonValidationSamInfo:
if (r->sam2) {
NDR_CHECK(ndr_push_netr_SamInfo2(ndr, NDR_SCALARS|NDR_BUFFERS, r->sam2));
}
break;
- case 3:
+ case NetlogonValidationSamInfo2:
if (r->sam3) {
NDR_CHECK(ndr_push_netr_SamInfo3(ndr, NDR_SCALARS|NDR_BUFFERS, r->sam3));
}
@@ -1565,13 +1829,13 @@ _PUBLIC_ enum ndr_err_code ndr_push_netr_Validation(struct ndr_push *ndr, int nd
}
break;
- case 5:
- if (r->pac) {
- NDR_CHECK(ndr_push_netr_PacInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->pac));
+ case NetlogonValidationGenericInfo2:
+ if (r->generic) {
+ NDR_CHECK(ndr_push_netr_GenericInfo2(ndr, NDR_SCALARS|NDR_BUFFERS, r->generic));
}
break;
- case 6:
+ case NetlogonValidationSamInfo4:
if (r->sam6) {
NDR_CHECK(ndr_push_netr_SamInfo6(ndr, NDR_SCALARS|NDR_BUFFERS, r->sam6));
}
@@ -1591,6 +1855,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_Validation(struct ndr_pull *ndr, int nd
TALLOC_CTX *_mem_save_sam2_0;
TALLOC_CTX *_mem_save_sam3_0;
TALLOC_CTX *_mem_save_pac_0;
+ TALLOC_CTX *_mem_save_generic_0;
TALLOC_CTX *_mem_save_sam6_0;
level = ndr_pull_get_switch_value(ndr, r);
if (ndr_flags & NDR_SCALARS) {
@@ -1599,7 +1864,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_Validation(struct ndr_pull *ndr, int nd
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level);
}
switch (level) {
- case 2: {
+ case NetlogonValidationSamInfo: {
uint32_t _ptr_sam2;
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sam2));
if (_ptr_sam2) {
@@ -1609,7 +1874,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_Validation(struct ndr_pull *ndr, int nd
}
break; }
- case 3: {
+ case NetlogonValidationSamInfo2: {
uint32_t _ptr_sam3;
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sam3));
if (_ptr_sam3) {
@@ -1629,17 +1894,17 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_Validation(struct ndr_pull *ndr, int nd
}
break; }
- case 5: {
- uint32_t _ptr_pac;
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_pac));
- if (_ptr_pac) {
- NDR_PULL_ALLOC(ndr, r->pac);
+ case NetlogonValidationGenericInfo2: {
+ uint32_t _ptr_generic;
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_generic));
+ if (_ptr_generic) {
+ NDR_PULL_ALLOC(ndr, r->generic);
} else {
- r->pac = NULL;
+ r->generic = NULL;
}
break; }
- case 6: {
+ case NetlogonValidationSamInfo4: {
uint32_t _ptr_sam6;
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sam6));
if (_ptr_sam6) {
@@ -1655,7 +1920,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_Validation(struct ndr_pull *ndr, int nd
}
if (ndr_flags & NDR_BUFFERS) {
switch (level) {
- case 2:
+ case NetlogonValidationSamInfo:
if (r->sam2) {
_mem_save_sam2_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->sam2, 0);
@@ -1664,7 +1929,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_Validation(struct ndr_pull *ndr, int nd
}
break;
- case 3:
+ case NetlogonValidationSamInfo2:
if (r->sam3) {
_mem_save_sam3_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->sam3, 0);
@@ -1682,16 +1947,16 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_Validation(struct ndr_pull *ndr, int nd
}
break;
- case 5:
- if (r->pac) {
- _mem_save_pac_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->pac, 0);
- NDR_CHECK(ndr_pull_netr_PacInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->pac));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_pac_0, 0);
+ case NetlogonValidationGenericInfo2:
+ if (r->generic) {
+ _mem_save_generic_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->generic, 0);
+ NDR_CHECK(ndr_pull_netr_GenericInfo2(ndr, NDR_SCALARS|NDR_BUFFERS, r->generic));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_generic_0, 0);
}
break;
- case 6:
+ case NetlogonValidationSamInfo4:
if (r->sam6) {
_mem_save_sam6_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->sam6, 0);
@@ -1713,7 +1978,7 @@ _PUBLIC_ void ndr_print_netr_Validation(struct ndr_print *ndr, const char *name,
level = ndr_print_get_switch_value(ndr, r);
ndr_print_union(ndr, name, level, "netr_Validation");
switch (level) {
- case 2:
+ case NetlogonValidationSamInfo:
ndr_print_ptr(ndr, "sam2", r->sam2);
ndr->depth++;
if (r->sam2) {
@@ -1722,7 +1987,7 @@ _PUBLIC_ void ndr_print_netr_Validation(struct ndr_print *ndr, const char *name,
ndr->depth--;
break;
- case 3:
+ case NetlogonValidationSamInfo2:
ndr_print_ptr(ndr, "sam3", r->sam3);
ndr->depth++;
if (r->sam3) {
@@ -1740,16 +2005,16 @@ _PUBLIC_ void ndr_print_netr_Validation(struct ndr_print *ndr, const char *name,
ndr->depth--;
break;
- case 5:
- ndr_print_ptr(ndr, "pac", r->pac);
+ case NetlogonValidationGenericInfo2:
+ ndr_print_ptr(ndr, "generic", r->generic);
ndr->depth++;
- if (r->pac) {
- ndr_print_netr_PacInfo(ndr, "pac", r->pac);
+ if (r->generic) {
+ ndr_print_netr_GenericInfo2(ndr, "generic", r->generic);
}
ndr->depth--;
break;
- case 6:
+ case NetlogonValidationSamInfo4:
ndr_print_ptr(ndr, "sam6", r->sam6);
ndr->depth++;
if (r->sam6) {
@@ -1841,31 +2106,6 @@ _PUBLIC_ void ndr_print_netr_Authenticator(struct ndr_print *ndr, const char *na
ndr->depth--;
}
-static enum ndr_err_code ndr_push_netr_LogonLevel(struct ndr_push *ndr, int ndr_flags, enum netr_LogonLevel r)
-{
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_netr_LogonLevel(struct ndr_pull *ndr, int ndr_flags, enum netr_LogonLevel *r)
-{
- uint16_t v;
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
- *r = v;
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_netr_LogonLevel(struct ndr_print *ndr, const char *name, enum netr_LogonLevel r)
-{
- const char *val = NULL;
-
- switch (r) {
- case INTERACTIVE_LOGON_TYPE: val = "INTERACTIVE_LOGON_TYPE"; break;
- case NET_LOGON_TYPE: val = "NET_LOGON_TYPE"; break;
- }
- ndr_print_enum(ndr, name, "ENUM", val, r);
-}
-
static enum ndr_err_code ndr_push_netr_DELTA_DELETE_USER(struct ndr_push *ndr, int ndr_flags, const struct netr_DELTA_DELETE_USER *r)
{
if (ndr_flags & NDR_SCALARS) {
@@ -1968,7 +2208,6 @@ static enum ndr_err_code ndr_push_netr_USER_KEY16(struct ndr_push *ndr, int ndr_
NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, &r->pwd));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_push_samr_Password(ndr, NDR_BUFFERS, &r->pwd));
}
return NDR_ERR_SUCCESS;
}
@@ -1983,7 +2222,6 @@ static enum ndr_err_code ndr_pull_netr_USER_KEY16(struct ndr_pull *ndr, int ndr_
NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, &r->pwd));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_BUFFERS, &r->pwd));
}
return NDR_ERR_SUCCESS;
}
@@ -2061,8 +2299,6 @@ static enum ndr_err_code ndr_push_netr_USER_KEYS2(struct ndr_push *ndr, int ndr_
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));
- NDR_CHECK(ndr_push_netr_USER_KEY16(ndr, NDR_BUFFERS, &r->ntpassword));
}
return NDR_ERR_SUCCESS;
}
@@ -2076,8 +2312,6 @@ static enum ndr_err_code ndr_pull_netr_USER_KEYS2(struct ndr_pull *ndr, int ndr_
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));
- NDR_CHECK(ndr_pull_netr_USER_KEY16(ndr, NDR_BUFFERS, &r->ntpassword));
}
return NDR_ERR_SUCCESS;
}
@@ -2099,7 +2333,6 @@ static enum ndr_err_code ndr_push_netr_USER_KEY_UNION(struct ndr_push *ndr, int
NDR_CHECK(ndr_push_netr_USER_KEYS2(ndr, NDR_SCALARS, &r->keys2));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_push_netr_USER_KEYS2(ndr, NDR_BUFFERS, &r->keys2));
}
return NDR_ERR_SUCCESS;
}
@@ -2111,7 +2344,6 @@ static enum ndr_err_code ndr_pull_netr_USER_KEY_UNION(struct ndr_pull *ndr, int
NDR_CHECK(ndr_pull_netr_USER_KEYS2(ndr, NDR_SCALARS, &r->keys2));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_pull_netr_USER_KEYS2(ndr, NDR_BUFFERS, &r->keys2));
}
return NDR_ERR_SUCCESS;
}
@@ -2132,7 +2364,6 @@ _PUBLIC_ enum ndr_err_code ndr_push_netr_USER_KEYS(struct ndr_push *ndr, int ndr
NDR_CHECK(ndr_push_netr_USER_KEY_UNION(ndr, NDR_SCALARS, &r->keys));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_push_netr_USER_KEY_UNION(ndr, NDR_BUFFERS, &r->keys));
}
return NDR_ERR_SUCCESS;
}
@@ -2145,7 +2376,6 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_USER_KEYS(struct ndr_pull *ndr, int ndr
NDR_CHECK(ndr_pull_netr_USER_KEY_UNION(ndr, NDR_SCALARS, &r->keys));
}
if (ndr_flags & NDR_BUFFERS) {
- NDR_CHECK(ndr_pull_netr_USER_KEY_UNION(ndr, NDR_BUFFERS, &r->keys));
}
return NDR_ERR_SUCCESS;
}
@@ -2293,8 +2523,6 @@ static enum ndr_err_code ndr_push_netr_DELTA_USER(struct ndr_push *ndr, int ndr_
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));
- NDR_CHECK(ndr_push_samr_Password(ndr, NDR_BUFFERS, &r->lmpassword));
- NDR_CHECK(ndr_push_samr_Password(ndr, NDR_BUFFERS, &r->ntpassword));
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_netr_USER_PRIVATE_INFO(ndr, NDR_BUFFERS, &r->user_private_info));
@@ -2358,8 +2586,6 @@ static enum ndr_err_code ndr_pull_netr_DELTA_USER(struct ndr_pull *ndr, int ndr_
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));
- NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_BUFFERS, &r->lmpassword));
- NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_BUFFERS, &r->ntpassword));
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_netr_USER_PRIVATE_INFO(ndr, NDR_BUFFERS, &r->user_private_info));
@@ -2421,7 +2647,7 @@ static enum ndr_err_code ndr_push_netr_DELTA_DOMAIN(struct ndr_push *ndr, int nd
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_lsa_String(ndr, NDR_SCALARS, &r->comment));
+ NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->oem_information));
NDR_CHECK(ndr_push_dlong(ndr, NDR_SCALARS, r->force_logoff_time));
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->min_password_length));
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->password_history_length));
@@ -2442,7 +2668,7 @@ static enum ndr_err_code ndr_push_netr_DELTA_DOMAIN(struct ndr_push *ndr, int nd
}
if (ndr_flags & NDR_BUFFERS) {
NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->domain_name));
- NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->comment));
+ NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->oem_information));
NDR_CHECK(ndr_push_sec_desc_buf(ndr, NDR_BUFFERS, &r->sdbuf));
NDR_CHECK(ndr_push_lsa_BinaryString(ndr, NDR_BUFFERS, &r->account_lockout));
NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->unknown2));
@@ -2457,7 +2683,7 @@ static enum ndr_err_code ndr_pull_netr_DELTA_DOMAIN(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_lsa_String(ndr, NDR_SCALARS, &r->comment));
+ NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->oem_information));
NDR_CHECK(ndr_pull_dlong(ndr, NDR_SCALARS, &r->force_logoff_time));
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->min_password_length));
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->password_history_length));
@@ -2478,7 +2704,7 @@ static enum ndr_err_code ndr_pull_netr_DELTA_DOMAIN(struct ndr_pull *ndr, int nd
}
if (ndr_flags & NDR_BUFFERS) {
NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->domain_name));
- NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->comment));
+ NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->oem_information));
NDR_CHECK(ndr_pull_sec_desc_buf(ndr, NDR_BUFFERS, &r->sdbuf));
NDR_CHECK(ndr_pull_lsa_BinaryString(ndr, NDR_BUFFERS, &r->account_lockout));
NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->unknown2));
@@ -2493,7 +2719,7 @@ _PUBLIC_ void ndr_print_netr_DELTA_DOMAIN(struct ndr_print *ndr, const char *nam
ndr_print_struct(ndr, name, "netr_DELTA_DOMAIN");
ndr->depth++;
ndr_print_lsa_String(ndr, "domain_name", &r->domain_name);
- ndr_print_lsa_String(ndr, "comment", &r->comment);
+ ndr_print_lsa_String(ndr, "oem_information", &r->oem_information);
ndr_print_dlong(ndr, "force_logoff_time", r->force_logoff_time);
ndr_print_uint16(ndr, "min_password_length", r->min_password_length);
ndr_print_uint16(ndr, "password_history_length", r->password_history_length);
@@ -6176,7 +6402,6 @@ _PUBLIC_ enum ndr_err_code ndr_push_netr_DsRGetDCNameInfo(struct ndr_push *ndr,
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->dc_address, CH_UTF16)));
NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->dc_address, ndr_charset_length(r->dc_address, CH_UTF16), sizeof(uint16_t), CH_UTF16));
}
- NDR_CHECK(ndr_push_GUID(ndr, NDR_BUFFERS, &r->domain_guid));
if (r->domain_name) {
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->domain_name, CH_UTF16)));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
@@ -6286,7 +6511,6 @@ _PUBLIC_ enum ndr_err_code ndr_pull_netr_DsRGetDCNameInfo(struct ndr_pull *ndr,
NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->dc_address, ndr_get_array_length(ndr, &r->dc_address), sizeof(uint16_t), CH_UTF16));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dc_address_0, 0);
}
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_BUFFERS, &r->domain_guid));
if (r->domain_name) {
_mem_save_domain_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->domain_name, 0);
@@ -6385,6 +6609,35 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameInfo(struct ndr_print *ndr, const char
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_print_bitmap_flag(ndr, sizeof(uint32_t), "NETR_TRUST_FLAG_MIT_KRB5", NETR_TRUST_FLAG_MIT_KRB5, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETR_TRUST_FLAG_AES", NETR_TRUST_FLAG_AES, r);
+ 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;
@@ -6893,10 +7146,115 @@ _PUBLIC_ void ndr_print_netr_DomainQuery(struct ndr_print *ndr, const char *name
}
}
+static enum ndr_err_code ndr_push_netr_trust_extension(struct ndr_push *ndr, int ndr_flags, const struct netr_trust_extension *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 8));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 8));
+ NDR_CHECK(ndr_push_netr_TrustFlags(ndr, NDR_SCALARS, r->flags));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->parent_index));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->trust_type));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->trust_attributes));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_netr_trust_extension(struct ndr_pull *ndr, int ndr_flags, struct netr_trust_extension *r)
+{
+ 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_uint32(ndr, NDR_SCALARS, &r->dummy));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size));
+ NDR_CHECK(ndr_pull_netr_TrustFlags(ndr, NDR_SCALARS, &r->flags));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->parent_index));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->trust_type));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->trust_attributes));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_netr_trust_extension(struct ndr_print *ndr, const char *name, const struct netr_trust_extension *r)
+{
+ ndr_print_struct(ndr, name, "netr_trust_extension");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?8:r->length);
+ ndr_print_uint32(ndr, "dummy", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?0:r->dummy);
+ ndr_print_uint32(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?8:r->size);
+ ndr_print_netr_TrustFlags(ndr, "flags", r->flags);
+ ndr_print_uint32(ndr, "parent_index", r->parent_index);
+ ndr_print_uint32(ndr, "trust_type", r->trust_type);
+ ndr_print_uint32(ndr, "trust_attributes", r->trust_attributes);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_netr_trust_extension_container(struct ndr_push *ndr, int ndr_flags, const struct netr_trust_extension_container *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->length));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->length));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->info));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->info) {
+ NDR_CHECK(ndr_push_netr_trust_extension(ndr, NDR_SCALARS, r->info));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_netr_trust_extension_container(struct ndr_pull *ndr, int ndr_flags, struct netr_trust_extension_container *r)
+{
+ uint32_t _ptr_info;
+ TALLOC_CTX *_mem_save_info_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info));
+ if (_ptr_info) {
+ NDR_PULL_ALLOC(ndr, r->info);
+ } else {
+ r->info = NULL;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->info) {
+ _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->info, 0);
+ NDR_CHECK(ndr_pull_netr_trust_extension(ndr, NDR_SCALARS, r->info));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_netr_trust_extension_container(struct ndr_print *ndr, const char *name, const struct netr_trust_extension_container *r)
+{
+ ndr_print_struct(ndr, name, "netr_trust_extension_container");
+ ndr->depth++;
+ ndr_print_uint16(ndr, "length", r->length);
+ ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->length:r->size);
+ ndr_print_ptr(ndr, "info", r->info);
+ ndr->depth++;
+ if (r->info) {
+ ndr_print_netr_trust_extension(ndr, "info", r->info);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
static enum ndr_err_code ndr_push_netr_DomainTrustInfo(struct ndr_push *ndr, int ndr_flags, const struct netr_DomainTrustInfo *r)
{
- uint32_t cntr_unknown1_0;
- uint32_t cntr_unknown_0;
+ uint32_t cntr_dummystring_0;
+ uint32_t cntr_dummy_0;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->domainname));
@@ -6904,23 +7262,24 @@ static enum ndr_err_code ndr_push_netr_DomainTrustInfo(struct ndr_push *ndr, int
NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->forest));
NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->guid));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->sid));
- for (cntr_unknown1_0 = 0; cntr_unknown1_0 < 4; cntr_unknown1_0++) {
- NDR_CHECK(ndr_push_netr_BinaryString(ndr, NDR_SCALARS, &r->unknown1[cntr_unknown1_0]));
+ NDR_CHECK(ndr_push_netr_trust_extension_container(ndr, NDR_SCALARS, &r->trust_extension));
+ for (cntr_dummystring_0 = 0; cntr_dummystring_0 < 3; cntr_dummystring_0++) {
+ NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->dummystring[cntr_dummystring_0]));
}
- for (cntr_unknown_0 = 0; cntr_unknown_0 < 4; cntr_unknown_0++) {
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown[cntr_unknown_0]));
+ for (cntr_dummy_0 = 0; cntr_dummy_0 < 4; cntr_dummy_0++) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->dummy[cntr_dummy_0]));
}
}
if (ndr_flags & NDR_BUFFERS) {
NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->domainname));
NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->fulldomainname));
NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->forest));
- NDR_CHECK(ndr_push_GUID(ndr, NDR_BUFFERS, &r->guid));
if (r->sid) {
NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->sid));
}
- for (cntr_unknown1_0 = 0; cntr_unknown1_0 < 4; cntr_unknown1_0++) {
- NDR_CHECK(ndr_push_netr_BinaryString(ndr, NDR_BUFFERS, &r->unknown1[cntr_unknown1_0]));
+ NDR_CHECK(ndr_push_netr_trust_extension_container(ndr, NDR_BUFFERS, &r->trust_extension));
+ for (cntr_dummystring_0 = 0; cntr_dummystring_0 < 3; cntr_dummystring_0++) {
+ NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->dummystring[cntr_dummystring_0]));
}
}
return NDR_ERR_SUCCESS;
@@ -6930,8 +7289,8 @@ static enum ndr_err_code ndr_pull_netr_DomainTrustInfo(struct ndr_pull *ndr, int
{
uint32_t _ptr_sid;
TALLOC_CTX *_mem_save_sid_0;
- uint32_t cntr_unknown1_0;
- uint32_t cntr_unknown_0;
+ uint32_t cntr_dummystring_0;
+ uint32_t cntr_dummy_0;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->domainname));
@@ -6944,26 +7303,27 @@ static enum ndr_err_code ndr_pull_netr_DomainTrustInfo(struct ndr_pull *ndr, int
} else {
r->sid = NULL;
}
- for (cntr_unknown1_0 = 0; cntr_unknown1_0 < 4; cntr_unknown1_0++) {
- NDR_CHECK(ndr_pull_netr_BinaryString(ndr, NDR_SCALARS, &r->unknown1[cntr_unknown1_0]));
+ NDR_CHECK(ndr_pull_netr_trust_extension_container(ndr, NDR_SCALARS, &r->trust_extension));
+ for (cntr_dummystring_0 = 0; cntr_dummystring_0 < 3; cntr_dummystring_0++) {
+ NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->dummystring[cntr_dummystring_0]));
}
- for (cntr_unknown_0 = 0; cntr_unknown_0 < 4; cntr_unknown_0++) {
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown[cntr_unknown_0]));
+ for (cntr_dummy_0 = 0; cntr_dummy_0 < 4; cntr_dummy_0++) {
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->dummy[cntr_dummy_0]));
}
}
if (ndr_flags & NDR_BUFFERS) {
NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->domainname));
NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->fulldomainname));
NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->forest));
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_BUFFERS, &r->guid));
if (r->sid) {
_mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->sid, 0);
NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->sid));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, 0);
}
- for (cntr_unknown1_0 = 0; cntr_unknown1_0 < 4; cntr_unknown1_0++) {
- NDR_CHECK(ndr_pull_netr_BinaryString(ndr, NDR_BUFFERS, &r->unknown1[cntr_unknown1_0]));
+ NDR_CHECK(ndr_pull_netr_trust_extension_container(ndr, NDR_BUFFERS, &r->trust_extension));
+ for (cntr_dummystring_0 = 0; cntr_dummystring_0 < 3; cntr_dummystring_0++) {
+ NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->dummystring[cntr_dummystring_0]));
}
}
return NDR_ERR_SUCCESS;
@@ -6971,8 +7331,8 @@ static enum ndr_err_code ndr_pull_netr_DomainTrustInfo(struct ndr_pull *ndr, int
_PUBLIC_ void ndr_print_netr_DomainTrustInfo(struct ndr_print *ndr, const char *name, const struct netr_DomainTrustInfo *r)
{
- uint32_t cntr_unknown1_0;
- uint32_t cntr_unknown_0;
+ uint32_t cntr_dummystring_0;
+ uint32_t cntr_dummy_0;
ndr_print_struct(ndr, name, "netr_DomainTrustInfo");
ndr->depth++;
ndr_print_lsa_String(ndr, "domainname", &r->domainname);
@@ -6985,22 +7345,23 @@ _PUBLIC_ void ndr_print_netr_DomainTrustInfo(struct ndr_print *ndr, const char *
ndr_print_dom_sid2(ndr, "sid", r->sid);
}
ndr->depth--;
- ndr->print(ndr, "%s: ARRAY(%d)", "unknown1", (int)4);
+ ndr_print_netr_trust_extension_container(ndr, "trust_extension", &r->trust_extension);
+ ndr->print(ndr, "%s: ARRAY(%d)", "dummystring", (int)3);
ndr->depth++;
- for (cntr_unknown1_0=0;cntr_unknown1_0<4;cntr_unknown1_0++) {
+ for (cntr_dummystring_0=0;cntr_dummystring_0<3;cntr_dummystring_0++) {
char *idx_0=NULL;
- if (asprintf(&idx_0, "[%d]", cntr_unknown1_0) != -1) {
- ndr_print_netr_BinaryString(ndr, "unknown1", &r->unknown1[cntr_unknown1_0]);
+ if (asprintf(&idx_0, "[%d]", cntr_dummystring_0) != -1) {
+ ndr_print_lsa_String(ndr, "dummystring", &r->dummystring[cntr_dummystring_0]);
free(idx_0);
}
}
ndr->depth--;
- ndr->print(ndr, "%s: ARRAY(%d)", "unknown", (int)4);
+ ndr->print(ndr, "%s: ARRAY(%d)", "dummy", (int)4);
ndr->depth++;
- for (cntr_unknown_0=0;cntr_unknown_0<4;cntr_unknown_0++) {
+ for (cntr_dummy_0=0;cntr_dummy_0<4;cntr_dummy_0++) {
char *idx_0=NULL;
- if (asprintf(&idx_0, "[%d]", cntr_unknown_0) != -1) {
- ndr_print_uint32(ndr, "unknown", r->unknown[cntr_unknown_0]);
+ if (asprintf(&idx_0, "[%d]", cntr_dummy_0) != -1) {
+ ndr_print_uint32(ndr, "dummy", r->dummy[cntr_dummy_0]);
free(idx_0);
}
}
@@ -7008,17 +7369,108 @@ _PUBLIC_ void ndr_print_netr_DomainTrustInfo(struct ndr_print *ndr, const char *
ndr->depth--;
}
+static enum ndr_err_code ndr_push_netr_LsaPolicyInfo(struct ndr_push *ndr, int ndr_flags, const struct netr_LsaPolicyInfo *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->policy_size));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->policy));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->policy) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->policy_size));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->policy, r->policy_size));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_netr_LsaPolicyInfo(struct ndr_pull *ndr, int ndr_flags, struct netr_LsaPolicyInfo *r)
+{
+ uint32_t _ptr_policy;
+ TALLOC_CTX *_mem_save_policy_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->policy_size));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_policy));
+ if (_ptr_policy) {
+ NDR_PULL_ALLOC(ndr, r->policy);
+ } else {
+ r->policy = NULL;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->policy) {
+ _mem_save_policy_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->policy, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->policy));
+ NDR_PULL_ALLOC_N(ndr, r->policy, ndr_get_array_size(ndr, &r->policy));
+ NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->policy, ndr_get_array_size(ndr, &r->policy)));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_policy_0, 0);
+ }
+ if (r->policy) {
+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->policy, r->policy_size));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_netr_LsaPolicyInfo(struct ndr_print *ndr, const char *name, const struct netr_LsaPolicyInfo *r)
+{
+ ndr_print_struct(ndr, name, "netr_LsaPolicyInfo");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "policy_size", r->policy_size);
+ ndr_print_ptr(ndr, "policy", r->policy);
+ ndr->depth++;
+ if (r->policy) {
+ ndr_print_array_uint8(ndr, "policy", r->policy, r->policy_size);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_netr_WorkstationFlags(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_WorkstationFlags(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_WorkstationFlags(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_WS_FLAG_HANDLES_INBOUND_TRUSTS", NETR_WS_FLAG_HANDLES_INBOUND_TRUSTS, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETR_WS_FLAG_HANDLES_SPN_UPDATE", NETR_WS_FLAG_HANDLES_SPN_UPDATE, r);
+ ndr->depth--;
+}
+
static enum ndr_err_code ndr_push_netr_DomainInfo1(struct ndr_push *ndr, int ndr_flags, const struct netr_DomainInfo1 *r)
{
uint32_t cntr_trusts_1;
- uint32_t cntr_unknown_0;
+ uint32_t cntr_dummystring_0;
+ uint32_t cntr_dummy_0;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_push_netr_DomainTrustInfo(ndr, NDR_SCALARS, &r->domaininfo));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_trusts));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->trusts));
- for (cntr_unknown_0 = 0; cntr_unknown_0 < 14; cntr_unknown_0++) {
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown[cntr_unknown_0]));
+ NDR_CHECK(ndr_push_netr_LsaPolicyInfo(ndr, NDR_SCALARS, &r->lsa_policy));
+ NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->dns_hostname));
+ for (cntr_dummystring_0 = 0; cntr_dummystring_0 < 3; cntr_dummystring_0++) {
+ NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->dummystring[cntr_dummystring_0]));
+ }
+ NDR_CHECK(ndr_push_netr_WorkstationFlags(ndr, NDR_SCALARS, r->workstation_flags));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->supported_enc_types));
+ for (cntr_dummy_0 = 0; cntr_dummy_0 < 2; cntr_dummy_0++) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->dummy[cntr_dummy_0]));
}
}
if (ndr_flags & NDR_BUFFERS) {
@@ -7032,6 +7484,11 @@ static enum ndr_err_code ndr_push_netr_DomainInfo1(struct ndr_push *ndr, int ndr
NDR_CHECK(ndr_push_netr_DomainTrustInfo(ndr, NDR_BUFFERS, &r->trusts[cntr_trusts_1]));
}
}
+ NDR_CHECK(ndr_push_netr_LsaPolicyInfo(ndr, NDR_BUFFERS, &r->lsa_policy));
+ NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->dns_hostname));
+ for (cntr_dummystring_0 = 0; cntr_dummystring_0 < 3; cntr_dummystring_0++) {
+ NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->dummystring[cntr_dummystring_0]));
+ }
}
return NDR_ERR_SUCCESS;
}
@@ -7042,7 +7499,8 @@ static enum ndr_err_code ndr_pull_netr_DomainInfo1(struct ndr_pull *ndr, int ndr
uint32_t cntr_trusts_1;
TALLOC_CTX *_mem_save_trusts_0;
TALLOC_CTX *_mem_save_trusts_1;
- uint32_t cntr_unknown_0;
+ uint32_t cntr_dummystring_0;
+ uint32_t cntr_dummy_0;
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
NDR_CHECK(ndr_pull_netr_DomainTrustInfo(ndr, NDR_SCALARS, &r->domaininfo));
@@ -7053,8 +7511,15 @@ static enum ndr_err_code ndr_pull_netr_DomainInfo1(struct ndr_pull *ndr, int ndr
} else {
r->trusts = NULL;
}
- for (cntr_unknown_0 = 0; cntr_unknown_0 < 14; cntr_unknown_0++) {
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown[cntr_unknown_0]));
+ NDR_CHECK(ndr_pull_netr_LsaPolicyInfo(ndr, NDR_SCALARS, &r->lsa_policy));
+ NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->dns_hostname));
+ for (cntr_dummystring_0 = 0; cntr_dummystring_0 < 3; cntr_dummystring_0++) {
+ NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->dummystring[cntr_dummystring_0]));
+ }
+ NDR_CHECK(ndr_pull_netr_WorkstationFlags(ndr, NDR_SCALARS, &r->workstation_flags));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->supported_enc_types));
+ for (cntr_dummy_0 = 0; cntr_dummy_0 < 2; cntr_dummy_0++) {
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->dummy[cntr_dummy_0]));
}
}
if (ndr_flags & NDR_BUFFERS) {
@@ -7075,6 +7540,11 @@ static enum ndr_err_code ndr_pull_netr_DomainInfo1(struct ndr_pull *ndr, int ndr
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trusts_1, 0);
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trusts_0, 0);
}
+ NDR_CHECK(ndr_pull_netr_LsaPolicyInfo(ndr, NDR_BUFFERS, &r->lsa_policy));
+ NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->dns_hostname));
+ for (cntr_dummystring_0 = 0; cntr_dummystring_0 < 3; cntr_dummystring_0++) {
+ NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->dummystring[cntr_dummystring_0]));
+ }
if (r->trusts) {
NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->trusts, r->num_trusts));
}
@@ -7085,7 +7555,8 @@ static enum ndr_err_code ndr_pull_netr_DomainInfo1(struct ndr_pull *ndr, int ndr
_PUBLIC_ void ndr_print_netr_DomainInfo1(struct ndr_print *ndr, const char *name, const struct netr_DomainInfo1 *r)
{
uint32_t cntr_trusts_1;
- uint32_t cntr_unknown_0;
+ uint32_t cntr_dummystring_0;
+ uint32_t cntr_dummy_0;
ndr_print_struct(ndr, name, "netr_DomainInfo1");
ndr->depth++;
ndr_print_netr_DomainTrustInfo(ndr, "domaininfo", &r->domaininfo);
@@ -7105,12 +7576,26 @@ _PUBLIC_ void ndr_print_netr_DomainInfo1(struct ndr_print *ndr, const char *name
ndr->depth--;
}
ndr->depth--;
- ndr->print(ndr, "%s: ARRAY(%d)", "unknown", (int)14);
+ ndr_print_netr_LsaPolicyInfo(ndr, "lsa_policy", &r->lsa_policy);
+ ndr_print_lsa_String(ndr, "dns_hostname", &r->dns_hostname);
+ ndr->print(ndr, "%s: ARRAY(%d)", "dummystring", (int)3);
ndr->depth++;
- for (cntr_unknown_0=0;cntr_unknown_0<14;cntr_unknown_0++) {
+ for (cntr_dummystring_0=0;cntr_dummystring_0<3;cntr_dummystring_0++) {
char *idx_0=NULL;
- if (asprintf(&idx_0, "[%d]", cntr_unknown_0) != -1) {
- ndr_print_uint32(ndr, "unknown", r->unknown[cntr_unknown_0]);
+ if (asprintf(&idx_0, "[%d]", cntr_dummystring_0) != -1) {
+ ndr_print_lsa_String(ndr, "dummystring", &r->dummystring[cntr_dummystring_0]);
+ free(idx_0);
+ }
+ }
+ ndr->depth--;
+ ndr_print_netr_WorkstationFlags(ndr, "workstation_flags", r->workstation_flags);
+ ndr_print_uint32(ndr, "supported_enc_types", r->supported_enc_types);
+ ndr->print(ndr, "%s: ARRAY(%d)", "dummy", (int)2);
+ ndr->depth++;
+ for (cntr_dummy_0=0;cntr_dummy_0<2;cntr_dummy_0++) {
+ char *idx_0=NULL;
+ if (asprintf(&idx_0, "[%d]", cntr_dummy_0) != -1) {
+ ndr_print_uint32(ndr, "dummy", r->dummy[cntr_dummy_0]);
free(idx_0);
}
}
@@ -7129,7 +7614,7 @@ static enum ndr_err_code ndr_push_netr_DomainInfo(struct ndr_push *ndr, int ndr_
break; }
case 2: {
- NDR_CHECK(ndr_push_unique_ptr(ndr, r->info1));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->info2));
break; }
default:
@@ -7146,8 +7631,8 @@ static enum ndr_err_code ndr_push_netr_DomainInfo(struct ndr_push *ndr, int ndr_
break;
case 2:
- if (r->info1) {
- NDR_CHECK(ndr_push_netr_DomainInfo1(ndr, NDR_SCALARS|NDR_BUFFERS, r->info1));
+ if (r->info2) {
+ NDR_CHECK(ndr_push_netr_DomainInfo1(ndr, NDR_SCALARS|NDR_BUFFERS, r->info2));
}
break;
@@ -7163,6 +7648,7 @@ static enum ndr_err_code ndr_pull_netr_DomainInfo(struct ndr_pull *ndr, int ndr_
int level;
uint32_t _level;
TALLOC_CTX *_mem_save_info1_0;
+ TALLOC_CTX *_mem_save_info2_0;
level = ndr_pull_get_switch_value(ndr, r);
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &_level));
@@ -7181,12 +7667,12 @@ static enum ndr_err_code ndr_pull_netr_DomainInfo(struct ndr_pull *ndr, int ndr_
break; }
case 2: {
- uint32_t _ptr_info1;
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info1));
- if (_ptr_info1) {
- NDR_PULL_ALLOC(ndr, r->info1);
+ uint32_t _ptr_info2;
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info2));
+ if (_ptr_info2) {
+ NDR_PULL_ALLOC(ndr, r->info2);
} else {
- r->info1 = NULL;
+ r->info2 = NULL;
}
break; }
@@ -7206,11 +7692,11 @@ static enum ndr_err_code ndr_pull_netr_DomainInfo(struct ndr_pull *ndr, int ndr_
break;
case 2:
- if (r->info1) {
- _mem_save_info1_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->info1, 0);
- NDR_CHECK(ndr_pull_netr_DomainInfo1(ndr, NDR_SCALARS|NDR_BUFFERS, r->info1));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info1_0, 0);
+ if (r->info2) {
+ _mem_save_info2_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->info2, 0);
+ NDR_CHECK(ndr_pull_netr_DomainInfo1(ndr, NDR_SCALARS|NDR_BUFFERS, r->info2));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info2_0, 0);
}
break;
@@ -7237,10 +7723,10 @@ _PUBLIC_ void ndr_print_netr_DomainInfo(struct ndr_print *ndr, const char *name,
break;
case 2:
- ndr_print_ptr(ndr, "info1", r->info1);
+ ndr_print_ptr(ndr, "info2", r->info2);
ndr->depth++;
- if (r->info1) {
- ndr_print_netr_DomainInfo1(ndr, "info1", r->info1);
+ if (r->info2) {
+ ndr_print_netr_DomainInfo1(ndr, "info2", r->info2);
}
ndr->depth--;
break;
@@ -7444,33 +7930,6 @@ _PUBLIC_ void ndr_print_netr_DsRAddress(struct ndr_print *ndr, const char *name,
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)
{
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
@@ -7555,7 +8014,6 @@ static enum ndr_err_code ndr_push_netr_DomainTrust(struct ndr_push *ndr, int ndr
if (r->sid) {
NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->sid));
}
- NDR_CHECK(ndr_push_GUID(ndr, NDR_BUFFERS, &r->guid));
}
return NDR_ERR_SUCCESS;
}
@@ -7625,7 +8083,6 @@ static enum ndr_err_code ndr_pull_netr_DomainTrust(struct ndr_pull *ndr, int ndr
NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->sid));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, 0);
}
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_BUFFERS, &r->guid));
}
return NDR_ERR_SUCCESS;
}
@@ -8235,12 +8692,12 @@ static enum ndr_err_code ndr_push_netr_LogonSamLogon(struct ndr_push *ndr, int f
if (r->in.return_authenticator) {
NDR_CHECK(ndr_push_netr_Authenticator(ndr, NDR_SCALARS, r->in.return_authenticator));
}
- NDR_CHECK(ndr_push_netr_LogonLevel(ndr, NDR_SCALARS, r->in.logon_level));
+ NDR_CHECK(ndr_push_netr_LogonInfoClass(ndr, NDR_SCALARS, r->in.logon_level));
if (r->in.logon == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.logon, r->in.logon_level));
- NDR_CHECK(ndr_push_netr_LogonInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.logon));
+ NDR_CHECK(ndr_push_netr_LogonLevel(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.logon));
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.validation_level));
}
if (flags & NDR_OUT) {
@@ -8338,14 +8795,14 @@ static enum ndr_err_code ndr_pull_netr_LogonSamLogon(struct ndr_pull *ndr, int f
NDR_CHECK(ndr_pull_netr_Authenticator(ndr, NDR_SCALARS, r->in.return_authenticator));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_return_authenticator_0, 0);
}
- NDR_CHECK(ndr_pull_netr_LogonLevel(ndr, NDR_SCALARS, &r->in.logon_level));
+ NDR_CHECK(ndr_pull_netr_LogonInfoClass(ndr, NDR_SCALARS, &r->in.logon_level));
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.logon);
}
_mem_save_logon_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.logon, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.logon, r->in.logon_level));
- NDR_CHECK(ndr_pull_netr_LogonInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.logon));
+ NDR_CHECK(ndr_pull_netr_LogonLevel(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.logon));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_logon_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.validation_level));
NDR_PULL_ALLOC(ndr, r->out.validation);
@@ -8420,11 +8877,11 @@ _PUBLIC_ void ndr_print_netr_LogonSamLogon(struct ndr_print *ndr, const char *na
ndr_print_netr_Authenticator(ndr, "return_authenticator", r->in.return_authenticator);
}
ndr->depth--;
- ndr_print_netr_LogonLevel(ndr, "logon_level", r->in.logon_level);
+ ndr_print_netr_LogonInfoClass(ndr, "logon_level", r->in.logon_level);
ndr_print_ptr(ndr, "logon", r->in.logon);
ndr->depth++;
ndr_print_set_switch_value(ndr, r->in.logon, r->in.logon_level);
- ndr_print_netr_LogonInfo(ndr, "logon", r->in.logon);
+ ndr_print_netr_LogonLevel(ndr, "logon", r->in.logon);
ndr->depth--;
ndr_print_uint16(ndr, "validation_level", r->in.validation_level);
ndr->depth--;
@@ -8478,9 +8935,9 @@ static enum ndr_err_code ndr_push_netr_LogonSamLogoff(struct ndr_push *ndr, int
if (r->in.return_authenticator) {
NDR_CHECK(ndr_push_netr_Authenticator(ndr, NDR_SCALARS, r->in.return_authenticator));
}
- NDR_CHECK(ndr_push_netr_LogonLevel(ndr, NDR_SCALARS, r->in.logon_level));
+ NDR_CHECK(ndr_push_netr_LogonInfoClass(ndr, NDR_SCALARS, r->in.logon_level));
NDR_CHECK(ndr_push_set_switch_value(ndr, &r->in.logon, r->in.logon_level));
- NDR_CHECK(ndr_push_netr_LogonInfo(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.logon));
+ NDR_CHECK(ndr_push_netr_LogonLevel(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.logon));
}
if (flags & NDR_OUT) {
NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.return_authenticator));
@@ -8565,9 +9022,9 @@ static enum ndr_err_code ndr_pull_netr_LogonSamLogoff(struct ndr_pull *ndr, int
NDR_CHECK(ndr_pull_netr_Authenticator(ndr, NDR_SCALARS, r->in.return_authenticator));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_return_authenticator_0, 0);
}
- NDR_CHECK(ndr_pull_netr_LogonLevel(ndr, NDR_SCALARS, &r->in.logon_level));
+ NDR_CHECK(ndr_pull_netr_LogonInfoClass(ndr, NDR_SCALARS, &r->in.logon_level));
NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->in.logon, r->in.logon_level));
- NDR_CHECK(ndr_pull_netr_LogonInfo(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.logon));
+ NDR_CHECK(ndr_pull_netr_LogonLevel(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.logon));
}
if (flags & NDR_OUT) {
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_return_authenticator));
@@ -8621,9 +9078,9 @@ _PUBLIC_ void ndr_print_netr_LogonSamLogoff(struct ndr_print *ndr, const char *n
ndr_print_netr_Authenticator(ndr, "return_authenticator", r->in.return_authenticator);
}
ndr->depth--;
- ndr_print_netr_LogonLevel(ndr, "logon_level", r->in.logon_level);
+ ndr_print_netr_LogonInfoClass(ndr, "logon_level", r->in.logon_level);
ndr_print_set_switch_value(ndr, &r->in.logon, r->in.logon_level);
- ndr_print_netr_LogonInfo(ndr, "logon", &r->in.logon);
+ ndr_print_netr_LogonLevel(ndr, "logon", &r->in.logon);
ndr->depth--;
}
if (flags & NDR_OUT) {
@@ -8926,7 +9383,7 @@ static enum ndr_err_code ndr_push_netr_ServerPasswordSet(struct ndr_push *ndr, i
if (r->in.new_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->in.new_password));
+ NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.new_password));
}
if (flags & NDR_OUT) {
if (r->out.return_authenticator == NULL) {
@@ -8993,7 +9450,7 @@ static enum ndr_err_code ndr_pull_netr_ServerPasswordSet(struct ndr_pull *ndr, i
}
_mem_save_new_password_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.new_password, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.new_password));
+ NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.new_password));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_new_password_0, LIBNDR_FLAG_REF_ALLOC);
NDR_PULL_ALLOC(ndr, r->out.return_authenticator);
ZERO_STRUCTP(r->out.return_authenticator);
@@ -11134,11 +11591,11 @@ static enum ndr_err_code ndr_push_netr_DsRGetDCName(struct ndr_push *ndr, int fl
}
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_GUID(ndr, NDR_SCALARS, r->in.domain_guid));
}
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.site_guid));
if (r->in.site_guid) {
- NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.site_guid));
+ NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, r->in.site_guid));
}
NDR_CHECK(ndr_push_netr_DsRGetDCName_flags(ndr, NDR_SCALARS, r->in.flags));
}
@@ -11216,7 +11673,7 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCName(struct ndr_pull *ndr, int fl
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_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, r->in.domain_guid));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_guid_0, 0);
}
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_site_guid));
@@ -11228,7 +11685,7 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCName(struct ndr_pull *ndr, int fl
if (r->in.site_guid) {
_mem_save_site_guid_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.site_guid, 0);
- NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.site_guid));
+ NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, r->in.site_guid));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_site_guid_0, 0);
}
NDR_CHECK(ndr_pull_netr_DsRGetDCName_flags(ndr, NDR_SCALARS, &r->in.flags));
@@ -11811,7 +12268,7 @@ static enum ndr_err_code ndr_push_netr_DsRGetDCNameEx(struct ndr_push *ndr, int
}
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_GUID(ndr, NDR_SCALARS, r->in.domain_guid));
}
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.site_name));
if (r->in.site_name) {
@@ -11896,7 +12353,7 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameEx(struct ndr_pull *ndr, int
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_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, r->in.domain_guid));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_guid_0, 0);
}
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_site_name));
@@ -12476,7 +12933,7 @@ static enum ndr_err_code ndr_push_netr_ServerPasswordGet(struct ndr_push *ndr, i
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_samr_Password(ndr, NDR_SCALARS, r->out.password));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -12550,7 +13007,7 @@ static enum ndr_err_code ndr_pull_netr_ServerPasswordGet(struct ndr_pull *ndr, i
}
_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_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, 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));
}
@@ -12831,7 +13288,7 @@ static enum ndr_err_code ndr_push_netr_DsRGetDCNameEx2(struct ndr_push *ndr, int
}
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_GUID(ndr, NDR_SCALARS, r->in.domain_guid));
}
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.site_name));
if (r->in.site_name) {
@@ -12937,7 +13394,7 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameEx2(struct ndr_pull *ndr, int
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_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, r->in.domain_guid));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_guid_0, 0);
}
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_site_name));
@@ -13458,12 +13915,12 @@ static enum ndr_err_code ndr_push_netr_LogonSamLogonEx(struct ndr_push *ndr, int
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));
}
- NDR_CHECK(ndr_push_netr_LogonLevel(ndr, NDR_SCALARS, r->in.logon_level));
+ NDR_CHECK(ndr_push_netr_LogonInfoClass(ndr, NDR_SCALARS, r->in.logon_level));
if (r->in.logon == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.logon, r->in.logon_level));
- NDR_CHECK(ndr_push_netr_LogonInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.logon));
+ NDR_CHECK(ndr_push_netr_LogonLevel(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.logon));
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.validation_level));
if (r->in.flags == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
@@ -13538,14 +13995,14 @@ static enum ndr_err_code ndr_pull_netr_LogonSamLogonEx(struct ndr_pull *ndr, int
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));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_computer_name_0, 0);
}
- NDR_CHECK(ndr_pull_netr_LogonLevel(ndr, NDR_SCALARS, &r->in.logon_level));
+ NDR_CHECK(ndr_pull_netr_LogonInfoClass(ndr, NDR_SCALARS, &r->in.logon_level));
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.logon);
}
_mem_save_logon_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.logon, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.logon, r->in.logon_level));
- NDR_CHECK(ndr_pull_netr_LogonInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.logon));
+ NDR_CHECK(ndr_pull_netr_LogonLevel(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.logon));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_logon_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.validation_level));
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
@@ -13612,11 +14069,11 @@ _PUBLIC_ void ndr_print_netr_LogonSamLogonEx(struct ndr_print *ndr, const char *
ndr_print_string(ndr, "computer_name", r->in.computer_name);
}
ndr->depth--;
- ndr_print_netr_LogonLevel(ndr, "logon_level", r->in.logon_level);
+ ndr_print_netr_LogonInfoClass(ndr, "logon_level", r->in.logon_level);
ndr_print_ptr(ndr, "logon", r->in.logon);
ndr->depth++;
ndr_print_set_switch_value(ndr, r->in.logon, r->in.logon_level);
- ndr_print_netr_LogonInfo(ndr, "logon", r->in.logon);
+ ndr_print_netr_LogonLevel(ndr, "logon", r->in.logon);
ndr->depth--;
ndr_print_uint16(ndr, "validation_level", r->in.validation_level);
ndr_print_ptr(ndr, "flags", r->in.flags);
@@ -13763,11 +14220,11 @@ static enum ndr_err_code ndr_push_netr_DsrDeregisterDNSHostRecords(struct ndr_pu
}
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_GUID(ndr, NDR_SCALARS, 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));
+ NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, r->in.dsa_guid));
}
if (r->in.dns_host == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
@@ -13839,7 +14296,7 @@ static enum ndr_err_code ndr_pull_netr_DsrDeregisterDNSHostRecords(struct ndr_pu
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_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, 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));
@@ -13851,7 +14308,7 @@ static enum ndr_err_code ndr_pull_netr_DsrDeregisterDNSHostRecords(struct ndr_pu
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_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, 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));
@@ -13949,11 +14406,11 @@ static enum ndr_err_code ndr_push_netr_ServerTrustPasswordsGet(struct ndr_push *
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_samr_Password(ndr, NDR_SCALARS, 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_samr_Password(ndr, NDR_SCALARS, r->out.password2));
NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -14030,14 +14487,14 @@ static enum ndr_err_code ndr_pull_netr_ServerTrustPasswordsGet(struct ndr_pull *
}
_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_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, 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_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, 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));
}
@@ -14436,9 +14893,9 @@ static enum ndr_err_code ndr_push_netr_LogonSamLogonWithFlags(struct ndr_push *n
if (r->in.return_authenticator) {
NDR_CHECK(ndr_push_netr_Authenticator(ndr, NDR_SCALARS, r->in.return_authenticator));
}
- NDR_CHECK(ndr_push_netr_LogonLevel(ndr, NDR_SCALARS, r->in.logon_level));
+ NDR_CHECK(ndr_push_netr_LogonInfoClass(ndr, NDR_SCALARS, r->in.logon_level));
NDR_CHECK(ndr_push_set_switch_value(ndr, &r->in.logon, r->in.logon_level));
- NDR_CHECK(ndr_push_netr_LogonInfo(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.logon));
+ NDR_CHECK(ndr_push_netr_LogonLevel(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.logon));
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.validation_level));
if (r->in.flags == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
@@ -14544,9 +15001,9 @@ static enum ndr_err_code ndr_pull_netr_LogonSamLogonWithFlags(struct ndr_pull *n
NDR_CHECK(ndr_pull_netr_Authenticator(ndr, NDR_SCALARS, r->in.return_authenticator));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_return_authenticator_0, 0);
}
- NDR_CHECK(ndr_pull_netr_LogonLevel(ndr, NDR_SCALARS, &r->in.logon_level));
+ NDR_CHECK(ndr_pull_netr_LogonInfoClass(ndr, NDR_SCALARS, &r->in.logon_level));
NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->in.logon, r->in.logon_level));
- NDR_CHECK(ndr_pull_netr_LogonInfo(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.logon));
+ NDR_CHECK(ndr_pull_netr_LogonLevel(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.logon));
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.validation_level));
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.flags);
@@ -14636,9 +15093,9 @@ _PUBLIC_ void ndr_print_netr_LogonSamLogonWithFlags(struct ndr_print *ndr, const
ndr_print_netr_Authenticator(ndr, "return_authenticator", r->in.return_authenticator);
}
ndr->depth--;
- ndr_print_netr_LogonLevel(ndr, "logon_level", r->in.logon_level);
+ ndr_print_netr_LogonInfoClass(ndr, "logon_level", r->in.logon_level);
ndr_print_set_switch_value(ndr, &r->in.logon, r->in.logon_level);
- ndr_print_netr_LogonInfo(ndr, "logon", &r->in.logon);
+ ndr_print_netr_LogonLevel(ndr, "logon", &r->in.logon);
ndr_print_uint16(ndr, "validation_level", r->in.validation_level);
ndr_print_ptr(ndr, "flags", r->in.flags);
ndr->depth++;
diff --git a/source3/librpc/gen_ndr/ndr_netlogon.h b/source3/librpc/gen_ndr/ndr_netlogon.h
index a9d36aeacb..2a3c0fbf84 100644
--- a/source3/librpc/gen_ndr/ndr_netlogon.h
+++ b/source3/librpc/gen_ndr/ndr_netlogon.h
@@ -118,9 +118,11 @@ void ndr_print_netr_IdentityInfo(struct ndr_print *ndr, const char *name, const
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);
void ndr_print_netr_NetworkInfo(struct ndr_print *ndr, const char *name, const struct netr_NetworkInfo *r);
-enum ndr_err_code ndr_push_netr_LogonInfo(struct ndr_push *ndr, int ndr_flags, const union netr_LogonInfo *r);
-enum ndr_err_code ndr_pull_netr_LogonInfo(struct ndr_pull *ndr, int ndr_flags, union netr_LogonInfo *r);
-void ndr_print_netr_LogonInfo(struct ndr_print *ndr, const char *name, const union netr_LogonInfo *r);
+void ndr_print_netr_GenericInfo(struct ndr_print *ndr, const char *name, const struct netr_GenericInfo *r);
+void ndr_print_netr_LogonInfoClass(struct ndr_print *ndr, const char *name, enum netr_LogonInfoClass r);
+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_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);
@@ -138,6 +140,7 @@ enum ndr_err_code ndr_pull_netr_SamInfo3(struct ndr_pull *ndr, int ndr_flags, st
void ndr_print_netr_SamInfo3(struct ndr_print *ndr, const char *name, const struct netr_SamInfo3 *r);
void ndr_print_netr_SamInfo6(struct ndr_print *ndr, const char *name, const struct netr_SamInfo6 *r);
void ndr_print_netr_PacInfo(struct ndr_print *ndr, const char *name, const struct netr_PacInfo *r);
+void ndr_print_netr_GenericInfo2(struct ndr_print *ndr, const char *name, const struct netr_GenericInfo2 *r);
enum ndr_err_code ndr_push_netr_Validation(struct ndr_push *ndr, int ndr_flags, const union netr_Validation *r);
enum ndr_err_code ndr_pull_netr_Validation(struct ndr_pull *ndr, int ndr_flags, union netr_Validation *r);
void ndr_print_netr_Validation(struct ndr_print *ndr, const char *name, const union netr_Validation *r);
@@ -147,7 +150,6 @@ void ndr_print_netr_Credential(struct ndr_print *ndr, const char *name, const st
enum ndr_err_code ndr_push_netr_Authenticator(struct ndr_push *ndr, int ndr_flags, const struct netr_Authenticator *r);
enum ndr_err_code ndr_pull_netr_Authenticator(struct ndr_pull *ndr, int ndr_flags, struct netr_Authenticator *r);
void ndr_print_netr_Authenticator(struct ndr_print *ndr, const char *name, const struct netr_Authenticator *r);
-void ndr_print_netr_LogonLevel(struct ndr_print *ndr, const char *name, enum netr_LogonLevel r);
void ndr_print_netr_DELTA_DELETE_USER(struct ndr_print *ndr, const char *name, const struct netr_DELTA_DELETE_USER *r);
void ndr_print_netr_USER_KEY16(struct ndr_print *ndr, const char *name, const struct netr_USER_KEY16 *r);
void ndr_print_netr_PasswordHistory(struct ndr_print *ndr, const char *name, const struct netr_PasswordHistory *r);
@@ -195,16 +197,22 @@ void ndr_print_netr_DsR_DcFlags(struct ndr_print *ndr, const char *name, uint32_
enum ndr_err_code ndr_push_netr_DsRGetDCNameInfo(struct ndr_push *ndr, int ndr_flags, const struct netr_DsRGetDCNameInfo *r);
enum ndr_err_code ndr_pull_netr_DsRGetDCNameInfo(struct ndr_pull *ndr, int ndr_flags, struct netr_DsRGetDCNameInfo *r);
void ndr_print_netr_DsRGetDCNameInfo(struct ndr_print *ndr, const char *name, const struct netr_DsRGetDCNameInfo *r);
+void ndr_print_netr_TrustFlags(struct ndr_print *ndr, const char *name, uint32_t 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);
+void ndr_print_netr_trust_extension(struct ndr_print *ndr, const char *name, const struct netr_trust_extension *r);
+void ndr_print_netr_trust_extension_container(struct ndr_print *ndr, const char *name, const struct netr_trust_extension_container *r);
void ndr_print_netr_DomainTrustInfo(struct ndr_print *ndr, const char *name, const struct netr_DomainTrustInfo *r);
+void ndr_print_netr_LsaPolicyInfo(struct ndr_print *ndr, const char *name, const struct netr_LsaPolicyInfo *r);
+enum ndr_err_code ndr_push_netr_WorkstationFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r);
+enum ndr_err_code ndr_pull_netr_WorkstationFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
+void ndr_print_netr_WorkstationFlags(struct ndr_print *ndr, const char *name, uint32_t r);
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);
diff --git a/source3/librpc/gen_ndr/ndr_notify.c b/source3/librpc/gen_ndr/ndr_notify.c
index 00ba8bc293..dfa72d8004 100644
--- a/source3/librpc/gen_ndr/ndr_notify.c
+++ b/source3/librpc/gen_ndr/ndr_notify.c
@@ -3,6 +3,7 @@
#include "includes.h"
#include "librpc/gen_ndr/ndr_notify.h"
+#include "librpc/gen_ndr/ndr_security.h"
_PUBLIC_ enum ndr_err_code ndr_push_notify_entry(struct ndr_push *ndr, int ndr_flags, const struct notify_entry *r)
{
if (ndr_flags & NDR_SCALARS) {
diff --git a/source3/librpc/gen_ndr/ndr_ntsvcs.c b/source3/librpc/gen_ndr/ndr_ntsvcs.c
index 62acf474ae..35d02a0dcb 100644
--- a/source3/librpc/gen_ndr/ndr_ntsvcs.c
+++ b/source3/librpc/gen_ndr/ndr_ntsvcs.c
@@ -508,9 +508,35 @@ _PUBLIC_ void ndr_print_PNP_EnumerateSubKeys(struct ndr_print *ndr, const char *
static enum ndr_err_code ndr_push_PNP_GetDeviceList(struct ndr_push *ndr, int flags, const struct PNP_GetDeviceList *r)
{
+ uint32_t cntr_buffer_1;
if (flags & NDR_IN) {
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.filter));
+ if (r->in.filter) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.filter, CH_UTF16)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.filter, CH_UTF16)));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.filter, ndr_charset_length(r->in.filter, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+ }
+ if (r->in.length == NULL) {
+ return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+ }
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.length));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags));
}
if (flags & NDR_OUT) {
+ if (r->out.buffer == NULL) {
+ return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+ }
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.length));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.length));
+ for (cntr_buffer_1 = 0; cntr_buffer_1 < *r->out.length; cntr_buffer_1++) {
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->out.buffer[cntr_buffer_1]));
+ }
+ if (r->out.length == NULL) {
+ return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+ }
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.length));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -518,16 +544,81 @@ static enum ndr_err_code ndr_push_PNP_GetDeviceList(struct ndr_push *ndr, int fl
static enum ndr_err_code ndr_pull_PNP_GetDeviceList(struct ndr_pull *ndr, int flags, struct PNP_GetDeviceList *r)
{
+ uint32_t _ptr_filter;
+ uint32_t cntr_buffer_1;
+ TALLOC_CTX *_mem_save_filter_0;
+ TALLOC_CTX *_mem_save_buffer_1;
+ TALLOC_CTX *_mem_save_length_0;
if (flags & NDR_IN) {
+ ZERO_STRUCT(r->out);
+
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_filter));
+ if (_ptr_filter) {
+ NDR_PULL_ALLOC(ndr, r->in.filter);
+ } else {
+ r->in.filter = NULL;
+ }
+ if (r->in.filter) {
+ _mem_save_filter_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.filter, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->in.filter));
+ NDR_CHECK(ndr_pull_array_length(ndr, &r->in.filter));
+ if (ndr_get_array_length(ndr, &r->in.filter) > ndr_get_array_size(ndr, &r->in.filter)) {
+ 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.filter), ndr_get_array_length(ndr, &r->in.filter));
+ }
+ NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.filter), sizeof(uint16_t)));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.filter, ndr_get_array_length(ndr, &r->in.filter), sizeof(uint16_t), CH_UTF16));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_filter_0, 0);
+ }
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->in.length);
+ }
+ _mem_save_length_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.length, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.length));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_length_0, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags));
+ NDR_PULL_ALLOC_N(ndr, r->out.buffer, *r->in.length);
+ memset(r->out.buffer, 0, (*r->in.length) * sizeof(*r->out.buffer));
+ NDR_PULL_ALLOC(ndr, r->out.length);
+ *r->out.length = *r->in.length;
}
if (flags & NDR_OUT) {
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->out.buffer));
+ NDR_CHECK(ndr_pull_array_length(ndr, &r->out.buffer));
+ if (ndr_get_array_length(ndr, &r->out.buffer) > ndr_get_array_size(ndr, &r->out.buffer)) {
+ 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.buffer), ndr_get_array_length(ndr, &r->out.buffer));
+ }
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC_N(ndr, r->out.buffer, ndr_get_array_size(ndr, &r->out.buffer));
+ }
+ _mem_save_buffer_1 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.buffer, 0);
+ for (cntr_buffer_1 = 0; cntr_buffer_1 < *r->out.length; cntr_buffer_1++) {
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->out.buffer[cntr_buffer_1]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_buffer_1, 0);
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.length);
+ }
+ _mem_save_length_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.length, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.length));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_length_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
+ if (r->out.buffer) {
+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.buffer, *r->out.length));
+ }
+ if (r->out.buffer) {
+ NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->out.buffer, *r->out.length));
+ }
}
return NDR_ERR_SUCCESS;
}
_PUBLIC_ void ndr_print_PNP_GetDeviceList(struct ndr_print *ndr, const char *name, int flags, const struct PNP_GetDeviceList *r)
{
+ uint32_t cntr_buffer_1;
ndr_print_struct(ndr, name, "PNP_GetDeviceList");
ndr->depth++;
if (flags & NDR_SET_VALUES) {
@@ -536,11 +627,39 @@ _PUBLIC_ void ndr_print_PNP_GetDeviceList(struct ndr_print *ndr, const char *nam
if (flags & NDR_IN) {
ndr_print_struct(ndr, "in", "PNP_GetDeviceList");
ndr->depth++;
+ ndr_print_ptr(ndr, "filter", r->in.filter);
+ ndr->depth++;
+ if (r->in.filter) {
+ ndr_print_string(ndr, "filter", r->in.filter);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "length", r->in.length);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "length", *r->in.length);
+ ndr->depth--;
+ ndr_print_uint32(ndr, "flags", r->in.flags);
ndr->depth--;
}
if (flags & NDR_OUT) {
ndr_print_struct(ndr, "out", "PNP_GetDeviceList");
ndr->depth++;
+ ndr_print_ptr(ndr, "buffer", r->out.buffer);
+ ndr->depth++;
+ ndr->print(ndr, "%s: ARRAY(%d)", "buffer", (int)*r->out.length);
+ ndr->depth++;
+ for (cntr_buffer_1=0;cntr_buffer_1<*r->out.length;cntr_buffer_1++) {
+ char *idx_1=NULL;
+ if (asprintf(&idx_1, "[%d]", cntr_buffer_1) != -1) {
+ ndr_print_uint16(ndr, "buffer", r->out.buffer[cntr_buffer_1]);
+ free(idx_1);
+ }
+ }
+ ndr->depth--;
+ ndr->depth--;
+ ndr_print_ptr(ndr, "length", r->out.length);
+ ndr->depth++;
+ ndr_print_uint32(ndr, "length", *r->out.length);
+ ndr->depth--;
ndr_print_WERROR(ndr, "result", r->out.result);
ndr->depth--;
}
@@ -696,10 +815,10 @@ static enum ndr_err_code ndr_push_PNP_GetDeviceRegProp(struct ndr_push *ndr, int
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.devicepath, CH_UTF16)));
NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.devicepath, ndr_charset_length(r->in.devicepath, CH_UTF16), sizeof(uint16_t), CH_UTF16));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.property));
- if (r->in.unknown1 == NULL) {
+ if (r->in.reg_data_type == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.unknown1));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.reg_data_type));
if (r->in.buffer_size == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -708,13 +827,13 @@ static enum ndr_err_code ndr_push_PNP_GetDeviceRegProp(struct ndr_push *ndr, int
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.needed));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown3));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags));
}
if (flags & NDR_OUT) {
- if (r->out.unknown1 == NULL) {
+ if (r->out.reg_data_type == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.unknown1));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.reg_data_type));
if (r->out.buffer == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -737,7 +856,7 @@ static enum ndr_err_code ndr_push_PNP_GetDeviceRegProp(struct ndr_push *ndr, int
static enum ndr_err_code ndr_pull_PNP_GetDeviceRegProp(struct ndr_pull *ndr, int flags, struct PNP_GetDeviceRegProp *r)
{
- TALLOC_CTX *_mem_save_unknown1_0;
+ TALLOC_CTX *_mem_save_reg_data_type_0;
TALLOC_CTX *_mem_save_buffer_size_0;
TALLOC_CTX *_mem_save_needed_0;
if (flags & NDR_IN) {
@@ -752,12 +871,12 @@ static enum ndr_err_code ndr_pull_PNP_GetDeviceRegProp(struct ndr_pull *ndr, int
NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.devicepath, ndr_get_array_length(ndr, &r->in.devicepath), sizeof(uint16_t), CH_UTF16));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.property));
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
- NDR_PULL_ALLOC(ndr, r->in.unknown1);
+ NDR_PULL_ALLOC(ndr, r->in.reg_data_type);
}
- _mem_save_unknown1_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->in.unknown1, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.unknown1));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_unknown1_0, LIBNDR_FLAG_REF_ALLOC);
+ _mem_save_reg_data_type_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.reg_data_type, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.reg_data_type));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_reg_data_type_0, LIBNDR_FLAG_REF_ALLOC);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.buffer_size);
}
@@ -772,9 +891,9 @@ static enum ndr_err_code ndr_pull_PNP_GetDeviceRegProp(struct ndr_pull *ndr, int
NDR_PULL_SET_MEM_CTX(ndr, r->in.needed, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.needed));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_needed_0, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown3));
- NDR_PULL_ALLOC(ndr, r->out.unknown1);
- *r->out.unknown1 = *r->in.unknown1;
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags));
+ NDR_PULL_ALLOC(ndr, r->out.reg_data_type);
+ *r->out.reg_data_type = *r->in.reg_data_type;
NDR_PULL_ALLOC_N(ndr, r->out.buffer, *r->in.buffer_size);
memset(r->out.buffer, 0, (*r->in.buffer_size) * sizeof(*r->out.buffer));
NDR_PULL_ALLOC(ndr, r->out.buffer_size);
@@ -784,12 +903,12 @@ static enum ndr_err_code ndr_pull_PNP_GetDeviceRegProp(struct ndr_pull *ndr, int
}
if (flags & NDR_OUT) {
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
- NDR_PULL_ALLOC(ndr, r->out.unknown1);
+ NDR_PULL_ALLOC(ndr, r->out.reg_data_type);
}
- _mem_save_unknown1_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->out.unknown1, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.unknown1));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_unknown1_0, LIBNDR_FLAG_REF_ALLOC);
+ _mem_save_reg_data_type_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.reg_data_type, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.reg_data_type));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_reg_data_type_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_array_size(ndr, &r->out.buffer));
NDR_CHECK(ndr_pull_array_length(ndr, &r->out.buffer));
if (ndr_get_array_length(ndr, &r->out.buffer) > ndr_get_array_size(ndr, &r->out.buffer)) {
@@ -839,9 +958,9 @@ _PUBLIC_ void ndr_print_PNP_GetDeviceRegProp(struct ndr_print *ndr, const char *
ndr_print_string(ndr, "devicepath", r->in.devicepath);
ndr->depth--;
ndr_print_uint32(ndr, "property", r->in.property);
- ndr_print_ptr(ndr, "unknown1", r->in.unknown1);
+ ndr_print_ptr(ndr, "reg_data_type", r->in.reg_data_type);
ndr->depth++;
- ndr_print_uint32(ndr, "unknown1", *r->in.unknown1);
+ ndr_print_uint32(ndr, "reg_data_type", *r->in.reg_data_type);
ndr->depth--;
ndr_print_ptr(ndr, "buffer_size", r->in.buffer_size);
ndr->depth++;
@@ -851,15 +970,15 @@ _PUBLIC_ void ndr_print_PNP_GetDeviceRegProp(struct ndr_print *ndr, const char *
ndr->depth++;
ndr_print_uint32(ndr, "needed", *r->in.needed);
ndr->depth--;
- ndr_print_uint32(ndr, "unknown3", r->in.unknown3);
+ ndr_print_uint32(ndr, "flags", r->in.flags);
ndr->depth--;
}
if (flags & NDR_OUT) {
ndr_print_struct(ndr, "out", "PNP_GetDeviceRegProp");
ndr->depth++;
- ndr_print_ptr(ndr, "unknown1", r->out.unknown1);
+ ndr_print_ptr(ndr, "reg_data_type", r->out.reg_data_type);
ndr->depth++;
- ndr_print_uint32(ndr, "unknown1", *r->out.unknown1);
+ ndr_print_uint32(ndr, "reg_data_type", *r->out.reg_data_type);
ndr->depth--;
ndr_print_ptr(ndr, "buffer", r->out.buffer);
ndr->depth++;
diff --git a/source3/librpc/gen_ndr/ndr_samr.c b/source3/librpc/gen_ndr/ndr_samr.c
index 9c5a886325..10055aef37 100644
--- a/source3/librpc/gen_ndr/ndr_samr.c
+++ b/source3/librpc/gen_ndr/ndr_samr.c
@@ -406,12 +406,12 @@ _PUBLIC_ void ndr_print_samr_DomInfo1(struct ndr_print *ndr, const char *name, c
ndr->depth--;
}
-static enum ndr_err_code ndr_push_samr_DomInfo2(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo2 *r)
+static enum ndr_err_code ndr_push_samr_DomGeneralInformation(struct ndr_push *ndr, int ndr_flags, const struct samr_DomGeneralInformation *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->oem_information));
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));
@@ -423,19 +423,19 @@ static enum ndr_err_code ndr_push_samr_DomInfo2(struct ndr_push *ndr, int ndr_fl
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->oem_information));
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)
+static enum ndr_err_code ndr_pull_samr_DomGeneralInformation(struct ndr_pull *ndr, int ndr_flags, struct samr_DomGeneralInformation *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->oem_information));
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));
@@ -447,19 +447,19 @@ static enum ndr_err_code ndr_pull_samr_DomInfo2(struct ndr_pull *ndr, int ndr_fl
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->oem_information));
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)
+_PUBLIC_ void ndr_print_samr_DomGeneralInformation(struct ndr_print *ndr, const char *name, const struct samr_DomGeneralInformation *r)
{
- ndr_print_struct(ndr, name, "samr_DomInfo2");
+ ndr_print_struct(ndr, name, "samr_DomGeneralInformation");
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, "oem_information", &r->oem_information);
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);
@@ -502,35 +502,35 @@ _PUBLIC_ void ndr_print_samr_DomInfo3(struct ndr_print *ndr, const char *name, c
ndr->depth--;
}
-static enum ndr_err_code ndr_push_samr_DomInfo4(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo4 *r)
+static enum ndr_err_code ndr_push_samr_DomOEMInformation(struct ndr_push *ndr, int ndr_flags, const struct samr_DomOEMInformation *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->oem_information));
}
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->oem_information));
}
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_samr_DomInfo4(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo4 *r)
+static enum ndr_err_code ndr_pull_samr_DomOEMInformation(struct ndr_pull *ndr, int ndr_flags, struct samr_DomOEMInformation *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->oem_information));
}
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->oem_information));
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_samr_DomInfo4(struct ndr_print *ndr, const char *name, const struct samr_DomInfo4 *r)
+_PUBLIC_ void ndr_print_samr_DomOEMInformation(struct ndr_print *ndr, const char *name, const struct samr_DomOEMInformation *r)
{
- ndr_print_struct(ndr, name, "samr_DomInfo4");
+ ndr_print_struct(ndr, name, "samr_DomOEMInformation");
ndr->depth++;
- ndr_print_lsa_String(ndr, "comment", &r->comment);
+ ndr_print_lsa_String(ndr, "oem_information", &r->oem_information);
ndr->depth--;
}
@@ -691,41 +691,41 @@ _PUBLIC_ void ndr_print_samr_DomInfo9(struct ndr_print *ndr, const char *name, c
ndr->depth--;
}
-static enum ndr_err_code ndr_push_samr_DomInfo11(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo11 *r)
+static enum ndr_err_code ndr_push_samr_DomGeneralInformation2(struct ndr_push *ndr, int ndr_flags, const struct samr_DomGeneralInformation2 *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_samr_DomGeneralInformation(ndr, NDR_SCALARS, &r->general));
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));
+ NDR_CHECK(ndr_push_samr_DomGeneralInformation(ndr, NDR_BUFFERS, &r->general));
}
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_samr_DomInfo11(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo11 *r)
+static enum ndr_err_code ndr_pull_samr_DomGeneralInformation2(struct ndr_pull *ndr, int ndr_flags, struct samr_DomGeneralInformation2 *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_samr_DomGeneralInformation(ndr, NDR_SCALARS, &r->general));
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));
+ NDR_CHECK(ndr_pull_samr_DomGeneralInformation(ndr, NDR_BUFFERS, &r->general));
}
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_samr_DomInfo11(struct ndr_print *ndr, const char *name, const struct samr_DomInfo11 *r)
+_PUBLIC_ void ndr_print_samr_DomGeneralInformation2(struct ndr_print *ndr, const char *name, const struct samr_DomGeneralInformation2 *r)
{
- ndr_print_struct(ndr, name, "samr_DomInfo11");
+ ndr_print_struct(ndr, name, "samr_DomGeneralInformation2");
ndr->depth++;
- ndr_print_samr_DomInfo2(ndr, "info2", &r->info2);
+ ndr_print_samr_DomGeneralInformation(ndr, "general", &r->general);
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);
@@ -818,7 +818,7 @@ static enum ndr_err_code ndr_push_samr_DomainInfo(struct ndr_push *ndr, int ndr_
break; }
case 2: {
- NDR_CHECK(ndr_push_samr_DomInfo2(ndr, NDR_SCALARS, &r->info2));
+ NDR_CHECK(ndr_push_samr_DomGeneralInformation(ndr, NDR_SCALARS, &r->general));
break; }
case 3: {
@@ -826,7 +826,7 @@ static enum ndr_err_code ndr_push_samr_DomainInfo(struct ndr_push *ndr, int ndr_
break; }
case 4: {
- NDR_CHECK(ndr_push_samr_DomInfo4(ndr, NDR_SCALARS, &r->info4));
+ NDR_CHECK(ndr_push_samr_DomOEMInformation(ndr, NDR_SCALARS, &r->oem));
break; }
case 5: {
@@ -850,7 +850,7 @@ static enum ndr_err_code ndr_push_samr_DomainInfo(struct ndr_push *ndr, int ndr_
break; }
case 11: {
- NDR_CHECK(ndr_push_samr_DomInfo11(ndr, NDR_SCALARS, &r->info11));
+ NDR_CHECK(ndr_push_samr_DomGeneralInformation2(ndr, NDR_SCALARS, &r->general2));
break; }
case 12: {
@@ -872,14 +872,14 @@ static enum ndr_err_code ndr_push_samr_DomainInfo(struct ndr_push *ndr, int ndr_
break;
case 2:
- NDR_CHECK(ndr_push_samr_DomInfo2(ndr, NDR_BUFFERS, &r->info2));
+ NDR_CHECK(ndr_push_samr_DomGeneralInformation(ndr, NDR_BUFFERS, &r->general));
break;
case 3:
break;
case 4:
- NDR_CHECK(ndr_push_samr_DomInfo4(ndr, NDR_BUFFERS, &r->info4));
+ NDR_CHECK(ndr_push_samr_DomOEMInformation(ndr, NDR_BUFFERS, &r->oem));
break;
case 5:
@@ -900,7 +900,7 @@ static enum ndr_err_code ndr_push_samr_DomainInfo(struct ndr_push *ndr, int ndr_
break;
case 11:
- NDR_CHECK(ndr_push_samr_DomInfo11(ndr, NDR_BUFFERS, &r->info11));
+ NDR_CHECK(ndr_push_samr_DomGeneralInformation2(ndr, NDR_BUFFERS, &r->general2));
break;
case 12:
@@ -932,7 +932,7 @@ static enum ndr_err_code ndr_pull_samr_DomainInfo(struct ndr_pull *ndr, int ndr_
break; }
case 2: {
- NDR_CHECK(ndr_pull_samr_DomInfo2(ndr, NDR_SCALARS, &r->info2));
+ NDR_CHECK(ndr_pull_samr_DomGeneralInformation(ndr, NDR_SCALARS, &r->general));
break; }
case 3: {
@@ -940,7 +940,7 @@ static enum ndr_err_code ndr_pull_samr_DomainInfo(struct ndr_pull *ndr, int ndr_
break; }
case 4: {
- NDR_CHECK(ndr_pull_samr_DomInfo4(ndr, NDR_SCALARS, &r->info4));
+ NDR_CHECK(ndr_pull_samr_DomOEMInformation(ndr, NDR_SCALARS, &r->oem));
break; }
case 5: {
@@ -964,7 +964,7 @@ static enum ndr_err_code ndr_pull_samr_DomainInfo(struct ndr_pull *ndr, int ndr_
break; }
case 11: {
- NDR_CHECK(ndr_pull_samr_DomInfo11(ndr, NDR_SCALARS, &r->info11));
+ NDR_CHECK(ndr_pull_samr_DomGeneralInformation2(ndr, NDR_SCALARS, &r->general2));
break; }
case 12: {
@@ -985,14 +985,14 @@ static enum ndr_err_code ndr_pull_samr_DomainInfo(struct ndr_pull *ndr, int ndr_
break;
case 2:
- NDR_CHECK(ndr_pull_samr_DomInfo2(ndr, NDR_BUFFERS, &r->info2));
+ NDR_CHECK(ndr_pull_samr_DomGeneralInformation(ndr, NDR_BUFFERS, &r->general));
break;
case 3:
break;
case 4:
- NDR_CHECK(ndr_pull_samr_DomInfo4(ndr, NDR_BUFFERS, &r->info4));
+ NDR_CHECK(ndr_pull_samr_DomOEMInformation(ndr, NDR_BUFFERS, &r->oem));
break;
case 5:
@@ -1013,7 +1013,7 @@ static enum ndr_err_code ndr_pull_samr_DomainInfo(struct ndr_pull *ndr, int ndr_
break;
case 11:
- NDR_CHECK(ndr_pull_samr_DomInfo11(ndr, NDR_BUFFERS, &r->info11));
+ NDR_CHECK(ndr_pull_samr_DomGeneralInformation2(ndr, NDR_BUFFERS, &r->general2));
break;
case 12:
@@ -1040,7 +1040,7 @@ _PUBLIC_ void ndr_print_samr_DomainInfo(struct ndr_print *ndr, const char *name,
break;
case 2:
- ndr_print_samr_DomInfo2(ndr, "info2", &r->info2);
+ ndr_print_samr_DomGeneralInformation(ndr, "general", &r->general);
break;
case 3:
@@ -1048,7 +1048,7 @@ _PUBLIC_ void ndr_print_samr_DomainInfo(struct ndr_print *ndr, const char *name,
break;
case 4:
- ndr_print_samr_DomInfo4(ndr, "info4", &r->info4);
+ ndr_print_samr_DomOEMInformation(ndr, "oem", &r->oem);
break;
case 5:
@@ -1072,7 +1072,7 @@ _PUBLIC_ void ndr_print_samr_DomainInfo(struct ndr_print *ndr, const char *name,
break;
case 11:
- ndr_print_samr_DomInfo11(ndr, "info11", &r->info11);
+ ndr_print_samr_DomGeneralInformation2(ndr, "general2", &r->general2);
break;
case 12:
diff --git a/source3/librpc/gen_ndr/ndr_samr.h b/source3/librpc/gen_ndr/ndr_samr.h
index c21b5455fb..1f582061f9 100644
--- a/source3/librpc/gen_ndr/ndr_samr.h
+++ b/source3/librpc/gen_ndr/ndr_samr.h
@@ -163,15 +163,15 @@ enum ndr_err_code ndr_push_samr_PasswordProperties(struct ndr_push *ndr, int ndr
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_DomGeneralInformation(struct ndr_print *ndr, const char *name, const struct samr_DomGeneralInformation *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_DomOEMInformation(struct ndr_print *ndr, const char *name, const struct samr_DomOEMInformation *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_DomGeneralInformation2(struct ndr_print *ndr, const char *name, const struct samr_DomGeneralInformation2 *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);
diff --git a/source3/librpc/gen_ndr/ndr_security.c b/source3/librpc/gen_ndr/ndr_security.c
index d54fdb2395..de899241ab 100644
--- a/source3/librpc/gen_ndr/ndr_security.c
+++ b/source3/librpc/gen_ndr/ndr_security.c
@@ -1024,3 +1024,29 @@ _PUBLIC_ void ndr_print_security_secinfo(struct ndr_print *ndr, const char *name
ndr->depth--;
}
+_PUBLIC_ enum ndr_err_code ndr_push_kerb_EncTypes(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_kerb_EncTypes(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_kerb_EncTypes(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), "KERB_ENCTYPE_DES_CBC_CRC", KERB_ENCTYPE_DES_CBC_CRC, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "KERB_ENCTYPE_DES_CBC_MD5", KERB_ENCTYPE_DES_CBC_MD5, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "KERB_ENCTYPE_RC4_HMAC_MD5", KERB_ENCTYPE_RC4_HMAC_MD5, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96", KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96", KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96, r);
+ ndr->depth--;
+}
+
diff --git a/source3/librpc/gen_ndr/ndr_security.h b/source3/librpc/gen_ndr/ndr_security.h
index 79bfd78f51..7a2ff74309 100644
--- a/source3/librpc/gen_ndr/ndr_security.h
+++ b/source3/librpc/gen_ndr/ndr_security.h
@@ -38,4 +38,7 @@ void ndr_print_security_token(struct ndr_print *ndr, const char *name, const str
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);
+enum ndr_err_code ndr_push_kerb_EncTypes(struct ndr_push *ndr, int ndr_flags, uint32_t r);
+enum ndr_err_code ndr_pull_kerb_EncTypes(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
+void ndr_print_kerb_EncTypes(struct ndr_print *ndr, const char *name, uint32_t r);
#endif /* _HEADER_NDR_security */
diff --git a/source3/librpc/gen_ndr/ndr_srvsvc.c b/source3/librpc/gen_ndr/ndr_srvsvc.c
index d97ee0171c..36c3dbe256 100644
--- a/source3/librpc/gen_ndr/ndr_srvsvc.c
+++ b/source3/librpc/gen_ndr/ndr_srvsvc.c
@@ -18013,7 +18013,7 @@ static enum ndr_err_code ndr_push_srvsvc_NetShareDelStart(struct ndr_push *ndr,
if (flags & NDR_OUT) {
NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.hnd));
if (r->out.hnd) {
- NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.hnd));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.hnd));
}
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
@@ -18066,7 +18066,7 @@ static enum ndr_err_code ndr_pull_srvsvc_NetShareDelStart(struct ndr_pull *ndr,
if (r->out.hnd) {
_mem_save_hnd_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.hnd, 0);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.hnd));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.hnd));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hnd_0, 0);
}
NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
@@ -18114,13 +18114,13 @@ static enum ndr_err_code ndr_push_srvsvc_NetShareDelCommit(struct ndr_push *ndr,
if (flags & NDR_IN) {
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.hnd));
if (r->in.hnd) {
- NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.hnd));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.hnd));
}
}
if (flags & NDR_OUT) {
NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.hnd));
if (r->out.hnd) {
- NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.hnd));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.hnd));
}
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
@@ -18143,7 +18143,7 @@ static enum ndr_err_code ndr_pull_srvsvc_NetShareDelCommit(struct ndr_pull *ndr,
if (r->in.hnd) {
_mem_save_hnd_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.hnd, 0);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.hnd));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.hnd));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hnd_0, 0);
}
}
@@ -18157,7 +18157,7 @@ static enum ndr_err_code ndr_pull_srvsvc_NetShareDelCommit(struct ndr_pull *ndr,
if (r->out.hnd) {
_mem_save_hnd_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.hnd, 0);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.hnd));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.hnd));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hnd_0, 0);
}
NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
diff --git a/source3/librpc/gen_ndr/ndr_svcctl.c b/source3/librpc/gen_ndr/ndr_svcctl.c
index eb3929696e..e897ef334b 100644
--- a/source3/librpc/gen_ndr/ndr_svcctl.c
+++ b/source3/librpc/gen_ndr/ndr_svcctl.c
@@ -3,6 +3,7 @@
#include "includes.h"
#include "librpc/gen_ndr/ndr_svcctl.h"
+#include "librpc/gen_ndr/ndr_misc.h"
static enum ndr_err_code ndr_push_SERVICE_LOCK_STATUS(struct ndr_push *ndr, int ndr_flags, const struct SERVICE_LOCK_STATUS *r)
{
if (ndr_flags & NDR_SCALARS) {
@@ -352,19 +353,228 @@ _PUBLIC_ void ndr_print_svcctl_ServiceAccessMask(struct ndr_print *ndr, const ch
ndr->depth--;
}
+_PUBLIC_ enum ndr_err_code ndr_push_QUERY_SERVICE_CONFIG(struct ndr_push *ndr, int ndr_flags, const struct QUERY_SERVICE_CONFIG *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->service_type));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->start_type));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->error_control));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->executablepath));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->loadordergroup));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->tag_id));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->dependencies));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->startname));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->displayname));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->executablepath) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->executablepath, CH_UTF16)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->executablepath, CH_UTF16)));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->executablepath, ndr_charset_length(r->executablepath, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+ }
+ if (r->loadordergroup) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->loadordergroup, CH_UTF16)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->loadordergroup, CH_UTF16)));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->loadordergroup, ndr_charset_length(r->loadordergroup, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+ }
+ if (r->dependencies) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->dependencies, CH_UTF16)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->dependencies, CH_UTF16)));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->dependencies, ndr_charset_length(r->dependencies, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+ }
+ if (r->startname) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->startname, CH_UTF16)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->startname, CH_UTF16)));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->startname, ndr_charset_length(r->startname, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+ }
+ if (r->displayname) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->displayname, CH_UTF16)));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->displayname, CH_UTF16)));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->displayname, ndr_charset_length(r->displayname, CH_UTF16), sizeof(uint16_t), CH_UTF16));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_QUERY_SERVICE_CONFIG(struct ndr_pull *ndr, int ndr_flags, struct QUERY_SERVICE_CONFIG *r)
+{
+ uint32_t _ptr_executablepath;
+ TALLOC_CTX *_mem_save_executablepath_0;
+ uint32_t _ptr_loadordergroup;
+ TALLOC_CTX *_mem_save_loadordergroup_0;
+ uint32_t _ptr_dependencies;
+ TALLOC_CTX *_mem_save_dependencies_0;
+ uint32_t _ptr_startname;
+ TALLOC_CTX *_mem_save_startname_0;
+ uint32_t _ptr_displayname;
+ TALLOC_CTX *_mem_save_displayname_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->service_type));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->start_type));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->error_control));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_executablepath));
+ if (_ptr_executablepath) {
+ NDR_PULL_ALLOC(ndr, r->executablepath);
+ } else {
+ r->executablepath = NULL;
+ }
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_loadordergroup));
+ if (_ptr_loadordergroup) {
+ NDR_PULL_ALLOC(ndr, r->loadordergroup);
+ } else {
+ r->loadordergroup = NULL;
+ }
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->tag_id));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dependencies));
+ if (_ptr_dependencies) {
+ NDR_PULL_ALLOC(ndr, r->dependencies);
+ } else {
+ r->dependencies = NULL;
+ }
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_startname));
+ if (_ptr_startname) {
+ NDR_PULL_ALLOC(ndr, r->startname);
+ } else {
+ r->startname = NULL;
+ }
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_displayname));
+ if (_ptr_displayname) {
+ NDR_PULL_ALLOC(ndr, r->displayname);
+ } else {
+ r->displayname = NULL;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->executablepath) {
+ _mem_save_executablepath_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->executablepath, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->executablepath));
+ NDR_CHECK(ndr_pull_array_length(ndr, &r->executablepath));
+ if (ndr_get_array_length(ndr, &r->executablepath) > ndr_get_array_size(ndr, &r->executablepath)) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->executablepath), ndr_get_array_length(ndr, &r->executablepath));
+ }
+ NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->executablepath), sizeof(uint16_t)));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->executablepath, ndr_get_array_length(ndr, &r->executablepath), sizeof(uint16_t), CH_UTF16));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_executablepath_0, 0);
+ }
+ if (r->loadordergroup) {
+ _mem_save_loadordergroup_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->loadordergroup, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->loadordergroup));
+ NDR_CHECK(ndr_pull_array_length(ndr, &r->loadordergroup));
+ if (ndr_get_array_length(ndr, &r->loadordergroup) > ndr_get_array_size(ndr, &r->loadordergroup)) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->loadordergroup), ndr_get_array_length(ndr, &r->loadordergroup));
+ }
+ NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->loadordergroup), sizeof(uint16_t)));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->loadordergroup, ndr_get_array_length(ndr, &r->loadordergroup), sizeof(uint16_t), CH_UTF16));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_loadordergroup_0, 0);
+ }
+ if (r->dependencies) {
+ _mem_save_dependencies_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->dependencies, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->dependencies));
+ NDR_CHECK(ndr_pull_array_length(ndr, &r->dependencies));
+ if (ndr_get_array_length(ndr, &r->dependencies) > ndr_get_array_size(ndr, &r->dependencies)) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->dependencies), ndr_get_array_length(ndr, &r->dependencies));
+ }
+ NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->dependencies), sizeof(uint16_t)));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->dependencies, ndr_get_array_length(ndr, &r->dependencies), sizeof(uint16_t), CH_UTF16));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dependencies_0, 0);
+ }
+ if (r->startname) {
+ _mem_save_startname_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->startname, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->startname));
+ NDR_CHECK(ndr_pull_array_length(ndr, &r->startname));
+ if (ndr_get_array_length(ndr, &r->startname) > ndr_get_array_size(ndr, &r->startname)) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->startname), ndr_get_array_length(ndr, &r->startname));
+ }
+ NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->startname), sizeof(uint16_t)));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->startname, ndr_get_array_length(ndr, &r->startname), sizeof(uint16_t), CH_UTF16));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_startname_0, 0);
+ }
+ if (r->displayname) {
+ _mem_save_displayname_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->displayname, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->displayname));
+ NDR_CHECK(ndr_pull_array_length(ndr, &r->displayname));
+ if (ndr_get_array_length(ndr, &r->displayname) > ndr_get_array_size(ndr, &r->displayname)) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->displayname), ndr_get_array_length(ndr, &r->displayname));
+ }
+ NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->displayname), sizeof(uint16_t)));
+ NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->displayname, ndr_get_array_length(ndr, &r->displayname), sizeof(uint16_t), CH_UTF16));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_displayname_0, 0);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_QUERY_SERVICE_CONFIG(struct ndr_print *ndr, const char *name, const struct QUERY_SERVICE_CONFIG *r)
+{
+ ndr_print_struct(ndr, name, "QUERY_SERVICE_CONFIG");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "service_type", r->service_type);
+ ndr_print_uint32(ndr, "start_type", r->start_type);
+ ndr_print_uint32(ndr, "error_control", r->error_control);
+ ndr_print_ptr(ndr, "executablepath", r->executablepath);
+ ndr->depth++;
+ if (r->executablepath) {
+ ndr_print_string(ndr, "executablepath", r->executablepath);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "loadordergroup", r->loadordergroup);
+ ndr->depth++;
+ if (r->loadordergroup) {
+ ndr_print_string(ndr, "loadordergroup", r->loadordergroup);
+ }
+ ndr->depth--;
+ ndr_print_uint32(ndr, "tag_id", r->tag_id);
+ ndr_print_ptr(ndr, "dependencies", r->dependencies);
+ ndr->depth++;
+ if (r->dependencies) {
+ ndr_print_string(ndr, "dependencies", r->dependencies);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "startname", r->startname);
+ ndr->depth++;
+ if (r->startname) {
+ ndr_print_string(ndr, "startname", r->startname);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "displayname", r->displayname);
+ ndr->depth++;
+ if (r->displayname) {
+ ndr_print_string(ndr, "displayname", r->displayname);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
+_PUBLIC_ size_t ndr_size_QUERY_SERVICE_CONFIG(const struct QUERY_SERVICE_CONFIG *r, int flags)
+{
+ return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_QUERY_SERVICE_CONFIG);
+}
+
static enum ndr_err_code ndr_push_svcctl_CloseServiceHandle(struct ndr_push *ndr, int flags, const struct svcctl_CloseServiceHandle *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_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|NDR_BUFFERS, r->out.handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -381,7 +591,7 @@ static enum ndr_err_code ndr_pull_svcctl_CloseServiceHandle(struct ndr_pull *ndr
}
_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_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;
@@ -392,7 +602,7 @@ static enum ndr_err_code ndr_pull_svcctl_CloseServiceHandle(struct ndr_pull *ndr
}
_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|NDR_BUFFERS, r->out.handle));
+ 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_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
@@ -434,7 +644,7 @@ static enum ndr_err_code ndr_push_svcctl_ControlService(struct ndr_push *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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.control));
}
if (flags & NDR_OUT) {
@@ -459,7 +669,7 @@ static enum ndr_err_code ndr_pull_svcctl_ControlService(struct ndr_pull *ndr, in
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.control));
NDR_PULL_ALLOC(ndr, r->out.service_status);
@@ -514,7 +724,7 @@ static enum ndr_err_code ndr_push_svcctl_DeleteService(struct ndr_push *ndr, int
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
}
if (flags & NDR_OUT) {
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
@@ -531,7 +741,7 @@ static enum ndr_err_code ndr_pull_svcctl_DeleteService(struct ndr_pull *ndr, int
}
_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_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);
}
if (flags & NDR_OUT) {
@@ -571,13 +781,13 @@ static enum ndr_err_code ndr_push_svcctl_LockServiceDatabase(struct ndr_push *nd
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
}
if (flags & NDR_OUT) {
if (r->out.lock == 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->out.lock));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.lock));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -595,7 +805,7 @@ static enum ndr_err_code ndr_pull_svcctl_LockServiceDatabase(struct ndr_pull *nd
}
_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_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.lock);
ZERO_STRUCTP(r->out.lock);
@@ -606,7 +816,7 @@ static enum ndr_err_code ndr_pull_svcctl_LockServiceDatabase(struct ndr_pull *nd
}
_mem_save_lock_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.lock, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.lock));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.lock));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_lock_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
@@ -648,7 +858,7 @@ static enum ndr_err_code ndr_push_svcctl_QueryServiceObjectSecurity(struct ndr_p
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.security_flags));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buffer_size));
}
@@ -679,7 +889,7 @@ static enum ndr_err_code ndr_pull_svcctl_QueryServiceObjectSecurity(struct ndr_p
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.security_flags));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buffer_size));
@@ -756,7 +966,7 @@ static enum ndr_err_code ndr_push_svcctl_SetServiceObjectSecurity(struct ndr_pus
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.security_flags));
if (r->in.buffer == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
@@ -780,7 +990,7 @@ static enum ndr_err_code ndr_pull_svcctl_SetServiceObjectSecurity(struct ndr_pul
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.security_flags));
NDR_CHECK(ndr_pull_array_size(ndr, &r->in.buffer));
@@ -836,7 +1046,7 @@ static enum ndr_err_code ndr_push_svcctl_QueryServiceStatus(struct ndr_push *ndr
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
}
if (flags & NDR_OUT) {
if (r->out.service_status == NULL) {
@@ -860,7 +1070,7 @@ static enum ndr_err_code ndr_pull_svcctl_QueryServiceStatus(struct ndr_pull *ndr
}
_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_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.service_status);
ZERO_STRUCTP(r->out.service_status);
@@ -954,13 +1164,13 @@ static enum ndr_err_code ndr_push_svcctl_UnlockServiceDatabase(struct ndr_push *
if (r->in.lock == 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.lock));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.lock));
}
if (flags & NDR_OUT) {
if (r->out.lock == 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->out.lock));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.lock));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -977,7 +1187,7 @@ static enum ndr_err_code ndr_pull_svcctl_UnlockServiceDatabase(struct ndr_pull *
}
_mem_save_lock_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.lock, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.lock));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.lock));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_lock_0, LIBNDR_FLAG_REF_ALLOC);
NDR_PULL_ALLOC(ndr, r->out.lock);
*r->out.lock = *r->in.lock;
@@ -988,7 +1198,7 @@ static enum ndr_err_code ndr_pull_svcctl_UnlockServiceDatabase(struct ndr_pull *
}
_mem_save_lock_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.lock, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.lock));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.lock));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_lock_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
@@ -1071,7 +1281,7 @@ static enum ndr_err_code ndr_push_svcctl_SCSetServiceBitsW(struct ndr_push *ndr,
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.bits));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.bitson));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.immediate));
@@ -1091,7 +1301,7 @@ static enum ndr_err_code ndr_pull_svcctl_SCSetServiceBitsW(struct ndr_pull *ndr,
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.bits));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.bitson));
@@ -1137,7 +1347,7 @@ static enum ndr_err_code ndr_push_svcctl_ChangeServiceConfigW(struct ndr_push *n
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.type));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.start));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.error));
@@ -1218,7 +1428,7 @@ static enum ndr_err_code ndr_pull_svcctl_ChangeServiceConfigW(struct ndr_pull *n
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.type));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.start));
@@ -1421,7 +1631,7 @@ static enum ndr_err_code ndr_push_svcctl_CreateServiceW(struct ndr_push *ndr, in
if (r->in.scmanager_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.scmanager_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.scmanager_handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.ServiceName, CH_UTF16)));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.ServiceName, CH_UTF16)));
@@ -1480,7 +1690,7 @@ static enum ndr_err_code ndr_push_svcctl_CreateServiceW(struct ndr_push *ndr, in
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|NDR_BUFFERS, r->out.handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -1510,7 +1720,7 @@ static enum ndr_err_code ndr_pull_svcctl_CreateServiceW(struct ndr_pull *ndr, in
}
_mem_save_scmanager_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.scmanager_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.scmanager_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.scmanager_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_scmanager_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_array_size(ndr, &r->in.ServiceName));
NDR_CHECK(ndr_pull_array_length(ndr, &r->in.ServiceName));
@@ -1653,7 +1863,7 @@ static enum ndr_err_code ndr_pull_svcctl_CreateServiceW(struct ndr_pull *ndr, in
}
_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|NDR_BUFFERS, r->out.handle));
+ 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_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
@@ -1745,7 +1955,7 @@ static enum ndr_err_code ndr_push_svcctl_EnumDependentServicesW(struct ndr_push
if (r->in.service == 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.service));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.service));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.state));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
}
@@ -1781,7 +1991,7 @@ static enum ndr_err_code ndr_pull_svcctl_EnumDependentServicesW(struct ndr_pull
}
_mem_save_service_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.service, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.service));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.service));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_service_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.state));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
@@ -1874,7 +2084,7 @@ static enum ndr_err_code ndr_push_svcctl_EnumServicesStatusW(struct ndr_push *nd
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.type));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.state));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
@@ -1918,7 +2128,7 @@ static enum ndr_err_code ndr_pull_svcctl_EnumServicesStatusW(struct ndr_pull *nd
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.type));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.state));
@@ -2050,7 +2260,7 @@ static enum ndr_err_code ndr_push_svcctl_OpenSCManagerW(struct ndr_push *ndr, in
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|NDR_BUFFERS, r->out.handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -2112,7 +2322,7 @@ static enum ndr_err_code ndr_pull_svcctl_OpenSCManagerW(struct ndr_pull *ndr, in
}
_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|NDR_BUFFERS, r->out.handle));
+ 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_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
@@ -2163,7 +2373,7 @@ static enum ndr_err_code ndr_push_svcctl_OpenServiceW(struct ndr_push *ndr, int
if (r->in.scmanager_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.scmanager_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.scmanager_handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.ServiceName, CH_UTF16)));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.ServiceName, CH_UTF16)));
@@ -2174,7 +2384,7 @@ static enum ndr_err_code ndr_push_svcctl_OpenServiceW(struct ndr_push *ndr, int
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|NDR_BUFFERS, r->out.handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -2192,7 +2402,7 @@ static enum ndr_err_code ndr_pull_svcctl_OpenServiceW(struct ndr_pull *ndr, int
}
_mem_save_scmanager_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.scmanager_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.scmanager_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.scmanager_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_scmanager_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_array_size(ndr, &r->in.ServiceName));
NDR_CHECK(ndr_pull_array_length(ndr, &r->in.ServiceName));
@@ -2211,7 +2421,7 @@ static enum ndr_err_code ndr_pull_svcctl_OpenServiceW(struct ndr_pull *ndr, int
}
_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|NDR_BUFFERS, r->out.handle));
+ 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_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
@@ -2255,11 +2465,14 @@ static enum ndr_err_code ndr_push_svcctl_QueryServiceConfigW(struct ndr_push *nd
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
}
if (flags & NDR_OUT) {
- NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.query, r->in.buf_size));
+ if (r->out.query == NULL) {
+ return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
+ }
+ NDR_CHECK(ndr_push_QUERY_SERVICE_CONFIG(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.query));
if (r->out.bytes_needed == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -2272,6 +2485,7 @@ static enum ndr_err_code ndr_push_svcctl_QueryServiceConfigW(struct ndr_push *nd
static enum ndr_err_code ndr_pull_svcctl_QueryServiceConfigW(struct ndr_pull *ndr, int flags, struct svcctl_QueryServiceConfigW *r)
{
TALLOC_CTX *_mem_save_handle_0;
+ TALLOC_CTX *_mem_save_query_0;
TALLOC_CTX *_mem_save_bytes_needed_0;
if (flags & NDR_IN) {
ZERO_STRUCT(r->out);
@@ -2281,21 +2495,34 @@ static enum ndr_err_code ndr_pull_svcctl_QueryServiceConfigW(struct ndr_pull *nd
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
+ if (r->in.buf_size < 0 || r->in.buf_size > 8192) {
+ return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+ }
+ NDR_PULL_ALLOC(ndr, r->out.query);
+ ZERO_STRUCTP(r->out.query);
NDR_PULL_ALLOC(ndr, r->out.bytes_needed);
ZERO_STRUCTP(r->out.bytes_needed);
}
if (flags & NDR_OUT) {
- NDR_PULL_ALLOC_N(ndr, r->out.query, r->in.buf_size);
- NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->out.query, r->in.buf_size));
+ if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
+ NDR_PULL_ALLOC(ndr, r->out.query);
+ }
+ _mem_save_query_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.query, LIBNDR_FLAG_REF_ALLOC);
+ NDR_CHECK(ndr_pull_QUERY_SERVICE_CONFIG(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.query));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_query_0, LIBNDR_FLAG_REF_ALLOC);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->out.bytes_needed);
}
_mem_save_bytes_needed_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.bytes_needed, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.bytes_needed));
+ if (*r->out.bytes_needed < 0 || *r->out.bytes_needed > 8192) {
+ return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+ }
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_bytes_needed_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
@@ -2322,7 +2549,10 @@ _PUBLIC_ void ndr_print_svcctl_QueryServiceConfigW(struct ndr_print *ndr, const
if (flags & NDR_OUT) {
ndr_print_struct(ndr, "out", "svcctl_QueryServiceConfigW");
ndr->depth++;
- ndr_print_array_uint8(ndr, "query", r->out.query, r->in.buf_size);
+ ndr_print_ptr(ndr, "query", r->out.query);
+ ndr->depth++;
+ ndr_print_QUERY_SERVICE_CONFIG(ndr, "query", r->out.query);
+ ndr->depth--;
ndr_print_ptr(ndr, "bytes_needed", r->out.bytes_needed);
ndr->depth++;
ndr_print_uint32(ndr, "bytes_needed", *r->out.bytes_needed);
@@ -2339,7 +2569,7 @@ static enum ndr_err_code ndr_push_svcctl_QueryServiceLockStatusW(struct ndr_push
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
}
if (flags & NDR_OUT) {
@@ -2369,7 +2599,7 @@ static enum ndr_err_code ndr_pull_svcctl_QueryServiceLockStatusW(struct ndr_pull
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
NDR_PULL_ALLOC(ndr, r->out.lock_status);
@@ -2437,7 +2667,7 @@ static enum ndr_err_code ndr_push_svcctl_StartServiceW(struct ndr_push *ndr, int
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.NumArgs));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.Arguments));
if (r->in.Arguments) {
@@ -2464,7 +2694,7 @@ static enum ndr_err_code ndr_pull_svcctl_StartServiceW(struct ndr_pull *ndr, int
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.NumArgs));
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_Arguments));
@@ -2530,7 +2760,7 @@ static enum ndr_err_code ndr_push_svcctl_GetServiceDisplayNameW(struct ndr_push
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.service_name));
if (r->in.service_name) {
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.service_name, CH_UTF16)));
@@ -2581,7 +2811,7 @@ static enum ndr_err_code ndr_pull_svcctl_GetServiceDisplayNameW(struct ndr_pull
}
_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_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_generic_ptr(ndr, &_ptr_service_name));
if (_ptr_service_name) {
@@ -2716,7 +2946,7 @@ static enum ndr_err_code ndr_push_svcctl_GetServiceKeyNameW(struct ndr_push *ndr
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.service_name));
if (r->in.service_name) {
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.service_name, CH_UTF16)));
@@ -2767,7 +2997,7 @@ static enum ndr_err_code ndr_pull_svcctl_GetServiceKeyNameW(struct ndr_pull *ndr
}
_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_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_generic_ptr(ndr, &_ptr_service_name));
if (_ptr_service_name) {
@@ -2902,7 +3132,7 @@ static enum ndr_err_code ndr_push_svcctl_SCSetServiceBitsA(struct ndr_push *ndr,
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.bits));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.bitson));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.immediate));
@@ -2922,7 +3152,7 @@ static enum ndr_err_code ndr_pull_svcctl_SCSetServiceBitsA(struct ndr_pull *ndr,
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.bits));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.bitson));
@@ -2968,7 +3198,7 @@ static enum ndr_err_code ndr_push_svcctl_ChangeServiceConfigA(struct ndr_push *n
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.type));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.start));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.error));
@@ -3049,7 +3279,7 @@ static enum ndr_err_code ndr_pull_svcctl_ChangeServiceConfigA(struct ndr_pull *n
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.type));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.start));
@@ -3252,7 +3482,7 @@ static enum ndr_err_code ndr_push_svcctl_CreateServiceA(struct ndr_push *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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.ServiceName));
if (r->in.ServiceName) {
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.ServiceName, CH_UTF16)));
@@ -3344,7 +3574,7 @@ static enum ndr_err_code ndr_pull_svcctl_CreateServiceA(struct ndr_pull *ndr, in
}
_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_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_generic_ptr(ndr, &_ptr_ServiceName));
if (_ptr_ServiceName) {
@@ -3578,7 +3808,7 @@ static enum ndr_err_code ndr_push_svcctl_EnumDependentServicesA(struct ndr_push
if (r->in.service == 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.service));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.service));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.state));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
}
@@ -3615,7 +3845,7 @@ static enum ndr_err_code ndr_pull_svcctl_EnumDependentServicesA(struct ndr_pull
}
_mem_save_service_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.service, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.service));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.service));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_service_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.state));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
@@ -3703,7 +3933,7 @@ static enum ndr_err_code ndr_push_svcctl_EnumServicesStatusA(struct ndr_push *nd
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.type));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.state));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
@@ -3747,7 +3977,7 @@ static enum ndr_err_code ndr_pull_svcctl_EnumServicesStatusA(struct ndr_pull *nd
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.type));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.state));
@@ -3879,7 +4109,7 @@ static enum ndr_err_code ndr_push_svcctl_OpenSCManagerA(struct ndr_push *ndr, in
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|NDR_BUFFERS, r->out.handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -3941,7 +4171,7 @@ static enum ndr_err_code ndr_pull_svcctl_OpenSCManagerA(struct ndr_pull *ndr, in
}
_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|NDR_BUFFERS, r->out.handle));
+ 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_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
@@ -3992,7 +4222,7 @@ static enum ndr_err_code ndr_push_svcctl_OpenServiceA(struct ndr_push *ndr, int
if (r->in.scmanager_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.scmanager_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.scmanager_handle));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.ServiceName));
if (r->in.ServiceName) {
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.ServiceName, CH_UTF16)));
@@ -4019,7 +4249,7 @@ static enum ndr_err_code ndr_pull_svcctl_OpenServiceA(struct ndr_pull *ndr, int
}
_mem_save_scmanager_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.scmanager_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.scmanager_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.scmanager_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_scmanager_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_ServiceName));
if (_ptr_ServiceName) {
@@ -4085,7 +4315,7 @@ static enum ndr_err_code ndr_push_svcctl_QueryServiceConfigA(struct ndr_push *nd
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
}
if (flags & NDR_OUT) {
@@ -4111,7 +4341,7 @@ static enum ndr_err_code ndr_pull_svcctl_QueryServiceConfigA(struct ndr_pull *nd
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
NDR_PULL_ALLOC(ndr, r->out.bytes_needed);
@@ -4169,7 +4399,7 @@ static enum ndr_err_code ndr_push_svcctl_QueryServiceLockStatusA(struct ndr_push
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
}
if (flags & NDR_OUT) {
@@ -4199,7 +4429,7 @@ static enum ndr_err_code ndr_pull_svcctl_QueryServiceLockStatusA(struct ndr_pull
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
NDR_PULL_ALLOC(ndr, r->out.lock_status);
@@ -4267,7 +4497,7 @@ static enum ndr_err_code ndr_push_svcctl_StartServiceA(struct ndr_push *ndr, int
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.NumArgs));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.Arguments));
if (r->in.Arguments) {
@@ -4294,7 +4524,7 @@ static enum ndr_err_code ndr_pull_svcctl_StartServiceA(struct ndr_pull *ndr, int
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.NumArgs));
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_Arguments));
@@ -4360,7 +4590,7 @@ static enum ndr_err_code ndr_push_svcctl_GetServiceDisplayNameA(struct ndr_push
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.service_name));
if (r->in.service_name) {
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.service_name, CH_UTF16)));
@@ -4411,7 +4641,7 @@ static enum ndr_err_code ndr_pull_svcctl_GetServiceDisplayNameA(struct ndr_pull
}
_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_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_generic_ptr(ndr, &_ptr_service_name));
if (_ptr_service_name) {
@@ -4546,7 +4776,7 @@ static enum ndr_err_code ndr_push_svcctl_GetServiceKeyNameA(struct ndr_push *ndr
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.service_name));
if (r->in.service_name) {
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.service_name, CH_UTF16)));
@@ -4597,7 +4827,7 @@ static enum ndr_err_code ndr_pull_svcctl_GetServiceKeyNameA(struct ndr_pull *ndr
}
_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_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_generic_ptr(ndr, &_ptr_service_name));
if (_ptr_service_name) {
@@ -4814,7 +5044,7 @@ static enum ndr_err_code ndr_push_svcctl_ChangeServiceConfig2A(struct ndr_push *
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.info_level));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.info));
if (r->in.info) {
@@ -4838,7 +5068,7 @@ static enum ndr_err_code ndr_pull_svcctl_ChangeServiceConfig2A(struct ndr_pull *
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.info_level));
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info));
@@ -4898,7 +5128,7 @@ static enum ndr_err_code ndr_push_svcctl_ChangeServiceConfig2W(struct ndr_push *
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.info_level));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.info));
if (r->in.info) {
@@ -4922,7 +5152,7 @@ static enum ndr_err_code ndr_pull_svcctl_ChangeServiceConfig2W(struct ndr_pull *
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.info_level));
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info));
@@ -4982,7 +5212,7 @@ static enum ndr_err_code ndr_push_svcctl_QueryServiceConfig2A(struct ndr_push *n
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.info_level));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
}
@@ -5009,7 +5239,7 @@ static enum ndr_err_code ndr_pull_svcctl_QueryServiceConfig2A(struct ndr_pull *n
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.info_level));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
@@ -5069,7 +5299,7 @@ static enum ndr_err_code ndr_push_svcctl_QueryServiceConfig2W(struct ndr_push *n
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.info_level));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
}
@@ -5096,7 +5326,7 @@ static enum ndr_err_code ndr_pull_svcctl_QueryServiceConfig2W(struct ndr_pull *n
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.info_level));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
@@ -5156,7 +5386,7 @@ static enum ndr_err_code ndr_push_svcctl_QueryServiceStatusEx(struct ndr_push *n
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.info_level));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size));
}
@@ -5183,7 +5413,7 @@ static enum ndr_err_code ndr_pull_svcctl_QueryServiceStatusEx(struct ndr_pull *n
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.info_level));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size));
@@ -5243,7 +5473,7 @@ static enum ndr_err_code ndr_push_EnumServicesStatusExA(struct ndr_push *ndr, in
if (r->in.scmanager == 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.scmanager));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.scmanager));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.info_level));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.type));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.state));
@@ -5300,7 +5530,7 @@ static enum ndr_err_code ndr_pull_EnumServicesStatusExA(struct ndr_pull *ndr, in
}
_mem_save_scmanager_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.scmanager, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.scmanager));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.scmanager));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_scmanager_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.info_level));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.type));
@@ -5448,7 +5678,7 @@ static enum ndr_err_code ndr_push_EnumServicesStatusExW(struct ndr_push *ndr, in
if (r->in.scmanager == 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.scmanager));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.scmanager));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.info_level));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.type));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.state));
@@ -5505,7 +5735,7 @@ static enum ndr_err_code ndr_pull_EnumServicesStatusExW(struct ndr_pull *ndr, in
}
_mem_save_scmanager_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.scmanager, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.scmanager));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.scmanager));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_scmanager_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.info_level));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.type));
diff --git a/source3/librpc/gen_ndr/ndr_svcctl.h b/source3/librpc/gen_ndr/ndr_svcctl.h
index 4475b08792..0bebd3401a 100644
--- a/source3/librpc/gen_ndr/ndr_svcctl.h
+++ b/source3/librpc/gen_ndr/ndr_svcctl.h
@@ -108,6 +108,10 @@ enum ndr_err_code ndr_pull_svcctl_ServerType(struct ndr_pull *ndr, int ndr_flags
void ndr_print_svcctl_ServerType(struct ndr_print *ndr, const char *name, uint32_t r);
void ndr_print_svcctl_MgrAccessMask(struct ndr_print *ndr, const char *name, uint32_t r);
void ndr_print_svcctl_ServiceAccessMask(struct ndr_print *ndr, const char *name, uint32_t r);
+enum ndr_err_code ndr_push_QUERY_SERVICE_CONFIG(struct ndr_push *ndr, int ndr_flags, const struct QUERY_SERVICE_CONFIG *r);
+enum ndr_err_code ndr_pull_QUERY_SERVICE_CONFIG(struct ndr_pull *ndr, int ndr_flags, struct QUERY_SERVICE_CONFIG *r);
+void ndr_print_QUERY_SERVICE_CONFIG(struct ndr_print *ndr, const char *name, const struct QUERY_SERVICE_CONFIG *r);
+size_t ndr_size_QUERY_SERVICE_CONFIG(const struct QUERY_SERVICE_CONFIG *r, int flags);
void ndr_print_svcctl_CloseServiceHandle(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_CloseServiceHandle *r);
void ndr_print_svcctl_ControlService(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_ControlService *r);
void ndr_print_svcctl_DeleteService(struct ndr_print *ndr, const char *name, int flags, const struct svcctl_DeleteService *r);
diff --git a/source3/librpc/gen_ndr/ndr_winreg.c b/source3/librpc/gen_ndr/ndr_winreg.c
index 053e155616..791d11103d 100644
--- a/source3/librpc/gen_ndr/ndr_winreg.c
+++ b/source3/librpc/gen_ndr/ndr_winreg.c
@@ -4,7 +4,6 @@
#include "librpc/gen_ndr/ndr_winreg.h"
#include "librpc/gen_ndr/ndr_lsa.h"
-#include "librpc/gen_ndr/ndr_initshutdown.h"
#include "librpc/gen_ndr/ndr_security.h"
static enum ndr_err_code ndr_push_winreg_AccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r)
{
@@ -35,13 +34,13 @@ _PUBLIC_ void ndr_print_winreg_AccessMask(struct ndr_print *ndr, const char *nam
ndr->depth--;
}
-static enum ndr_err_code ndr_push_winreg_Type(struct ndr_push *ndr, int ndr_flags, enum winreg_Type r)
+_PUBLIC_ enum ndr_err_code ndr_push_winreg_Type(struct ndr_push *ndr, int ndr_flags, enum winreg_Type r)
{
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_winreg_Type(struct ndr_pull *ndr, int ndr_flags, enum winreg_Type *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_winreg_Type(struct ndr_pull *ndr, int ndr_flags, enum winreg_Type *r)
{
uint32_t v;
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
@@ -276,7 +275,7 @@ static enum ndr_err_code ndr_push_winreg_StringBuf(struct ndr_push *ndr, int ndr
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m_term_null(r->name) * 2));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m_term(r->name) * 2));
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->size));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->name));
}
@@ -284,8 +283,8 @@ static enum ndr_err_code ndr_push_winreg_StringBuf(struct ndr_push *ndr, int ndr
if (r->name) {
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size / 2));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, strlen_m_term_null(r->name) * 2 / 2));
- NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, strlen_m_term_null(r->name) * 2 / 2, sizeof(uint16_t), CH_UTF16));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, strlen_m_term(r->name) * 2 / 2));
+ NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, strlen_m_term(r->name) * 2 / 2, sizeof(uint16_t), CH_UTF16));
}
}
return NDR_ERR_SUCCESS;
@@ -332,7 +331,7 @@ _PUBLIC_ void ndr_print_winreg_StringBuf(struct ndr_print *ndr, const char *name
{
ndr_print_struct(ndr, name, "winreg_StringBuf");
ndr->depth++;
- ndr_print_uint16(ndr, "length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m_term_null(r->name) * 2:r->length);
+ ndr_print_uint16(ndr, "length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m_term(r->name) * 2:r->length);
ndr_print_uint16(ndr, "size", r->size);
ndr_print_ptr(ndr, "name", r->name);
ndr->depth++;
@@ -343,74 +342,28 @@ _PUBLIC_ void ndr_print_winreg_StringBuf(struct ndr_print *ndr, const char *name
ndr->depth--;
}
-static enum ndr_err_code ndr_push_winreg_ValNameBuf(struct ndr_push *ndr, int ndr_flags, const struct winreg_ValNameBuf *r)
+_PUBLIC_ enum ndr_err_code ndr_push_winreg_NotifyChangeType(struct ndr_push *ndr, int ndr_flags, uint32_t r)
{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m_term(r->name) * 2));
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->size));
- NDR_CHECK(ndr_push_unique_ptr(ndr, r->name));
- }
- if (ndr_flags & NDR_BUFFERS) {
- if (r->name) {
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size / 2));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, strlen_m_term(r->name) * 2 / 2));
- NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, strlen_m_term(r->name) * 2 / 2, sizeof(uint16_t), CH_UTF16));
- }
- }
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_winreg_ValNameBuf(struct ndr_pull *ndr, int ndr_flags, struct winreg_ValNameBuf *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_winreg_NotifyChangeType(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
{
- uint32_t _ptr_name;
- TALLOC_CTX *_mem_save_name_0;
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name));
- if (_ptr_name) {
- NDR_PULL_ALLOC(ndr, r->name);
- } else {
- r->name = NULL;
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- if (r->name) {
- _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->name, 0);
- NDR_CHECK(ndr_pull_array_size(ndr, &r->name));
- NDR_CHECK(ndr_pull_array_length(ndr, &r->name));
- if (ndr_get_array_length(ndr, &r->name) > ndr_get_array_size(ndr, &r->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->name), ndr_get_array_length(ndr, &r->name));
- }
- NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->name, ndr_get_array_length(ndr, &r->name), sizeof(uint16_t), CH_UTF16));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, 0);
- }
- if (r->name) {
- NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->name, r->size / 2));
- }
- if (r->name) {
- NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->name, r->length / 2));
- }
- }
+ uint32_t v;
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
+ *r = v;
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_winreg_ValNameBuf(struct ndr_print *ndr, const char *name, const struct winreg_ValNameBuf *r)
+_PUBLIC_ void ndr_print_winreg_NotifyChangeType(struct ndr_print *ndr, const char *name, uint32_t r)
{
- ndr_print_struct(ndr, name, "winreg_ValNameBuf");
- ndr->depth++;
- ndr_print_uint16(ndr, "length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m_term(r->name) * 2:r->length);
- ndr_print_uint16(ndr, "size", r->size);
- ndr_print_ptr(ndr, "name", r->name);
+ ndr_print_uint32(ndr, name, r);
ndr->depth++;
- if (r->name) {
- ndr_print_string(ndr, "name", r->name);
- }
- ndr->depth--;
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "REG_NOTIFY_CHANGE_NAME", REG_NOTIFY_CHANGE_NAME, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "REG_NOTIFY_CHANGE_ATTRIBUTES", REG_NOTIFY_CHANGE_ATTRIBUTES, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "REG_NOTIFY_CHANGE_LAST_SET", REG_NOTIFY_CHANGE_LAST_SET, r);
+ ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "REG_NOTIFY_CHANGE_SECURITY", REG_NOTIFY_CHANGE_SECURITY, r);
ndr->depth--;
}
@@ -525,7 +478,7 @@ static enum ndr_err_code ndr_push_winreg_OpenHKCR(struct ndr_push *ndr, int flag
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|NDR_BUFFERS, r->out.handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -561,7 +514,7 @@ static enum ndr_err_code ndr_pull_winreg_OpenHKCR(struct ndr_pull *ndr, int flag
}
_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|NDR_BUFFERS, r->out.handle));
+ 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_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
@@ -613,7 +566,7 @@ static enum ndr_err_code ndr_push_winreg_OpenHKCU(struct ndr_push *ndr, int flag
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|NDR_BUFFERS, r->out.handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -649,7 +602,7 @@ static enum ndr_err_code ndr_pull_winreg_OpenHKCU(struct ndr_pull *ndr, int flag
}
_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|NDR_BUFFERS, r->out.handle));
+ 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_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
@@ -688,7 +641,7 @@ _PUBLIC_ void ndr_print_winreg_OpenHKCU(struct ndr_print *ndr, const char *name,
ndr->depth--;
}
-static enum ndr_err_code ndr_push_winreg_OpenHKLM(struct ndr_push *ndr, int flags, const struct winreg_OpenHKLM *r)
+_PUBLIC_ enum ndr_err_code ndr_push_winreg_OpenHKLM(struct ndr_push *ndr, int flags, const struct winreg_OpenHKLM *r)
{
if (flags & NDR_IN) {
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name));
@@ -701,13 +654,13 @@ static enum ndr_err_code ndr_push_winreg_OpenHKLM(struct ndr_push *ndr, int flag
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|NDR_BUFFERS, r->out.handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_winreg_OpenHKLM(struct ndr_pull *ndr, int flags, struct winreg_OpenHKLM *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_winreg_OpenHKLM(struct ndr_pull *ndr, int flags, struct winreg_OpenHKLM *r)
{
uint32_t _ptr_system_name;
TALLOC_CTX *_mem_save_system_name_0;
@@ -737,7 +690,7 @@ static enum ndr_err_code ndr_pull_winreg_OpenHKLM(struct ndr_pull *ndr, int flag
}
_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|NDR_BUFFERS, r->out.handle));
+ 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_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
@@ -789,7 +742,7 @@ static enum ndr_err_code ndr_push_winreg_OpenHKPD(struct ndr_push *ndr, int flag
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|NDR_BUFFERS, r->out.handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -825,7 +778,7 @@ static enum ndr_err_code ndr_pull_winreg_OpenHKPD(struct ndr_pull *ndr, int flag
}
_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|NDR_BUFFERS, r->out.handle));
+ 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_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
@@ -877,7 +830,7 @@ static enum ndr_err_code ndr_push_winreg_OpenHKU(struct ndr_push *ndr, int flags
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|NDR_BUFFERS, r->out.handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -913,7 +866,7 @@ static enum ndr_err_code ndr_pull_winreg_OpenHKU(struct ndr_pull *ndr, int flags
}
_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|NDR_BUFFERS, r->out.handle));
+ 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_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
@@ -952,25 +905,25 @@ _PUBLIC_ void ndr_print_winreg_OpenHKU(struct ndr_print *ndr, const char *name,
ndr->depth--;
}
-static enum ndr_err_code ndr_push_winreg_CloseKey(struct ndr_push *ndr, int flags, const struct winreg_CloseKey *r)
+_PUBLIC_ enum ndr_err_code ndr_push_winreg_CloseKey(struct ndr_push *ndr, int flags, const struct winreg_CloseKey *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_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|NDR_BUFFERS, r->out.handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_winreg_CloseKey(struct ndr_pull *ndr, int flags, struct winreg_CloseKey *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_winreg_CloseKey(struct ndr_pull *ndr, int flags, struct winreg_CloseKey *r)
{
TALLOC_CTX *_mem_save_handle_0;
if (flags & NDR_IN) {
@@ -981,7 +934,7 @@ static enum ndr_err_code ndr_pull_winreg_CloseKey(struct ndr_pull *ndr, int flag
}
_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_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;
@@ -992,7 +945,7 @@ static enum ndr_err_code ndr_pull_winreg_CloseKey(struct ndr_pull *ndr, int flag
}
_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|NDR_BUFFERS, r->out.handle));
+ 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_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
@@ -1028,13 +981,13 @@ _PUBLIC_ void ndr_print_winreg_CloseKey(struct ndr_print *ndr, const char *name,
ndr->depth--;
}
-static enum ndr_err_code ndr_push_winreg_CreateKey(struct ndr_push *ndr, int flags, const struct winreg_CreateKey *r)
+_PUBLIC_ enum ndr_err_code ndr_push_winreg_CreateKey(struct ndr_push *ndr, int flags, const struct winreg_CreateKey *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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name));
NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.keyclass));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.options));
@@ -1052,7 +1005,7 @@ static enum ndr_err_code ndr_push_winreg_CreateKey(struct ndr_push *ndr, int fla
if (r->out.new_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->out.new_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.new_handle));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.action_taken));
if (r->out.action_taken) {
NDR_CHECK(ndr_push_winreg_CreateAction(ndr, NDR_SCALARS, *r->out.action_taken));
@@ -1062,7 +1015,7 @@ static enum ndr_err_code ndr_push_winreg_CreateKey(struct ndr_push *ndr, int fla
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_winreg_CreateKey(struct ndr_pull *ndr, int flags, struct winreg_CreateKey *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_winreg_CreateKey(struct ndr_pull *ndr, int flags, struct winreg_CreateKey *r)
{
uint32_t _ptr_secdesc;
uint32_t _ptr_action_taken;
@@ -1078,7 +1031,7 @@ static enum ndr_err_code ndr_pull_winreg_CreateKey(struct ndr_pull *ndr, int fla
}
_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_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_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name));
NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.keyclass));
@@ -1117,7 +1070,7 @@ static enum ndr_err_code ndr_pull_winreg_CreateKey(struct ndr_pull *ndr, int fla
}
_mem_save_new_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.new_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.new_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.new_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_new_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_action_taken));
if (_ptr_action_taken) {
@@ -1187,13 +1140,13 @@ _PUBLIC_ void ndr_print_winreg_CreateKey(struct ndr_print *ndr, const char *name
ndr->depth--;
}
-static enum ndr_err_code ndr_push_winreg_DeleteKey(struct ndr_push *ndr, int flags, const struct winreg_DeleteKey *r)
+_PUBLIC_ enum ndr_err_code ndr_push_winreg_DeleteKey(struct ndr_push *ndr, int flags, const struct winreg_DeleteKey *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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.key));
}
if (flags & NDR_OUT) {
@@ -1202,7 +1155,7 @@ static enum ndr_err_code ndr_push_winreg_DeleteKey(struct ndr_push *ndr, int fla
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_winreg_DeleteKey(struct ndr_pull *ndr, int flags, struct winreg_DeleteKey *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_winreg_DeleteKey(struct ndr_pull *ndr, int flags, struct winreg_DeleteKey *r)
{
TALLOC_CTX *_mem_save_handle_0;
if (flags & NDR_IN) {
@@ -1211,7 +1164,7 @@ static enum ndr_err_code ndr_pull_winreg_DeleteKey(struct ndr_pull *ndr, int fla
}
_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_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_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.key));
}
@@ -1253,7 +1206,7 @@ static enum ndr_err_code ndr_push_winreg_DeleteValue(struct ndr_push *ndr, int f
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.value));
}
if (flags & NDR_OUT) {
@@ -1271,7 +1224,7 @@ static enum ndr_err_code ndr_pull_winreg_DeleteValue(struct ndr_pull *ndr, int f
}
_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_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_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.value));
}
@@ -1307,13 +1260,13 @@ _PUBLIC_ void ndr_print_winreg_DeleteValue(struct ndr_print *ndr, const char *na
ndr->depth--;
}
-static enum ndr_err_code ndr_push_winreg_EnumKey(struct ndr_push *ndr, int flags, const struct winreg_EnumKey *r)
+_PUBLIC_ enum ndr_err_code ndr_push_winreg_EnumKey(struct ndr_push *ndr, int flags, const struct winreg_EnumKey *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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.enum_index));
if (r->in.name == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
@@ -1346,7 +1299,7 @@ static enum ndr_err_code ndr_push_winreg_EnumKey(struct ndr_push *ndr, int flags
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_winreg_EnumKey(struct ndr_pull *ndr, int flags, struct winreg_EnumKey *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_winreg_EnumKey(struct ndr_pull *ndr, int flags, struct winreg_EnumKey *r)
{
uint32_t _ptr_keyclass;
uint32_t _ptr_last_changed_time;
@@ -1362,7 +1315,7 @@ static enum ndr_err_code ndr_pull_winreg_EnumKey(struct ndr_pull *ndr, int flags
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.enum_index));
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
@@ -1494,18 +1447,18 @@ _PUBLIC_ void ndr_print_winreg_EnumKey(struct ndr_print *ndr, const char *name,
ndr->depth--;
}
-static enum ndr_err_code ndr_push_winreg_EnumValue(struct ndr_push *ndr, int flags, const struct winreg_EnumValue *r)
+_PUBLIC_ enum ndr_err_code ndr_push_winreg_EnumValue(struct ndr_push *ndr, int flags, const struct winreg_EnumValue *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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.enum_index));
if (r->in.name == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
- NDR_CHECK(ndr_push_winreg_ValNameBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name));
+ NDR_CHECK(ndr_push_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.type));
if (r->in.type) {
NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, *r->in.type));
@@ -1530,7 +1483,7 @@ static enum ndr_err_code ndr_push_winreg_EnumValue(struct ndr_push *ndr, int fla
if (r->out.name == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
- NDR_CHECK(ndr_push_winreg_ValNameBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.name));
+ NDR_CHECK(ndr_push_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.name));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.type));
if (r->out.type) {
NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, *r->out.type));
@@ -1555,7 +1508,7 @@ static enum ndr_err_code ndr_push_winreg_EnumValue(struct ndr_push *ndr, int fla
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_winreg_EnumValue(struct ndr_pull *ndr, int flags, struct winreg_EnumValue *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_winreg_EnumValue(struct ndr_pull *ndr, int flags, struct winreg_EnumValue *r)
{
uint32_t _ptr_type;
uint32_t _ptr_value;
@@ -1575,7 +1528,7 @@ static enum ndr_err_code ndr_pull_winreg_EnumValue(struct ndr_pull *ndr, int fla
}
_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_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_uint32(ndr, NDR_SCALARS, &r->in.enum_index));
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
@@ -1583,7 +1536,7 @@ static enum ndr_err_code ndr_pull_winreg_EnumValue(struct ndr_pull *ndr, int fla
}
_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_winreg_ValNameBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name));
+ NDR_CHECK(ndr_pull_winreg_StringBuf(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_generic_ptr(ndr, &_ptr_type));
if (_ptr_type) {
@@ -1656,7 +1609,7 @@ static enum ndr_err_code ndr_pull_winreg_EnumValue(struct ndr_pull *ndr, int fla
}
_mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.name, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_winreg_ValNameBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.name));
+ NDR_CHECK(ndr_pull_winreg_StringBuf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.name));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_type));
if (_ptr_type) {
@@ -1742,7 +1695,7 @@ _PUBLIC_ void ndr_print_winreg_EnumValue(struct ndr_print *ndr, const char *name
ndr_print_uint32(ndr, "enum_index", r->in.enum_index);
ndr_print_ptr(ndr, "name", r->in.name);
ndr->depth++;
- ndr_print_winreg_ValNameBuf(ndr, "name", r->in.name);
+ ndr_print_winreg_StringBuf(ndr, "name", r->in.name);
ndr->depth--;
ndr_print_ptr(ndr, "type", r->in.type);
ndr->depth++;
@@ -1776,7 +1729,7 @@ _PUBLIC_ void ndr_print_winreg_EnumValue(struct ndr_print *ndr, const char *name
ndr->depth++;
ndr_print_ptr(ndr, "name", r->out.name);
ndr->depth++;
- ndr_print_winreg_ValNameBuf(ndr, "name", r->out.name);
+ ndr_print_winreg_StringBuf(ndr, "name", r->out.name);
ndr->depth--;
ndr_print_ptr(ndr, "type", r->out.type);
ndr->depth++;
@@ -1809,13 +1762,13 @@ _PUBLIC_ void ndr_print_winreg_EnumValue(struct ndr_print *ndr, const char *name
ndr->depth--;
}
-static enum ndr_err_code ndr_push_winreg_FlushKey(struct ndr_push *ndr, int flags, const struct winreg_FlushKey *r)
+_PUBLIC_ enum ndr_err_code ndr_push_winreg_FlushKey(struct ndr_push *ndr, int flags, const struct winreg_FlushKey *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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
}
if (flags & NDR_OUT) {
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
@@ -1823,7 +1776,7 @@ static enum ndr_err_code ndr_push_winreg_FlushKey(struct ndr_push *ndr, int flag
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_winreg_FlushKey(struct ndr_pull *ndr, int flags, struct winreg_FlushKey *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_winreg_FlushKey(struct ndr_pull *ndr, int flags, struct winreg_FlushKey *r)
{
TALLOC_CTX *_mem_save_handle_0;
if (flags & NDR_IN) {
@@ -1832,7 +1785,7 @@ static enum ndr_err_code ndr_pull_winreg_FlushKey(struct ndr_pull *ndr, int flag
}
_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_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);
}
if (flags & NDR_OUT) {
@@ -1866,13 +1819,13 @@ _PUBLIC_ void ndr_print_winreg_FlushKey(struct ndr_print *ndr, const char *name,
ndr->depth--;
}
-static enum ndr_err_code ndr_push_winreg_GetKeySecurity(struct ndr_push *ndr, int flags, const struct winreg_GetKeySecurity *r)
+_PUBLIC_ enum ndr_err_code ndr_push_winreg_GetKeySecurity(struct ndr_push *ndr, int flags, const struct winreg_GetKeySecurity *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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_security_secinfo(ndr, NDR_SCALARS, r->in.sec_info));
if (r->in.sd == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
@@ -1889,7 +1842,7 @@ static enum ndr_err_code ndr_push_winreg_GetKeySecurity(struct ndr_push *ndr, in
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_winreg_GetKeySecurity(struct ndr_pull *ndr, int flags, struct winreg_GetKeySecurity *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_winreg_GetKeySecurity(struct ndr_pull *ndr, int flags, struct winreg_GetKeySecurity *r)
{
TALLOC_CTX *_mem_save_handle_0;
TALLOC_CTX *_mem_save_sd_0;
@@ -1901,7 +1854,7 @@ static enum ndr_err_code ndr_pull_winreg_GetKeySecurity(struct ndr_pull *ndr, in
}
_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_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) {
@@ -1967,7 +1920,7 @@ static enum ndr_err_code ndr_push_winreg_LoadKey(struct ndr_push *ndr, int flags
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.keyname));
if (r->in.keyname) {
NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.keyname));
@@ -1996,7 +1949,7 @@ static enum ndr_err_code ndr_pull_winreg_LoadKey(struct ndr_pull *ndr, int flags
}
_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_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_generic_ptr(ndr, &_ptr_keyname));
if (_ptr_keyname) {
@@ -2066,15 +2019,15 @@ _PUBLIC_ void ndr_print_winreg_LoadKey(struct ndr_print *ndr, const char *name,
ndr->depth--;
}
-static enum ndr_err_code ndr_push_winreg_NotifyChangeKeyValue(struct ndr_push *ndr, int flags, const struct winreg_NotifyChangeKeyValue *r)
+_PUBLIC_ enum ndr_err_code ndr_push_winreg_NotifyChangeKeyValue(struct ndr_push *ndr, int flags, const struct winreg_NotifyChangeKeyValue *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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.watch_subtree));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.notify_filter));
+ NDR_CHECK(ndr_push_winreg_NotifyChangeType(ndr, NDR_SCALARS, r->in.notify_filter));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown));
NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.string1));
NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.string2));
@@ -2086,7 +2039,7 @@ static enum ndr_err_code ndr_push_winreg_NotifyChangeKeyValue(struct ndr_push *n
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_winreg_NotifyChangeKeyValue(struct ndr_pull *ndr, int flags, struct winreg_NotifyChangeKeyValue *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_winreg_NotifyChangeKeyValue(struct ndr_pull *ndr, int flags, struct winreg_NotifyChangeKeyValue *r)
{
TALLOC_CTX *_mem_save_handle_0;
if (flags & NDR_IN) {
@@ -2095,10 +2048,10 @@ static enum ndr_err_code ndr_pull_winreg_NotifyChangeKeyValue(struct ndr_pull *n
}
_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_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_uint8(ndr, NDR_SCALARS, &r->in.watch_subtree));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.notify_filter));
+ NDR_CHECK(ndr_pull_winreg_NotifyChangeType(ndr, NDR_SCALARS, &r->in.notify_filter));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown));
NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.string1));
NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.string2));
@@ -2125,7 +2078,7 @@ _PUBLIC_ void ndr_print_winreg_NotifyChangeKeyValue(struct ndr_print *ndr, const
ndr_print_policy_handle(ndr, "handle", r->in.handle);
ndr->depth--;
ndr_print_uint8(ndr, "watch_subtree", r->in.watch_subtree);
- ndr_print_uint32(ndr, "notify_filter", r->in.notify_filter);
+ ndr_print_winreg_NotifyChangeType(ndr, "notify_filter", r->in.notify_filter);
ndr_print_uint32(ndr, "unknown", r->in.unknown);
ndr_print_winreg_String(ndr, "string1", &r->in.string1);
ndr_print_winreg_String(ndr, "string2", &r->in.string2);
@@ -2141,13 +2094,13 @@ _PUBLIC_ void ndr_print_winreg_NotifyChangeKeyValue(struct ndr_print *ndr, const
ndr->depth--;
}
-static enum ndr_err_code ndr_push_winreg_OpenKey(struct ndr_push *ndr, int flags, const struct winreg_OpenKey *r)
+_PUBLIC_ enum ndr_err_code ndr_push_winreg_OpenKey(struct ndr_push *ndr, int flags, const struct winreg_OpenKey *r)
{
if (flags & NDR_IN) {
if (r->in.parent_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.parent_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.parent_handle));
NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.keyname));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown));
NDR_CHECK(ndr_push_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask));
@@ -2156,13 +2109,13 @@ static enum ndr_err_code ndr_push_winreg_OpenKey(struct ndr_push *ndr, int flags
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|NDR_BUFFERS, r->out.handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_winreg_OpenKey(struct ndr_pull *ndr, int flags, struct winreg_OpenKey *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_winreg_OpenKey(struct ndr_pull *ndr, int flags, struct winreg_OpenKey *r)
{
TALLOC_CTX *_mem_save_parent_handle_0;
TALLOC_CTX *_mem_save_handle_0;
@@ -2174,7 +2127,7 @@ static enum ndr_err_code ndr_pull_winreg_OpenKey(struct ndr_pull *ndr, int flags
}
_mem_save_parent_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.parent_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.parent_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.parent_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_parent_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.keyname));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown));
@@ -2188,7 +2141,7 @@ static enum ndr_err_code ndr_pull_winreg_OpenKey(struct ndr_pull *ndr, int flags
}
_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|NDR_BUFFERS, r->out.handle));
+ 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_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
@@ -2227,13 +2180,13 @@ _PUBLIC_ void ndr_print_winreg_OpenKey(struct ndr_print *ndr, const char *name,
ndr->depth--;
}
-static enum ndr_err_code ndr_push_winreg_QueryInfoKey(struct ndr_push *ndr, int flags, const struct winreg_QueryInfoKey *r)
+_PUBLIC_ enum ndr_err_code ndr_push_winreg_QueryInfoKey(struct ndr_push *ndr, int flags, const struct winreg_QueryInfoKey *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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.classname == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -2281,7 +2234,7 @@ static enum ndr_err_code ndr_push_winreg_QueryInfoKey(struct ndr_push *ndr, int
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_winreg_QueryInfoKey(struct ndr_pull *ndr, int flags, struct winreg_QueryInfoKey *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_winreg_QueryInfoKey(struct ndr_pull *ndr, int flags, struct winreg_QueryInfoKey *r)
{
TALLOC_CTX *_mem_save_handle_0;
TALLOC_CTX *_mem_save_classname_0;
@@ -2301,7 +2254,7 @@ static enum ndr_err_code ndr_pull_winreg_QueryInfoKey(struct ndr_pull *ndr, int
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.classname);
@@ -2463,13 +2416,13 @@ _PUBLIC_ void ndr_print_winreg_QueryInfoKey(struct ndr_print *ndr, const char *n
ndr->depth--;
}
-static enum ndr_err_code ndr_push_winreg_QueryValue(struct ndr_push *ndr, int flags, const struct winreg_QueryValue *r)
+_PUBLIC_ enum ndr_err_code ndr_push_winreg_QueryValue(struct ndr_push *ndr, int flags, const struct winreg_QueryValue *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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.value_name == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -2482,16 +2435,16 @@ static enum ndr_err_code ndr_push_winreg_QueryValue(struct ndr_push *ndr, int fl
if (r->in.data) {
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.data_size));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.value_length));
- NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.data, *r->in.value_length));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.data_length));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->in.data, *r->in.data_length));
}
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.data_size));
if (r->in.data_size) {
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.data_size));
}
- NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.value_length));
- if (r->in.value_length) {
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.value_length));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.data_length));
+ if (r->in.data_length) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.data_length));
}
}
if (flags & NDR_OUT) {
@@ -2503,34 +2456,34 @@ static enum ndr_err_code ndr_push_winreg_QueryValue(struct ndr_push *ndr, int fl
if (r->out.data) {
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.data_size));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.value_length));
- NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.data, *r->out.value_length));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.data_length));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->out.data, *r->out.data_length));
}
NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.data_size));
if (r->out.data_size) {
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.data_size));
}
- NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.value_length));
- if (r->out.value_length) {
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.value_length));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.data_length));
+ if (r->out.data_length) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.data_length));
}
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_winreg_QueryValue(struct ndr_pull *ndr, int flags, struct winreg_QueryValue *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_winreg_QueryValue(struct ndr_pull *ndr, int flags, struct winreg_QueryValue *r)
{
uint32_t _ptr_type;
uint32_t _ptr_data;
uint32_t _ptr_data_size;
- uint32_t _ptr_value_length;
+ uint32_t _ptr_data_length;
TALLOC_CTX *_mem_save_handle_0;
TALLOC_CTX *_mem_save_value_name_0;
TALLOC_CTX *_mem_save_type_0;
TALLOC_CTX *_mem_save_data_0;
TALLOC_CTX *_mem_save_data_size_0;
- TALLOC_CTX *_mem_save_value_length_0;
+ TALLOC_CTX *_mem_save_data_length_0;
if (flags & NDR_IN) {
ZERO_STRUCT(r->out);
@@ -2539,7 +2492,7 @@ static enum ndr_err_code ndr_pull_winreg_QueryValue(struct ndr_pull *ndr, int fl
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.value_name);
@@ -2590,25 +2543,25 @@ static enum ndr_err_code ndr_pull_winreg_QueryValue(struct ndr_pull *ndr, int fl
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.data_size));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_size_0, 0);
}
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value_length));
- if (_ptr_value_length) {
- NDR_PULL_ALLOC(ndr, r->in.value_length);
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data_length));
+ if (_ptr_data_length) {
+ NDR_PULL_ALLOC(ndr, r->in.data_length);
} else {
- r->in.value_length = NULL;
+ r->in.data_length = NULL;
}
- if (r->in.value_length) {
- _mem_save_value_length_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->in.value_length, 0);
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.value_length));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value_length_0, 0);
+ if (r->in.data_length) {
+ _mem_save_data_length_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->in.data_length, 0);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.data_length));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_length_0, 0);
}
if (r->in.data) {
if (r->in.data_size == NULL) return ndr_pull_error(ndr, NDR_ERR_INVALID_POINTER, "NULL Pointer for size_is()");
NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.data, *r->in.data_size));
}
if (r->in.data) {
- if (r->in.value_length == NULL) return ndr_pull_error(ndr, NDR_ERR_INVALID_POINTER, "NULL Pointer for length_is()");
- NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->in.data, *r->in.value_length));
+ if (r->in.data_length == NULL) return ndr_pull_error(ndr, NDR_ERR_INVALID_POINTER, "NULL Pointer for length_is()");
+ NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->in.data, *r->in.data_length));
}
}
if (flags & NDR_OUT) {
@@ -2654,17 +2607,17 @@ static enum ndr_err_code ndr_pull_winreg_QueryValue(struct ndr_pull *ndr, int fl
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.data_size));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_size_0, 0);
}
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_value_length));
- if (_ptr_value_length) {
- NDR_PULL_ALLOC(ndr, r->out.value_length);
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data_length));
+ if (_ptr_data_length) {
+ NDR_PULL_ALLOC(ndr, r->out.data_length);
} else {
- r->out.value_length = NULL;
+ r->out.data_length = NULL;
}
- if (r->out.value_length) {
- _mem_save_value_length_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->out.value_length, 0);
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.value_length));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_value_length_0, 0);
+ if (r->out.data_length) {
+ _mem_save_data_length_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->out.data_length, 0);
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.data_length));
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_length_0, 0);
}
NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
if (r->out.data) {
@@ -2672,8 +2625,8 @@ static enum ndr_err_code ndr_pull_winreg_QueryValue(struct ndr_pull *ndr, int fl
NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.data, *r->out.data_size));
}
if (r->out.data) {
- if (r->out.value_length == NULL) return ndr_pull_error(ndr, NDR_ERR_INVALID_POINTER, "NULL Pointer for length_is()");
- NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->out.data, *r->out.value_length));
+ if (r->out.data_length == NULL) return ndr_pull_error(ndr, NDR_ERR_INVALID_POINTER, "NULL Pointer for length_is()");
+ NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->out.data, *r->out.data_length));
}
}
return NDR_ERR_SUCCESS;
@@ -2706,8 +2659,8 @@ _PUBLIC_ void ndr_print_winreg_QueryValue(struct ndr_print *ndr, const char *nam
ndr_print_ptr(ndr, "data", r->in.data);
ndr->depth++;
if (r->in.data) {
- if (r->in.value_length == NULL) return;
- ndr_print_array_uint8(ndr, "data", r->in.data, *r->in.value_length);
+ if (r->in.data_length == NULL) return;
+ ndr_print_array_uint8(ndr, "data", r->in.data, *r->in.data_length);
}
ndr->depth--;
ndr_print_ptr(ndr, "data_size", r->in.data_size);
@@ -2716,10 +2669,10 @@ _PUBLIC_ void ndr_print_winreg_QueryValue(struct ndr_print *ndr, const char *nam
ndr_print_uint32(ndr, "data_size", *r->in.data_size);
}
ndr->depth--;
- ndr_print_ptr(ndr, "value_length", r->in.value_length);
+ ndr_print_ptr(ndr, "data_length", r->in.data_length);
ndr->depth++;
- if (r->in.value_length) {
- ndr_print_uint32(ndr, "value_length", *r->in.value_length);
+ if (r->in.data_length) {
+ ndr_print_uint32(ndr, "data_length", *r->in.data_length);
}
ndr->depth--;
ndr->depth--;
@@ -2736,8 +2689,8 @@ _PUBLIC_ void ndr_print_winreg_QueryValue(struct ndr_print *ndr, const char *nam
ndr_print_ptr(ndr, "data", r->out.data);
ndr->depth++;
if (r->out.data) {
- if (r->out.value_length == NULL) return;
- ndr_print_array_uint8(ndr, "data", r->out.data, *r->out.value_length);
+ if (r->out.data_length == NULL) return;
+ ndr_print_array_uint8(ndr, "data", r->out.data, *r->out.data_length);
}
ndr->depth--;
ndr_print_ptr(ndr, "data_size", r->out.data_size);
@@ -2746,10 +2699,10 @@ _PUBLIC_ void ndr_print_winreg_QueryValue(struct ndr_print *ndr, const char *nam
ndr_print_uint32(ndr, "data_size", *r->out.data_size);
}
ndr->depth--;
- ndr_print_ptr(ndr, "value_length", r->out.value_length);
+ ndr_print_ptr(ndr, "data_length", r->out.data_length);
ndr->depth++;
- if (r->out.value_length) {
- ndr_print_uint32(ndr, "value_length", *r->out.value_length);
+ if (r->out.data_length) {
+ ndr_print_uint32(ndr, "data_length", *r->out.data_length);
}
ndr->depth--;
ndr_print_WERROR(ndr, "result", r->out.result);
@@ -2805,7 +2758,7 @@ static enum ndr_err_code ndr_push_winreg_RestoreKey(struct ndr_push *ndr, int fl
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.filename == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -2828,7 +2781,7 @@ static enum ndr_err_code ndr_pull_winreg_RestoreKey(struct ndr_pull *ndr, int fl
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.filename);
@@ -2881,7 +2834,7 @@ static enum ndr_err_code ndr_push_winreg_SaveKey(struct ndr_push *ndr, int flags
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
if (r->in.filename == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -2909,7 +2862,7 @@ static enum ndr_err_code ndr_pull_winreg_SaveKey(struct ndr_pull *ndr, int flags
}
_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_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);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.filename);
@@ -2978,8 +2931,8 @@ static enum ndr_err_code ndr_push_winreg_SetKeySecurity(struct ndr_push *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_winreg_AccessMask(ndr, NDR_SCALARS, r->in.access_mask));
+ 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.sd == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -3001,9 +2954,9 @@ static enum ndr_err_code ndr_pull_winreg_SetKeySecurity(struct ndr_pull *ndr, in
}
_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_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_winreg_AccessMask(ndr, NDR_SCALARS, &r->in.access_mask));
+ 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.sd);
}
@@ -3032,7 +2985,7 @@ _PUBLIC_ void ndr_print_winreg_SetKeySecurity(struct ndr_print *ndr, const char
ndr->depth++;
ndr_print_policy_handle(ndr, "handle", r->in.handle);
ndr->depth--;
- ndr_print_winreg_AccessMask(ndr, "access_mask", r->in.access_mask);
+ ndr_print_security_secinfo(ndr, "sec_info", r->in.sec_info);
ndr_print_ptr(ndr, "sd", r->in.sd);
ndr->depth++;
ndr_print_KeySecurityData(ndr, "sd", r->in.sd);
@@ -3054,7 +3007,7 @@ static enum ndr_err_code ndr_push_winreg_SetValue(struct ndr_push *ndr, int flag
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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name));
NDR_CHECK(ndr_push_winreg_Type(ndr, NDR_SCALARS, r->in.type));
if (r->in.data == NULL) {
@@ -3079,7 +3032,7 @@ static enum ndr_err_code ndr_pull_winreg_SetValue(struct ndr_pull *ndr, int flag
}
_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_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_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name));
NDR_CHECK(ndr_pull_winreg_Type(ndr, NDR_SCALARS, &r->in.type));
@@ -3181,7 +3134,7 @@ static enum ndr_err_code ndr_push_winreg_InitiateSystemShutdown(struct ndr_push
}
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.message));
if (r->in.message) {
- NDR_CHECK(ndr_push_initshutdown_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message));
+ NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message));
}
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.timeout));
NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.force_apps));
@@ -3221,7 +3174,7 @@ static enum ndr_err_code ndr_pull_winreg_InitiateSystemShutdown(struct ndr_pull
if (r->in.message) {
_mem_save_message_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.message, 0);
- NDR_CHECK(ndr_pull_initshutdown_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message));
+ NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_message_0, 0);
}
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.timeout));
@@ -3253,7 +3206,7 @@ _PUBLIC_ void ndr_print_winreg_InitiateSystemShutdown(struct ndr_print *ndr, con
ndr_print_ptr(ndr, "message", r->in.message);
ndr->depth++;
if (r->in.message) {
- ndr_print_initshutdown_String(ndr, "message", r->in.message);
+ ndr_print_lsa_StringLarge(ndr, "message", r->in.message);
}
ndr->depth--;
ndr_print_uint32(ndr, "timeout", r->in.timeout);
@@ -3335,13 +3288,13 @@ _PUBLIC_ void ndr_print_winreg_AbortSystemShutdown(struct ndr_print *ndr, const
ndr->depth--;
}
-static enum ndr_err_code ndr_push_winreg_GetVersion(struct ndr_push *ndr, int flags, const struct winreg_GetVersion *r)
+_PUBLIC_ enum ndr_err_code ndr_push_winreg_GetVersion(struct ndr_push *ndr, int flags, const struct winreg_GetVersion *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_policy_handle(ndr, NDR_SCALARS, r->in.handle));
}
if (flags & NDR_OUT) {
if (r->out.version == NULL) {
@@ -3353,7 +3306,7 @@ static enum ndr_err_code ndr_push_winreg_GetVersion(struct ndr_push *ndr, int fl
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_winreg_GetVersion(struct ndr_pull *ndr, int flags, struct winreg_GetVersion *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_winreg_GetVersion(struct ndr_pull *ndr, int flags, struct winreg_GetVersion *r)
{
TALLOC_CTX *_mem_save_handle_0;
TALLOC_CTX *_mem_save_version_0;
@@ -3365,7 +3318,7 @@ static enum ndr_err_code ndr_pull_winreg_GetVersion(struct ndr_pull *ndr, int fl
}
_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_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.version);
ZERO_STRUCTP(r->out.version);
@@ -3425,7 +3378,7 @@ static enum ndr_err_code ndr_push_winreg_OpenHKCC(struct ndr_push *ndr, int flag
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|NDR_BUFFERS, r->out.handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -3461,7 +3414,7 @@ static enum ndr_err_code ndr_pull_winreg_OpenHKCC(struct ndr_pull *ndr, int flag
}
_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|NDR_BUFFERS, r->out.handle));
+ 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_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
@@ -3513,7 +3466,7 @@ static enum ndr_err_code ndr_push_winreg_OpenHKDD(struct ndr_push *ndr, int flag
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|NDR_BUFFERS, r->out.handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -3549,7 +3502,7 @@ static enum ndr_err_code ndr_pull_winreg_OpenHKDD(struct ndr_pull *ndr, int flag
}
_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|NDR_BUFFERS, r->out.handle));
+ 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_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
@@ -3588,14 +3541,14 @@ _PUBLIC_ void ndr_print_winreg_OpenHKDD(struct ndr_print *ndr, const char *name,
ndr->depth--;
}
-static enum ndr_err_code ndr_push_winreg_QueryMultipleValues(struct ndr_push *ndr, int flags, const struct winreg_QueryMultipleValues *r)
+_PUBLIC_ enum ndr_err_code ndr_push_winreg_QueryMultipleValues(struct ndr_push *ndr, int flags, const struct winreg_QueryMultipleValues *r)
{
uint32_t cntr_values_1;
if (flags & NDR_IN) {
if (r->in.key_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.key_handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.key_handle));
if (r->in.values == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
}
@@ -3650,7 +3603,7 @@ static enum ndr_err_code ndr_push_winreg_QueryMultipleValues(struct ndr_push *nd
return NDR_ERR_SUCCESS;
}
-static enum ndr_err_code ndr_pull_winreg_QueryMultipleValues(struct ndr_pull *ndr, int flags, struct winreg_QueryMultipleValues *r)
+_PUBLIC_ enum ndr_err_code ndr_pull_winreg_QueryMultipleValues(struct ndr_pull *ndr, int flags, struct winreg_QueryMultipleValues *r)
{
uint32_t cntr_values_1;
uint32_t _ptr_buffer;
@@ -3666,7 +3619,7 @@ static enum ndr_err_code ndr_pull_winreg_QueryMultipleValues(struct ndr_pull *nd
}
_mem_save_key_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.key_handle, LIBNDR_FLAG_REF_ALLOC);
- NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.key_handle));
+ NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.key_handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_key_handle_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_array_size(ndr, &r->in.values));
NDR_CHECK(ndr_pull_array_length(ndr, &r->in.values));
@@ -3872,7 +3825,7 @@ static enum ndr_err_code ndr_push_winreg_InitiateSystemShutdownEx(struct ndr_pus
}
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.message));
if (r->in.message) {
- NDR_CHECK(ndr_push_initshutdown_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message));
+ NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message));
}
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.timeout));
NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.force_apps));
@@ -3913,7 +3866,7 @@ static enum ndr_err_code ndr_pull_winreg_InitiateSystemShutdownEx(struct ndr_pul
if (r->in.message) {
_mem_save_message_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.message, 0);
- NDR_CHECK(ndr_pull_initshutdown_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message));
+ NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.message));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_message_0, 0);
}
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.timeout));
@@ -3946,7 +3899,7 @@ _PUBLIC_ void ndr_print_winreg_InitiateSystemShutdownEx(struct ndr_print *ndr, c
ndr_print_ptr(ndr, "message", r->in.message);
ndr->depth++;
if (r->in.message) {
- ndr_print_initshutdown_String(ndr, "message", r->in.message);
+ ndr_print_lsa_StringLarge(ndr, "message", r->in.message);
}
ndr->depth--;
ndr_print_uint32(ndr, "timeout", r->in.timeout);
@@ -4018,7 +3971,7 @@ static enum ndr_err_code ndr_push_winreg_OpenHKPT(struct ndr_push *ndr, int flag
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|NDR_BUFFERS, r->out.handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -4054,7 +4007,7 @@ static enum ndr_err_code ndr_pull_winreg_OpenHKPT(struct ndr_pull *ndr, int flag
}
_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|NDR_BUFFERS, r->out.handle));
+ 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_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
@@ -4106,7 +4059,7 @@ static enum ndr_err_code ndr_push_winreg_OpenHKPN(struct ndr_push *ndr, int flag
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|NDR_BUFFERS, r->out.handle));
+ NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle));
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
}
return NDR_ERR_SUCCESS;
@@ -4142,7 +4095,7 @@ static enum ndr_err_code ndr_pull_winreg_OpenHKPN(struct ndr_pull *ndr, int flag
}
_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|NDR_BUFFERS, r->out.handle));
+ 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_WERROR(ndr, NDR_SCALARS, &r->out.result));
}
diff --git a/source3/librpc/gen_ndr/ndr_winreg.h b/source3/librpc/gen_ndr/ndr_winreg.h
index c093b0d1e0..8dea3ae273 100644
--- a/source3/librpc/gen_ndr/ndr_winreg.h
+++ b/source3/librpc/gen_ndr/ndr_winreg.h
@@ -83,6 +83,8 @@ extern const struct ndr_interface_table ndr_table_winreg;
#define NDR_WINREG_CALL_COUNT (35)
void ndr_print_winreg_AccessMask(struct ndr_print *ndr, const char *name, uint32_t r);
+enum ndr_err_code ndr_push_winreg_Type(struct ndr_push *ndr, int ndr_flags, enum winreg_Type r);
+enum ndr_err_code ndr_pull_winreg_Type(struct ndr_pull *ndr, int ndr_flags, enum winreg_Type *r);
void ndr_print_winreg_Type(struct ndr_print *ndr, const char *name, enum winreg_Type r);
enum ndr_err_code ndr_push_winreg_String(struct ndr_push *ndr, int ndr_flags, const struct winreg_String *r);
enum ndr_err_code ndr_pull_winreg_String(struct ndr_pull *ndr, int ndr_flags, struct winreg_String *r);
@@ -91,26 +93,52 @@ void ndr_print_KeySecurityData(struct ndr_print *ndr, const char *name, const st
void ndr_print_winreg_SecBuf(struct ndr_print *ndr, const char *name, const struct winreg_SecBuf *r);
void ndr_print_winreg_CreateAction(struct ndr_print *ndr, const char *name, enum winreg_CreateAction r);
void ndr_print_winreg_StringBuf(struct ndr_print *ndr, const char *name, const struct winreg_StringBuf *r);
-void ndr_print_winreg_ValNameBuf(struct ndr_print *ndr, const char *name, const struct winreg_ValNameBuf *r);
+enum ndr_err_code ndr_push_winreg_NotifyChangeType(struct ndr_push *ndr, int ndr_flags, uint32_t r);
+enum ndr_err_code ndr_pull_winreg_NotifyChangeType(struct ndr_pull *ndr, int ndr_flags, uint32_t *r);
+void ndr_print_winreg_NotifyChangeType(struct ndr_print *ndr, const char *name, uint32_t r);
void ndr_print_KeySecurityAttribute(struct ndr_print *ndr, const char *name, const struct KeySecurityAttribute *r);
void ndr_print_QueryMultipleValue(struct ndr_print *ndr, const char *name, const struct QueryMultipleValue *r);
void ndr_print_winreg_OpenHKCR(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCR *r);
void ndr_print_winreg_OpenHKCU(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCU *r);
+enum ndr_err_code ndr_push_winreg_OpenHKLM(struct ndr_push *ndr, int flags, const struct winreg_OpenHKLM *r);
+enum ndr_err_code ndr_pull_winreg_OpenHKLM(struct ndr_pull *ndr, int flags, struct winreg_OpenHKLM *r);
void ndr_print_winreg_OpenHKLM(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKLM *r);
void ndr_print_winreg_OpenHKPD(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKPD *r);
void ndr_print_winreg_OpenHKU(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKU *r);
+enum ndr_err_code ndr_push_winreg_CloseKey(struct ndr_push *ndr, int flags, const struct winreg_CloseKey *r);
+enum ndr_err_code ndr_pull_winreg_CloseKey(struct ndr_pull *ndr, int flags, struct winreg_CloseKey *r);
void ndr_print_winreg_CloseKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_CloseKey *r);
+enum ndr_err_code ndr_push_winreg_CreateKey(struct ndr_push *ndr, int flags, const struct winreg_CreateKey *r);
+enum ndr_err_code ndr_pull_winreg_CreateKey(struct ndr_pull *ndr, int flags, struct winreg_CreateKey *r);
void ndr_print_winreg_CreateKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_CreateKey *r);
+enum ndr_err_code ndr_push_winreg_DeleteKey(struct ndr_push *ndr, int flags, const struct winreg_DeleteKey *r);
+enum ndr_err_code ndr_pull_winreg_DeleteKey(struct ndr_pull *ndr, int flags, struct winreg_DeleteKey *r);
void ndr_print_winreg_DeleteKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_DeleteKey *r);
void ndr_print_winreg_DeleteValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_DeleteValue *r);
+enum ndr_err_code ndr_push_winreg_EnumKey(struct ndr_push *ndr, int flags, const struct winreg_EnumKey *r);
+enum ndr_err_code ndr_pull_winreg_EnumKey(struct ndr_pull *ndr, int flags, struct winreg_EnumKey *r);
void ndr_print_winreg_EnumKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_EnumKey *r);
+enum ndr_err_code ndr_push_winreg_EnumValue(struct ndr_push *ndr, int flags, const struct winreg_EnumValue *r);
+enum ndr_err_code ndr_pull_winreg_EnumValue(struct ndr_pull *ndr, int flags, struct winreg_EnumValue *r);
void ndr_print_winreg_EnumValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_EnumValue *r);
+enum ndr_err_code ndr_push_winreg_FlushKey(struct ndr_push *ndr, int flags, const struct winreg_FlushKey *r);
+enum ndr_err_code ndr_pull_winreg_FlushKey(struct ndr_pull *ndr, int flags, struct winreg_FlushKey *r);
void ndr_print_winreg_FlushKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_FlushKey *r);
+enum ndr_err_code ndr_push_winreg_GetKeySecurity(struct ndr_push *ndr, int flags, const struct winreg_GetKeySecurity *r);
+enum ndr_err_code ndr_pull_winreg_GetKeySecurity(struct ndr_pull *ndr, int flags, struct winreg_GetKeySecurity *r);
void ndr_print_winreg_GetKeySecurity(struct ndr_print *ndr, const char *name, int flags, const struct winreg_GetKeySecurity *r);
void ndr_print_winreg_LoadKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_LoadKey *r);
+enum ndr_err_code ndr_push_winreg_NotifyChangeKeyValue(struct ndr_push *ndr, int flags, const struct winreg_NotifyChangeKeyValue *r);
+enum ndr_err_code ndr_pull_winreg_NotifyChangeKeyValue(struct ndr_pull *ndr, int flags, struct winreg_NotifyChangeKeyValue *r);
void ndr_print_winreg_NotifyChangeKeyValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_NotifyChangeKeyValue *r);
+enum ndr_err_code ndr_push_winreg_OpenKey(struct ndr_push *ndr, int flags, const struct winreg_OpenKey *r);
+enum ndr_err_code ndr_pull_winreg_OpenKey(struct ndr_pull *ndr, int flags, struct winreg_OpenKey *r);
void ndr_print_winreg_OpenKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenKey *r);
+enum ndr_err_code ndr_push_winreg_QueryInfoKey(struct ndr_push *ndr, int flags, const struct winreg_QueryInfoKey *r);
+enum ndr_err_code ndr_pull_winreg_QueryInfoKey(struct ndr_pull *ndr, int flags, struct winreg_QueryInfoKey *r);
void ndr_print_winreg_QueryInfoKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryInfoKey *r);
+enum ndr_err_code ndr_push_winreg_QueryValue(struct ndr_push *ndr, int flags, const struct winreg_QueryValue *r);
+enum ndr_err_code ndr_pull_winreg_QueryValue(struct ndr_pull *ndr, int flags, struct winreg_QueryValue *r);
void ndr_print_winreg_QueryValue(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryValue *r);
void ndr_print_winreg_ReplaceKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_ReplaceKey *r);
void ndr_print_winreg_RestoreKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_RestoreKey *r);
@@ -120,9 +148,13 @@ void ndr_print_winreg_SetValue(struct ndr_print *ndr, const char *name, int flag
void ndr_print_winreg_UnLoadKey(struct ndr_print *ndr, const char *name, int flags, const struct winreg_UnLoadKey *r);
void ndr_print_winreg_InitiateSystemShutdown(struct ndr_print *ndr, const char *name, int flags, const struct winreg_InitiateSystemShutdown *r);
void ndr_print_winreg_AbortSystemShutdown(struct ndr_print *ndr, const char *name, int flags, const struct winreg_AbortSystemShutdown *r);
+enum ndr_err_code ndr_push_winreg_GetVersion(struct ndr_push *ndr, int flags, const struct winreg_GetVersion *r);
+enum ndr_err_code ndr_pull_winreg_GetVersion(struct ndr_pull *ndr, int flags, struct winreg_GetVersion *r);
void ndr_print_winreg_GetVersion(struct ndr_print *ndr, const char *name, int flags, const struct winreg_GetVersion *r);
void ndr_print_winreg_OpenHKCC(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCC *r);
void ndr_print_winreg_OpenHKDD(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKDD *r);
+enum ndr_err_code ndr_push_winreg_QueryMultipleValues(struct ndr_push *ndr, int flags, const struct winreg_QueryMultipleValues *r);
+enum ndr_err_code ndr_pull_winreg_QueryMultipleValues(struct ndr_pull *ndr, int flags, struct winreg_QueryMultipleValues *r);
void ndr_print_winreg_QueryMultipleValues(struct ndr_print *ndr, const char *name, int flags, const struct winreg_QueryMultipleValues *r);
void ndr_print_winreg_InitiateSystemShutdownEx(struct ndr_print *ndr, const char *name, int flags, const struct winreg_InitiateSystemShutdownEx *r);
void ndr_print_winreg_SaveKeyEx(struct ndr_print *ndr, const char *name, int flags, const struct winreg_SaveKeyEx *r);
diff --git a/source3/librpc/gen_ndr/ndr_xattr.c b/source3/librpc/gen_ndr/ndr_xattr.c
index 92369835cf..0e9dda9f47 100644
--- a/source3/librpc/gen_ndr/ndr_xattr.c
+++ b/source3/librpc/gen_ndr/ndr_xattr.c
@@ -3,7 +3,244 @@
#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)
+#include "librpc/gen_ndr/ndr_security.h"
+static enum ndr_err_code ndr_push_xattr_DosInfo1(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosInfo1 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->attrib));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ea_size));
+ NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->size));
+ NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->alloc_size));
+ NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->create_time));
+ NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->change_time));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_xattr_DosInfo1(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosInfo1 *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->attrib));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ea_size));
+ NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->size));
+ NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->alloc_size));
+ NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->create_time));
+ NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->change_time));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_xattr_DosInfo1(struct ndr_print *ndr, const char *name, const struct xattr_DosInfo1 *r)
+{
+ ndr_print_struct(ndr, name, "xattr_DosInfo1");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "attrib", r->attrib);
+ ndr_print_uint32(ndr, "ea_size", r->ea_size);
+ ndr_print_udlong(ndr, "size", r->size);
+ ndr_print_udlong(ndr, "alloc_size", r->alloc_size);
+ ndr_print_NTTIME(ndr, "create_time", r->create_time);
+ ndr_print_NTTIME(ndr, "change_time", r->change_time);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_xattr_DosInfo2Old(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosInfo2Old *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->flags));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->attrib));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ea_size));
+ NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->size));
+ NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->alloc_size));
+ NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->create_time));
+ NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->change_time));
+ NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->write_time));
+ {
+ 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;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_xattr_DosInfo2Old(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosInfo2Old *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->flags));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->attrib));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ea_size));
+ NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->size));
+ NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->alloc_size));
+ NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->create_time));
+ NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->change_time));
+ NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->write_time));
+ {
+ 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;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_xattr_DosInfo2Old(struct ndr_print *ndr, const char *name, const struct xattr_DosInfo2Old *r)
+{
+ ndr_print_struct(ndr, name, "xattr_DosInfo2Old");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "flags", r->flags);
+ ndr_print_uint32(ndr, "attrib", r->attrib);
+ ndr_print_uint32(ndr, "ea_size", r->ea_size);
+ ndr_print_udlong(ndr, "size", r->size);
+ ndr_print_udlong(ndr, "alloc_size", r->alloc_size);
+ ndr_print_NTTIME(ndr, "create_time", r->create_time);
+ ndr_print_NTTIME(ndr, "change_time", r->change_time);
+ ndr_print_NTTIME(ndr, "write_time", r->write_time);
+ ndr_print_string(ndr, "name", r->name);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_xattr_DosInfo(struct ndr_push *ndr, int ndr_flags, const union xattr_DosInfo *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_xattr_DosInfo1(ndr, NDR_SCALARS, &r->info1));
+ break; }
+
+ case 2: {
+ NDR_CHECK(ndr_push_xattr_DosInfo2Old(ndr, NDR_SCALARS, &r->oldinfo2));
+ 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:
+ 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_xattr_DosInfo(struct ndr_pull *ndr, int ndr_flags, union xattr_DosInfo *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_xattr_DosInfo1(ndr, NDR_SCALARS, &r->info1));
+ break; }
+
+ case 2: {
+ NDR_CHECK(ndr_pull_xattr_DosInfo2Old(ndr, NDR_SCALARS, &r->oldinfo2));
+ 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:
+ break;
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_xattr_DosInfo(struct ndr_print *ndr, const char *name, const union xattr_DosInfo *r)
+{
+ int level;
+ level = ndr_print_get_switch_value(ndr, r);
+ ndr_print_union(ndr, name, level, "xattr_DosInfo");
+ switch (level) {
+ case 1:
+ ndr_print_xattr_DosInfo1(ndr, "info1", &r->info1);
+ break;
+
+ case 2:
+ ndr_print_xattr_DosInfo2Old(ndr, "oldinfo2", &r->oldinfo2);
+ break;
+
+ default:
+ ndr_print_bad_level(ndr, name, level);
+ }
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_xattr_DosAttrib(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosAttrib *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->version));
+ NDR_CHECK(ndr_push_set_switch_value(ndr, &r->info, r->version));
+ NDR_CHECK(ndr_push_xattr_DosInfo(ndr, NDR_SCALARS, &r->info));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_xattr_DosAttrib(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosAttrib *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->version));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->info, r->version));
+ NDR_CHECK(ndr_pull_xattr_DosInfo(ndr, NDR_SCALARS, &r->info));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_xattr_DosAttrib(struct ndr_print *ndr, const char *name, const struct xattr_DosAttrib *r)
+{
+ ndr_print_struct(ndr, name, "xattr_DosAttrib");
+ ndr->depth++;
+ ndr_print_uint16(ndr, "version", r->version);
+ ndr_print_set_switch_value(ndr, &r->info, r->version);
+ ndr_print_xattr_DosInfo(ndr, "info", &r->info);
+ ndr->depth--;
+}
+
+static enum ndr_err_code ndr_push_xattr_EA(struct ndr_push *ndr, int ndr_flags, const struct xattr_EA *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
@@ -20,7 +257,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_tdb_xattr(struct ndr_push *ndr, int ndr_flag
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ enum ndr_err_code ndr_pull_tdb_xattr(struct ndr_pull *ndr, int ndr_flags, struct tdb_xattr *r)
+static enum ndr_err_code ndr_pull_xattr_EA(struct ndr_pull *ndr, int ndr_flags, struct xattr_EA *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
@@ -37,23 +274,103 @@ _PUBLIC_ enum ndr_err_code ndr_pull_tdb_xattr(struct ndr_pull *ndr, int ndr_flag
return NDR_ERR_SUCCESS;
}
-_PUBLIC_ void ndr_print_tdb_xattr(struct ndr_print *ndr, const char *name, const struct tdb_xattr *r)
+_PUBLIC_ void ndr_print_xattr_EA(struct ndr_print *ndr, const char *name, const struct xattr_EA *r)
{
- ndr_print_struct(ndr, name, "tdb_xattr");
+ ndr_print_struct(ndr, name, "xattr_EA");
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_xattr_DosEAs(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosEAs *r)
+{
+ uint32_t cntr_eas_1;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->num_eas));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->eas));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->eas) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_eas));
+ for (cntr_eas_1 = 0; cntr_eas_1 < r->num_eas; cntr_eas_1++) {
+ NDR_CHECK(ndr_push_xattr_EA(ndr, NDR_SCALARS, &r->eas[cntr_eas_1]));
+ }
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_xattr_DosEAs(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosEAs *r)
+{
+ uint32_t _ptr_eas;
+ uint32_t cntr_eas_1;
+ TALLOC_CTX *_mem_save_eas_0;
+ TALLOC_CTX *_mem_save_eas_1;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->num_eas));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_eas));
+ if (_ptr_eas) {
+ NDR_PULL_ALLOC(ndr, r->eas);
+ } else {
+ r->eas = NULL;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->eas) {
+ _mem_save_eas_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->eas, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->eas));
+ NDR_PULL_ALLOC_N(ndr, r->eas, ndr_get_array_size(ndr, &r->eas));
+ _mem_save_eas_1 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->eas, 0);
+ for (cntr_eas_1 = 0; cntr_eas_1 < r->num_eas; cntr_eas_1++) {
+ NDR_CHECK(ndr_pull_xattr_EA(ndr, NDR_SCALARS, &r->eas[cntr_eas_1]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_eas_1, 0);
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_eas_0, 0);
+ }
+ if (r->eas) {
+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->eas, r->num_eas));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_xattr_DosEAs(struct ndr_print *ndr, const char *name, const struct xattr_DosEAs *r)
+{
+ uint32_t cntr_eas_1;
+ ndr_print_struct(ndr, name, "xattr_DosEAs");
+ ndr->depth++;
+ ndr_print_uint16(ndr, "num_eas", r->num_eas);
+ ndr_print_ptr(ndr, "eas", r->eas);
+ ndr->depth++;
+ if (r->eas) {
+ ndr->print(ndr, "%s: ARRAY(%d)", "eas", (int)r->num_eas);
+ ndr->depth++;
+ for (cntr_eas_1=0;cntr_eas_1<r->num_eas;cntr_eas_1++) {
+ char *idx_1=NULL;
+ if (asprintf(&idx_1, "[%d]", cntr_eas_1) != -1) {
+ ndr_print_xattr_EA(ndr, "eas", &r->eas[cntr_eas_1]);
+ free(idx_1);
+ }
+ }
+ ndr->depth--;
+ }
+ ndr->depth--;
+ 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;
+ uint32_t cntr_eas_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]));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_eas));
+ for (cntr_eas_0 = 0; cntr_eas_0 < r->num_eas; cntr_eas_0++) {
+ NDR_CHECK(ndr_push_xattr_EA(ndr, NDR_SCALARS, &r->eas[cntr_eas_0]));
}
}
if (ndr_flags & NDR_BUFFERS) {
@@ -63,18 +380,18 @@ _PUBLIC_ enum ndr_err_code ndr_push_tdb_xattrs(struct ndr_push *ndr, int ndr_fla
_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;
+ uint32_t cntr_eas_0;
+ TALLOC_CTX *_mem_save_eas_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_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_eas));
+ NDR_PULL_ALLOC_N(ndr, r->eas, r->num_eas);
+ _mem_save_eas_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->eas, 0);
+ for (cntr_eas_0 = 0; cntr_eas_0 < r->num_eas; cntr_eas_0++) {
+ NDR_CHECK(ndr_pull_xattr_EA(ndr, NDR_SCALARS, &r->eas[cntr_eas_0]));
}
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_xattrs_0, 0);
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_eas_0, 0);
}
if (ndr_flags & NDR_BUFFERS) {
}
@@ -83,16 +400,16 @@ _PUBLIC_ enum ndr_err_code ndr_pull_tdb_xattrs(struct ndr_pull *ndr, int ndr_fla
_PUBLIC_ void ndr_print_tdb_xattrs(struct ndr_print *ndr, const char *name, const struct tdb_xattrs *r)
{
- uint32_t cntr_xattrs_0;
+ uint32_t cntr_eas_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", (int)r->num_xattrs);
+ ndr_print_uint32(ndr, "num_eas", r->num_eas);
+ ndr->print(ndr, "%s: ARRAY(%d)", "eas", (int)r->num_eas);
ndr->depth++;
- for (cntr_xattrs_0=0;cntr_xattrs_0<r->num_xattrs;cntr_xattrs_0++) {
+ for (cntr_eas_0=0;cntr_eas_0<r->num_eas;cntr_eas_0++) {
char *idx_0=NULL;
- if (asprintf(&idx_0, "[%d]", cntr_xattrs_0) != -1) {
- ndr_print_tdb_xattr(ndr, "xattrs", &r->xattrs[cntr_xattrs_0]);
+ if (asprintf(&idx_0, "[%d]", cntr_eas_0) != -1) {
+ ndr_print_xattr_EA(ndr, "eas", &r->eas[cntr_eas_0]);
free(idx_0);
}
}
@@ -100,6 +417,135 @@ _PUBLIC_ void ndr_print_tdb_xattrs(struct ndr_print *ndr, const char *name, cons
ndr->depth--;
}
+static enum ndr_err_code ndr_push_xattr_DosStream(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosStream *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->flags));
+ NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->size));
+ NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->alloc_size));
+ {
+ 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;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+static enum ndr_err_code ndr_pull_xattr_DosStream(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosStream *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->flags));
+ NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->size));
+ NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->alloc_size));
+ {
+ 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;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_xattr_DosStream(struct ndr_print *ndr, const char *name, const struct xattr_DosStream *r)
+{
+ ndr_print_struct(ndr, name, "xattr_DosStream");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "flags", r->flags);
+ ndr_print_udlong(ndr, "size", r->size);
+ ndr_print_udlong(ndr, "alloc_size", r->alloc_size);
+ ndr_print_string(ndr, "name", r->name);
+ ndr->depth--;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_xattr_DosStreams(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosStreams *r)
+{
+ uint32_t cntr_streams_1;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_streams));
+ NDR_CHECK(ndr_push_unique_ptr(ndr, r->streams));
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->streams) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_streams));
+ for (cntr_streams_1 = 0; cntr_streams_1 < r->num_streams; cntr_streams_1++) {
+ NDR_CHECK(ndr_push_xattr_DosStream(ndr, NDR_SCALARS, &r->streams[cntr_streams_1]));
+ }
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_xattr_DosStreams(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosStreams *r)
+{
+ uint32_t _ptr_streams;
+ uint32_t cntr_streams_1;
+ TALLOC_CTX *_mem_save_streams_0;
+ TALLOC_CTX *_mem_save_streams_1;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_streams));
+ NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_streams));
+ if (_ptr_streams) {
+ NDR_PULL_ALLOC(ndr, r->streams);
+ } else {
+ r->streams = NULL;
+ }
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ if (r->streams) {
+ _mem_save_streams_0 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->streams, 0);
+ NDR_CHECK(ndr_pull_array_size(ndr, &r->streams));
+ NDR_PULL_ALLOC_N(ndr, r->streams, ndr_get_array_size(ndr, &r->streams));
+ _mem_save_streams_1 = NDR_PULL_GET_MEM_CTX(ndr);
+ NDR_PULL_SET_MEM_CTX(ndr, r->streams, 0);
+ for (cntr_streams_1 = 0; cntr_streams_1 < r->num_streams; cntr_streams_1++) {
+ NDR_CHECK(ndr_pull_xattr_DosStream(ndr, NDR_SCALARS, &r->streams[cntr_streams_1]));
+ }
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_streams_1, 0);
+ NDR_PULL_SET_MEM_CTX(ndr, _mem_save_streams_0, 0);
+ }
+ if (r->streams) {
+ NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->streams, r->num_streams));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ void ndr_print_xattr_DosStreams(struct ndr_print *ndr, const char *name, const struct xattr_DosStreams *r)
+{
+ uint32_t cntr_streams_1;
+ ndr_print_struct(ndr, name, "xattr_DosStreams");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "num_streams", r->num_streams);
+ ndr_print_ptr(ndr, "streams", r->streams);
+ ndr->depth++;
+ if (r->streams) {
+ ndr->print(ndr, "%s: ARRAY(%d)", "streams", (int)r->num_streams);
+ ndr->depth++;
+ for (cntr_streams_1=0;cntr_streams_1<r->num_streams;cntr_streams_1++) {
+ char *idx_1=NULL;
+ if (asprintf(&idx_1, "[%d]", cntr_streams_1) != -1) {
+ ndr_print_xattr_DosStream(ndr, "streams", &r->streams[cntr_streams_1]);
+ free(idx_1);
+ }
+ }
+ ndr->depth--;
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
_PUBLIC_ enum ndr_err_code ndr_push_security_descriptor_timestamp(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor_timestamp *r)
{
if (ndr_flags & NDR_SCALARS) {
diff --git a/source3/librpc/gen_ndr/ndr_xattr.h b/source3/librpc/gen_ndr/ndr_xattr.h
index 21c5ae03b5..38701b1aca 100644
--- a/source3/librpc/gen_ndr/ndr_xattr.h
+++ b/source3/librpc/gen_ndr/ndr_xattr.h
@@ -7,12 +7,23 @@
#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);
+void ndr_print_xattr_DosInfo1(struct ndr_print *ndr, const char *name, const struct xattr_DosInfo1 *r);
+void ndr_print_xattr_DosInfo2Old(struct ndr_print *ndr, const char *name, const struct xattr_DosInfo2Old *r);
+void ndr_print_xattr_DosInfo(struct ndr_print *ndr, const char *name, const union xattr_DosInfo *r);
+enum ndr_err_code ndr_push_xattr_DosAttrib(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosAttrib *r);
+enum ndr_err_code ndr_pull_xattr_DosAttrib(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosAttrib *r);
+void ndr_print_xattr_DosAttrib(struct ndr_print *ndr, const char *name, const struct xattr_DosAttrib *r);
+void ndr_print_xattr_EA(struct ndr_print *ndr, const char *name, const struct xattr_EA *r);
+enum ndr_err_code ndr_push_xattr_DosEAs(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosEAs *r);
+enum ndr_err_code ndr_pull_xattr_DosEAs(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosEAs *r);
+void ndr_print_xattr_DosEAs(struct ndr_print *ndr, const char *name, const struct xattr_DosEAs *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);
+void ndr_print_xattr_DosStream(struct ndr_print *ndr, const char *name, const struct xattr_DosStream *r);
+enum ndr_err_code ndr_push_xattr_DosStreams(struct ndr_push *ndr, int ndr_flags, const struct xattr_DosStreams *r);
+enum ndr_err_code ndr_pull_xattr_DosStreams(struct ndr_pull *ndr, int ndr_flags, struct xattr_DosStreams *r);
+void ndr_print_xattr_DosStreams(struct ndr_print *ndr, const char *name, const struct xattr_DosStreams *r);
enum ndr_err_code ndr_push_security_descriptor_timestamp(struct ndr_push *ndr, int ndr_flags, const struct security_descriptor_timestamp *r);
enum ndr_err_code ndr_pull_security_descriptor_timestamp(struct ndr_pull *ndr, int ndr_flags, struct security_descriptor_timestamp *r);
void ndr_print_security_descriptor_timestamp(struct ndr_print *ndr, const char *name, const struct security_descriptor_timestamp *r);
diff --git a/source3/librpc/gen_ndr/netlogon.h b/source3/librpc/gen_ndr/netlogon.h
index 1cea1f0f42..cf3959b199 100644
--- a/source3/librpc/gen_ndr/netlogon.h
+++ b/source3/librpc/gen_ndr/netlogon.h
@@ -2,6 +2,7 @@
#include <stdint.h>
+#include "librpc/gen_ndr/misc.h"
#include "librpc/gen_ndr/lsa.h"
#include "librpc/gen_ndr/samr.h"
#include "librpc/gen_ndr/security.h"
@@ -78,10 +79,41 @@ struct netr_NetworkInfo {
struct netr_ChallengeResponse lm;
}/* [flag(LIBNDR_PRINT_ARRAY_HEX)] */;
-union netr_LogonInfo {
- struct netr_PasswordInfo *password;/* [unique,case] */
- struct netr_NetworkInfo *network;/* [unique,case(2)] */
-}/* [public,switch_type(uint16)] */;
+struct netr_GenericInfo {
+ struct netr_IdentityInfo identity_info;
+ struct lsa_String package_name;
+ uint32_t length;
+ uint8_t *data;/* [unique,size_is(length)] */
+}/* [flag(LIBNDR_PRINT_ARRAY_HEX)] */;
+
+enum netr_LogonInfoClass
+#ifndef USE_UINT_ENUMS
+ {
+ NetlogonInteractiveInformation=1,
+ NetlogonNetworkInformation=2,
+ NetlogonServiceInformation=3,
+ NetlogonGenericInformation=4,
+ NetlogonInteractiveTransitiveInformation=5,
+ NetlogonNetworkTransitiveInformation=6,
+ NetlogonServiceTransitiveInformation=7
+}
+#else
+ { __donnot_use_enum_netr_LogonInfoClass=0x7FFFFFFF}
+#define NetlogonInteractiveInformation ( 1 )
+#define NetlogonNetworkInformation ( 2 )
+#define NetlogonServiceInformation ( 3 )
+#define NetlogonGenericInformation ( 4 )
+#define NetlogonInteractiveTransitiveInformation ( 5 )
+#define NetlogonNetworkTransitiveInformation ( 6 )
+#define NetlogonServiceTransitiveInformation ( 7 )
+#endif
+;
+
+union netr_LogonLevel {
+ struct netr_PasswordInfo *password;/* [unique,case(NetlogonInteractiveInformation)] */
+ struct netr_NetworkInfo *network;/* [unique,case(NetlogonNetworkInformation)] */
+ struct netr_GenericInfo *generic;/* [unique,case(NetlogonGenericInformation)] */
+}/* [public,switch_type(netr_LogonInfoClass)] */;
struct netr_UserSessionKey {
uint8_t key[16];
@@ -172,11 +204,36 @@ struct netr_PacInfo {
struct lsa_String unknown4;
};
+struct netr_GenericInfo2 {
+ uint32_t length;
+ uint8_t *data;/* [unique,size_is(length)] */
+}/* [flag(LIBNDR_PRINT_ARRAY_HEX)] */;
+
+enum netr_ValidationInfoClass
+#ifndef USE_UINT_ENUMS
+ {
+ NetlogonValidationUasInfo=1,
+ NetlogonValidationSamInfo=2,
+ NetlogonValidationSamInfo2=3,
+ NetlogonValidationGenericInfo2=5,
+ NetlogonValidationSamInfo4=6
+}
+#else
+ { __donnot_use_enum_netr_ValidationInfoClass=0x7FFFFFFF}
+#define NetlogonValidationUasInfo ( 1 )
+#define NetlogonValidationSamInfo ( 2 )
+#define NetlogonValidationSamInfo2 ( 3 )
+#define NetlogonValidationGenericInfo2 ( 5 )
+#define NetlogonValidationSamInfo4 ( 6 )
+#endif
+;
+
union netr_Validation {
- struct netr_SamInfo2 *sam2;/* [unique,case(2)] */
- struct netr_SamInfo3 *sam3;/* [unique,case(3)] */
+ struct netr_SamInfo2 *sam2;/* [unique,case(NetlogonValidationSamInfo)] */
+ struct netr_SamInfo3 *sam3;/* [unique,case(NetlogonValidationSamInfo2)] */
struct netr_PacInfo *pac;/* [unique,case(4)] */
- struct netr_SamInfo6 *sam6;/* [unique,case(6)] */
+ struct netr_GenericInfo2 *generic;/* [unique,case(NetlogonValidationGenericInfo2)] */
+ struct netr_SamInfo6 *sam6;/* [unique,case(NetlogonValidationSamInfo4)] */
}/* [public,switch_type(uint16)] */;
struct netr_Credential {
@@ -188,19 +245,6 @@ struct netr_Authenticator {
time_t timestamp;
}/* [public] */;
-enum netr_LogonLevel
-#ifndef USE_UINT_ENUMS
- {
- INTERACTIVE_LOGON_TYPE=1,
- NET_LOGON_TYPE=2
-}
-#else
- { __donnot_use_enum_netr_LogonLevel=0x7FFFFFFF}
-#define INTERACTIVE_LOGON_TYPE ( 1 )
-#define NET_LOGON_TYPE ( 2 )
-#endif
-;
-
enum netr_SchannelType;
enum netr_SamDatabaseID;
@@ -298,7 +342,7 @@ struct netr_DELTA_USER {
struct netr_DELTA_DOMAIN {
struct lsa_String domain_name;
- struct lsa_String comment;
+ struct lsa_String oem_information;
int64_t force_logoff_time;
uint16_t min_password_length;
uint16_t password_history_length;
@@ -736,6 +780,16 @@ struct netr_DsRGetDCNameInfo {
const char *client_site_name;/* [unique,charset(UTF16)] */
}/* [public] */;
+/* bitmap netr_TrustFlags */
+#define NETR_TRUST_FLAG_IN_FOREST ( 0x00000001 )
+#define NETR_TRUST_FLAG_OUTBOUND ( 0x00000002 )
+#define NETR_TRUST_FLAG_TREEROOT ( 0x00000004 )
+#define NETR_TRUST_FLAG_PRIMARY ( 0x00000008 )
+#define NETR_TRUST_FLAG_NATIVE ( 0x00000010 )
+#define NETR_TRUST_FLAG_INBOUND ( 0x00000020 )
+#define NETR_TRUST_FLAG_MIT_KRB5 ( 0x00000080 )
+#define NETR_TRUST_FLAG_AES ( 0x00000100 )
+
struct netr_BinaryString {
uint16_t length;
uint16_t size;
@@ -761,25 +815,57 @@ union netr_DomainQuery {
struct netr_DomainQuery1 *query1;/* [unique,case] */
};
+struct netr_trust_extension {
+ uint32_t length;/* [value(8)] */
+ uint32_t dummy;/* [value(0)] */
+ uint32_t size;/* [value(8)] */
+ uint32_t flags;
+ uint32_t parent_index;
+ uint32_t trust_type;
+ uint32_t trust_attributes;
+};
+
+struct netr_trust_extension_container {
+ uint16_t length;
+ uint16_t size;/* [value(length)] */
+ struct netr_trust_extension *info;/* [unique] */
+};
+
struct netr_DomainTrustInfo {
struct lsa_String domainname;
struct lsa_String fulldomainname;
struct lsa_String forest;
struct GUID guid;
struct dom_sid2 *sid;/* [unique] */
- struct netr_BinaryString unknown1[4];
- uint32_t unknown[4];
+ struct netr_trust_extension_container trust_extension;
+ struct lsa_String dummystring[3];
+ uint32_t dummy[4];
};
+struct netr_LsaPolicyInfo {
+ uint32_t policy_size;
+ uint8_t *policy;/* [unique,size_is(policy_size)] */
+};
+
+/* bitmap netr_WorkstationFlags */
+#define NETR_WS_FLAG_HANDLES_INBOUND_TRUSTS ( 0x00000001 )
+#define NETR_WS_FLAG_HANDLES_SPN_UPDATE ( 0x00000002 )
+
struct netr_DomainInfo1 {
struct netr_DomainTrustInfo domaininfo;
uint32_t num_trusts;
struct netr_DomainTrustInfo *trusts;/* [unique,size_is(num_trusts)] */
- uint32_t unknown[14];
+ struct netr_LsaPolicyInfo lsa_policy;
+ struct lsa_String dns_hostname;
+ struct lsa_String dummystring[3];
+ uint32_t workstation_flags;
+ uint32_t supported_enc_types;
+ uint32_t dummy[2];
};
union netr_DomainInfo {
struct netr_DomainInfo1 *info1;/* [unique,case] */
+ struct netr_DomainInfo1 *info2;/* [unique,case(2)] */
};
struct netr_CryptPassword {
@@ -797,14 +883,6 @@ struct netr_DsRAddress {
uint32_t size;
};
-/* bitmap netr_TrustFlags */
-#define NETR_TRUST_FLAG_IN_FOREST ( 0x00000001 )
-#define NETR_TRUST_FLAG_OUTBOUND ( 0x00000002 )
-#define NETR_TRUST_FLAG_TREEROOT ( 0x00000004 )
-#define NETR_TRUST_FLAG_PRIMARY ( 0x00000008 )
-#define NETR_TRUST_FLAG_NATIVE ( 0x00000010 )
-#define NETR_TRUST_FLAG_INBOUND ( 0x00000020 )
-
enum netr_TrustType
#ifndef USE_UINT_ENUMS
{
@@ -894,8 +972,8 @@ struct netr_LogonSamLogon {
const char *server_name;/* [unique,charset(UTF16)] */
const char *computer_name;/* [unique,charset(UTF16)] */
struct netr_Authenticator *credential;/* [unique] */
- enum netr_LogonLevel logon_level;
- union netr_LogonInfo *logon;/* [ref,switch_is(logon_level)] */
+ enum netr_LogonInfoClass logon_level;
+ union netr_LogonLevel *logon;/* [ref,switch_is(logon_level)] */
uint16_t validation_level;
struct netr_Authenticator *return_authenticator;/* [unique] */
} in;
@@ -915,8 +993,8 @@ struct netr_LogonSamLogoff {
const char *server_name;/* [unique,charset(UTF16)] */
const char *computer_name;/* [unique,charset(UTF16)] */
struct netr_Authenticator *credential;/* [unique] */
- enum netr_LogonLevel logon_level;
- union netr_LogonInfo logon;/* [switch_is(logon_level)] */
+ enum netr_LogonInfoClass logon_level;
+ union netr_LogonLevel logon;/* [switch_is(logon_level)] */
struct netr_Authenticator *return_authenticator;/* [unique] */
} in;
@@ -1480,8 +1558,8 @@ struct netr_LogonSamLogonEx {
struct {
const char *server_name;/* [unique,charset(UTF16)] */
const char *computer_name;/* [unique,charset(UTF16)] */
- enum netr_LogonLevel logon_level;
- union netr_LogonInfo *logon;/* [ref,switch_is(logon_level)] */
+ enum netr_LogonInfoClass logon_level;
+ union netr_LogonLevel *logon;/* [ref,switch_is(logon_level)] */
uint16_t validation_level;
uint32_t *flags;/* [ref] */
} in;
@@ -1582,8 +1660,8 @@ struct netr_LogonSamLogonWithFlags {
const char *server_name;/* [unique,charset(UTF16)] */
const char *computer_name;/* [unique,charset(UTF16)] */
struct netr_Authenticator *credential;/* [unique] */
- enum netr_LogonLevel logon_level;
- union netr_LogonInfo logon;/* [switch_is(logon_level)] */
+ enum netr_LogonInfoClass logon_level;
+ union netr_LogonLevel logon;/* [switch_is(logon_level)] */
uint16_t validation_level;
struct netr_Authenticator *return_authenticator;/* [unique] */
uint32_t *flags;/* [ref] */
diff --git a/source3/librpc/gen_ndr/notify.h b/source3/librpc/gen_ndr/notify.h
index c809702e5d..46a7e24e0d 100644
--- a/source3/librpc/gen_ndr/notify.h
+++ b/source3/librpc/gen_ndr/notify.h
@@ -2,6 +2,7 @@
#include <stdint.h>
+#include "librpc/gen_ndr/security.h"
#ifndef _HEADER_notify
#define _HEADER_notify
diff --git a/source3/librpc/gen_ndr/ntsvcs.h b/source3/librpc/gen_ndr/ntsvcs.h
index 95484e49f5..b56b552ae2 100644
--- a/source3/librpc/gen_ndr/ntsvcs.h
+++ b/source3/librpc/gen_ndr/ntsvcs.h
@@ -101,6 +101,14 @@ struct PNP_EnumerateSubKeys {
struct PNP_GetDeviceList {
struct {
+ const char *filter;/* [unique,charset(UTF16)] */
+ uint32_t flags;
+ uint32_t *length;/* [ref] */
+ } in;
+
+ struct {
+ uint16_t *buffer;/* [ref,length_is(*length),size_is(*length)] */
+ uint32_t *length;/* [ref] */
WERROR result;
} out;
@@ -133,15 +141,15 @@ struct PNP_GetDeviceRegProp {
struct {
const char *devicepath;/* [ref,charset(UTF16)] */
uint32_t property;
- uint32_t unknown3;
- uint32_t *unknown1;/* [ref] */
+ uint32_t flags;
+ uint32_t *reg_data_type;/* [ref] */
uint32_t *buffer_size;/* [ref] */
uint32_t *needed;/* [ref] */
} in;
struct {
uint8_t *buffer;/* [ref,length_is(*buffer_size),size_is(*buffer_size)] */
- uint32_t *unknown1;/* [ref] */
+ uint32_t *reg_data_type;/* [ref] */
uint32_t *buffer_size;/* [ref] */
uint32_t *needed;/* [ref] */
WERROR result;
diff --git a/source3/librpc/gen_ndr/samr.h b/source3/librpc/gen_ndr/samr.h
index 522c6a9cec..62f6bf8de6 100644
--- a/source3/librpc/gen_ndr/samr.h
+++ b/source3/librpc/gen_ndr/samr.h
@@ -125,9 +125,9 @@ struct samr_DomInfo1 {
int64_t min_password_age;
};
-struct samr_DomInfo2 {
+struct samr_DomGeneralInformation {
NTTIME force_logoff_time;
- struct lsa_String comment;
+ struct lsa_String oem_information;
struct lsa_String domain_name;
struct lsa_String primary;
uint64_t sequence_num;
@@ -143,8 +143,8 @@ struct samr_DomInfo3 {
NTTIME force_logoff_time;
};
-struct samr_DomInfo4 {
- struct lsa_String comment;
+struct samr_DomOEMInformation {
+ struct lsa_String oem_information;
};
struct samr_DomInfo5 {
@@ -168,8 +168,8 @@ struct samr_DomInfo9 {
uint32_t unknown;
};
-struct samr_DomInfo11 {
- struct samr_DomInfo2 info2;
+struct samr_DomGeneralInformation2 {
+ struct samr_DomGeneralInformation general;
uint64_t lockout_duration;
uint64_t lockout_window;
uint16_t lockout_threshold;
@@ -190,15 +190,15 @@ struct samr_DomInfo13 {
union samr_DomainInfo {
struct samr_DomInfo1 info1;/* [case] */
- struct samr_DomInfo2 info2;/* [case(2)] */
+ struct samr_DomGeneralInformation general;/* [case(2)] */
struct samr_DomInfo3 info3;/* [case(3)] */
- struct samr_DomInfo4 info4;/* [case(4)] */
+ struct samr_DomOEMInformation oem;/* [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_DomGeneralInformation2 general2;/* [case(11)] */
struct samr_DomInfo12 info12;/* [case(12)] */
struct samr_DomInfo13 info13;/* [case(13)] */
}/* [switch_type(uint16)] */;
diff --git a/source3/librpc/gen_ndr/security.h b/source3/librpc/gen_ndr/security.h
index 04655b178e..5b77d76b50 100644
--- a/source3/librpc/gen_ndr/security.h
+++ b/source3/librpc/gen_ndr/security.h
@@ -59,6 +59,7 @@
#define SEC_ADS_DELETE_TREE ( 0x00000040 )
#define SEC_ADS_LIST_OBJECT ( 0x00000080 )
#define SEC_ADS_CONTROL_ACCESS ( 0x00000100 )
+#define SEC_MASK_INVALID ( 0x0ce0fe00 )
#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 )
@@ -74,6 +75,7 @@
#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_OWNER_RIGHTS ( "S-1-3-4" )
#define NAME_NT_AUTHORITY ( "NT AUTHORITY" )
#define SID_NT_AUTHORITY ( "S-1-5" )
#define SID_NT_DIALUP ( "S-1-5-1" )
@@ -90,9 +92,14 @@
#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_IUSR ( "S-1-5-17" )
#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_NT_DIGEST_AUTHENTICATION ( "S-1-5-64-21" )
+#define SID_NT_NTLM_AUTHENTICATION ( "S-1-5-64-10" )
+#define SID_NT_SCHANNEL_AUTHENTICATION ( "S-1-5-64-14" )
+#define SID_NT_OTHER_ORGANISATION ( "S-1-5-1000" )
#define NAME_BUILTIN ( "BUILTIN" )
#define SID_BUILTIN ( "S-1-5-32" )
#define SID_BUILTIN_ADMINISTRATORS ( "S-1-5-32-544" )
@@ -324,4 +331,11 @@ struct security_token {
#define SECINFO_PROTECTED_SACL ( 0x40000000 )
#define SECINFO_PROTECTED_DACL ( 0x80000000 )
+/* bitmap kerb_EncTypes */
+#define KERB_ENCTYPE_DES_CBC_CRC ( 0x00000001 )
+#define KERB_ENCTYPE_DES_CBC_MD5 ( 0x00000002 )
+#define KERB_ENCTYPE_RC4_HMAC_MD5 ( 0x00000004 )
+#define KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96 ( 0x00000008 )
+#define KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96 ( 0x00000010 )
+
#endif /* _HEADER_security */
diff --git a/source3/librpc/gen_ndr/srv_dfs.c b/source3/librpc/gen_ndr/srv_dfs.c
index 54b2184829..d58272084a 100644
--- a/source3/librpc/gen_ndr/srv_dfs.c
+++ b/source3/librpc/gen_ndr/srv_dfs.c
@@ -27,7 +27,7 @@ static bool api_dfs_GetManagerVersion(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -63,7 +63,7 @@ static bool api_dfs_GetManagerVersion(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_GetManagerVersion, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -107,7 +107,7 @@ static bool api_dfs_Add(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -136,7 +136,7 @@ static bool api_dfs_Add(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_Add, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -180,7 +180,7 @@ static bool api_dfs_Remove(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -209,7 +209,7 @@ static bool api_dfs_Remove(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_Remove, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -253,7 +253,7 @@ static bool api_dfs_SetInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -282,7 +282,7 @@ static bool api_dfs_SetInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_SetInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -326,7 +326,7 @@ static bool api_dfs_GetInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -362,7 +362,7 @@ static bool api_dfs_GetInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_GetInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -406,7 +406,7 @@ static bool api_dfs_Enum(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -438,7 +438,7 @@ static bool api_dfs_Enum(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_Enum, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -482,7 +482,7 @@ static bool api_dfs_Rename(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -511,7 +511,7 @@ static bool api_dfs_Rename(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_Rename, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -555,7 +555,7 @@ static bool api_dfs_Move(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -584,7 +584,7 @@ static bool api_dfs_Move(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_Move, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -628,7 +628,7 @@ static bool api_dfs_ManagerGetConfigInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -657,7 +657,7 @@ static bool api_dfs_ManagerGetConfigInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_ManagerGetConfigInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -701,7 +701,7 @@ static bool api_dfs_ManagerSendSiteInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -730,7 +730,7 @@ static bool api_dfs_ManagerSendSiteInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_ManagerSendSiteInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -774,7 +774,7 @@ static bool api_dfs_AddFtRoot(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -805,7 +805,7 @@ static bool api_dfs_AddFtRoot(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_AddFtRoot, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -849,7 +849,7 @@ static bool api_dfs_RemoveFtRoot(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -880,7 +880,7 @@ static bool api_dfs_RemoveFtRoot(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_RemoveFtRoot, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -924,7 +924,7 @@ static bool api_dfs_AddStdRoot(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -953,7 +953,7 @@ static bool api_dfs_AddStdRoot(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_AddStdRoot, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -997,7 +997,7 @@ static bool api_dfs_RemoveStdRoot(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1026,7 +1026,7 @@ static bool api_dfs_RemoveStdRoot(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_RemoveStdRoot, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1070,7 +1070,7 @@ static bool api_dfs_ManagerInitialize(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1099,7 +1099,7 @@ static bool api_dfs_ManagerInitialize(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_ManagerInitialize, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1143,7 +1143,7 @@ static bool api_dfs_AddStdRootForced(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1172,7 +1172,7 @@ static bool api_dfs_AddStdRootForced(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_AddStdRootForced, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1216,7 +1216,7 @@ static bool api_dfs_GetDcAddress(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1249,7 +1249,7 @@ static bool api_dfs_GetDcAddress(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_GetDcAddress, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1293,7 +1293,7 @@ static bool api_dfs_SetDcAddress(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1322,7 +1322,7 @@ static bool api_dfs_SetDcAddress(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_SetDcAddress, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1366,7 +1366,7 @@ static bool api_dfs_FlushFtTable(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1395,7 +1395,7 @@ static bool api_dfs_FlushFtTable(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_FlushFtTable, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1439,7 +1439,7 @@ static bool api_dfs_Add2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1468,7 +1468,7 @@ static bool api_dfs_Add2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_Add2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1512,7 +1512,7 @@ static bool api_dfs_Remove2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1541,7 +1541,7 @@ static bool api_dfs_Remove2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_Remove2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1585,7 +1585,7 @@ static bool api_dfs_EnumEx(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1617,7 +1617,7 @@ static bool api_dfs_EnumEx(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_EnumEx, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1661,7 +1661,7 @@ static bool api_dfs_SetInfo2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1690,7 +1690,7 @@ static bool api_dfs_SetInfo2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dfs_SetInfo2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
diff --git a/source3/librpc/gen_ndr/srv_dssetup.c b/source3/librpc/gen_ndr/srv_dssetup.c
index 79bde30d06..62123b826c 100644
--- a/source3/librpc/gen_ndr/srv_dssetup.c
+++ b/source3/librpc/gen_ndr/srv_dssetup.c
@@ -27,7 +27,7 @@ static bool api_dssetup_DsRoleGetPrimaryDomainInformation(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -63,7 +63,7 @@ static bool api_dssetup_DsRoleGetPrimaryDomainInformation(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dssetup_DsRoleGetPrimaryDomainInformation, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -107,7 +107,7 @@ static bool api_dssetup_DsRoleDnsNameToFlatName(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -136,7 +136,7 @@ static bool api_dssetup_DsRoleDnsNameToFlatName(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dssetup_DsRoleDnsNameToFlatName, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -180,7 +180,7 @@ static bool api_dssetup_DsRoleDcAsDc(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -209,7 +209,7 @@ static bool api_dssetup_DsRoleDcAsDc(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dssetup_DsRoleDcAsDc, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -253,7 +253,7 @@ static bool api_dssetup_DsRoleDcAsReplica(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -282,7 +282,7 @@ static bool api_dssetup_DsRoleDcAsReplica(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dssetup_DsRoleDcAsReplica, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -326,7 +326,7 @@ static bool api_dssetup_DsRoleDemoteDc(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -355,7 +355,7 @@ static bool api_dssetup_DsRoleDemoteDc(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dssetup_DsRoleDemoteDc, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -399,7 +399,7 @@ static bool api_dssetup_DsRoleGetDcOperationProgress(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -428,7 +428,7 @@ static bool api_dssetup_DsRoleGetDcOperationProgress(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dssetup_DsRoleGetDcOperationProgress, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -472,7 +472,7 @@ static bool api_dssetup_DsRoleGetDcOperationResults(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -501,7 +501,7 @@ static bool api_dssetup_DsRoleGetDcOperationResults(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dssetup_DsRoleGetDcOperationResults, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -545,7 +545,7 @@ static bool api_dssetup_DsRoleCancel(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -574,7 +574,7 @@ static bool api_dssetup_DsRoleCancel(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dssetup_DsRoleCancel, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -618,7 +618,7 @@ static bool api_dssetup_DsRoleServerSaveStateForUpgrade(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -647,7 +647,7 @@ static bool api_dssetup_DsRoleServerSaveStateForUpgrade(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dssetup_DsRoleServerSaveStateForUpgrade, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -691,7 +691,7 @@ static bool api_dssetup_DsRoleUpgradeDownlevelServer(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -720,7 +720,7 @@ static bool api_dssetup_DsRoleUpgradeDownlevelServer(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dssetup_DsRoleUpgradeDownlevelServer, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -764,7 +764,7 @@ static bool api_dssetup_DsRoleAbortDownlevelServerUpgrade(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -793,7 +793,7 @@ static bool api_dssetup_DsRoleAbortDownlevelServerUpgrade(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(dssetup_DsRoleAbortDownlevelServerUpgrade, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
diff --git a/source3/librpc/gen_ndr/srv_echo.c b/source3/librpc/gen_ndr/srv_echo.c
index b8b38dad13..970398dc71 100644
--- a/source3/librpc/gen_ndr/srv_echo.c
+++ b/source3/librpc/gen_ndr/srv_echo.c
@@ -27,7 +27,7 @@ static bool api_echo_AddOne(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -63,7 +63,7 @@ static bool api_echo_AddOne(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(echo_AddOne, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -107,7 +107,7 @@ static bool api_echo_EchoData(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -143,7 +143,7 @@ static bool api_echo_EchoData(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(echo_EchoData, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -187,7 +187,7 @@ static bool api_echo_SinkData(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -216,7 +216,7 @@ static bool api_echo_SinkData(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(echo_SinkData, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -260,7 +260,7 @@ static bool api_echo_SourceData(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -296,7 +296,7 @@ static bool api_echo_SourceData(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(echo_SourceData, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -340,7 +340,7 @@ static bool api_echo_TestCall(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -376,7 +376,7 @@ static bool api_echo_TestCall(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(echo_TestCall, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -420,7 +420,7 @@ static bool api_echo_TestCall2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -456,7 +456,7 @@ static bool api_echo_TestCall2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(echo_TestCall2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -500,7 +500,7 @@ static bool api_echo_TestSleep(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -529,7 +529,7 @@ static bool api_echo_TestSleep(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(echo_TestSleep, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -573,7 +573,7 @@ static bool api_echo_TestEnum(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -606,7 +606,7 @@ static bool api_echo_TestEnum(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(echo_TestEnum, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -650,7 +650,7 @@ static bool api_echo_TestSurrounding(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -681,7 +681,7 @@ static bool api_echo_TestSurrounding(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(echo_TestSurrounding, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -725,7 +725,7 @@ static bool api_echo_TestDoublePointer(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -754,7 +754,7 @@ static bool api_echo_TestDoublePointer(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(echo_TestDoublePointer, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
diff --git a/source3/librpc/gen_ndr/srv_epmapper.c b/source3/librpc/gen_ndr/srv_epmapper.c
index f42598abd4..a31d89b8e8 100644
--- a/source3/librpc/gen_ndr/srv_epmapper.c
+++ b/source3/librpc/gen_ndr/srv_epmapper.c
@@ -27,7 +27,7 @@ static bool api_epm_Insert(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -56,7 +56,7 @@ static bool api_epm_Insert(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(epm_Insert, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -100,7 +100,7 @@ static bool api_epm_Delete(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -129,7 +129,7 @@ static bool api_epm_Delete(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(epm_Delete, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -173,7 +173,7 @@ static bool api_epm_Lookup(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -216,7 +216,7 @@ static bool api_epm_Lookup(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(epm_Lookup, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -260,7 +260,7 @@ static bool api_epm_Map(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -303,7 +303,7 @@ static bool api_epm_Map(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(epm_Map, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -347,7 +347,7 @@ static bool api_epm_LookupHandleFree(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -378,7 +378,7 @@ static bool api_epm_LookupHandleFree(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(epm_LookupHandleFree, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -422,7 +422,7 @@ static bool api_epm_InqObject(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -451,7 +451,7 @@ static bool api_epm_InqObject(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(epm_InqObject, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -495,7 +495,7 @@ static bool api_epm_MgmtDelete(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -524,7 +524,7 @@ static bool api_epm_MgmtDelete(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(epm_MgmtDelete, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -568,7 +568,7 @@ static bool api_epm_MapAuth(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -597,7 +597,7 @@ static bool api_epm_MapAuth(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(epm_MapAuth, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
diff --git a/source3/librpc/gen_ndr/srv_eventlog.c b/source3/librpc/gen_ndr/srv_eventlog.c
index eb3fb1fe6d..b9a4a2e9ed 100644
--- a/source3/librpc/gen_ndr/srv_eventlog.c
+++ b/source3/librpc/gen_ndr/srv_eventlog.c
@@ -27,7 +27,7 @@ static bool api_eventlog_ClearEventLogW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -56,7 +56,7 @@ static bool api_eventlog_ClearEventLogW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_ClearEventLogW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -100,7 +100,7 @@ static bool api_eventlog_BackupEventLogW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -129,7 +129,7 @@ static bool api_eventlog_BackupEventLogW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_BackupEventLogW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -173,7 +173,7 @@ static bool api_eventlog_CloseEventLog(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -204,7 +204,7 @@ static bool api_eventlog_CloseEventLog(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_CloseEventLog, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -248,7 +248,7 @@ static bool api_eventlog_DeregisterEventSource(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -277,7 +277,7 @@ static bool api_eventlog_DeregisterEventSource(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_DeregisterEventSource, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -321,7 +321,7 @@ static bool api_eventlog_GetNumRecords(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -357,7 +357,7 @@ static bool api_eventlog_GetNumRecords(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_GetNumRecords, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -401,7 +401,7 @@ static bool api_eventlog_GetOldestRecord(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -437,7 +437,7 @@ static bool api_eventlog_GetOldestRecord(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_GetOldestRecord, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -481,7 +481,7 @@ static bool api_eventlog_ChangeNotify(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -510,7 +510,7 @@ static bool api_eventlog_ChangeNotify(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_ChangeNotify, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -554,7 +554,7 @@ static bool api_eventlog_OpenEventLogW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -590,7 +590,7 @@ static bool api_eventlog_OpenEventLogW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_OpenEventLogW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -634,7 +634,7 @@ static bool api_eventlog_RegisterEventSourceW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -663,7 +663,7 @@ static bool api_eventlog_RegisterEventSourceW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_RegisterEventSourceW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -707,7 +707,7 @@ static bool api_eventlog_OpenBackupEventLogW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -736,7 +736,7 @@ static bool api_eventlog_OpenBackupEventLogW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_OpenBackupEventLogW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -780,7 +780,7 @@ static bool api_eventlog_ReadEventLogW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -828,7 +828,7 @@ static bool api_eventlog_ReadEventLogW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_ReadEventLogW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -872,7 +872,7 @@ static bool api_eventlog_ReportEventW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -901,7 +901,7 @@ static bool api_eventlog_ReportEventW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_ReportEventW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -945,7 +945,7 @@ static bool api_eventlog_ClearEventLogA(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -974,7 +974,7 @@ static bool api_eventlog_ClearEventLogA(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_ClearEventLogA, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1018,7 +1018,7 @@ static bool api_eventlog_BackupEventLogA(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1047,7 +1047,7 @@ static bool api_eventlog_BackupEventLogA(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_BackupEventLogA, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1091,7 +1091,7 @@ static bool api_eventlog_OpenEventLogA(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1120,7 +1120,7 @@ static bool api_eventlog_OpenEventLogA(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_OpenEventLogA, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1164,7 +1164,7 @@ static bool api_eventlog_RegisterEventSourceA(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1193,7 +1193,7 @@ static bool api_eventlog_RegisterEventSourceA(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_RegisterEventSourceA, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1237,7 +1237,7 @@ static bool api_eventlog_OpenBackupEventLogA(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1266,7 +1266,7 @@ static bool api_eventlog_OpenBackupEventLogA(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_OpenBackupEventLogA, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1310,7 +1310,7 @@ static bool api_eventlog_ReadEventLogA(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1339,7 +1339,7 @@ static bool api_eventlog_ReadEventLogA(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_ReadEventLogA, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1383,7 +1383,7 @@ static bool api_eventlog_ReportEventA(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1412,7 +1412,7 @@ static bool api_eventlog_ReportEventA(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_ReportEventA, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1456,7 +1456,7 @@ static bool api_eventlog_RegisterClusterSvc(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1485,7 +1485,7 @@ static bool api_eventlog_RegisterClusterSvc(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_RegisterClusterSvc, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1529,7 +1529,7 @@ static bool api_eventlog_DeregisterClusterSvc(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1558,7 +1558,7 @@ static bool api_eventlog_DeregisterClusterSvc(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_DeregisterClusterSvc, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1602,7 +1602,7 @@ static bool api_eventlog_WriteClusterEvents(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1631,7 +1631,7 @@ static bool api_eventlog_WriteClusterEvents(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_WriteClusterEvents, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1675,7 +1675,7 @@ static bool api_eventlog_GetLogIntormation(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1704,7 +1704,7 @@ static bool api_eventlog_GetLogIntormation(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_GetLogIntormation, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1748,7 +1748,7 @@ static bool api_eventlog_FlushEventLog(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1777,7 +1777,7 @@ static bool api_eventlog_FlushEventLog(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(eventlog_FlushEventLog, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
diff --git a/source3/librpc/gen_ndr/srv_initshutdown.c b/source3/librpc/gen_ndr/srv_initshutdown.c
index 00a89661b5..51098074ac 100644
--- a/source3/librpc/gen_ndr/srv_initshutdown.c
+++ b/source3/librpc/gen_ndr/srv_initshutdown.c
@@ -27,7 +27,7 @@ static bool api_initshutdown_Init(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -56,7 +56,7 @@ static bool api_initshutdown_Init(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(initshutdown_Init, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -100,7 +100,7 @@ static bool api_initshutdown_Abort(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -129,7 +129,7 @@ static bool api_initshutdown_Abort(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(initshutdown_Abort, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -173,7 +173,7 @@ static bool api_initshutdown_InitEx(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -202,7 +202,7 @@ static bool api_initshutdown_InitEx(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(initshutdown_InitEx, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
diff --git a/source3/librpc/gen_ndr/srv_lsa.c b/source3/librpc/gen_ndr/srv_lsa.c
index 41d1c9716c..b0893623a8 100644
--- a/source3/librpc/gen_ndr/srv_lsa.c
+++ b/source3/librpc/gen_ndr/srv_lsa.c
@@ -27,7 +27,7 @@ static bool api_lsa_Close(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -58,7 +58,7 @@ static bool api_lsa_Close(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_Close, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -102,7 +102,7 @@ static bool api_lsa_Delete(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -131,7 +131,7 @@ static bool api_lsa_Delete(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_Delete, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -175,7 +175,7 @@ static bool api_lsa_EnumPrivs(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -212,7 +212,7 @@ static bool api_lsa_EnumPrivs(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_EnumPrivs, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -256,7 +256,7 @@ static bool api_lsa_QuerySecurity(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -292,7 +292,7 @@ static bool api_lsa_QuerySecurity(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_QuerySecurity, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -336,7 +336,7 @@ static bool api_lsa_SetSecObj(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -365,7 +365,7 @@ static bool api_lsa_SetSecObj(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_SetSecObj, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -409,7 +409,7 @@ static bool api_lsa_ChangePassword(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -438,7 +438,7 @@ static bool api_lsa_ChangePassword(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_ChangePassword, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -482,7 +482,7 @@ static bool api_lsa_OpenPolicy(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -518,7 +518,7 @@ static bool api_lsa_OpenPolicy(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_OpenPolicy, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -562,7 +562,7 @@ static bool api_lsa_QueryInfoPolicy(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -598,7 +598,7 @@ static bool api_lsa_QueryInfoPolicy(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_QueryInfoPolicy, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -642,7 +642,7 @@ static bool api_lsa_SetInfoPolicy(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -671,7 +671,7 @@ static bool api_lsa_SetInfoPolicy(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_SetInfoPolicy, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -715,7 +715,7 @@ static bool api_lsa_ClearAuditLog(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -744,7 +744,7 @@ static bool api_lsa_ClearAuditLog(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_ClearAuditLog, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -788,7 +788,7 @@ static bool api_lsa_CreateAccount(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -824,7 +824,7 @@ static bool api_lsa_CreateAccount(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_CreateAccount, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -868,7 +868,7 @@ static bool api_lsa_EnumAccounts(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -905,7 +905,7 @@ static bool api_lsa_EnumAccounts(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_EnumAccounts, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -949,7 +949,7 @@ static bool api_lsa_CreateTrustedDomain(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -985,7 +985,7 @@ static bool api_lsa_CreateTrustedDomain(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomain, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1029,7 +1029,7 @@ static bool api_lsa_EnumTrustDom(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1066,7 +1066,7 @@ static bool api_lsa_EnumTrustDom(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_EnumTrustDom, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1110,7 +1110,7 @@ static bool api_lsa_LookupNames(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1148,7 +1148,7 @@ static bool api_lsa_LookupNames(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_LookupNames, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1192,7 +1192,7 @@ static bool api_lsa_LookupSids(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1230,7 +1230,7 @@ static bool api_lsa_LookupSids(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_LookupSids, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1274,7 +1274,7 @@ static bool api_lsa_CreateSecret(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1310,7 +1310,7 @@ static bool api_lsa_CreateSecret(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_CreateSecret, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1354,7 +1354,7 @@ static bool api_lsa_OpenAccount(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1390,7 +1390,7 @@ static bool api_lsa_OpenAccount(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_OpenAccount, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1434,7 +1434,7 @@ static bool api_lsa_EnumPrivsAccount(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1470,7 +1470,7 @@ static bool api_lsa_EnumPrivsAccount(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_EnumPrivsAccount, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1514,7 +1514,7 @@ static bool api_lsa_AddPrivilegesToAccount(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1543,7 +1543,7 @@ static bool api_lsa_AddPrivilegesToAccount(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_AddPrivilegesToAccount, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1587,7 +1587,7 @@ static bool api_lsa_RemovePrivilegesFromAccount(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1616,7 +1616,7 @@ static bool api_lsa_RemovePrivilegesFromAccount(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_RemovePrivilegesFromAccount, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1660,7 +1660,7 @@ static bool api_lsa_GetQuotasForAccount(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1689,7 +1689,7 @@ static bool api_lsa_GetQuotasForAccount(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_GetQuotasForAccount, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1733,7 +1733,7 @@ static bool api_lsa_SetQuotasForAccount(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1762,7 +1762,7 @@ static bool api_lsa_SetQuotasForAccount(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_SetQuotasForAccount, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1806,7 +1806,7 @@ static bool api_lsa_GetSystemAccessAccount(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1842,7 +1842,7 @@ static bool api_lsa_GetSystemAccessAccount(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_GetSystemAccessAccount, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1886,7 +1886,7 @@ static bool api_lsa_SetSystemAccessAccount(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1915,7 +1915,7 @@ static bool api_lsa_SetSystemAccessAccount(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_SetSystemAccessAccount, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1959,7 +1959,7 @@ static bool api_lsa_OpenTrustedDomain(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1995,7 +1995,7 @@ static bool api_lsa_OpenTrustedDomain(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_OpenTrustedDomain, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2039,7 +2039,7 @@ static bool api_lsa_QueryTrustedDomainInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2075,7 +2075,7 @@ static bool api_lsa_QueryTrustedDomainInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2119,7 +2119,7 @@ static bool api_lsa_SetInformationTrustedDomain(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2148,7 +2148,7 @@ static bool api_lsa_SetInformationTrustedDomain(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_SetInformationTrustedDomain, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2192,7 +2192,7 @@ static bool api_lsa_OpenSecret(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2228,7 +2228,7 @@ static bool api_lsa_OpenSecret(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_OpenSecret, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2272,7 +2272,7 @@ static bool api_lsa_SetSecret(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2301,7 +2301,7 @@ static bool api_lsa_SetSecret(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_SetSecret, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2345,7 +2345,7 @@ static bool api_lsa_QuerySecret(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2379,7 +2379,7 @@ static bool api_lsa_QuerySecret(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_QuerySecret, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2423,7 +2423,7 @@ static bool api_lsa_LookupPrivValue(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2459,7 +2459,7 @@ static bool api_lsa_LookupPrivValue(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_LookupPrivValue, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2503,7 +2503,7 @@ static bool api_lsa_LookupPrivName(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2539,7 +2539,7 @@ static bool api_lsa_LookupPrivName(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_LookupPrivName, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2583,7 +2583,7 @@ static bool api_lsa_LookupPrivDisplayName(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2625,7 +2625,7 @@ static bool api_lsa_LookupPrivDisplayName(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_LookupPrivDisplayName, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2669,7 +2669,7 @@ static bool api_lsa_DeleteObject(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2700,7 +2700,7 @@ static bool api_lsa_DeleteObject(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_DeleteObject, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2744,7 +2744,7 @@ static bool api_lsa_EnumAccountsWithUserRight(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2780,7 +2780,7 @@ static bool api_lsa_EnumAccountsWithUserRight(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_EnumAccountsWithUserRight, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2824,7 +2824,7 @@ static bool api_lsa_EnumAccountRights(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2860,7 +2860,7 @@ static bool api_lsa_EnumAccountRights(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_EnumAccountRights, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2904,7 +2904,7 @@ static bool api_lsa_AddAccountRights(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2933,7 +2933,7 @@ static bool api_lsa_AddAccountRights(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_AddAccountRights, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2977,7 +2977,7 @@ static bool api_lsa_RemoveAccountRights(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3006,7 +3006,7 @@ static bool api_lsa_RemoveAccountRights(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_RemoveAccountRights, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3050,7 +3050,7 @@ static bool api_lsa_QueryTrustedDomainInfoBySid(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3086,7 +3086,7 @@ static bool api_lsa_QueryTrustedDomainInfoBySid(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfoBySid, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3130,7 +3130,7 @@ static bool api_lsa_SetTrustedDomainInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3159,7 +3159,7 @@ static bool api_lsa_SetTrustedDomainInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_SetTrustedDomainInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3203,7 +3203,7 @@ static bool api_lsa_DeleteTrustedDomain(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3232,7 +3232,7 @@ static bool api_lsa_DeleteTrustedDomain(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_DeleteTrustedDomain, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3276,7 +3276,7 @@ static bool api_lsa_StorePrivateData(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3305,7 +3305,7 @@ static bool api_lsa_StorePrivateData(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_StorePrivateData, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3349,7 +3349,7 @@ static bool api_lsa_RetrievePrivateData(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3378,7 +3378,7 @@ static bool api_lsa_RetrievePrivateData(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_RetrievePrivateData, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3422,7 +3422,7 @@ static bool api_lsa_OpenPolicy2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3458,7 +3458,7 @@ static bool api_lsa_OpenPolicy2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_OpenPolicy2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3502,7 +3502,7 @@ static bool api_lsa_GetUserName(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3534,7 +3534,7 @@ static bool api_lsa_GetUserName(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_GetUserName, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3578,7 +3578,7 @@ static bool api_lsa_QueryInfoPolicy2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3614,7 +3614,7 @@ static bool api_lsa_QueryInfoPolicy2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_QueryInfoPolicy2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3658,7 +3658,7 @@ static bool api_lsa_SetInfoPolicy2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3687,7 +3687,7 @@ static bool api_lsa_SetInfoPolicy2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_SetInfoPolicy2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3731,7 +3731,7 @@ static bool api_lsa_QueryTrustedDomainInfoByName(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3767,7 +3767,7 @@ static bool api_lsa_QueryTrustedDomainInfoByName(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_QueryTrustedDomainInfoByName, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3811,7 +3811,7 @@ static bool api_lsa_SetTrustedDomainInfoByName(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3840,7 +3840,7 @@ static bool api_lsa_SetTrustedDomainInfoByName(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_SetTrustedDomainInfoByName, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3884,7 +3884,7 @@ static bool api_lsa_EnumTrustedDomainsEx(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3921,7 +3921,7 @@ static bool api_lsa_EnumTrustedDomainsEx(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_EnumTrustedDomainsEx, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3965,7 +3965,7 @@ static bool api_lsa_CreateTrustedDomainEx(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3982,6 +3982,13 @@ static bool api_lsa_CreateTrustedDomainEx(pipes_struct *p)
NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomainEx, 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;
+ }
+
r->out.result = _lsa_CreateTrustedDomainEx(p, r);
if (p->rng_fault_state) {
@@ -3994,7 +4001,7 @@ static bool api_lsa_CreateTrustedDomainEx(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomainEx, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4038,7 +4045,7 @@ static bool api_lsa_CloseTrustedDomainEx(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4069,7 +4076,7 @@ static bool api_lsa_CloseTrustedDomainEx(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_CloseTrustedDomainEx, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4113,7 +4120,7 @@ static bool api_lsa_QueryDomainInformationPolicy(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4149,7 +4156,7 @@ static bool api_lsa_QueryDomainInformationPolicy(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_QueryDomainInformationPolicy, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4193,7 +4200,7 @@ static bool api_lsa_SetDomainInformationPolicy(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4222,7 +4229,7 @@ static bool api_lsa_SetDomainInformationPolicy(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_SetDomainInformationPolicy, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4266,7 +4273,7 @@ static bool api_lsa_OpenTrustedDomainByName(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4302,7 +4309,7 @@ static bool api_lsa_OpenTrustedDomainByName(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_OpenTrustedDomainByName, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4346,7 +4353,7 @@ static bool api_lsa_TestCall(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4375,7 +4382,7 @@ static bool api_lsa_TestCall(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_TestCall, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4419,7 +4426,7 @@ static bool api_lsa_LookupSids2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4457,7 +4464,7 @@ static bool api_lsa_LookupSids2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_LookupSids2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4501,7 +4508,7 @@ static bool api_lsa_LookupNames2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4539,7 +4546,7 @@ static bool api_lsa_LookupNames2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_LookupNames2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4583,7 +4590,7 @@ static bool api_lsa_CreateTrustedDomainEx2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4600,6 +4607,13 @@ static bool api_lsa_CreateTrustedDomainEx2(pipes_struct *p)
NDR_PRINT_IN_DEBUG(lsa_CreateTrustedDomainEx2, 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;
+ }
+
r->out.result = _lsa_CreateTrustedDomainEx2(p, r);
if (p->rng_fault_state) {
@@ -4612,7 +4626,7 @@ static bool api_lsa_CreateTrustedDomainEx2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_CreateTrustedDomainEx2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4656,7 +4670,7 @@ static bool api_lsa_CREDRWRITE(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4685,7 +4699,7 @@ static bool api_lsa_CREDRWRITE(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_CREDRWRITE, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4729,7 +4743,7 @@ static bool api_lsa_CREDRREAD(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4758,7 +4772,7 @@ static bool api_lsa_CREDRREAD(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_CREDRREAD, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4802,7 +4816,7 @@ static bool api_lsa_CREDRENUMERATE(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4831,7 +4845,7 @@ static bool api_lsa_CREDRENUMERATE(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_CREDRENUMERATE, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4875,7 +4889,7 @@ static bool api_lsa_CREDRWRITEDOMAINCREDENTIALS(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4904,7 +4918,7 @@ static bool api_lsa_CREDRWRITEDOMAINCREDENTIALS(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_CREDRWRITEDOMAINCREDENTIALS, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4948,7 +4962,7 @@ static bool api_lsa_CREDRREADDOMAINCREDENTIALS(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4977,7 +4991,7 @@ static bool api_lsa_CREDRREADDOMAINCREDENTIALS(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_CREDRREADDOMAINCREDENTIALS, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -5021,7 +5035,7 @@ static bool api_lsa_CREDRDELETE(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -5050,7 +5064,7 @@ static bool api_lsa_CREDRDELETE(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_CREDRDELETE, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -5094,7 +5108,7 @@ static bool api_lsa_CREDRGETTARGETINFO(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -5123,7 +5137,7 @@ static bool api_lsa_CREDRGETTARGETINFO(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_CREDRGETTARGETINFO, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -5167,7 +5181,7 @@ static bool api_lsa_CREDRPROFILELOADED(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -5196,7 +5210,7 @@ static bool api_lsa_CREDRPROFILELOADED(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_CREDRPROFILELOADED, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -5240,7 +5254,7 @@ static bool api_lsa_LookupNames3(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -5278,7 +5292,7 @@ static bool api_lsa_LookupNames3(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_LookupNames3, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -5322,7 +5336,7 @@ static bool api_lsa_CREDRGETSESSIONTYPES(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -5351,7 +5365,7 @@ static bool api_lsa_CREDRGETSESSIONTYPES(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_CREDRGETSESSIONTYPES, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -5395,7 +5409,7 @@ static bool api_lsa_LSARREGISTERAUDITEVENT(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -5424,7 +5438,7 @@ static bool api_lsa_LSARREGISTERAUDITEVENT(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_LSARREGISTERAUDITEVENT, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -5468,7 +5482,7 @@ static bool api_lsa_LSARGENAUDITEVENT(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -5497,7 +5511,7 @@ static bool api_lsa_LSARGENAUDITEVENT(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_LSARGENAUDITEVENT, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -5541,7 +5555,7 @@ static bool api_lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -5570,7 +5584,7 @@ static bool api_lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_LSARUNREGISTERAUDITEVENT, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -5614,7 +5628,7 @@ static bool api_lsa_lsaRQueryForestTrustInformation(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -5650,7 +5664,7 @@ static bool api_lsa_lsaRQueryForestTrustInformation(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_lsaRQueryForestTrustInformation, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -5694,7 +5708,7 @@ static bool api_lsa_LSARSETFORESTTRUSTINFORMATION(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -5723,7 +5737,7 @@ static bool api_lsa_LSARSETFORESTTRUSTINFORMATION(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_LSARSETFORESTTRUSTINFORMATION, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -5767,7 +5781,7 @@ static bool api_lsa_CREDRRENAME(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -5796,7 +5810,7 @@ static bool api_lsa_CREDRRENAME(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_CREDRRENAME, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -5840,7 +5854,7 @@ static bool api_lsa_LookupSids3(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -5878,7 +5892,7 @@ static bool api_lsa_LookupSids3(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_LookupSids3, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -5922,7 +5936,7 @@ static bool api_lsa_LookupNames4(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -5960,7 +5974,7 @@ static bool api_lsa_LookupNames4(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_LookupNames4, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -6004,7 +6018,7 @@ static bool api_lsa_LSAROPENPOLICYSCE(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -6033,7 +6047,7 @@ static bool api_lsa_LSAROPENPOLICYSCE(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_LSAROPENPOLICYSCE, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -6077,7 +6091,7 @@ static bool api_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -6106,7 +6120,7 @@ static bool api_lsa_LSARADTREGISTERSECURITYEVENTSOURCE(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_LSARADTREGISTERSECURITYEVENTSOURCE, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -6150,7 +6164,7 @@ static bool api_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -6179,7 +6193,7 @@ static bool api_lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -6223,7 +6237,7 @@ static bool api_lsa_LSARADTREPORTSECURITYEVENT(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -6252,7 +6266,7 @@ static bool api_lsa_LSARADTREPORTSECURITYEVENT(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(lsa_LSARADTREPORTSECURITYEVENT, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
diff --git a/source3/librpc/gen_ndr/srv_netlogon.c b/source3/librpc/gen_ndr/srv_netlogon.c
index 154ef71d40..c14f682c1c 100644
--- a/source3/librpc/gen_ndr/srv_netlogon.c
+++ b/source3/librpc/gen_ndr/srv_netlogon.c
@@ -27,7 +27,7 @@ static bool api_netr_LogonUasLogon(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -63,7 +63,7 @@ static bool api_netr_LogonUasLogon(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_LogonUasLogon, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -107,7 +107,7 @@ static bool api_netr_LogonUasLogoff(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -143,7 +143,7 @@ static bool api_netr_LogonUasLogoff(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_LogonUasLogoff, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -187,7 +187,7 @@ static bool api_netr_LogonSamLogon(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -230,7 +230,7 @@ static bool api_netr_LogonSamLogon(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_LogonSamLogon, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -274,7 +274,7 @@ static bool api_netr_LogonSamLogoff(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -305,7 +305,7 @@ static bool api_netr_LogonSamLogoff(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_LogonSamLogoff, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -349,7 +349,7 @@ static bool api_netr_ServerReqChallenge(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -385,7 +385,7 @@ static bool api_netr_ServerReqChallenge(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_ServerReqChallenge, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -429,7 +429,7 @@ static bool api_netr_ServerAuthenticate(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -465,7 +465,7 @@ static bool api_netr_ServerAuthenticate(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -509,7 +509,7 @@ static bool api_netr_ServerPasswordSet(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -545,7 +545,7 @@ static bool api_netr_ServerPasswordSet(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -589,7 +589,7 @@ static bool api_netr_DatabaseDeltas(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -627,7 +627,7 @@ static bool api_netr_DatabaseDeltas(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_DatabaseDeltas, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -671,7 +671,7 @@ static bool api_netr_DatabaseSync(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -709,7 +709,7 @@ static bool api_netr_DatabaseSync(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_DatabaseSync, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -753,7 +753,7 @@ static bool api_netr_AccountDeltas(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -808,7 +808,7 @@ static bool api_netr_AccountDeltas(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_AccountDeltas, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -852,7 +852,7 @@ static bool api_netr_AccountSync(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -908,7 +908,7 @@ static bool api_netr_AccountSync(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_AccountSync, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -952,7 +952,7 @@ static bool api_netr_GetDcName(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -988,7 +988,7 @@ static bool api_netr_GetDcName(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_GetDcName, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1032,7 +1032,7 @@ static bool api_netr_LogonControl(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1068,7 +1068,7 @@ static bool api_netr_LogonControl(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_LogonControl, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1112,7 +1112,7 @@ static bool api_netr_GetAnyDCName(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1148,7 +1148,7 @@ static bool api_netr_GetAnyDCName(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_GetAnyDCName, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1192,7 +1192,7 @@ static bool api_netr_LogonControl2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1228,7 +1228,7 @@ static bool api_netr_LogonControl2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_LogonControl2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1272,7 +1272,7 @@ static bool api_netr_ServerAuthenticate2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1309,7 +1309,7 @@ static bool api_netr_ServerAuthenticate2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1353,7 +1353,7 @@ static bool api_netr_DatabaseSync2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1391,7 +1391,7 @@ static bool api_netr_DatabaseSync2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_DatabaseSync2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1435,7 +1435,7 @@ static bool api_netr_DatabaseRedo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1472,7 +1472,7 @@ static bool api_netr_DatabaseRedo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_DatabaseRedo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1516,7 +1516,7 @@ static bool api_netr_LogonControl2Ex(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1552,7 +1552,7 @@ static bool api_netr_LogonControl2Ex(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_LogonControl2Ex, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1596,7 +1596,7 @@ static bool api_netr_NetrEnumerateTrustedDomains(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1632,7 +1632,7 @@ static bool api_netr_NetrEnumerateTrustedDomains(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_NetrEnumerateTrustedDomains, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1676,7 +1676,7 @@ static bool api_netr_DsRGetDCName(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1712,7 +1712,7 @@ static bool api_netr_DsRGetDCName(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_DsRGetDCName, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1756,7 +1756,7 @@ static bool api_netr_NETRLOGONDUMMYROUTINE1(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1785,7 +1785,7 @@ static bool api_netr_NETRLOGONDUMMYROUTINE1(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_NETRLOGONDUMMYROUTINE1, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1829,7 +1829,7 @@ static bool api_netr_NETRLOGONSETSERVICEBITS(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1858,7 +1858,7 @@ static bool api_netr_NETRLOGONSETSERVICEBITS(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSETSERVICEBITS, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1902,7 +1902,7 @@ static bool api_netr_LogonGetTrustRid(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1938,7 +1938,7 @@ static bool api_netr_LogonGetTrustRid(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_LogonGetTrustRid, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1982,7 +1982,7 @@ static bool api_netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2011,7 +2011,7 @@ static bool api_netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTESERVERDIGEST, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2055,7 +2055,7 @@ static bool api_netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2084,7 +2084,7 @@ static bool api_netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_NETRLOGONCOMPUTECLIENTDIGEST, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2128,7 +2128,7 @@ static bool api_netr_ServerAuthenticate3(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2166,7 +2166,7 @@ static bool api_netr_ServerAuthenticate3(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_ServerAuthenticate3, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2210,7 +2210,7 @@ static bool api_netr_DsRGetDCNameEx(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2246,7 +2246,7 @@ static bool api_netr_DsRGetDCNameEx(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2290,7 +2290,7 @@ static bool api_netr_DsRGetSiteName(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2326,7 +2326,7 @@ static bool api_netr_DsRGetSiteName(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_DsRGetSiteName, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2370,7 +2370,7 @@ static bool api_netr_LogonGetDomainInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2407,7 +2407,7 @@ static bool api_netr_LogonGetDomainInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_LogonGetDomainInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2451,7 +2451,7 @@ static bool api_netr_ServerPasswordSet2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2487,7 +2487,7 @@ static bool api_netr_ServerPasswordSet2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_ServerPasswordSet2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2531,7 +2531,7 @@ static bool api_netr_ServerPasswordGet(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2573,7 +2573,7 @@ static bool api_netr_ServerPasswordGet(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_ServerPasswordGet, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2617,7 +2617,7 @@ static bool api_netr_NETRLOGONSENDTOSAM(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2646,7 +2646,7 @@ static bool api_netr_NETRLOGONSENDTOSAM(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_NETRLOGONSENDTOSAM, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2690,7 +2690,7 @@ static bool api_netr_DsRAddressToSitenamesW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2726,7 +2726,7 @@ static bool api_netr_DsRAddressToSitenamesW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_DsRAddressToSitenamesW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2770,7 +2770,7 @@ static bool api_netr_DsRGetDCNameEx2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2806,7 +2806,7 @@ static bool api_netr_DsRGetDCNameEx2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_DsRGetDCNameEx2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2850,7 +2850,7 @@ static bool api_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2879,7 +2879,7 @@ static bool api_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2923,7 +2923,7 @@ static bool api_netr_NetrEnumerateTrustedDomainsEx(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2959,7 +2959,7 @@ static bool api_netr_NetrEnumerateTrustedDomainsEx(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_NetrEnumerateTrustedDomainsEx, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3003,7 +3003,7 @@ static bool api_netr_DsRAddressToSitenamesExW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3039,7 +3039,7 @@ static bool api_netr_DsRAddressToSitenamesExW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_DsRAddressToSitenamesExW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3083,7 +3083,7 @@ static bool api_netr_DsrGetDcSiteCoverageW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3119,7 +3119,7 @@ static bool api_netr_DsrGetDcSiteCoverageW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_DsrGetDcSiteCoverageW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3163,7 +3163,7 @@ static bool api_netr_LogonSamLogonEx(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3206,7 +3206,7 @@ static bool api_netr_LogonSamLogonEx(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonEx, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3250,7 +3250,7 @@ static bool api_netr_DsrEnumerateDomainTrusts(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3286,7 +3286,7 @@ static bool api_netr_DsrEnumerateDomainTrusts(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_DsrEnumerateDomainTrusts, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3330,7 +3330,7 @@ static bool api_netr_DsrDeregisterDNSHostRecords(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3359,7 +3359,7 @@ static bool api_netr_DsrDeregisterDNSHostRecords(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_DsrDeregisterDNSHostRecords, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3403,7 +3403,7 @@ static bool api_netr_ServerTrustPasswordsGet(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3451,7 +3451,7 @@ static bool api_netr_ServerTrustPasswordsGet(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_ServerTrustPasswordsGet, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3495,7 +3495,7 @@ static bool api_netr_DsRGetForestTrustInformation(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3531,7 +3531,7 @@ static bool api_netr_DsRGetForestTrustInformation(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_DsRGetForestTrustInformation, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3575,7 +3575,7 @@ static bool api_netr_GetForestTrustInformation(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3617,7 +3617,7 @@ static bool api_netr_GetForestTrustInformation(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_GetForestTrustInformation, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3661,7 +3661,7 @@ static bool api_netr_LogonSamLogonWithFlags(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3705,7 +3705,7 @@ static bool api_netr_LogonSamLogonWithFlags(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_LogonSamLogonWithFlags, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3749,7 +3749,7 @@ static bool api_netr_NETRSERVERGETTRUSTINFO(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3778,7 +3778,7 @@ static bool api_netr_NETRSERVERGETTRUSTINFO(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(netr_NETRSERVERGETTRUSTINFO, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
diff --git a/source3/librpc/gen_ndr/srv_ntsvcs.c b/source3/librpc/gen_ndr/srv_ntsvcs.c
index d21e86db6e..87f5d51695 100644
--- a/source3/librpc/gen_ndr/srv_ntsvcs.c
+++ b/source3/librpc/gen_ndr/srv_ntsvcs.c
@@ -27,7 +27,7 @@ static bool api_PNP_Disconnect(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -56,7 +56,7 @@ static bool api_PNP_Disconnect(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_Disconnect, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -100,7 +100,7 @@ static bool api_PNP_Connect(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -129,7 +129,7 @@ static bool api_PNP_Connect(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_Connect, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -173,7 +173,7 @@ static bool api_PNP_GetVersion(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -209,7 +209,7 @@ static bool api_PNP_GetVersion(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetVersion, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -253,7 +253,7 @@ static bool api_PNP_GetGlobalState(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -282,7 +282,7 @@ static bool api_PNP_GetGlobalState(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetGlobalState, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -326,7 +326,7 @@ static bool api_PNP_InitDetection(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -355,7 +355,7 @@ static bool api_PNP_InitDetection(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_InitDetection, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -399,7 +399,7 @@ static bool api_PNP_ReportLogOn(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -428,7 +428,7 @@ static bool api_PNP_ReportLogOn(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_ReportLogOn, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -472,7 +472,7 @@ static bool api_PNP_ValidateDeviceInstance(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -501,7 +501,7 @@ static bool api_PNP_ValidateDeviceInstance(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_ValidateDeviceInstance, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -545,7 +545,7 @@ static bool api_PNP_GetRootDeviceInstance(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -574,7 +574,7 @@ static bool api_PNP_GetRootDeviceInstance(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetRootDeviceInstance, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -618,7 +618,7 @@ static bool api_PNP_GetRelatedDeviceInstance(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -647,7 +647,7 @@ static bool api_PNP_GetRelatedDeviceInstance(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetRelatedDeviceInstance, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -691,7 +691,7 @@ static bool api_PNP_EnumerateSubKeys(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -720,7 +720,7 @@ static bool api_PNP_EnumerateSubKeys(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_EnumerateSubKeys, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -764,7 +764,7 @@ static bool api_PNP_GetDeviceList(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -781,6 +781,14 @@ static bool api_PNP_GetDeviceList(pipes_struct *p)
NDR_PRINT_IN_DEBUG(PNP_GetDeviceList, r);
}
+ ZERO_STRUCT(r->out);
+ r->out.buffer = talloc_zero_array(r, uint16_t, *r->out.length);
+ if (r->out.buffer == NULL) {
+ talloc_free(r);
+ return false;
+ }
+
+ r->out.length = r->in.length;
r->out.result = _PNP_GetDeviceList(p, r);
if (p->rng_fault_state) {
@@ -793,7 +801,7 @@ static bool api_PNP_GetDeviceList(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetDeviceList, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -837,7 +845,7 @@ static bool api_PNP_GetDeviceListSize(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -873,7 +881,7 @@ static bool api_PNP_GetDeviceListSize(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetDeviceListSize, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -917,7 +925,7 @@ static bool api_PNP_GetDepth(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -946,7 +954,7 @@ static bool api_PNP_GetDepth(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetDepth, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -990,7 +998,7 @@ static bool api_PNP_GetDeviceRegProp(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1008,7 +1016,7 @@ static bool api_PNP_GetDeviceRegProp(pipes_struct *p)
}
ZERO_STRUCT(r->out);
- r->out.unknown1 = r->in.unknown1;
+ r->out.reg_data_type = r->in.reg_data_type;
r->out.buffer = talloc_zero_array(r, uint8_t, *r->out.buffer_size);
if (r->out.buffer == NULL) {
talloc_free(r);
@@ -1029,7 +1037,7 @@ static bool api_PNP_GetDeviceRegProp(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetDeviceRegProp, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1073,7 +1081,7 @@ static bool api_PNP_SetDeviceRegProp(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1102,7 +1110,7 @@ static bool api_PNP_SetDeviceRegProp(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_SetDeviceRegProp, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1146,7 +1154,7 @@ static bool api_PNP_GetClassInstance(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1175,7 +1183,7 @@ static bool api_PNP_GetClassInstance(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetClassInstance, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1219,7 +1227,7 @@ static bool api_PNP_CreateKey(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1248,7 +1256,7 @@ static bool api_PNP_CreateKey(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_CreateKey, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1292,7 +1300,7 @@ static bool api_PNP_DeleteRegistryKey(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1321,7 +1329,7 @@ static bool api_PNP_DeleteRegistryKey(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_DeleteRegistryKey, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1365,7 +1373,7 @@ static bool api_PNP_GetClassCount(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1394,7 +1402,7 @@ static bool api_PNP_GetClassCount(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetClassCount, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1438,7 +1446,7 @@ static bool api_PNP_GetClassName(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1467,7 +1475,7 @@ static bool api_PNP_GetClassName(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetClassName, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1511,7 +1519,7 @@ static bool api_PNP_DeleteClassKey(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1540,7 +1548,7 @@ static bool api_PNP_DeleteClassKey(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_DeleteClassKey, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1584,7 +1592,7 @@ static bool api_PNP_GetInterfaceDeviceAlias(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1613,7 +1621,7 @@ static bool api_PNP_GetInterfaceDeviceAlias(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetInterfaceDeviceAlias, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1657,7 +1665,7 @@ static bool api_PNP_GetInterfaceDeviceList(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1686,7 +1694,7 @@ static bool api_PNP_GetInterfaceDeviceList(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetInterfaceDeviceList, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1730,7 +1738,7 @@ static bool api_PNP_GetInterfaceDeviceListSize(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1759,7 +1767,7 @@ static bool api_PNP_GetInterfaceDeviceListSize(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetInterfaceDeviceListSize, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1803,7 +1811,7 @@ static bool api_PNP_RegisterDeviceClassAssociation(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1832,7 +1840,7 @@ static bool api_PNP_RegisterDeviceClassAssociation(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_RegisterDeviceClassAssociation, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1876,7 +1884,7 @@ static bool api_PNP_UnregisterDeviceClassAssociation(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1905,7 +1913,7 @@ static bool api_PNP_UnregisterDeviceClassAssociation(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_UnregisterDeviceClassAssociation, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1949,7 +1957,7 @@ static bool api_PNP_GetClassRegProp(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1978,7 +1986,7 @@ static bool api_PNP_GetClassRegProp(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetClassRegProp, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2022,7 +2030,7 @@ static bool api_PNP_SetClassRegProp(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2051,7 +2059,7 @@ static bool api_PNP_SetClassRegProp(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_SetClassRegProp, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2095,7 +2103,7 @@ static bool api_PNP_CreateDevInst(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2124,7 +2132,7 @@ static bool api_PNP_CreateDevInst(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_CreateDevInst, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2168,7 +2176,7 @@ static bool api_PNP_DeviceInstanceAction(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2197,7 +2205,7 @@ static bool api_PNP_DeviceInstanceAction(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_DeviceInstanceAction, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2241,7 +2249,7 @@ static bool api_PNP_GetDeviceStatus(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2270,7 +2278,7 @@ static bool api_PNP_GetDeviceStatus(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetDeviceStatus, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2314,7 +2322,7 @@ static bool api_PNP_SetDeviceProblem(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2343,7 +2351,7 @@ static bool api_PNP_SetDeviceProblem(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_SetDeviceProblem, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2387,7 +2395,7 @@ static bool api_PNP_DisableDevInst(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2416,7 +2424,7 @@ static bool api_PNP_DisableDevInst(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_DisableDevInst, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2460,7 +2468,7 @@ static bool api_PNP_UninstallDevInst(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2489,7 +2497,7 @@ static bool api_PNP_UninstallDevInst(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_UninstallDevInst, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2533,7 +2541,7 @@ static bool api_PNP_AddID(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2562,7 +2570,7 @@ static bool api_PNP_AddID(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_AddID, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2606,7 +2614,7 @@ static bool api_PNP_RegisterDriver(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2635,7 +2643,7 @@ static bool api_PNP_RegisterDriver(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_RegisterDriver, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2679,7 +2687,7 @@ static bool api_PNP_QueryRemove(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2708,7 +2716,7 @@ static bool api_PNP_QueryRemove(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_QueryRemove, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2752,7 +2760,7 @@ static bool api_PNP_RequestDeviceEject(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2781,7 +2789,7 @@ static bool api_PNP_RequestDeviceEject(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_RequestDeviceEject, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2825,7 +2833,7 @@ static bool api_PNP_IsDockStationPresent(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2854,7 +2862,7 @@ static bool api_PNP_IsDockStationPresent(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_IsDockStationPresent, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2898,7 +2906,7 @@ static bool api_PNP_RequestEjectPC(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2927,7 +2935,7 @@ static bool api_PNP_RequestEjectPC(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_RequestEjectPC, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2971,7 +2979,7 @@ static bool api_PNP_HwProfFlags(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3009,7 +3017,7 @@ static bool api_PNP_HwProfFlags(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_HwProfFlags, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3053,7 +3061,7 @@ static bool api_PNP_GetHwProfInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3084,7 +3092,7 @@ static bool api_PNP_GetHwProfInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetHwProfInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3128,7 +3136,7 @@ static bool api_PNP_AddEmptyLogConf(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3157,7 +3165,7 @@ static bool api_PNP_AddEmptyLogConf(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_AddEmptyLogConf, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3201,7 +3209,7 @@ static bool api_PNP_FreeLogConf(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3230,7 +3238,7 @@ static bool api_PNP_FreeLogConf(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_FreeLogConf, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3274,7 +3282,7 @@ static bool api_PNP_GetFirstLogConf(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3303,7 +3311,7 @@ static bool api_PNP_GetFirstLogConf(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetFirstLogConf, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3347,7 +3355,7 @@ static bool api_PNP_GetNextLogConf(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3376,7 +3384,7 @@ static bool api_PNP_GetNextLogConf(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetNextLogConf, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3420,7 +3428,7 @@ static bool api_PNP_GetLogConfPriority(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3449,7 +3457,7 @@ static bool api_PNP_GetLogConfPriority(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetLogConfPriority, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3493,7 +3501,7 @@ static bool api_PNP_AddResDes(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3522,7 +3530,7 @@ static bool api_PNP_AddResDes(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_AddResDes, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3566,7 +3574,7 @@ static bool api_PNP_FreeResDes(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3595,7 +3603,7 @@ static bool api_PNP_FreeResDes(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_FreeResDes, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3639,7 +3647,7 @@ static bool api_PNP_GetNextResDes(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3668,7 +3676,7 @@ static bool api_PNP_GetNextResDes(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetNextResDes, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3712,7 +3720,7 @@ static bool api_PNP_GetResDesData(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3741,7 +3749,7 @@ static bool api_PNP_GetResDesData(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetResDesData, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3785,7 +3793,7 @@ static bool api_PNP_GetResDesDataSize(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3814,7 +3822,7 @@ static bool api_PNP_GetResDesDataSize(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetResDesDataSize, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3858,7 +3866,7 @@ static bool api_PNP_ModifyResDes(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3887,7 +3895,7 @@ static bool api_PNP_ModifyResDes(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_ModifyResDes, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3931,7 +3939,7 @@ static bool api_PNP_DetectResourceLimit(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3960,7 +3968,7 @@ static bool api_PNP_DetectResourceLimit(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_DetectResourceLimit, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4004,7 +4012,7 @@ static bool api_PNP_QueryResConfList(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4033,7 +4041,7 @@ static bool api_PNP_QueryResConfList(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_QueryResConfList, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4077,7 +4085,7 @@ static bool api_PNP_SetHwProf(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4106,7 +4114,7 @@ static bool api_PNP_SetHwProf(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_SetHwProf, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4150,7 +4158,7 @@ static bool api_PNP_QueryArbitratorFreeData(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4179,7 +4187,7 @@ static bool api_PNP_QueryArbitratorFreeData(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_QueryArbitratorFreeData, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4223,7 +4231,7 @@ static bool api_PNP_QueryArbitratorFreeSize(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4252,7 +4260,7 @@ static bool api_PNP_QueryArbitratorFreeSize(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_QueryArbitratorFreeSize, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4296,7 +4304,7 @@ static bool api_PNP_RunDetection(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4325,7 +4333,7 @@ static bool api_PNP_RunDetection(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_RunDetection, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4369,7 +4377,7 @@ static bool api_PNP_RegisterNotification(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4398,7 +4406,7 @@ static bool api_PNP_RegisterNotification(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_RegisterNotification, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4442,7 +4450,7 @@ static bool api_PNP_UnregisterNotification(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4471,7 +4479,7 @@ static bool api_PNP_UnregisterNotification(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_UnregisterNotification, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4515,7 +4523,7 @@ static bool api_PNP_GetCustomDevProp(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4544,7 +4552,7 @@ static bool api_PNP_GetCustomDevProp(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetCustomDevProp, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4588,7 +4596,7 @@ static bool api_PNP_GetVersionInternal(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4617,7 +4625,7 @@ static bool api_PNP_GetVersionInternal(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetVersionInternal, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4661,7 +4669,7 @@ static bool api_PNP_GetBlockedDriverInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4690,7 +4698,7 @@ static bool api_PNP_GetBlockedDriverInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetBlockedDriverInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4734,7 +4742,7 @@ static bool api_PNP_GetServerSideDeviceInstallFlags(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4763,7 +4771,7 @@ static bool api_PNP_GetServerSideDeviceInstallFlags(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(PNP_GetServerSideDeviceInstallFlags, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
diff --git a/source3/librpc/gen_ndr/srv_samr.c b/source3/librpc/gen_ndr/srv_samr.c
index 1eaa19eaf7..e09c7a3faf 100644
--- a/source3/librpc/gen_ndr/srv_samr.c
+++ b/source3/librpc/gen_ndr/srv_samr.c
@@ -27,7 +27,7 @@ static bool api_samr_Connect(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -63,7 +63,7 @@ static bool api_samr_Connect(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_Connect, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -107,7 +107,7 @@ static bool api_samr_Close(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -138,7 +138,7 @@ static bool api_samr_Close(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_Close, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -182,7 +182,7 @@ static bool api_samr_SetSecurity(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -211,7 +211,7 @@ static bool api_samr_SetSecurity(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_SetSecurity, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -255,7 +255,7 @@ static bool api_samr_QuerySecurity(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -291,7 +291,7 @@ static bool api_samr_QuerySecurity(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_QuerySecurity, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -335,7 +335,7 @@ static bool api_samr_Shutdown(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -364,7 +364,7 @@ static bool api_samr_Shutdown(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_Shutdown, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -408,7 +408,7 @@ static bool api_samr_LookupDomain(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -444,7 +444,7 @@ static bool api_samr_LookupDomain(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_LookupDomain, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -488,7 +488,7 @@ static bool api_samr_EnumDomains(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -531,7 +531,7 @@ static bool api_samr_EnumDomains(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_EnumDomains, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -575,7 +575,7 @@ static bool api_samr_OpenDomain(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -611,7 +611,7 @@ static bool api_samr_OpenDomain(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_OpenDomain, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -655,7 +655,7 @@ static bool api_samr_QueryDomainInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -691,7 +691,7 @@ static bool api_samr_QueryDomainInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_QueryDomainInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -735,7 +735,7 @@ static bool api_samr_SetDomainInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -764,7 +764,7 @@ static bool api_samr_SetDomainInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_SetDomainInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -808,7 +808,7 @@ static bool api_samr_CreateDomainGroup(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -850,7 +850,7 @@ static bool api_samr_CreateDomainGroup(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_CreateDomainGroup, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -894,7 +894,7 @@ static bool api_samr_EnumDomainGroups(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -937,7 +937,7 @@ static bool api_samr_EnumDomainGroups(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_EnumDomainGroups, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -981,7 +981,7 @@ static bool api_samr_CreateUser(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1023,7 +1023,7 @@ static bool api_samr_CreateUser(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_CreateUser, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1067,7 +1067,7 @@ static bool api_samr_EnumDomainUsers(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1110,7 +1110,7 @@ static bool api_samr_EnumDomainUsers(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_EnumDomainUsers, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1154,7 +1154,7 @@ static bool api_samr_CreateDomAlias(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1196,7 +1196,7 @@ static bool api_samr_CreateDomAlias(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_CreateDomAlias, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1240,7 +1240,7 @@ static bool api_samr_EnumDomainAliases(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1283,7 +1283,7 @@ static bool api_samr_EnumDomainAliases(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_EnumDomainAliases, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1327,7 +1327,7 @@ static bool api_samr_GetAliasMembership(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1363,7 +1363,7 @@ static bool api_samr_GetAliasMembership(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_GetAliasMembership, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1407,7 +1407,7 @@ static bool api_samr_LookupNames(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1449,7 +1449,7 @@ static bool api_samr_LookupNames(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_LookupNames, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1493,7 +1493,7 @@ static bool api_samr_LookupRids(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1535,7 +1535,7 @@ static bool api_samr_LookupRids(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_LookupRids, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1579,7 +1579,7 @@ static bool api_samr_OpenGroup(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1615,7 +1615,7 @@ static bool api_samr_OpenGroup(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_OpenGroup, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1659,7 +1659,7 @@ static bool api_samr_QueryGroupInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1695,7 +1695,7 @@ static bool api_samr_QueryGroupInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_QueryGroupInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1739,7 +1739,7 @@ static bool api_samr_SetGroupInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1768,7 +1768,7 @@ static bool api_samr_SetGroupInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_SetGroupInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1812,7 +1812,7 @@ static bool api_samr_AddGroupMember(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1841,7 +1841,7 @@ static bool api_samr_AddGroupMember(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_AddGroupMember, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1885,7 +1885,7 @@ static bool api_samr_DeleteDomainGroup(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1916,7 +1916,7 @@ static bool api_samr_DeleteDomainGroup(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_DeleteDomainGroup, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1960,7 +1960,7 @@ static bool api_samr_DeleteGroupMember(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1989,7 +1989,7 @@ static bool api_samr_DeleteGroupMember(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_DeleteGroupMember, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2033,7 +2033,7 @@ static bool api_samr_QueryGroupMember(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2069,7 +2069,7 @@ static bool api_samr_QueryGroupMember(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_QueryGroupMember, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2113,7 +2113,7 @@ static bool api_samr_SetMemberAttributesOfGroup(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2142,7 +2142,7 @@ static bool api_samr_SetMemberAttributesOfGroup(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_SetMemberAttributesOfGroup, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2186,7 +2186,7 @@ static bool api_samr_OpenAlias(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2222,7 +2222,7 @@ static bool api_samr_OpenAlias(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_OpenAlias, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2266,7 +2266,7 @@ static bool api_samr_QueryAliasInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2302,7 +2302,7 @@ static bool api_samr_QueryAliasInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_QueryAliasInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2346,7 +2346,7 @@ static bool api_samr_SetAliasInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2375,7 +2375,7 @@ static bool api_samr_SetAliasInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_SetAliasInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2419,7 +2419,7 @@ static bool api_samr_DeleteDomAlias(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2450,7 +2450,7 @@ static bool api_samr_DeleteDomAlias(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_DeleteDomAlias, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2494,7 +2494,7 @@ static bool api_samr_AddAliasMember(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2523,7 +2523,7 @@ static bool api_samr_AddAliasMember(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_AddAliasMember, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2567,7 +2567,7 @@ static bool api_samr_DeleteAliasMember(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2596,7 +2596,7 @@ static bool api_samr_DeleteAliasMember(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_DeleteAliasMember, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2640,7 +2640,7 @@ static bool api_samr_GetMembersInAlias(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2676,7 +2676,7 @@ static bool api_samr_GetMembersInAlias(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_GetMembersInAlias, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2720,7 +2720,7 @@ static bool api_samr_OpenUser(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2756,7 +2756,7 @@ static bool api_samr_OpenUser(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_OpenUser, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2800,7 +2800,7 @@ static bool api_samr_DeleteUser(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2831,7 +2831,7 @@ static bool api_samr_DeleteUser(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_DeleteUser, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2875,7 +2875,7 @@ static bool api_samr_QueryUserInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2911,7 +2911,7 @@ static bool api_samr_QueryUserInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_QueryUserInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2955,7 +2955,7 @@ static bool api_samr_SetUserInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2984,7 +2984,7 @@ static bool api_samr_SetUserInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_SetUserInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3028,7 +3028,7 @@ static bool api_samr_ChangePasswordUser(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3057,7 +3057,7 @@ static bool api_samr_ChangePasswordUser(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3101,7 +3101,7 @@ static bool api_samr_GetGroupsForUser(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3137,7 +3137,7 @@ static bool api_samr_GetGroupsForUser(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_GetGroupsForUser, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3181,7 +3181,7 @@ static bool api_samr_QueryDisplayInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3229,7 +3229,7 @@ static bool api_samr_QueryDisplayInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3273,7 +3273,7 @@ static bool api_samr_GetDisplayEnumerationIndex(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3309,7 +3309,7 @@ static bool api_samr_GetDisplayEnumerationIndex(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_GetDisplayEnumerationIndex, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3353,7 +3353,7 @@ static bool api_samr_TestPrivateFunctionsDomain(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3382,7 +3382,7 @@ static bool api_samr_TestPrivateFunctionsDomain(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_TestPrivateFunctionsDomain, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3426,7 +3426,7 @@ static bool api_samr_TestPrivateFunctionsUser(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3455,7 +3455,7 @@ static bool api_samr_TestPrivateFunctionsUser(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_TestPrivateFunctionsUser, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3499,7 +3499,7 @@ static bool api_samr_GetUserPwInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3535,7 +3535,7 @@ static bool api_samr_GetUserPwInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_GetUserPwInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3579,7 +3579,7 @@ static bool api_samr_RemoveMemberFromForeignDomain(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3608,7 +3608,7 @@ static bool api_samr_RemoveMemberFromForeignDomain(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_RemoveMemberFromForeignDomain, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3652,7 +3652,7 @@ static bool api_samr_QueryDomainInfo2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3688,7 +3688,7 @@ static bool api_samr_QueryDomainInfo2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_QueryDomainInfo2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3732,7 +3732,7 @@ static bool api_samr_QueryUserInfo2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3768,7 +3768,7 @@ static bool api_samr_QueryUserInfo2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_QueryUserInfo2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3812,7 +3812,7 @@ static bool api_samr_QueryDisplayInfo2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3860,7 +3860,7 @@ static bool api_samr_QueryDisplayInfo2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3904,7 +3904,7 @@ static bool api_samr_GetDisplayEnumerationIndex2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3940,7 +3940,7 @@ static bool api_samr_GetDisplayEnumerationIndex2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_GetDisplayEnumerationIndex2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3984,7 +3984,7 @@ static bool api_samr_CreateUser2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4032,7 +4032,7 @@ static bool api_samr_CreateUser2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_CreateUser2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4076,7 +4076,7 @@ static bool api_samr_QueryDisplayInfo3(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4124,7 +4124,7 @@ static bool api_samr_QueryDisplayInfo3(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo3, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4168,7 +4168,7 @@ static bool api_samr_AddMultipleMembersToAlias(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4197,7 +4197,7 @@ static bool api_samr_AddMultipleMembersToAlias(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_AddMultipleMembersToAlias, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4241,7 +4241,7 @@ static bool api_samr_RemoveMultipleMembersFromAlias(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4270,7 +4270,7 @@ static bool api_samr_RemoveMultipleMembersFromAlias(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_RemoveMultipleMembersFromAlias, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4314,7 +4314,7 @@ static bool api_samr_OemChangePasswordUser2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4343,7 +4343,7 @@ static bool api_samr_OemChangePasswordUser2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_OemChangePasswordUser2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4387,7 +4387,7 @@ static bool api_samr_ChangePasswordUser2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4416,7 +4416,7 @@ static bool api_samr_ChangePasswordUser2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4460,7 +4460,7 @@ static bool api_samr_GetDomPwInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4496,7 +4496,7 @@ static bool api_samr_GetDomPwInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_GetDomPwInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4540,7 +4540,7 @@ static bool api_samr_Connect2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4576,7 +4576,7 @@ static bool api_samr_Connect2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_Connect2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4620,7 +4620,7 @@ static bool api_samr_SetUserInfo2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4649,7 +4649,7 @@ static bool api_samr_SetUserInfo2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_SetUserInfo2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4693,7 +4693,7 @@ static bool api_samr_SetBootKeyInformation(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4722,7 +4722,7 @@ static bool api_samr_SetBootKeyInformation(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_SetBootKeyInformation, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4766,7 +4766,7 @@ static bool api_samr_GetBootKeyInformation(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4802,7 +4802,7 @@ static bool api_samr_GetBootKeyInformation(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_GetBootKeyInformation, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4846,7 +4846,7 @@ static bool api_samr_Connect3(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4882,7 +4882,7 @@ static bool api_samr_Connect3(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_Connect3, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4926,7 +4926,7 @@ static bool api_samr_Connect4(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4962,7 +4962,7 @@ static bool api_samr_Connect4(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_Connect4, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -5006,7 +5006,7 @@ static bool api_samr_ChangePasswordUser3(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -5048,7 +5048,7 @@ static bool api_samr_ChangePasswordUser3(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser3, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -5092,7 +5092,7 @@ static bool api_samr_Connect5(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -5140,7 +5140,7 @@ static bool api_samr_Connect5(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_Connect5, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -5184,7 +5184,7 @@ static bool api_samr_RidToSid(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -5220,7 +5220,7 @@ static bool api_samr_RidToSid(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_RidToSid, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -5264,7 +5264,7 @@ static bool api_samr_SetDsrmPassword(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -5293,7 +5293,7 @@ static bool api_samr_SetDsrmPassword(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_SetDsrmPassword, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -5337,7 +5337,7 @@ static bool api_samr_ValidatePassword(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -5373,7 +5373,7 @@ static bool api_samr_ValidatePassword(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(samr_ValidatePassword, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
diff --git a/source3/librpc/gen_ndr/srv_srvsvc.c b/source3/librpc/gen_ndr/srv_srvsvc.c
index 66faaaaf7e..57d5239971 100644
--- a/source3/librpc/gen_ndr/srv_srvsvc.c
+++ b/source3/librpc/gen_ndr/srv_srvsvc.c
@@ -27,7 +27,7 @@ static bool api_srvsvc_NetCharDevEnum(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -66,7 +66,7 @@ static bool api_srvsvc_NetCharDevEnum(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevEnum, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -110,7 +110,7 @@ static bool api_srvsvc_NetCharDevGetInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -146,7 +146,7 @@ static bool api_srvsvc_NetCharDevGetInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevGetInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -190,7 +190,7 @@ static bool api_srvsvc_NetCharDevControl(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -219,7 +219,7 @@ static bool api_srvsvc_NetCharDevControl(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevControl, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -263,7 +263,7 @@ static bool api_srvsvc_NetCharDevQEnum(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -302,7 +302,7 @@ static bool api_srvsvc_NetCharDevQEnum(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQEnum, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -346,7 +346,7 @@ static bool api_srvsvc_NetCharDevQGetInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -382,7 +382,7 @@ static bool api_srvsvc_NetCharDevQGetInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQGetInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -426,7 +426,7 @@ static bool api_srvsvc_NetCharDevQSetInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -457,7 +457,7 @@ static bool api_srvsvc_NetCharDevQSetInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQSetInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -501,7 +501,7 @@ static bool api_srvsvc_NetCharDevQPurge(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -530,7 +530,7 @@ static bool api_srvsvc_NetCharDevQPurge(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQPurge, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -574,7 +574,7 @@ static bool api_srvsvc_NetCharDevQPurgeSelf(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -603,7 +603,7 @@ static bool api_srvsvc_NetCharDevQPurgeSelf(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetCharDevQPurgeSelf, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -647,7 +647,7 @@ static bool api_srvsvc_NetConnEnum(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -685,7 +685,7 @@ static bool api_srvsvc_NetConnEnum(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetConnEnum, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -729,7 +729,7 @@ static bool api_srvsvc_NetFileEnum(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -767,7 +767,7 @@ static bool api_srvsvc_NetFileEnum(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetFileEnum, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -811,7 +811,7 @@ static bool api_srvsvc_NetFileGetInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -847,7 +847,7 @@ static bool api_srvsvc_NetFileGetInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetFileGetInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -891,7 +891,7 @@ static bool api_srvsvc_NetFileClose(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -920,7 +920,7 @@ static bool api_srvsvc_NetFileClose(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetFileClose, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -964,7 +964,7 @@ static bool api_srvsvc_NetSessEnum(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1002,7 +1002,7 @@ static bool api_srvsvc_NetSessEnum(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetSessEnum, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1046,7 +1046,7 @@ static bool api_srvsvc_NetSessDel(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1075,7 +1075,7 @@ static bool api_srvsvc_NetSessDel(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetSessDel, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1119,7 +1119,7 @@ static bool api_srvsvc_NetShareAdd(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1150,7 +1150,7 @@ static bool api_srvsvc_NetShareAdd(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetShareAdd, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1194,7 +1194,7 @@ static bool api_srvsvc_NetShareEnumAll(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1232,7 +1232,7 @@ static bool api_srvsvc_NetShareEnumAll(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetShareEnumAll, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1276,7 +1276,7 @@ static bool api_srvsvc_NetShareGetInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1312,7 +1312,7 @@ static bool api_srvsvc_NetShareGetInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetShareGetInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1356,7 +1356,7 @@ static bool api_srvsvc_NetShareSetInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1387,7 +1387,7 @@ static bool api_srvsvc_NetShareSetInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetShareSetInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1431,7 +1431,7 @@ static bool api_srvsvc_NetShareDel(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1460,7 +1460,7 @@ static bool api_srvsvc_NetShareDel(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDel, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1504,7 +1504,7 @@ static bool api_srvsvc_NetShareDelSticky(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1533,7 +1533,7 @@ static bool api_srvsvc_NetShareDelSticky(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelSticky, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1577,7 +1577,7 @@ static bool api_srvsvc_NetShareCheck(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1613,7 +1613,7 @@ static bool api_srvsvc_NetShareCheck(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetShareCheck, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1657,7 +1657,7 @@ static bool api_srvsvc_NetSrvGetInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1693,7 +1693,7 @@ static bool api_srvsvc_NetSrvGetInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetSrvGetInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1737,7 +1737,7 @@ static bool api_srvsvc_NetSrvSetInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1768,7 +1768,7 @@ static bool api_srvsvc_NetSrvSetInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetSrvSetInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1812,7 +1812,7 @@ static bool api_srvsvc_NetDiskEnum(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1850,7 +1850,7 @@ static bool api_srvsvc_NetDiskEnum(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetDiskEnum, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1894,7 +1894,7 @@ static bool api_srvsvc_NetServerStatisticsGet(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1930,7 +1930,7 @@ static bool api_srvsvc_NetServerStatisticsGet(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetServerStatisticsGet, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1974,7 +1974,7 @@ static bool api_srvsvc_NetTransportAdd(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2003,7 +2003,7 @@ static bool api_srvsvc_NetTransportAdd(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportAdd, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2047,7 +2047,7 @@ static bool api_srvsvc_NetTransportEnum(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2086,7 +2086,7 @@ static bool api_srvsvc_NetTransportEnum(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportEnum, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2130,7 +2130,7 @@ static bool api_srvsvc_NetTransportDel(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2159,7 +2159,7 @@ static bool api_srvsvc_NetTransportDel(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetTransportDel, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2203,7 +2203,7 @@ static bool api_srvsvc_NetRemoteTOD(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2239,7 +2239,7 @@ static bool api_srvsvc_NetRemoteTOD(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetRemoteTOD, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2283,7 +2283,7 @@ static bool api_srvsvc_NetSetServiceBits(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2312,7 +2312,7 @@ static bool api_srvsvc_NetSetServiceBits(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetSetServiceBits, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2356,7 +2356,7 @@ static bool api_srvsvc_NetPathType(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2392,7 +2392,7 @@ static bool api_srvsvc_NetPathType(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetPathType, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2436,7 +2436,7 @@ static bool api_srvsvc_NetPathCanonicalize(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2473,7 +2473,7 @@ static bool api_srvsvc_NetPathCanonicalize(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetPathCanonicalize, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2517,7 +2517,7 @@ static bool api_srvsvc_NetPathCompare(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2546,7 +2546,7 @@ static bool api_srvsvc_NetPathCompare(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetPathCompare, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2590,7 +2590,7 @@ static bool api_srvsvc_NetNameValidate(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2619,7 +2619,7 @@ static bool api_srvsvc_NetNameValidate(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetNameValidate, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2663,7 +2663,7 @@ static bool api_srvsvc_NETRPRNAMECANONICALIZE(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2692,7 +2692,7 @@ static bool api_srvsvc_NETRPRNAMECANONICALIZE(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NETRPRNAMECANONICALIZE, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2736,7 +2736,7 @@ static bool api_srvsvc_NetPRNameCompare(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2765,7 +2765,7 @@ static bool api_srvsvc_NetPRNameCompare(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetPRNameCompare, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2809,7 +2809,7 @@ static bool api_srvsvc_NetShareEnum(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2847,7 +2847,7 @@ static bool api_srvsvc_NetShareEnum(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetShareEnum, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2891,7 +2891,7 @@ static bool api_srvsvc_NetShareDelStart(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2927,7 +2927,7 @@ static bool api_srvsvc_NetShareDelStart(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelStart, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2971,7 +2971,7 @@ static bool api_srvsvc_NetShareDelCommit(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3002,7 +3002,7 @@ static bool api_srvsvc_NetShareDelCommit(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetShareDelCommit, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3046,7 +3046,7 @@ static bool api_srvsvc_NetGetFileSecurity(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3082,7 +3082,7 @@ static bool api_srvsvc_NetGetFileSecurity(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetGetFileSecurity, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3126,7 +3126,7 @@ static bool api_srvsvc_NetSetFileSecurity(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3155,7 +3155,7 @@ static bool api_srvsvc_NetSetFileSecurity(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetSetFileSecurity, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3199,7 +3199,7 @@ static bool api_srvsvc_NetServerTransportAddEx(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3228,7 +3228,7 @@ static bool api_srvsvc_NetServerTransportAddEx(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetServerTransportAddEx, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3272,7 +3272,7 @@ static bool api_srvsvc_NetServerSetServiceBitsEx(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3301,7 +3301,7 @@ static bool api_srvsvc_NetServerSetServiceBitsEx(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NetServerSetServiceBitsEx, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3345,7 +3345,7 @@ static bool api_srvsvc_NETRDFSGETVERSION(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3374,7 +3374,7 @@ static bool api_srvsvc_NETRDFSGETVERSION(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSGETVERSION, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3418,7 +3418,7 @@ static bool api_srvsvc_NETRDFSCREATELOCALPARTITION(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3447,7 +3447,7 @@ static bool api_srvsvc_NETRDFSCREATELOCALPARTITION(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSCREATELOCALPARTITION, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3491,7 +3491,7 @@ static bool api_srvsvc_NETRDFSDELETELOCALPARTITION(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3520,7 +3520,7 @@ static bool api_srvsvc_NETRDFSDELETELOCALPARTITION(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSDELETELOCALPARTITION, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3564,7 +3564,7 @@ static bool api_srvsvc_NETRDFSSETLOCALVOLUMESTATE(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3593,7 +3593,7 @@ static bool api_srvsvc_NETRDFSSETLOCALVOLUMESTATE(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSSETLOCALVOLUMESTATE, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3637,7 +3637,7 @@ static bool api_srvsvc_NETRDFSSETSERVERINFO(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3666,7 +3666,7 @@ static bool api_srvsvc_NETRDFSSETSERVERINFO(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSSETSERVERINFO, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3710,7 +3710,7 @@ static bool api_srvsvc_NETRDFSCREATEEXITPOINT(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3739,7 +3739,7 @@ static bool api_srvsvc_NETRDFSCREATEEXITPOINT(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSCREATEEXITPOINT, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3783,7 +3783,7 @@ static bool api_srvsvc_NETRDFSDELETEEXITPOINT(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3812,7 +3812,7 @@ static bool api_srvsvc_NETRDFSDELETEEXITPOINT(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSDELETEEXITPOINT, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3856,7 +3856,7 @@ static bool api_srvsvc_NETRDFSMODIFYPREFIX(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3885,7 +3885,7 @@ static bool api_srvsvc_NETRDFSMODIFYPREFIX(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSMODIFYPREFIX, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3929,7 +3929,7 @@ static bool api_srvsvc_NETRDFSFIXLOCALVOLUME(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3958,7 +3958,7 @@ static bool api_srvsvc_NETRDFSFIXLOCALVOLUME(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSFIXLOCALVOLUME, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4002,7 +4002,7 @@ static bool api_srvsvc_NETRDFSMANAGERREPORTSITEINFO(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4031,7 +4031,7 @@ static bool api_srvsvc_NETRDFSMANAGERREPORTSITEINFO(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NETRDFSMANAGERREPORTSITEINFO, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -4075,7 +4075,7 @@ static bool api_srvsvc_NETRSERVERTRANSPORTDELEX(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -4104,7 +4104,7 @@ static bool api_srvsvc_NETRSERVERTRANSPORTDELEX(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(srvsvc_NETRSERVERTRANSPORTDELEX, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
diff --git a/source3/librpc/gen_ndr/srv_svcctl.c b/source3/librpc/gen_ndr/srv_svcctl.c
index 32317ad8fe..2349b4fd93 100644
--- a/source3/librpc/gen_ndr/srv_svcctl.c
+++ b/source3/librpc/gen_ndr/srv_svcctl.c
@@ -27,7 +27,7 @@ static bool api_svcctl_CloseServiceHandle(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -58,7 +58,7 @@ static bool api_svcctl_CloseServiceHandle(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_CloseServiceHandle, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -102,7 +102,7 @@ static bool api_svcctl_ControlService(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -138,7 +138,7 @@ static bool api_svcctl_ControlService(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_ControlService, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -182,7 +182,7 @@ static bool api_svcctl_DeleteService(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -211,7 +211,7 @@ static bool api_svcctl_DeleteService(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_DeleteService, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -255,7 +255,7 @@ static bool api_svcctl_LockServiceDatabase(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -291,7 +291,7 @@ static bool api_svcctl_LockServiceDatabase(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_LockServiceDatabase, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -335,7 +335,7 @@ static bool api_svcctl_QueryServiceObjectSecurity(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -377,7 +377,7 @@ static bool api_svcctl_QueryServiceObjectSecurity(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceObjectSecurity, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -421,7 +421,7 @@ static bool api_svcctl_SetServiceObjectSecurity(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -450,7 +450,7 @@ static bool api_svcctl_SetServiceObjectSecurity(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_SetServiceObjectSecurity, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -494,7 +494,7 @@ static bool api_svcctl_QueryServiceStatus(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -530,7 +530,7 @@ static bool api_svcctl_QueryServiceStatus(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatus, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -574,7 +574,7 @@ static bool api_svcctl_SetServiceStatus(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -603,7 +603,7 @@ static bool api_svcctl_SetServiceStatus(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_SetServiceStatus, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -647,7 +647,7 @@ static bool api_svcctl_UnlockServiceDatabase(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -678,7 +678,7 @@ static bool api_svcctl_UnlockServiceDatabase(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_UnlockServiceDatabase, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -722,7 +722,7 @@ static bool api_svcctl_NotifyBootConfigStatus(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -751,7 +751,7 @@ static bool api_svcctl_NotifyBootConfigStatus(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_NotifyBootConfigStatus, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -795,7 +795,7 @@ static bool api_svcctl_SCSetServiceBitsW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -824,7 +824,7 @@ static bool api_svcctl_SCSetServiceBitsW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -868,7 +868,7 @@ static bool api_svcctl_ChangeServiceConfigW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -904,7 +904,7 @@ static bool api_svcctl_ChangeServiceConfigW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -948,7 +948,7 @@ static bool api_svcctl_CreateServiceW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -985,7 +985,7 @@ static bool api_svcctl_CreateServiceW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1029,7 +1029,7 @@ static bool api_svcctl_EnumDependentServicesW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1077,7 +1077,7 @@ static bool api_svcctl_EnumDependentServicesW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1121,7 +1121,7 @@ static bool api_svcctl_EnumServicesStatusW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1170,7 +1170,7 @@ static bool api_svcctl_EnumServicesStatusW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1214,7 +1214,7 @@ static bool api_svcctl_OpenSCManagerW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1250,7 +1250,7 @@ static bool api_svcctl_OpenSCManagerW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1294,7 +1294,7 @@ static bool api_svcctl_OpenServiceW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1330,7 +1330,7 @@ static bool api_svcctl_OpenServiceW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1374,7 +1374,7 @@ static bool api_svcctl_QueryServiceConfigW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1392,7 +1392,7 @@ static bool api_svcctl_QueryServiceConfigW(pipes_struct *p)
}
ZERO_STRUCT(r->out);
- r->out.query = talloc_zero_array(r, uint8_t, r->in.buf_size);
+ r->out.query = talloc_zero(r, struct QUERY_SERVICE_CONFIG);
if (r->out.query == NULL) {
talloc_free(r);
return false;
@@ -1416,7 +1416,7 @@ static bool api_svcctl_QueryServiceConfigW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1460,7 +1460,7 @@ static bool api_svcctl_QueryServiceLockStatusW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1502,7 +1502,7 @@ static bool api_svcctl_QueryServiceLockStatusW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1546,7 +1546,7 @@ static bool api_svcctl_StartServiceW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1575,7 +1575,7 @@ static bool api_svcctl_StartServiceW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_StartServiceW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1619,7 +1619,7 @@ static bool api_svcctl_GetServiceDisplayNameW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1656,7 +1656,7 @@ static bool api_svcctl_GetServiceDisplayNameW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1700,7 +1700,7 @@ static bool api_svcctl_GetServiceKeyNameW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1737,7 +1737,7 @@ static bool api_svcctl_GetServiceKeyNameW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1781,7 +1781,7 @@ static bool api_svcctl_SCSetServiceBitsA(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1810,7 +1810,7 @@ static bool api_svcctl_SCSetServiceBitsA(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_SCSetServiceBitsA, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1854,7 +1854,7 @@ static bool api_svcctl_ChangeServiceConfigA(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1890,7 +1890,7 @@ static bool api_svcctl_ChangeServiceConfigA(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfigA, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1934,7 +1934,7 @@ static bool api_svcctl_CreateServiceA(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1970,7 +1970,7 @@ static bool api_svcctl_CreateServiceA(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_CreateServiceA, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2014,7 +2014,7 @@ static bool api_svcctl_EnumDependentServicesA(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2062,7 +2062,7 @@ static bool api_svcctl_EnumDependentServicesA(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_EnumDependentServicesA, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2106,7 +2106,7 @@ static bool api_svcctl_EnumServicesStatusA(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2155,7 +2155,7 @@ static bool api_svcctl_EnumServicesStatusA(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_EnumServicesStatusA, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2199,7 +2199,7 @@ static bool api_svcctl_OpenSCManagerA(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2235,7 +2235,7 @@ static bool api_svcctl_OpenSCManagerA(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_OpenSCManagerA, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2279,7 +2279,7 @@ static bool api_svcctl_OpenServiceA(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2308,7 +2308,7 @@ static bool api_svcctl_OpenServiceA(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_OpenServiceA, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2352,7 +2352,7 @@ static bool api_svcctl_QueryServiceConfigA(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2394,7 +2394,7 @@ static bool api_svcctl_QueryServiceConfigA(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfigA, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2438,7 +2438,7 @@ static bool api_svcctl_QueryServiceLockStatusA(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2480,7 +2480,7 @@ static bool api_svcctl_QueryServiceLockStatusA(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceLockStatusA, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2524,7 +2524,7 @@ static bool api_svcctl_StartServiceA(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2553,7 +2553,7 @@ static bool api_svcctl_StartServiceA(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_StartServiceA, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2597,7 +2597,7 @@ static bool api_svcctl_GetServiceDisplayNameA(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2634,7 +2634,7 @@ static bool api_svcctl_GetServiceDisplayNameA(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_GetServiceDisplayNameA, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2678,7 +2678,7 @@ static bool api_svcctl_GetServiceKeyNameA(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2715,7 +2715,7 @@ static bool api_svcctl_GetServiceKeyNameA(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_GetServiceKeyNameA, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2759,7 +2759,7 @@ static bool api_svcctl_GetCurrentGroupeStateW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2788,7 +2788,7 @@ static bool api_svcctl_GetCurrentGroupeStateW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_GetCurrentGroupeStateW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2832,7 +2832,7 @@ static bool api_svcctl_EnumServiceGroupW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2861,7 +2861,7 @@ static bool api_svcctl_EnumServiceGroupW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_EnumServiceGroupW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2905,7 +2905,7 @@ static bool api_svcctl_ChangeServiceConfig2A(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2934,7 +2934,7 @@ static bool api_svcctl_ChangeServiceConfig2A(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2A, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2978,7 +2978,7 @@ static bool api_svcctl_ChangeServiceConfig2W(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3007,7 +3007,7 @@ static bool api_svcctl_ChangeServiceConfig2W(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_ChangeServiceConfig2W, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3051,7 +3051,7 @@ static bool api_svcctl_QueryServiceConfig2A(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3093,7 +3093,7 @@ static bool api_svcctl_QueryServiceConfig2A(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2A, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3137,7 +3137,7 @@ static bool api_svcctl_QueryServiceConfig2W(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3179,7 +3179,7 @@ static bool api_svcctl_QueryServiceConfig2W(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceConfig2W, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3223,7 +3223,7 @@ static bool api_svcctl_QueryServiceStatusEx(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3265,7 +3265,7 @@ static bool api_svcctl_QueryServiceStatusEx(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_QueryServiceStatusEx, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3309,7 +3309,7 @@ static bool api_EnumServicesStatusExA(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3364,7 +3364,7 @@ static bool api_EnumServicesStatusExA(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(EnumServicesStatusExA, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3408,7 +3408,7 @@ static bool api_EnumServicesStatusExW(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3463,7 +3463,7 @@ static bool api_EnumServicesStatusExW(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(EnumServicesStatusExW, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -3507,7 +3507,7 @@ static bool api_svcctl_SCSendTSMessage(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -3536,7 +3536,7 @@ static bool api_svcctl_SCSendTSMessage(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(svcctl_SCSendTSMessage, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
diff --git a/source3/librpc/gen_ndr/srv_winreg.c b/source3/librpc/gen_ndr/srv_winreg.c
index c697f44d2a..77b0a1c5d2 100644
--- a/source3/librpc/gen_ndr/srv_winreg.c
+++ b/source3/librpc/gen_ndr/srv_winreg.c
@@ -27,7 +27,7 @@ static bool api_winreg_OpenHKCR(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -63,7 +63,7 @@ static bool api_winreg_OpenHKCR(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_OpenHKCR, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -107,7 +107,7 @@ static bool api_winreg_OpenHKCU(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -143,7 +143,7 @@ static bool api_winreg_OpenHKCU(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_OpenHKCU, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -187,7 +187,7 @@ static bool api_winreg_OpenHKLM(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -223,7 +223,7 @@ static bool api_winreg_OpenHKLM(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_OpenHKLM, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -267,7 +267,7 @@ static bool api_winreg_OpenHKPD(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -303,7 +303,7 @@ static bool api_winreg_OpenHKPD(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_OpenHKPD, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -347,7 +347,7 @@ static bool api_winreg_OpenHKU(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -383,7 +383,7 @@ static bool api_winreg_OpenHKU(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_OpenHKU, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -427,7 +427,7 @@ static bool api_winreg_CloseKey(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -458,7 +458,7 @@ static bool api_winreg_CloseKey(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_CloseKey, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -502,7 +502,7 @@ static bool api_winreg_CreateKey(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -539,7 +539,7 @@ static bool api_winreg_CreateKey(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_CreateKey, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -583,7 +583,7 @@ static bool api_winreg_DeleteKey(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -612,7 +612,7 @@ static bool api_winreg_DeleteKey(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_DeleteKey, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -656,7 +656,7 @@ static bool api_winreg_DeleteValue(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -685,7 +685,7 @@ static bool api_winreg_DeleteValue(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_DeleteValue, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -729,7 +729,7 @@ static bool api_winreg_EnumKey(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -762,7 +762,7 @@ static bool api_winreg_EnumKey(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_EnumKey, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -806,7 +806,7 @@ static bool api_winreg_EnumValue(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -841,7 +841,7 @@ static bool api_winreg_EnumValue(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_EnumValue, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -885,7 +885,7 @@ static bool api_winreg_FlushKey(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -914,7 +914,7 @@ static bool api_winreg_FlushKey(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_FlushKey, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -958,7 +958,7 @@ static bool api_winreg_GetKeySecurity(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -989,7 +989,7 @@ static bool api_winreg_GetKeySecurity(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_GetKeySecurity, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1033,7 +1033,7 @@ static bool api_winreg_LoadKey(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1062,7 +1062,7 @@ static bool api_winreg_LoadKey(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_LoadKey, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1106,7 +1106,7 @@ static bool api_winreg_NotifyChangeKeyValue(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1135,7 +1135,7 @@ static bool api_winreg_NotifyChangeKeyValue(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_NotifyChangeKeyValue, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1179,7 +1179,7 @@ static bool api_winreg_OpenKey(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1215,7 +1215,7 @@ static bool api_winreg_OpenKey(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_OpenKey, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1259,7 +1259,7 @@ static bool api_winreg_QueryInfoKey(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1338,7 +1338,7 @@ static bool api_winreg_QueryInfoKey(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_QueryInfoKey, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1382,7 +1382,7 @@ static bool api_winreg_QueryValue(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1403,7 +1403,7 @@ static bool api_winreg_QueryValue(pipes_struct *p)
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.data_length = r->in.data_length;
r->out.result = _winreg_QueryValue(p, r);
if (p->rng_fault_state) {
@@ -1416,7 +1416,7 @@ static bool api_winreg_QueryValue(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_QueryValue, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1460,7 +1460,7 @@ static bool api_winreg_ReplaceKey(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1489,7 +1489,7 @@ static bool api_winreg_ReplaceKey(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_ReplaceKey, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1533,7 +1533,7 @@ static bool api_winreg_RestoreKey(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1562,7 +1562,7 @@ static bool api_winreg_RestoreKey(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_RestoreKey, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1606,7 +1606,7 @@ static bool api_winreg_SaveKey(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1635,7 +1635,7 @@ static bool api_winreg_SaveKey(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_SaveKey, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1679,7 +1679,7 @@ static bool api_winreg_SetKeySecurity(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1708,7 +1708,7 @@ static bool api_winreg_SetKeySecurity(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_SetKeySecurity, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1752,7 +1752,7 @@ static bool api_winreg_SetValue(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1781,7 +1781,7 @@ static bool api_winreg_SetValue(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_SetValue, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1825,7 +1825,7 @@ static bool api_winreg_UnLoadKey(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1854,7 +1854,7 @@ static bool api_winreg_UnLoadKey(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_UnLoadKey, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1898,7 +1898,7 @@ static bool api_winreg_InitiateSystemShutdown(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1927,7 +1927,7 @@ static bool api_winreg_InitiateSystemShutdown(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdown, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1971,7 +1971,7 @@ static bool api_winreg_AbortSystemShutdown(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2000,7 +2000,7 @@ static bool api_winreg_AbortSystemShutdown(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_AbortSystemShutdown, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2044,7 +2044,7 @@ static bool api_winreg_GetVersion(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2080,7 +2080,7 @@ static bool api_winreg_GetVersion(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_GetVersion, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2124,7 +2124,7 @@ static bool api_winreg_OpenHKCC(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2160,7 +2160,7 @@ static bool api_winreg_OpenHKCC(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_OpenHKCC, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2204,7 +2204,7 @@ static bool api_winreg_OpenHKDD(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2240,7 +2240,7 @@ static bool api_winreg_OpenHKDD(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_OpenHKDD, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2284,7 +2284,7 @@ static bool api_winreg_QueryMultipleValues(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2317,7 +2317,7 @@ static bool api_winreg_QueryMultipleValues(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2361,7 +2361,7 @@ static bool api_winreg_InitiateSystemShutdownEx(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2390,7 +2390,7 @@ static bool api_winreg_InitiateSystemShutdownEx(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_InitiateSystemShutdownEx, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2434,7 +2434,7 @@ static bool api_winreg_SaveKeyEx(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2463,7 +2463,7 @@ static bool api_winreg_SaveKeyEx(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_SaveKeyEx, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2507,7 +2507,7 @@ static bool api_winreg_OpenHKPT(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2543,7 +2543,7 @@ static bool api_winreg_OpenHKPT(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_OpenHKPT, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2587,7 +2587,7 @@ static bool api_winreg_OpenHKPN(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2623,7 +2623,7 @@ static bool api_winreg_OpenHKPN(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_OpenHKPN, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2667,7 +2667,7 @@ static bool api_winreg_QueryMultipleValues2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2696,7 +2696,7 @@ static bool api_winreg_QueryMultipleValues2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(winreg_QueryMultipleValues2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
diff --git a/source3/librpc/gen_ndr/srv_wkssvc.c b/source3/librpc/gen_ndr/srv_wkssvc.c
index 227e4c1a48..9c07fa86ea 100644
--- a/source3/librpc/gen_ndr/srv_wkssvc.c
+++ b/source3/librpc/gen_ndr/srv_wkssvc.c
@@ -27,7 +27,7 @@ static bool api_wkssvc_NetWkstaGetInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -63,7 +63,7 @@ static bool api_wkssvc_NetWkstaGetInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaGetInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -107,7 +107,7 @@ static bool api_wkssvc_NetWkstaSetInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -138,7 +138,7 @@ static bool api_wkssvc_NetWkstaSetInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaSetInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -182,7 +182,7 @@ static bool api_wkssvc_NetWkstaEnumUsers(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -220,7 +220,7 @@ static bool api_wkssvc_NetWkstaEnumUsers(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaEnumUsers, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -264,7 +264,7 @@ static bool api_wkssvc_NetrWkstaUserGetInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -300,7 +300,7 @@ static bool api_wkssvc_NetrWkstaUserGetInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaUserGetInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -344,7 +344,7 @@ static bool api_wkssvc_NetrWkstaUserSetInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -375,7 +375,7 @@ static bool api_wkssvc_NetrWkstaUserSetInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaUserSetInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -419,7 +419,7 @@ static bool api_wkssvc_NetWkstaTransportEnum(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -457,7 +457,7 @@ static bool api_wkssvc_NetWkstaTransportEnum(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetWkstaTransportEnum, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -501,7 +501,7 @@ static bool api_wkssvc_NetrWkstaTransportAdd(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -532,7 +532,7 @@ static bool api_wkssvc_NetrWkstaTransportAdd(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaTransportAdd, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -576,7 +576,7 @@ static bool api_wkssvc_NetrWkstaTransportDel(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -605,7 +605,7 @@ static bool api_wkssvc_NetrWkstaTransportDel(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrWkstaTransportDel, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -649,7 +649,7 @@ static bool api_wkssvc_NetrUseAdd(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -680,7 +680,7 @@ static bool api_wkssvc_NetrUseAdd(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseAdd, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -724,7 +724,7 @@ static bool api_wkssvc_NetrUseGetInfo(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -760,7 +760,7 @@ static bool api_wkssvc_NetrUseGetInfo(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseGetInfo, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -804,7 +804,7 @@ static bool api_wkssvc_NetrUseDel(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -833,7 +833,7 @@ static bool api_wkssvc_NetrUseDel(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseDel, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -877,7 +877,7 @@ static bool api_wkssvc_NetrUseEnum(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -915,7 +915,7 @@ static bool api_wkssvc_NetrUseEnum(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrUseEnum, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -959,7 +959,7 @@ static bool api_wkssvc_NetrMessageBufferSend(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -988,7 +988,7 @@ static bool api_wkssvc_NetrMessageBufferSend(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrMessageBufferSend, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1032,7 +1032,7 @@ static bool api_wkssvc_NetrWorkstationStatisticsGet(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1068,7 +1068,7 @@ static bool api_wkssvc_NetrWorkstationStatisticsGet(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrWorkstationStatisticsGet, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1112,7 +1112,7 @@ static bool api_wkssvc_NetrLogonDomainNameAdd(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1141,7 +1141,7 @@ static bool api_wkssvc_NetrLogonDomainNameAdd(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrLogonDomainNameAdd, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1185,7 +1185,7 @@ static bool api_wkssvc_NetrLogonDomainNameDel(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1214,7 +1214,7 @@ static bool api_wkssvc_NetrLogonDomainNameDel(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrLogonDomainNameDel, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1258,7 +1258,7 @@ static bool api_wkssvc_NetrJoinDomain(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1287,7 +1287,7 @@ static bool api_wkssvc_NetrJoinDomain(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrJoinDomain, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1331,7 +1331,7 @@ static bool api_wkssvc_NetrUnjoinDomain(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1360,7 +1360,7 @@ static bool api_wkssvc_NetrUnjoinDomain(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrUnjoinDomain, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1404,7 +1404,7 @@ static bool api_wkssvc_NetrRenameMachineInDomain(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1433,7 +1433,7 @@ static bool api_wkssvc_NetrRenameMachineInDomain(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrRenameMachineInDomain, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1477,7 +1477,7 @@ static bool api_wkssvc_NetrValidateName(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1506,7 +1506,7 @@ static bool api_wkssvc_NetrValidateName(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrValidateName, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1550,7 +1550,7 @@ static bool api_wkssvc_NetrGetJoinInformation(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1587,7 +1587,7 @@ static bool api_wkssvc_NetrGetJoinInformation(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrGetJoinInformation, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1631,7 +1631,7 @@ static bool api_wkssvc_NetrGetJoinableOus(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1668,7 +1668,7 @@ static bool api_wkssvc_NetrGetJoinableOus(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrGetJoinableOus, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1712,7 +1712,7 @@ static bool api_wkssvc_NetrJoinDomain2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1741,7 +1741,7 @@ static bool api_wkssvc_NetrJoinDomain2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrJoinDomain2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1785,7 +1785,7 @@ static bool api_wkssvc_NetrUnjoinDomain2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1814,7 +1814,7 @@ static bool api_wkssvc_NetrUnjoinDomain2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrUnjoinDomain2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1858,7 +1858,7 @@ static bool api_wkssvc_NetrRenameMachineInDomain2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1887,7 +1887,7 @@ static bool api_wkssvc_NetrRenameMachineInDomain2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrRenameMachineInDomain2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -1931,7 +1931,7 @@ static bool api_wkssvc_NetrValidateName2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -1960,7 +1960,7 @@ static bool api_wkssvc_NetrValidateName2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrValidateName2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2004,7 +2004,7 @@ static bool api_wkssvc_NetrGetJoinableOus2(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2041,7 +2041,7 @@ static bool api_wkssvc_NetrGetJoinableOus2(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrGetJoinableOus2, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2085,7 +2085,7 @@ static bool api_wkssvc_NetrAddAlternateComputerName(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2114,7 +2114,7 @@ static bool api_wkssvc_NetrAddAlternateComputerName(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrAddAlternateComputerName, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2158,7 +2158,7 @@ static bool api_wkssvc_NetrRemoveAlternateComputerName(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2187,7 +2187,7 @@ static bool api_wkssvc_NetrRemoveAlternateComputerName(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrRemoveAlternateComputerName, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2231,7 +2231,7 @@ static bool api_wkssvc_NetrSetPrimaryComputername(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2260,7 +2260,7 @@ static bool api_wkssvc_NetrSetPrimaryComputername(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrSetPrimaryComputername, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
@@ -2304,7 +2304,7 @@ static bool api_wkssvc_NetrEnumerateComputerNames(pipes_struct *p)
return false;
}
- pull = ndr_pull_init_blob(&blob, r);
+ pull = ndr_pull_init_blob(&blob, r, NULL);
if (pull == NULL) {
talloc_free(r);
return false;
@@ -2340,7 +2340,7 @@ static bool api_wkssvc_NetrEnumerateComputerNames(pipes_struct *p)
NDR_PRINT_OUT_DEBUG(wkssvc_NetrEnumerateComputerNames, r);
}
- push = ndr_push_init_ctx(r);
+ push = ndr_push_init_ctx(r, NULL);
if (push == NULL) {
talloc_free(r);
return false;
diff --git a/source3/librpc/gen_ndr/svcctl.h b/source3/librpc/gen_ndr/svcctl.h
index d4135d2ddb..42ed039784 100644
--- a/source3/librpc/gen_ndr/svcctl.h
+++ b/source3/librpc/gen_ndr/svcctl.h
@@ -2,6 +2,7 @@
#include <stdint.h>
+#include "librpc/gen_ndr/misc.h"
#ifndef _HEADER_svcctl
#define _HEADER_svcctl
@@ -98,6 +99,18 @@ enum SERVICE_CONTROL
#define SC_RIGHT_SVC_INTERROGATE ( 0x0080 )
#define SC_RIGHT_SVC_USER_DEFINED_CONTROL ( 0x0100 )
+struct QUERY_SERVICE_CONFIG {
+ uint32_t service_type;
+ uint32_t start_type;
+ uint32_t error_control;
+ const char *executablepath;/* [unique,range(0,8192),charset(UTF16)] */
+ const char *loadordergroup;/* [unique,range(0,8192),charset(UTF16)] */
+ uint32_t tag_id;
+ const char *dependencies;/* [unique,range(0,8192),charset(UTF16)] */
+ const char *startname;/* [unique,range(0,8192),charset(UTF16)] */
+ const char *displayname;/* [unique,range(0,8192),charset(UTF16)] */
+}/* [gensize,public] */;
+
struct svcctl_CloseServiceHandle {
struct {
@@ -359,12 +372,12 @@ struct svcctl_OpenServiceW {
struct svcctl_QueryServiceConfigW {
struct {
struct policy_handle *handle;/* [ref] */
- uint32_t buf_size;
+ uint32_t buf_size;/* [range(0,8192)] */
} in;
struct {
- uint8_t *query;
- uint32_t *bytes_needed;/* [ref] */
+ struct QUERY_SERVICE_CONFIG *query;/* [ref] */
+ uint32_t *bytes_needed;/* [ref,range(0,8192)] */
WERROR result;
} out;
diff --git a/source3/librpc/gen_ndr/tables.c b/source3/librpc/gen_ndr/tables.c
new file mode 100644
index 0000000000..f2064d95ac
--- /dev/null
+++ b/source3/librpc/gen_ndr/tables.c
@@ -0,0 +1,83 @@
+
+/* Automatically generated by tables.pl. DO NOT EDIT */
+
+#include "includes.h"
+#include "librpc/ndr/libndr.h"
+#include "librpc/ndr/ndr_table.h"
+#include "librpc/gen_ndr/ndr_dfs.h"
+#include "librpc/gen_ndr/ndr_drsblobs.h"
+#include "librpc/gen_ndr/ndr_drsuapi.h"
+#include "librpc/gen_ndr/ndr_dssetup.h"
+#include "librpc/gen_ndr/ndr_echo.h"
+#include "librpc/gen_ndr/ndr_epmapper.h"
+#include "librpc/gen_ndr/ndr_eventlog.h"
+#include "librpc/gen_ndr/ndr_initshutdown.h"
+#include "librpc/gen_ndr/ndr_krb5pac.h"
+#include "librpc/gen_ndr/ndr_lsa.h"
+#include "librpc/gen_ndr/ndr_netlogon.h"
+#include "librpc/gen_ndr/ndr_ntsvcs.h"
+#include "librpc/gen_ndr/ndr_samr.h"
+#include "librpc/gen_ndr/ndr_srvsvc.h"
+#include "librpc/gen_ndr/ndr_svcctl.h"
+#include "librpc/gen_ndr/ndr_winreg.h"
+#include "librpc/gen_ndr/ndr_wkssvc.h"
+
+NTSTATUS ndr_table_register_builtin_tables(void)
+{
+ NTSTATUS status;
+
+ status = ndr_table_register(&ndr_table_netdfs);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_drsblobs);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_drsuapi);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_dssetup);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_rpcecho);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_epmapper);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_eventlog);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_initshutdown);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_krb5pac);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_lsarpc);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_netlogon);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_ntsvcs);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_samr);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_srvsvc);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_svcctl);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_winreg);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+ status = ndr_table_register(&ndr_table_wkssvc);
+ if (NT_STATUS_IS_ERR(status)) return status;
+
+
+
+ return NT_STATUS_OK;
+}
diff --git a/source3/librpc/gen_ndr/winreg.h b/source3/librpc/gen_ndr/winreg.h
index 4a06e3bc83..fbbab33c8d 100644
--- a/source3/librpc/gen_ndr/winreg.h
+++ b/source3/librpc/gen_ndr/winreg.h
@@ -3,7 +3,6 @@
#include <stdint.h>
#include "librpc/gen_ndr/lsa.h"
-#include "librpc/gen_ndr/initshutdown.h"
#include "librpc/gen_ndr/security.h"
#ifndef _HEADER_winreg
#define _HEADER_winreg
@@ -85,17 +84,17 @@ enum winreg_CreateAction
;
struct winreg_StringBuf {
- uint16_t length;/* [value(strlen_m_term_null(name)*2)] */
- uint16_t size;
- const char *name;/* [unique,length_is(length/2),charset(UTF16),size_is(size/2)] */
-};
-
-struct winreg_ValNameBuf {
uint16_t length;/* [value(strlen_m_term(name)*2)] */
uint16_t size;
const char *name;/* [unique,length_is(length/2),charset(UTF16),size_is(size/2)] */
};
+/* bitmap winreg_NotifyChangeType */
+#define REG_NOTIFY_CHANGE_NAME ( 0x00000001 )
+#define REG_NOTIFY_CHANGE_ATTRIBUTES ( 0x00000002 )
+#define REG_NOTIFY_CHANGE_LAST_SET ( 0x00000004 )
+#define REG_NOTIFY_CHANGE_SECURITY ( 0x00000008 )
+
struct KeySecurityAttribute {
uint32_t data_size;
struct KeySecurityData sec_data;
@@ -262,7 +261,7 @@ struct winreg_EnumValue {
struct {
struct policy_handle *handle;/* [ref] */
uint32_t enum_index;
- struct winreg_ValNameBuf *name;/* [ref] */
+ struct winreg_StringBuf *name;/* [ref] */
enum winreg_Type *type;/* [unique] */
uint8_t *value;/* [unique,length_is(*length),size_is(*size)] */
uint32_t *size;/* [unique] */
@@ -270,7 +269,7 @@ struct winreg_EnumValue {
} in;
struct {
- struct winreg_ValNameBuf *name;/* [ref] */
+ struct winreg_StringBuf *name;/* [ref] */
enum winreg_Type *type;/* [unique] */
uint8_t *value;/* [unique,length_is(*length),size_is(*size)] */
uint32_t *size;/* [unique] */
@@ -383,16 +382,16 @@ struct winreg_QueryValue {
struct policy_handle *handle;/* [ref] */
struct winreg_String *value_name;/* [ref] */
enum winreg_Type *type;/* [unique] */
- uint8_t *data;/* [unique,length_is(*value_length),size_is(*data_size)] */
+ uint8_t *data;/* [unique,length_is(*data_length),size_is(*data_size)] */
uint32_t *data_size;/* [unique] */
- uint32_t *value_length;/* [unique] */
+ uint32_t *data_length;/* [unique] */
} in;
struct {
enum winreg_Type *type;/* [unique] */
- uint8_t *data;/* [unique,length_is(*value_length),size_is(*data_size)] */
+ uint8_t *data;/* [unique,length_is(*data_length),size_is(*data_size)] */
uint32_t *data_size;/* [unique] */
- uint32_t *value_length;/* [unique] */
+ uint32_t *data_length;/* [unique] */
WERROR result;
} out;
@@ -438,7 +437,7 @@ struct winreg_SaveKey {
struct winreg_SetKeySecurity {
struct {
struct policy_handle *handle;/* [ref] */
- uint32_t access_mask;
+ uint32_t sec_info;
struct KeySecurityData *sd;/* [ref] */
} in;
@@ -476,7 +475,7 @@ struct winreg_UnLoadKey {
struct winreg_InitiateSystemShutdown {
struct {
uint16_t *hostname;/* [unique] */
- struct initshutdown_String *message;/* [unique] */
+ struct lsa_StringLarge *message;/* [unique] */
uint32_t timeout;
uint8_t force_apps;
uint8_t do_reboot;
@@ -564,7 +563,7 @@ struct winreg_QueryMultipleValues {
struct winreg_InitiateSystemShutdownEx {
struct {
uint16_t *hostname;/* [unique] */
- struct initshutdown_String *message;/* [unique] */
+ struct lsa_StringLarge *message;/* [unique] */
uint32_t timeout;
uint8_t force_apps;
uint8_t do_reboot;
diff --git a/source3/librpc/gen_ndr/xattr.h b/source3/librpc/gen_ndr/xattr.h
index b0b9db99c1..1d8da3f5e2 100644
--- a/source3/librpc/gen_ndr/xattr.h
+++ b/source3/librpc/gen_ndr/xattr.h
@@ -2,18 +2,75 @@
#include <stdint.h>
+#include "librpc/gen_ndr/security.h"
#ifndef _HEADER_xattr
#define _HEADER_xattr
+#define XATTR_DOSATTRIB_NAME ( "user.DosAttrib" )
+#define XATTR_DOSATTRIB_ESTIMATED_SIZE ( 64 )
+#define XATTR_DOSEAS_NAME ( "user.DosEAs" )
+#define XATTR_DOSSTREAMS_NAME ( "user.DosStreams" )
+#define XATTR_STREAM_FLAG_INTERNAL ( 0x00000001 )
+#define XATTR_DOSSTREAM_PREFIX ( "user.DosStream." )
+#define XATTR_MAX_STREAM_SIZE ( 0x4000 )
+#define XATTR_MAX_STREAM_SIZE_TDB ( 0x100000 )
#define XATTR_NTACL_NAME ( "security.NTACL" )
-struct tdb_xattr {
+struct xattr_DosInfo1 {
+ uint32_t attrib;
+ uint32_t ea_size;
+ uint64_t size;
+ uint64_t alloc_size;
+ NTTIME create_time;
+ NTTIME change_time;
+};
+
+struct xattr_DosInfo2Old {
+ uint32_t flags;
+ uint32_t attrib;
+ uint32_t ea_size;
+ uint64_t size;
+ uint64_t alloc_size;
+ NTTIME create_time;
+ NTTIME change_time;
+ NTTIME write_time;
+ const char * name;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
+};
+
+union xattr_DosInfo {
+ struct xattr_DosInfo1 info1;/* [case] */
+ struct xattr_DosInfo2Old oldinfo2;/* [case(2)] */
+}/* [switch_type(uint16)] */;
+
+struct xattr_DosAttrib {
+ uint16_t version;
+ union xattr_DosInfo info;/* [switch_is(version)] */
+}/* [public] */;
+
+struct xattr_EA {
const char * name;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
DATA_BLOB value;
+};
+
+struct xattr_DosEAs {
+ uint16_t num_eas;
+ struct xattr_EA *eas;/* [unique,size_is(num_eas)] */
}/* [public] */;
struct tdb_xattrs {
- uint32_t num_xattrs;
- struct tdb_xattr *xattrs;
+ uint32_t num_eas;
+ struct xattr_EA *eas;
+}/* [public] */;
+
+struct xattr_DosStream {
+ uint32_t flags;
+ uint64_t size;
+ uint64_t alloc_size;
+ const char * name;/* [flag(LIBNDR_FLAG_STR_UTF8|LIBNDR_FLAG_STR_NULLTERM)] */
+};
+
+struct xattr_DosStreams {
+ uint32_t num_streams;
+ struct xattr_DosStream *streams;/* [unique,size_is(num_streams)] */
}/* [public] */;
struct security_descriptor_timestamp {
diff --git a/source3/librpc/idl/dfs.idl b/source3/librpc/idl/dfs.idl
deleted file mode 100644
index a729b0e560..0000000000
--- a/source3/librpc/idl/dfs.idl
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- dfs interface definition
-*/
-
-[ uuid("4fc742e0-4a10-11cf-8273-00aa004ae673"),
- version(3.0),
- pointer_default(unique),
- helpstring("Settings for Microsoft Distributed File System"),
- endpoint("ncacn_np:[\\pipe\\netdfs]", "ncacn_ip_tcp:", "ncalrpc:")
-] interface netdfs
-{
- /******************/
- /* Function: 0x00 */
- typedef [v1_enum] enum {
- DFS_MANAGER_VERSION_NT4 = 1,
- DFS_MANAGER_VERSION_W2K = 2,
- DFS_MANAGER_VERSION_W2K3 = 4,
- DFS_MANAGER_VERSION_W2K8 = 6
- } dfs_ManagerVersion;
-
- [public] void dfs_GetManagerVersion(
- [out] dfs_ManagerVersion *version
- );
-
-
- /******************/
- /* Function: 0x01 */
- WERROR dfs_Add (
- [in] [string,charset(UTF16)] uint16 *path,
- [in] [string,charset(UTF16)] uint16 *server,
- [in,unique] [string,charset(UTF16)] uint16 *share,
- [in,unique] [string,charset(UTF16)] uint16 *comment,
- [in] uint32 flags
- );
-
- /******************/
- /* Function: 0x02 */
- WERROR dfs_Remove (
- [in] [string,charset(UTF16)] uint16 *dfs_entry_path,
- [in,unique] [string,charset(UTF16)] uint16 *servername,
- [in,unique] [string,charset(UTF16)] uint16 *sharename
- );
-
- /******************/
- /* Function: 0x03 */
-
- typedef struct {
- } dfs_Info0;
-
- typedef struct {
- [string,charset(UTF16)] uint16 *path;
- } dfs_Info1;
-
- typedef [public,bitmap32bit] bitmap {
- DFS_VOLUME_STATE_OK = 0x1,
- DFS_VOLUME_STATE_INCONSISTENT = 0x2,
- 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;
-
- typedef struct {
- [string,charset(UTF16)] uint16 *path;
- [string,charset(UTF16)] uint16 *comment;
- dfs_VolumeState state;
- uint32 num_stores;
- } dfs_Info2;
-
- const int DFS_STORAGE_STATES = 0xf;
-
- /* yes, this is a bitmap */
- typedef [public,bitmap32bit] bitmap {
- DFS_STORAGE_STATE_OFFLINE = 1,
- DFS_STORAGE_STATE_ONLINE = 2,
- DFS_STORAGE_STATE_ACTIVE = 4
- } dfs_StorageState;
-
- typedef struct {
- dfs_StorageState state;
- [string,charset(UTF16)] uint16 *server;
- [string,charset(UTF16)] uint16 *share;
- } dfs_StorageInfo;
-
- typedef struct {
- [string,charset(UTF16)] uint16 *path;
- [string,charset(UTF16)] uint16 *comment;
- dfs_VolumeState state;
- uint32 num_stores;
- [size_is(num_stores)] dfs_StorageInfo *stores;
- } dfs_Info3;
-
- typedef struct {
- [string,charset(UTF16)] uint16 *path;
- [string,charset(UTF16)] uint16 *comment;
- dfs_VolumeState state;
- uint32 timeout;
- GUID guid;
- uint32 num_stores;
- [size_is(num_stores)] dfs_StorageInfo *stores;
- } dfs_Info4;
-
- /* verified with dfsutil */
- typedef [public,bitmap32bit] bitmap {
- DFS_PROPERTY_FLAG_INSITE_REFERRALS = 0x01,
- DFS_PROPERTY_FLAG_ROOT_SCALABILITY = 0x02,
- DFS_PROPERTY_FLAG_SITE_COSTING = 0x04,
- DFS_PROPERTY_FLAG_TARGET_FAILBACK = 0x08,
- DFS_PROPERTY_FLAG_CLUSTER_ENABLED = 0x10 /* untested */
- } dfs_PropertyFlags;
-
- typedef struct {
- [string,charset(UTF16)] uint16 *path;
- [string,charset(UTF16)] uint16 *comment;
- dfs_VolumeState state;
- uint32 timeout;
- GUID guid;
- dfs_PropertyFlags flags;
- uint32 pktsize;
- uint32 num_stores;
- } dfs_Info5;
-
- typedef [v1_enum] enum {
- DFS_INVALID_PRIORITY_CLASS = -1,
- DFS_SITE_COST_NORMAL_PRIORITY_CLASS = 0,
- DFS_GLOBAL_HIGH_PRIORITY_CLASS = 1,
- DFS_SITE_COST_HIGH_PRIORITY_CLASS = 2,
- DFS_SITE_COST_LOW_PRIORITY_CLASS = 3,
- DFS_GLOBAL_LOW_PRIORITY_CLASS = 4
- } dfs_Target_PriorityClass;
-
- typedef struct {
- dfs_Target_PriorityClass target_priority_class;
- uint16 target_priority_rank;
- uint16 reserved;
- } dfs_Target_Priority;
-
- typedef struct {
- dfs_StorageInfo info;
- dfs_Target_Priority target_priority;
- } dfs_StorageInfo2;
-
- typedef struct {
- [string,charset(UTF16)] uint16 *entry_path;
- [string,charset(UTF16)] uint16 *comment;
- dfs_VolumeState state;
- uint32 timeout;
- GUID guid;
- dfs_PropertyFlags flags;
- uint32 pktsize;
- uint16 num_stores;
- [size_is(num_stores)] dfs_StorageInfo2 *stores;
- } dfs_Info6;
-
- typedef struct {
- GUID generation_guid;
- } dfs_Info7;
-
- typedef struct {
- [string,charset(UTF16)] uint16 *comment;
- } dfs_Info100;
-
- typedef struct {
- dfs_StorageState state;
- } dfs_Info101;
-
- typedef struct {
- uint32 timeout;
- } dfs_Info102;
-
- typedef struct {
- dfs_PropertyFlags flags;
- } dfs_Info103;
-
- typedef struct {
- dfs_Target_Priority priority;
- } dfs_Info104;
-
- typedef struct {
- [string,charset(UTF16)] uint16 *comment;
- dfs_VolumeState state;
- uint32 timeout;
- uint32 property_flag_mask;
- uint32 property_flags;
- } dfs_Info105;
-
- typedef struct {
- dfs_StorageState state;
- dfs_Target_Priority priority;
- } dfs_Info106;
-
- typedef struct {
- [string,charset(UTF16)] uint16 *dom_root;
- } dfs_Info200;
-
- typedef enum {
- DFS_VOLUME_FLAVOR_STANDALONE = 0x100,
- DFS_VOLUME_FLAVOR_AD_BLOB = 0x200
- } dfs_VolumeFlavor;
-
- typedef struct {
- dfs_VolumeFlavor flavor;
- [string,charset(UTF16)] uint16 *dom_root;
- } dfs_Info300;
-
- typedef union {
- [case(0)] dfs_Info0 *info0;
- [case(1)] dfs_Info1 *info1;
- [case(2)] dfs_Info2 *info2;
- [case(3)] dfs_Info3 *info3;
- [case(4)] dfs_Info4 *info4;
- [case(5)] dfs_Info5 *info5;
- [case(6)] dfs_Info6 *info6;
- [case(7)] dfs_Info7 *info7;
- [case(100)] dfs_Info100 *info100;
- [case(101)] dfs_Info101 *info101;
- [case(102)] dfs_Info102 *info102;
- [case(103)] dfs_Info103 *info103;
- [case(104)] dfs_Info104 *info104;
- [case(105)] dfs_Info105 *info105;
- [case(106)] dfs_Info106 *info106;
- } dfs_Info;
-
- WERROR dfs_SetInfo (
- [in] [string,charset(UTF16)] uint16 dfs_entry_path[],
- [in,unique] [string,charset(UTF16)] uint16 *servername,
- [in,unique] [string,charset(UTF16)] uint16 *sharename,
- [in] uint32 level,
- [in,ref,switch_is(level)] dfs_Info *info
- );
-
- /******************/
- /* Function: 0x04 */
- WERROR dfs_GetInfo (
- [in] [string,charset(UTF16)] uint16 dfs_entry_path[],
- [in,unique] [string,charset(UTF16)] uint16 *servername,
- [in,unique] [string,charset(UTF16)] uint16 *sharename,
- [in] uint32 level,
- [out,switch_is(level)] dfs_Info *info
- );
-
- /******************/
- /* Function: 0x05 */
-
- typedef struct {
- uint32 count;
- [size_is(count)] dfs_Info1 *s;
- } dfs_EnumArray1;
-
- typedef struct {
- uint32 count;
- [size_is(count)] dfs_Info2 *s;
- } dfs_EnumArray2;
-
- typedef struct {
- uint32 count;
- [size_is(count)] dfs_Info3 *s;
- } dfs_EnumArray3;
-
- typedef struct {
- uint32 count;
- [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;
- } dfs_EnumArray200;
-
- typedef struct {
- uint32 count;
- [size_is(count)] dfs_Info300 *s;
- } dfs_EnumArray300;
-
-
- typedef union {
- [case(1)] dfs_EnumArray1 *info1;
- [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;
-
- typedef struct {
- uint32 level;
- [switch_is(level)] dfs_EnumInfo e;
- } dfs_EnumStruct;
-
- WERROR dfs_Enum (
- [in] uint32 level,
- [in] uint32 bufsize,
- [in,out,unique] dfs_EnumStruct *info,
- [in,out,unique] uint32 *total
- );
-
- /* Function 0x06 */
- WERROR dfs_Rename();
-
- /* Function 0x07 */
- WERROR dfs_Move();
-
- /* Function 0x08 */
- WERROR dfs_ManagerGetConfigInfo();
-
- /* Function 0x09 */
- WERROR dfs_ManagerSendSiteInfo();
-
- /* Function 0x0a */
- typedef struct {
- uint32 unknown1;
- [string,charset(UTF16)] uint16 *unknown2;
- } dfs_UnknownStruct;
-
- WERROR dfs_AddFtRoot(
- [in] [string,charset(UTF16)] uint16 servername[],
- [in] [string,charset(UTF16)] uint16 dns_servername[],
- [in] [string,charset(UTF16)] uint16 dfsname[],
- [in] [string,charset(UTF16)] uint16 rootshare[],
- [in] [string,charset(UTF16)] uint16 comment[],
- [in] [string,charset(UTF16)] uint16 dfs_config_dn[],
- [in] uint8 unknown1,
- [in] uint32 flags,
- [in,out,unique] dfs_UnknownStruct **unknown2
- );
-
- /* Function 0x0b */
- WERROR dfs_RemoveFtRoot(
- [in] [string,charset(UTF16)] uint16 servername[],
- [in] [string,charset(UTF16)] uint16 dns_servername[],
- [in] [string,charset(UTF16)] uint16 dfsname[],
- [in] [string,charset(UTF16)] uint16 rootshare[],
- [in] uint32 flags,
- [in,out,unique] dfs_UnknownStruct **unknown
- );
-
- /* Function 0x0c */
- WERROR dfs_AddStdRoot(
- [in] [string,charset(UTF16)] uint16 servername[],
- [in] [string,charset(UTF16)] uint16 rootshare[],
- [in] [string,charset(UTF16)] uint16 comment[],
- [in] uint32 flags
- );
-
- /* Function 0x0d */
- WERROR dfs_RemoveStdRoot(
- [in] [string,charset(UTF16)] uint16 servername[],
- [in] [string,charset(UTF16)] uint16 rootshare[],
- [in] uint32 flags
- );
-
- /* Function 0x0e */
- WERROR dfs_ManagerInitialize(
- [in] [string,charset(UTF16)] uint16 *servername,
- [in] uint32 flags
- );
-
- /* Function 0x0f */
- WERROR dfs_AddStdRootForced(
- [in] [string,charset(UTF16)] uint16 servername[],
- [in] [string,charset(UTF16)] uint16 rootshare[],
- [in] [string,charset(UTF16)] uint16 comment[],
- [in] [string,charset(UTF16)] uint16 store[] /* C:\\whatever */
- );
-
- /* Function 0x10 */
- 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(
- [in] [string,charset(UTF16)] uint16 servername[],
- [in] [string,charset(UTF16)] uint16 server_fullname[],
- [in] uint32 flags,
- [in] uint32 ttl
- );
-
- /* Function 0x12 */
- WERROR dfs_FlushFtTable(
- [in] [string,charset(UTF16)] uint16 servername[],
- [in] [string,charset(UTF16)] uint16 rootshare[]
- );
-
- /* Function 0x13 */
- WERROR dfs_Add2();
-
- /* Function 0x14 */
- WERROR dfs_Remove2();
-
- /* Function 0x15 */
- [public] WERROR dfs_EnumEx(
- [in] [string,charset(UTF16)] uint16 dfs_name[],
- [in] uint32 level,
- [in] uint32 bufsize,
- [in,out,unique] dfs_EnumStruct *info,
- [in,out,unique] uint32 *total
- );
-
- /* Function 0x16 */
- WERROR dfs_SetInfo2();
-}
diff --git a/source3/librpc/idl/drsblobs.idl b/source3/librpc/idl/drsblobs.idl
deleted file mode 100644
index 6fdca0ec43..0000000000
--- a/source3/librpc/idl/drsblobs.idl
+++ /dev/null
@@ -1,436 +0,0 @@
-#include "idl_types.h"
-
-import "drsuapi.idl", "misc.idl";
-
-[
- uuid("12345778-1234-abcd-0001-00000001"),
- version(0.0),
- pointer_default(unique),
- helpstring("Active Directory Replication LDAP Blobs")
-]
-interface drsblobs {
- typedef bitmap drsuapi_DsReplicaSyncOptions drsuapi_DsReplicaSyncOptions;
- typedef bitmap drsuapi_DsReplicaNeighbourFlags drsuapi_DsReplicaNeighbourFlags;
- typedef [v1_enum] enum drsuapi_DsAttributeId drsuapi_DsAttributeId;
-
- /*
- * replPropertyMetaData
- * w2k uses version 1
- * w2k3 uses version 1
- */
- typedef struct {
- drsuapi_DsAttributeId attid;
- uint32 version;
- NTTIME_1sec originating_change_time;
- GUID originating_invocation_id;
- hyper originating_usn;
- hyper local_usn;
- } replPropertyMetaData1;
-
- typedef struct {
- uint32 count;
- uint32 reserved;
- replPropertyMetaData1 array[count];
- } replPropertyMetaDataCtr1;
-
- typedef [nodiscriminant] union {
- [case(1)] replPropertyMetaDataCtr1 ctr1;
- } replPropertyMetaDataCtr;
-
- typedef [public] struct {
- uint32 version;
- uint32 reserved;
- [switch_is(version)] replPropertyMetaDataCtr ctr;
- } replPropertyMetaDataBlob;
-
- void decode_replPropertyMetaData(
- [in] replPropertyMetaDataBlob blob
- );
-
- /*
- * replUpToDateVector
- * w2k uses version 1
- * w2k3 uses version 2
- */
- typedef struct {
- uint32 count;
- uint32 reserved;
- drsuapi_DsReplicaCursor cursors[count];
- } replUpToDateVectorCtr1;
-
- typedef struct {
- uint32 count;
- uint32 reserved;
- drsuapi_DsReplicaCursor2 cursors[count];
- } replUpToDateVectorCtr2;
-
- typedef [nodiscriminant] union {
- [case(1)] replUpToDateVectorCtr1 ctr1;
- [case(2)] replUpToDateVectorCtr2 ctr2;
- } replUpToDateVectorCtr;
-
- typedef [public] struct {
- uint32 version;
- uint32 reserved;
- [switch_is(version)] replUpToDateVectorCtr ctr;
- } replUpToDateVectorBlob;
-
- void decode_replUpToDateVector(
- [in] replUpToDateVectorBlob blob
- );
-
- /*
- * repsFrom/repsTo
- * w2k uses version 1
- * w2k3 uses version 1
- */
- typedef [public,gensize] struct {
- [value(strlen(dns_name)+1)] uint32 __dns_name_size;
- [charset(DOS)] uint8 dns_name[__dns_name_size];
- } repsFromTo1OtherInfo;
-
- typedef [public,gensize,flag(NDR_PAHEX)] struct {
- /* this includes the 8 bytes of the repsFromToBlob header */
- [value(ndr_size_repsFromTo1(this, ndr->flags)+8)] uint32 blobsize;
- uint32 consecutive_sync_failures;
- NTTIME_1sec last_success;
- NTTIME_1sec last_attempt;
- WERROR result_last_attempt;
- [relative] repsFromTo1OtherInfo *other_info;
- [value(ndr_size_repsFromTo1OtherInfo(other_info, ndr->flags))] uint32 other_info_length;
- drsuapi_DsReplicaNeighbourFlags replica_flags;
- uint8 schedule[84];
- uint32 reserved;
- drsuapi_DsReplicaHighWaterMark highwatermark;
- GUID source_dsa_obj_guid; /* the 'objectGuid' field of the CN=NTDS Settings object */
- GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
- GUID transport_guid;
- } repsFromTo1;
-
- typedef [nodiscriminant] union {
- [case(1)] repsFromTo1 ctr1;
- } repsFromTo;
-
- typedef [public] struct {
- uint32 version;
- uint32 reserved;
- [switch_is(version)] repsFromTo ctr;
- } repsFromToBlob;
-
- void decode_repsFromTo(
- [in] repsFromToBlob blob
- );
-
- /*
- * partialAttributeSet
- * w2k uses version 1
- * w2k3 uses version 1
- */
- typedef struct {
- uint32 count;
- drsuapi_DsAttributeId array[count];
- } partialAttributeSetCtr1;
-
- typedef [nodiscriminant] union {
- [case(1)] partialAttributeSetCtr1 ctr1;
- } partialAttributeSetCtr;
-
- typedef [public] struct {
- uint32 version;
- uint32 reserved;
- [switch_is(version)] partialAttributeSetCtr ctr;
- } partialAttributeSetBlob;
-
- void decode_partialAttributeSet(
- [in] partialAttributeSetBlob blob
- );
-
- /*
- * prefixMap
- * w2k unknown
- * w2k3 unknown
- * samba4 uses 0x44534442 'DSDB'
- *
- * as we windows don't return the prefixMap attribute when you ask for
- * we don't know the format, but the attribute is not replicated
- * so that we can choose our own format...
- */
- typedef [v1_enum] enum {
- PREFIX_MAP_VERSION_DSDB = 0x44534442
- } prefixMapVersion;
-
- typedef [nodiscriminant] union {
- [case(PREFIX_MAP_VERSION_DSDB)] drsuapi_DsReplicaOIDMapping_Ctr dsdb;
- } prefixMapCtr;
-
- typedef [public] struct {
- prefixMapVersion version;
- uint32 reserved;
- [switch_is(version)] prefixMapCtr ctr;
- } prefixMapBlob;
-
- void decode_prefixMap(
- [in] prefixMapBlob blob
- );
-
- /*
- * the cookie for the LDAP dirsync control
- */
- typedef [nodiscriminant,gensize] union {
- [case(0)];
- [default] replUpToDateVectorBlob uptodateness_vector;
- } ldapControlDirSyncExtra;
-
- typedef struct {
- [value(3)] uint32 u1;
- NTTIME time;
- uint32 u2;
- uint32 u3;
- [value(ndr_size_ldapControlDirSyncExtra(&extra, extra.uptodateness_vector.version, 0))]
- uint32 extra_length;
- drsuapi_DsReplicaHighWaterMark highwatermark;
- GUID guid1;
- [switch_is(extra_length)] ldapControlDirSyncExtra extra;
- } ldapControlDirSyncBlob;
-
- typedef [public,relative_base] struct {
- [charset(DOS),value("MSDS")] uint8 msds[4];
- [subcontext(0)] ldapControlDirSyncBlob blob;
- } ldapControlDirSyncCookie;
-
- void decode_ldapControlDirSync(
- [in] ldapControlDirSyncCookie cookie
- );
-
- typedef struct {
- [value(2*strlen_m(name))] uint16 name_len;
- [value(strlen(data))] uint16 data_len;
- uint16 reserved; /* 2 for 'Packages', 1 for 'Primary:*', but should be ignored */
- [charset(UTF16)] uint8 name[name_len];
- /*
- * the data field contains data as HEX strings
- *
- * 'Packages':
- * data contains the list of packages
- * as non termiated UTF16 strings with
- * a UTF16 NULL byte as separator
- *
- * 'Primary:Kerberos-Newer-Keys':
- * ...
- *
- * 'Primary:Kerberos':
- * ...
- *
- * 'Primary:WDigest':
- * ...
- *
- * 'Primary:CLEARTEXT':
- * data contains the cleartext password
- * as UTF16 string encoded as HEX string
- */
- [charset(DOS)] uint8 data[data_len];
- } supplementalCredentialsPackage;
-
- /* this are 0x30 (48) whitespaces (0x20) */
- const string SUPPLEMENTAL_CREDENTIALS_PREFIX = " ";
-
- typedef [flag(NDR_PAHEX)] enum {
- SUPPLEMENTAL_CREDENTIALS_SIGNATURE = 0x0050
- } supplementalCredentialsSignature;
-
- typedef [gensize] struct {
- [value(SUPPLEMENTAL_CREDENTIALS_PREFIX),charset(UTF16)] uint16 prefix[0x30];
- [value(SUPPLEMENTAL_CREDENTIALS_SIGNATURE)] supplementalCredentialsSignature signature;
- uint16 num_packages;
- supplementalCredentialsPackage packages[num_packages];
- } supplementalCredentialsSubBlob;
-
- typedef [public] struct {
- [value(0)] uint32 unknown1;
- [value(ndr_size_supplementalCredentialsSubBlob(&sub, ndr->flags))] uint32 __ndr_size;
- [value(0)] uint32 unknown2;
- [subcontext(0),subcontext_size(__ndr_size)] supplementalCredentialsSubBlob sub;
- [value(0)] uint8 unknown3;
- } supplementalCredentialsBlob;
-
- void decode_supplementalCredentials(
- [in] supplementalCredentialsBlob blob
- );
-
- typedef [public] struct {
- [flag(STR_NOTERM|NDR_REMAINING)] string_array names;
- } package_PackagesBlob;
-
- void decode_Packages(
- [in] package_PackagesBlob blob
- );
-
- typedef struct {
- [value(2*strlen_m(string))] uint16 length;
- [value(2*strlen_m(string))] uint16 size;
- [relative,subcontext(0),subcontext_size(size),flag(STR_NOTERM|NDR_REMAINING)] string *string;
- } package_PrimaryKerberosString;
-
- typedef struct {
- [value(0)] uint16 reserved1;
- [value(0)] uint16 reserved2;
- [value(0)] uint32 reserved3;
- uint32 keytype;
- [value((value?value->length:0))] uint32 value_len;
- [relative,subcontext(0),subcontext_size(value_len),flag(NDR_REMAINING)] DATA_BLOB *value;
- } package_PrimaryKerberosKey3;
-
- typedef struct {
- uint16 num_keys;
- uint16 num_old_keys;
- package_PrimaryKerberosString salt;
- package_PrimaryKerberosKey3 keys[num_keys];
- package_PrimaryKerberosKey3 old_keys[num_old_keys];
- [value(0)] uint32 padding1;
- [value(0)] uint32 padding2;
- [value(0)] uint32 padding3;
- [value(0)] uint32 padding4;
- [value(0)] uint32 padding5;
- } package_PrimaryKerberosCtr3;
-
- typedef struct {
- [value(0)] uint16 reserved1;
- [value(0)] uint16 reserved2;
- [value(0)] uint32 reserved3;
- uint32 iteration_count;
- uint32 keytype;
- [value((value?value->length:0))] uint32 value_len;
- [relative,subcontext(0),subcontext_size(value_len),flag(NDR_REMAINING)] DATA_BLOB *value;
- } package_PrimaryKerberosKey4;
-
- typedef struct {
- uint16 num_keys;
- [value(0)] uint16 num_service_keys;
- uint16 num_old_keys;
- uint16 num_older_keys;
- package_PrimaryKerberosString salt;
- uint32 default_iteration_count;
- package_PrimaryKerberosKey4 keys[num_keys];
- package_PrimaryKerberosKey4 service_keys[num_service_keys];
- package_PrimaryKerberosKey4 old_keys[num_old_keys];
- package_PrimaryKerberosKey4 older_keys[num_older_keys];
- } package_PrimaryKerberosCtr4;
-
- typedef [nodiscriminant] union {
- [case(3)] package_PrimaryKerberosCtr3 ctr3;
- [case(4)] package_PrimaryKerberosCtr4 ctr4;
- } package_PrimaryKerberosCtr;
-
- typedef [public] struct {
- uint16 version;
- [value(0)] uint16 flags;
- [switch_is(version)] package_PrimaryKerberosCtr ctr;
- } package_PrimaryKerberosBlob;
-
- void decode_PrimaryKerberos(
- [in] package_PrimaryKerberosBlob blob
- );
-
- typedef [public] struct {
- [flag(STR_NOTERM|NDR_REMAINING)] string cleartext;
- } package_PrimaryCLEARTEXTBlob;
-
- void decode_PrimaryCLEARTEXT(
- [in] package_PrimaryCLEARTEXTBlob blob
- );
-
- typedef [flag(NDR_PAHEX)] struct {
- uint8 hash[16];
- } package_PrimaryWDigestHash;
-
- typedef [public] struct {
- [value(0x31)] uint16 unknown1;
- [value(0x01)] uint8 unknown2;
- uint8 num_hashes;
- [value(0)] uint32 unknown3;
- [value(0)] udlong uuknown4;
- package_PrimaryWDigestHash hashes[num_hashes];
- } package_PrimaryWDigestBlob;
-
- void decode_PrimaryWDigest(
- [in] package_PrimaryWDigestBlob blob
- );
-
- typedef struct {
- NTTIME time1;
- uint32 unknown1;
- /*
- * the secret value is encoded as UTF16 if it's a string
- * but krb5 trusts have random bytes here, so converting to UTF16
- * mayfail...
- *
- * TODO: We should try handle the case of a random buffer in all places
- * we deal with cleartext passwords from windows
- *
- * so we don't use this:
- *
- * uint32 value_len;
- * [charset(UTF16)] uint8 value[value_len];
- */
- DATA_BLOB value;
- [flag(NDR_ALIGN4)] DATA_BLOB _pad;
- } trustAuthInOutSecret1;
-
- typedef struct {
- [relative] trustAuthInOutSecret1 *value1;
- [relative] trustAuthInOutSecret1 *value2;
- } trustAuthInOutCtr1;
-
- typedef struct {
- NTTIME time1;
- uint32 unknown1;
- DATA_BLOB value;
- NTTIME time2;
- uint32 unknown2;
- uint32 unknown3;
- uint32 unknown4;
- [flag(NDR_ALIGN4)] DATA_BLOB _pad;
- } trustAuthInOutSecret2V1;
-
- typedef struct {
- NTTIME time1;
- uint32 unknown1;
- DATA_BLOB value;
- NTTIME time2;
- uint32 unknown2;
- uint32 unknown3;
- [flag(NDR_ALIGN4)] DATA_BLOB _pad;
- } trustAuthInOutSecret2V2;
-
- typedef struct {
- [relative] trustAuthInOutSecret2V1 *value1;
- [relative] trustAuthInOutSecret2V2 *value2;
- } trustAuthInOutCtr2;
-
- typedef [nodiscriminant] union {
- [case(1)] trustAuthInOutCtr1 ctr1;
- [case(2)] trustAuthInOutCtr2 ctr2;
- } trustAuthInOutCtr;
-
- typedef [public] struct {
- uint32 version;
- [switch_is(version)] trustAuthInOutCtr ctr;
- } trustAuthInOutBlob;
-
- void decode_trustAuthInOut(
- [in] trustAuthInOutBlob blob
- );
-
- typedef [public] struct {
- uint32 marker;
- DATA_BLOB data;
- } DsCompressedChunk;
-
- typedef [public] struct {
- DsCompressedChunk chunks[5];
- } DsCompressedBlob;
-
- void decode_DsCompressed(
- [in] DsCompressedBlob blob
- );
-}
diff --git a/source3/librpc/idl/drsuapi.idl b/source3/librpc/idl/drsuapi.idl
deleted file mode 100644
index 56dd483054..0000000000
--- a/source3/librpc/idl/drsuapi.idl
+++ /dev/null
@@ -1,1601 +0,0 @@
-#include "idl_types.h"
-
-import "security.idl", "misc.idl", "samr.idl";
-
-[
- uuid("e3514235-4b06-11d1-ab04-00c04fc2dcd2"),
- version(4.0),
- endpoint("ncacn_np:[\\pipe\\lsass]","ncacn_np:[\\pipe\\protected_storage]", "ncacn_ip_tcp:", "ncalrpc:"),
- authservice("ldap"),
- helpstring("Active Directory Replication"),
- helper("librpc/ndr/ndr_drsuapi.h"),
- pointer_default(unique)
-]
-interface drsuapi
-{
- typedef bitmap samr_GroupAttrs samr_GroupAttrs;
-
- /*****************/
- /* Function 0x00 */
- typedef [bitmap32bit] bitmap {
- DRSUAPI_SUPPORTED_EXTENSION_BASE = 0x00000001,
- DRSUAPI_SUPPORTED_EXTENSION_ASYNC_REPLICATION = 0x00000002,
- DRSUAPI_SUPPORTED_EXTENSION_REMOVEAPI = 0x00000004,
- DRSUAPI_SUPPORTED_EXTENSION_MOVEREQ_V2 = 0x00000008,
- DRSUAPI_SUPPORTED_EXTENSION_GETCHG_COMPRESS = 0x00000010,
- DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V1 = 0x00000020,
- DRSUAPI_SUPPORTED_EXTENSION_RESTORE_USN_OPTIMIZATION = 0x00000040,
- DRSUAPI_SUPPORTED_EXTENSION_00000080 = 0x00000080,
- DRSUAPI_SUPPORTED_EXTENSION_KCC_EXECUTE = 0x00000100,
- DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY_V2 = 0x00000200,
- DRSUAPI_SUPPORTED_EXTENSION_LINKED_VALUE_REPLICATION = 0x00000400,
- DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V2 = 0x00000800,
- DRSUAPI_SUPPORTED_EXTENSION_INSTANCE_TYPE_NOT_REQ_ON_MOD= 0x00001000,
- DRSUAPI_SUPPORTED_EXTENSION_CRYPTO_BIND = 0x00002000,
- DRSUAPI_SUPPORTED_EXTENSION_GET_REPL_INFO = 0x00004000,
- DRSUAPI_SUPPORTED_EXTENSION_STRONG_ENCRYPTION = 0x00008000,
- DRSUAPI_SUPPORTED_EXTENSION_DCINFO_V01 = 0x00010000,
- DRSUAPI_SUPPORTED_EXTENSION_TRANSITIVE_MEMBERSHIP = 0x00020000,
- DRSUAPI_SUPPORTED_EXTENSION_ADD_SID_HISTORY = 0x00040000,
- DRSUAPI_SUPPORTED_EXTENSION_POST_BETA3 = 0x00080000,
- DRSUAPI_SUPPORTED_EXTENSION_00100000 = 0x00100000,
- DRSUAPI_SUPPORTED_EXTENSION_GET_MEMBERSHIPS2 = 0x00200000,
- DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V6 = 0x00400000,
- DRSUAPI_SUPPORTED_EXTENSION_NONDOMAIN_NCS = 0x00800000,
- DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8 = 0x01000000,
- DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V5 = 0x02000000,
- DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V6 = 0x04000000,
- /*
- * the following 3 have the same value
- * repadmin.exe /bind says that
- */
- DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3 = 0x08000000,
- DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V7 = 0x08000000,
- DRSUAPI_SUPPORTED_EXTENSION_VERIFY_OBJECT = 0x08000000,
- DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS = 0x10000000,
- DRSUAPI_SUPPORTED_EXTENSION_20000000 = 0x20000000,
- DRSUAPI_SUPPORTED_EXTENSION_40000000 = 0x40000000,
- DRSUAPI_SUPPORTED_EXTENSION_80000000 = 0x80000000
- } drsuapi_SupportedExtensions;
-
- typedef [bitmap32bit] bitmap {
- DRSUAPI_SUPPORTED_EXTENSION_ADAM = 0x00000001,
- DRSUAPI_SUPPORTED_EXTENSION_LH_BETA2 = 0x00000002
- } drsuapi_SupportedExtensionsExt;
-
- /* this is used by w2k */
- typedef struct {
- drsuapi_SupportedExtensions supported_extensions;
- GUID site_guid;
- uint32 pid;
- } drsuapi_DsBindInfo24;
-
- /* this is used by w2k3 */
- typedef struct {
- drsuapi_SupportedExtensions supported_extensions;
- GUID site_guid;
- uint32 pid;
- uint32 repl_epoch;
- } drsuapi_DsBindInfo28;
-
- /* this is used by w2k8 */
- typedef struct {
- drsuapi_SupportedExtensions supported_extensions;
- GUID site_guid;
- uint32 pid;
- uint32 repl_epoch;
- drsuapi_SupportedExtensionsExt supported_extensions_ext;
- GUID config_dn_guid;
- } drsuapi_DsBindInfo48;
-
- typedef struct {
- [flag(NDR_REMAINING)] DATA_BLOB info;
- } drsuapi_DsBindInfoFallBack;
-
- typedef [nodiscriminant] union {
- [case(24)][subcontext(4)] drsuapi_DsBindInfo24 info24;
- [case(28)][subcontext(4)] drsuapi_DsBindInfo28 info28;
- [case(48)][subcontext(4)] drsuapi_DsBindInfo48 info48;
- [default][subcontext(4)] drsuapi_DsBindInfoFallBack FallBack;
- } drsuapi_DsBindInfo;
-
- /* the drsuapi_DsBindInfoCtr was this before
- * typedef [flag(NDR_PAHEX)] struct {
- * [range(1,10000)] uint32 length;
- * [size_is(length)] uint8 data[];
- * } drsuapi_DsBindInfo;
- *
- * but we don't want the caller to manually decode this blob,
- * so we're doing it here
- */
-
- typedef struct {
- [range(1,10000)] uint32 length;
- [switch_is(length)] drsuapi_DsBindInfo info;
- } drsuapi_DsBindInfoCtr;
-
- /* this is a magic guid you need to pass to DsBind to make drsuapi_DsWriteAccountSpn() work
- *
- * maybe the bind_guid could also be the invocation_id see drsuapi_DsReplicaConnection04
- */
- const char *DRSUAPI_DS_BIND_GUID = "e24d201a-4fd6-11d1-a3da-0000f875ae0d";
- /*
- * this magic guid are needed to fetch the whole tree with drsuapi_DsGetNCChanges()
- * as administrator and this values are also used in the destination_dsa_guid field
- * of drsuapi_DsGetNCChangesReq5/8 and the source_dsa_guid is zero.
- */
- const char *DRSUAPI_DS_BIND_GUID_W2K = "6abec3d1-3054-41c8-a362-5a0c5b7d5d71";
- const char *DRSUAPI_DS_BIND_GUID_W2K3 = "6afab99c-6e26-464a-975f-f58f105218bc";
-
- [public] WERROR drsuapi_DsBind(
- [in,unique] GUID *bind_guid,
- [in,out,unique] drsuapi_DsBindInfoCtr *bind_info,
- [out] policy_handle *bind_handle
- );
-
- /*****************/
- /* Function 0x01 */
- WERROR drsuapi_DsUnbind(
- [in,out] policy_handle *bind_handle
- );
-
- /*****************/
- /* Function 0x02 */
- typedef [public,gensize] struct {
- [value(ndr_size_drsuapi_DsReplicaObjectIdentifier(r, ndr->flags)-4)] uint32 __ndr_size;
- [value(ndr_size_dom_sid28(&sid, ndr->flags))] uint32 __ndr_size_sid;
- GUID guid;
- dom_sid28 sid;
- [value(strlen_m(dn))] uint32 __ndr_size_dn;
- [charset(UTF16),size_is(__ndr_size_dn+1)] uint16 dn[];
- } drsuapi_DsReplicaObjectIdentifier;
-
- typedef [public] bitmap {
- DRSUAPI_DS_REPLICA_SYNC_ASYNCHRONOUS_OPERATION = 0x00000001,
- DRSUAPI_DS_REPLICA_SYNC_WRITEABLE = 0x00000002,
- DRSUAPI_DS_REPLICA_SYNC_PERIODIC = 0x00000004,
- DRSUAPI_DS_REPLICA_SYNC_INTERSITE_MESSAGING = 0x00000008,
- DRSUAPI_DS_REPLICA_SYNC_ALL_SOURCES = 0x00000010,
- DRSUAPI_DS_REPLICA_SYNC_FULL = 0x00000020,
- DRSUAPI_DS_REPLICA_SYNC_URGENT = 0x00000040,
- DRSUAPI_DS_REPLICA_SYNC_NO_DISCARD = 0x00000080,
- DRSUAPI_DS_REPLICA_SYNC_FORCE = 0x00000100,
- DRSUAPI_DS_REPLICA_SYNC_ADD_REFERENCE = 0x00000200,
- DRSUAPI_DS_REPLICA_SYNC_NEVER_COMPLETED = 0x00000400,
- DRSUAPI_DS_REPLICA_SYNC_TWO_WAY = 0x00000800,
- DRSUAPI_DS_REPLICA_SYNC_NEVER_NOTIFY = 0x00001000,
- DRSUAPI_DS_REPLICA_SYNC_INITIAL = 0x00002000,
- DRSUAPI_DS_REPLICA_SYNC_USE_COMPRESSION = 0x00004000,
- DRSUAPI_DS_REPLICA_SYNC_ABANDONED = 0x00008000,
- DRSUAPI_DS_REPLICA_SYNC_INITIAL_IN_PROGRESS = 0x00010000,
- DRSUAPI_DS_REPLICA_SYNC_PARTIAL_ATTRIBUTE_SET = 0x00020000,
- DRSUAPI_DS_REPLICA_SYNC_REQUEUE = 0x00040000,
- DRSUAPI_DS_REPLICA_SYNC_NOTIFICATION = 0x00080000,
- DRSUAPI_DS_REPLICA_SYNC_ASYNCHRONOUS_REPLICA = 0x00100000,
- DRSUAPI_DS_REPLICA_SYNC_CRITICAL = 0x00200000,
- DRSUAPI_DS_REPLICA_SYNC_FULL_IN_PROGRESS = 0x00400000,
- DRSUAPI_DS_REPLICA_SYNC_PREEMPTED = 0x00800000
- } drsuapi_DsReplicaSyncOptions;
-
- typedef struct {
- drsuapi_DsReplicaObjectIdentifier *naming_context;
- GUID source_dsa_guid;
- astring *other_info; /* I assume this is related to the repsFromTo1OtherInfo dns_name */
- drsuapi_DsReplicaSyncOptions options;
- } drsuapi_DsReplicaSyncRequest1;
-
- typedef [switch_type(int32)] union {
- [case(1)] drsuapi_DsReplicaSyncRequest1 req1;
- } drsuapi_DsReplicaSyncRequest;
-
- WERROR drsuapi_DsReplicaSync(
- [in] policy_handle *bind_handle,
- [in] int32 level,
- [in,switch_is(level)] drsuapi_DsReplicaSyncRequest req
- );
-
- /*****************/
- /* Function 0x03 */
- typedef [public] struct {
- hyper tmp_highest_usn; /* updated after each object update */
- hyper reserved_usn;
- hyper highest_usn; /* updated after a full replication cycle */
- } drsuapi_DsReplicaHighWaterMark;
-
- typedef [public] struct {
- GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
- hyper highest_usn; /* updated after a full replication cycle */
- } drsuapi_DsReplicaCursor;
-
- typedef struct {
- [value(1)] uint32 version;
- [value(0)] uint32 reserved1;
- [range(0,0x100000)] uint32 count;
- [value(0)] uint32 reserved2;
- [size_is(count)] drsuapi_DsReplicaCursor cursors[];
- } drsuapi_DsReplicaCursorCtrEx;
-
- typedef [public] bitmap {
- /* the _WRITEABLE flag indicates a replication with all attributes
- *
- * --metze
- */
- DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE = 0x00000010,
- DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP = 0x00000020,
- DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS = 0x00000040,
- DRSUAPI_DS_REPLICA_NEIGHBOUR_USE_ASYNC_INTERSIDE_TRANSPORT = 0x00000080,
- DRSUAPI_DS_REPLICA_NEIGHBOUR_TWO_WAY_SYNC = 0x00000200,
- DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS = 0x00000800,
- DRSUAPI_DS_REPLICA_NEIGHBOUR_FULL_IN_PROGRESS = 0x00001000, /* was 0x00010000, */
- DRSUAPI_DS_REPLICA_NEIGHBOUR_FULL_NEXT_PACKET = 0x00002000, /* was 0x00020000, */
- DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED = 0x00200000,
- DRSUAPI_DS_REPLICA_NEIGHBOUR_PREEMPTED = 0x01000000,
- DRSUAPI_DS_REPLICA_NEIGHBOUR_IGNORE_CHANGE_NOTIFICATIONS = 0x04000000,
- DRSUAPI_DS_REPLICA_NEIGHBOUR_DISABLE_SCHEDULED_SYNC = 0x08000000,
- /*
- * the following NOTE applies to DsGetNCChangesRequest5:
- * - the data is only compressed when 10 or more objects are replicated
- * - but there could also be a size limit of 35 KBytes or something like that
- * - the reply is DsGetNCChangesCtr2
- * - maybe the same applies to DsGetNCChangesRequest8...
- *
- * --metze
- */
- DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES = 0x10000000,
- DRSUAPI_DS_REPLICA_NEIGHBOUR_NO_CHANGE_NOTIFICATIONS = 0x20000000,
- DRSUAPI_DS_REPLICA_NEIGHBOUR_PARTIAL_ATTRIBUTE_SET = 0x40000000
- } drsuapi_DsReplicaNeighbourFlags;
-
- typedef [flag(NDR_PAHEX),v1_enum] enum {
- DRSUAPI_EXOP_NONE = 0x00000000,
- DRSUAPI_EXOP_FSMO_REQ_ROLE = 0x00000001,
- DRSUAPI_EXOP_FSMO_RID_ALLOC = 0x00000002,
- DRSUAPI_EXOP_FSMO_RID_REQ_ROLE = 0x00000003,
- DRSUAPI_EXOP_FSMO_REQ_PDC = 0x00000004,
- DRSUAPI_EXOP_FSMO_ABANDON_ROLE = 0x00000005,
- DRSUAPI_EXOP_REPL_OBJ = 0x00000006,
- DRSUAPI_EXOP_REPL_SECRET = 0x00000007
- } drsuapi_DsExtendedOperation;
-
- typedef [flag(NDR_PAHEX),v1_enum] enum {
- DRSUAPI_EXOP_ERR_NONE = 0x00000000,
- DRSUAPI_EXOP_ERR_SUCCESS = 0x00000001,
- DRSUAPI_EXOP_ERR_UNKNOWN_OP = 0x00000002,
- DRSUAPI_EXOP_ERR_FSMO_NOT_OWNER = 0x00000003,
- DRSUAPI_EXOP_ERR_UPDATE_ERR = 0x00000004,
- DRSUAPI_EXOP_ERR_EXCEPTION = 0x00000005,
- DRSUAPI_EXOP_ERR_UNKNOWN_CALLER = 0x00000006,
- DRSUAPI_EXOP_ERR_RID_ALLOC = 0x00000007,
- DRSUAPI_EXOP_ERR_FSMO_OWNER_DELETED = 0x00000008,
- DRSUAPI_EXOP_ERR_FMSO_PENDING_OP = 0x00000009,
- DRSUAPI_EXOP_ERR_MISMATCH = 0x0000000A,
- DRSUAPI_EXOP_ERR_COULDNT_CONTACT = 0x0000000B,
- DRSUAPI_EXOP_ERR_FSMO_REFUSING_ROLES = 0x0000000C,
- DRSUAPI_EXOP_ERR_DIR_ERROR = 0x0000000D,
- DRSUAPI_EXOP_ERR_FSMO_MISSING_SETTINGS = 0x0000000E,
- DRSUAPI_EXOP_ERR_ACCESS_DENIED = 0x0000000F,
- DRSUAPI_EXOP_ERR_PARAM_ERROR = 0x00000010
- } drsuapi_DsExtendedError;
-
- typedef struct {
- GUID destination_dsa_guid;
- GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
- [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
- drsuapi_DsReplicaHighWaterMark highwatermark;
- drsuapi_DsReplicaCursorCtrEx *uptodateness_vector;
- drsuapi_DsReplicaNeighbourFlags replica_flags;
- uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */
- uint32 max_ndr_size; /* w2k3 seems to ignore this */
- drsuapi_DsExtendedOperation extended_op;
- hyper fsmo_info;
- } drsuapi_DsGetNCChangesRequest5;
-
- /*
- * In DRSUAPI all attributes with syntax 2.5.5.2
- * are identified by uint32 values
- *
- * the following table shows the mapping used between the two representations
- * e.g. - objectClass 'nTDSDSA' has governsID: 1.2.840.113556.1.5.7000.47
- * and a UINT32-ID of '0x0017002F'.
- * - so the OID 1.2.840.113556.1.5.7000.47 is splitted into a
- * OID-prefix: 1.2.840.113556.1.5.7000
- * and a value: 47 => 0x2F
- * - the mapping table gives a UINT32-prefix: 0x00170000
- * - and the UINT32-ID is 0x0017002F = 0x00170000 | 0x2F
- *
- * This prefix mapping table is replied in the drsuapi_DsReplicaOIDMapping_Ctr
- * array. The following are the default mappings of w2k3
- *
- * OID-prefix => UINT32-Id prefix
- *
- * 2.5.4.* => 0x00000000 (standard attributes RFC2256 core.schema)
- * 2.5.6.* => 0x00010000 (standard object classes RFC2256 core.schema)
- * 1.2.840.113556.1.2.* => 0x00020000
- * 1.2.840.113556.1.3.* => 0x00030000
- * 2.5.5.* => 0x00080000 (attributeSyntax OID's)
- * 1.2.840.113556.1.4.* => 0x00090000
- * 1.2.840.113556.1.5.* => 0x000A0000
- * 2.16.840.1.113730.3.* => 0x00140000
- * 0.9.2342.19200300.100.1.* => 0x00150000
- * 2.16.840.1.113730.3.1.* => 0x00160000
- * 1.2.840.113556.1.5.7000.* => 0x00170000
- * 2.5.21.* => 0x00180000 (attrs for SubSchema)
- * 2.5.18.* => 0x00190000 (createTimeStamp,modifyTimeStamp, SubSchema)
- * 2.5.20.* => 0x001A0000
- * 1.3.6.1.4.1.1466.101.119.* => 0x001B0000 (dynamicObject, entryTTL)
- * 2.16.840.1.113730.3.2.* => 0x001C0000
- * 1.3.6.1.4.1.250.1.* => 0x001D0000
- * 1.2.840.113549.1.9.* => 0x001E0000 (unstructuredAddress,unstructuredName)
- * 0.9.2342.19200300.100.4.* => 0x001F0000
- *
- * Here's a list of used 'attributeSyntax' OID's
- *
- * 2.5.5.1 => Object(DS-DN) string
- * struct drsuapi_DsObjectIdentifier3
- *
- * 2.5.5.2 => OID-string
- * => all values are represented as uint32 values in drsuapi
- * => governsID, attributeID and attributeSyntax returned as OID-Strings in LDAP
- * => mayContain, mustContain and all other attributes with 2.5.5.2 syntax
- * are returned as attribute names
- *
- * 2.5.5.4 => String(Teletex) case-insensitive string with teletex charset
- *
- * 2.5.5.5 => String(IA5) case-sensitive string
- *
- * 2.5.5.6 => String(Numeric)
- * => eg. internationalISDNNumber
- *
- * 2.5.5.7 => Object(DN-Binary) B:<byte count>:<bytes>:<object DN>
- * => e.g. wellKnownObjects
- *
- * 2.5.5.8 => BOOL
- *
- * 2.5.5.9 => int32
- *
- * 2.5.5.10 => DATA_BLOB
- * => struct GUID
- *
- * 2.5.5.11 => LDAP timestring
- * => NTTIME_1sec
- *
- * 2.5.5.12 => String(Unicode) case-insensitive string
- * => 'standard strings'
- *
- * 2.5.5.13 => Object(Presentation-Address) string
- * => used in objectClass applicationEntity
- *
- * 2.5.5.14 => Object(DN-String) S:<char count>:<string>:<object DN>
- * => not used
- *
- * 2.5.5.15 => ntSecurityDescriptor
- *
- * 2.5.5.16 => int64
- *
- * 2.5.5.17 => dom_sid
- */
- typedef [nopush,nopull] struct {
- [range(0,10000),value(ndr_size_drsuapi_DsReplicaOID_oid(oid, 0))] uint32 __ndr_size;
- [size_is(__ndr_size),charset(DOS)] uint8 *oid; /* it's encoded with asn1_write_OID_String() */
- } drsuapi_DsReplicaOID;
-
- typedef struct {
- uint32 id_prefix;
- drsuapi_DsReplicaOID oid;
- } drsuapi_DsReplicaOIDMapping;
-
- typedef [public] struct {
- [range(0,0x100000)] uint32 num_mappings;
- [size_is(num_mappings)] drsuapi_DsReplicaOIDMapping *mappings;
- } drsuapi_DsReplicaOIDMapping_Ctr;
-
- typedef [flag(NDR_PAHEX),v1_enum] enum {
- DRSUAPI_OBJECTCLASS_top = 0x00010000,
- DRSUAPI_OBJECTCLASS_classSchema = 0x0003000d,
- DRSUAPI_OBJECTCLASS_attributeSchema = 0x0003000e
- } drsuapi_DsObjectClassId;
-
- typedef [flag(NDR_PAHEX),v1_enum,public] enum {
- DRSUAPI_ATTRIBUTE_objectClass = 0x00000000,
- DRSUAPI_ATTRIBUTE_description = 0x0000000d,
- DRSUAPI_ATTRIBUTE_member = 0x0000001f,
- DRSUAPI_ATTRIBUTE_instanceType = 0x00020001,
- DRSUAPI_ATTRIBUTE_whenCreated = 0x00020002,
- DRSUAPI_ATTRIBUTE_hasMasterNCs = 0x0002000e,
- DRSUAPI_ATTRIBUTE_governsID = 0x00020016,
- DRSUAPI_ATTRIBUTE_attributeID = 0x0002001e,
- DRSUAPI_ATTRIBUTE_attributeSyntax = 0x00020020,
- DRSUAPI_ATTRIBUTE_isSingleValued = 0x00020021,
- DRSUAPI_ATTRIBUTE_rangeLower = 0x00020022,
- DRSUAPI_ATTRIBUTE_rangeUpper = 0x00020023,
- DRSUAPI_ATTRIBUTE_dMDLocation = 0x00020024,
- DRSUAPI_ATTRIBUTE_objectVersion = 0x0002004c,
- DRSUAPI_ATTRIBUTE_invocationId = 0x00020073,
- DRSUAPI_ATTRIBUTE_showInAdvancedViewOnly = 0x000200a9,
- DRSUAPI_ATTRIBUTE_adminDisplayName = 0x000200c2,
- DRSUAPI_ATTRIBUTE_adminDescription = 0x000200e2,
- DRSUAPI_ATTRIBUTE_oMSyntax = 0x000200e7,
- DRSUAPI_ATTRIBUTE_ntSecurityDescriptor = 0x00020119,
- DRSUAPI_ATTRIBUTE_searchFlags = 0x0002014e,
- DRSUAPI_ATTRIBUTE_lDAPDisplayName = 0x000201cc,
- DRSUAPI_ATTRIBUTE_name = 0x00090001,
- DRSUAPI_ATTRIBUTE_userAccountControl = 0x00090008,
- DRSUAPI_ATTRIBUTE_currentValue = 0x0009001b,
- DRSUAPI_ATTRIBUTE_homeDirectory = 0x0009002c,
- DRSUAPI_ATTRIBUTE_homeDrive = 0x0009002d,
- DRSUAPI_ATTRIBUTE_scriptPath = 0x0009003e,
- DRSUAPI_ATTRIBUTE_profilePath = 0x0009008b,
- DRSUAPI_ATTRIBUTE_objectSid = 0x00090092,
- DRSUAPI_ATTRIBUTE_schemaIDGUID = 0x00090094,
- DRSUAPI_ATTRIBUTE_dBCSPwd = 0x00090037,/* lmPwdHash */
- DRSUAPI_ATTRIBUTE_logonHours = 0x00090040,
- DRSUAPI_ATTRIBUTE_userWorkstations = 0x00090056,
- DRSUAPI_ATTRIBUTE_unicodePwd = 0x0009005a,/* ntPwdHash */
- DRSUAPI_ATTRIBUTE_ntPwdHistory = 0x0009005e,
- DRSUAPI_ATTRIBUTE_priorValue = 0x00090064,
- DRSUAPI_ATTRIBUTE_supplementalCredentials = 0x0009007d,
- DRSUAPI_ATTRIBUTE_trustAuthIncoming = 0x00090081,
- DRSUAPI_ATTRIBUTE_trustAuthOutgoing = 0x00090087,
- DRSUAPI_ATTRIBUTE_lmPwdHistory = 0x000900a0,
- DRSUAPI_ATTRIBUTE_sAMAccountName = 0x000900dd,
- DRSUAPI_ATTRIBUTE_sAMAccountType = 0x0009012e,
- DRSUAPI_ATTRIBUTE_fSMORoleOwner = 0x00090171,
- DRSUAPI_ATTRIBUTE_systemFlags = 0x00090177,
- DRSUAPI_ATTRIBUTE_serverReference = 0x00090203,
- DRSUAPI_ATTRIBUTE_serverReferenceBL = 0x00090204,
- DRSUAPI_ATTRIBUTE_initialAuthIncoming = 0x0009021b,
- DRSUAPI_ATTRIBUTE_initialAuthOutgoing = 0x0009021c,
- DRSUAPI_ATTRIBUTE_wellKnownObjects = 0x0009026a,
- DRSUAPI_ATTRIBUTE_dNSHostName = 0x0009026b,
- DRSUAPI_ATTRIBUTE_isMemberOfPartialAttributeSet = 0x0009027f,
- DRSUAPI_ATTRIBUTE_userPrincipalName = 0x00090290,
- DRSUAPI_ATTRIBUTE_groupType = 0x000902ee,
- DRSUAPI_ATTRIBUTE_servicePrincipalName = 0x00090303,
- DRSUAPI_ATTRIBUTE_objectCategory = 0x0009030e,
- DRSUAPI_ATTRIBUTE_gPLink = 0x0009037b,
- DRSUAPI_ATTRIBUTE_msDS_Behavior_Version = 0x000905b3,
- DRSUAPI_ATTRIBUTE_msDS_KeyVersionNumber = 0x000906f6,
- DRSUAPI_ATTRIBUTE_msDS_HasDomainNCs = 0x0009071c,
- DRSUAPI_ATTRIBUTE_msDS_hasMasterNCs = 0x0009072c
- } drsuapi_DsAttributeId;
-
- typedef struct {
- [value(1)] uint32 version;
- [value(0)] uint32 reserved1;
- [range(1,0x100000)] uint32 num_attids;
- [size_is(num_attids)] drsuapi_DsAttributeId attids[];
- } drsuapi_DsPartialAttributeSet;
-
- typedef struct {
- GUID destination_dsa_guid;
- GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
- [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
- drsuapi_DsReplicaHighWaterMark highwatermark;
- drsuapi_DsReplicaCursorCtrEx *uptodateness_vector;
- drsuapi_DsReplicaNeighbourFlags replica_flags;
- uint32 max_object_count; /* w2k3 uses min(133,max(100,max_object_count)) */
- uint32 max_ndr_size; /* w2k3 seems to ignore this */
- drsuapi_DsExtendedOperation extended_op;
- hyper fsmo_info;
- drsuapi_DsPartialAttributeSet *partial_attribute_set;
- drsuapi_DsPartialAttributeSet *partial_attribute_set_ex;
- drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr;
- } drsuapi_DsGetNCChangesRequest8;
-
- typedef [switch_type(int32)] union {
- [case(5)] drsuapi_DsGetNCChangesRequest5 req5;
- [case(8)] drsuapi_DsGetNCChangesRequest8 req8;
- } drsuapi_DsGetNCChangesRequest;
-
- typedef [public] struct {
- GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
- hyper highest_usn; /* updated after a full replication cycle */
- NTTIME last_sync_success;
- } drsuapi_DsReplicaCursor2;
-
- typedef struct {
- [value(2)] uint32 version;
- [value(0)] uint32 reserved1;
- [range(0,0x100000)] uint32 count;
- [value(0)] uint32 reserved2;
- [size_is(count)] drsuapi_DsReplicaCursor2 cursors[];
- } drsuapi_DsReplicaCursor2CtrEx;
-
- /* Generic DATA_BLOB values */
- typedef struct {
- [range(0,10485760),value(ndr_size_DATA_BLOB(0,blob,0))] uint32 __ndr_size;
- DATA_BLOB *blob;
- } drsuapi_DsAttributeValue;
-
- typedef struct {
- [range(0,10485760)] uint32 num_values;
- [size_is(num_values)] drsuapi_DsAttributeValue *values;
- } drsuapi_DsAttributeValueCtr;
-
- /* DN String values */
- typedef [public,gensize] struct {
- [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3(r, ndr->flags))] uint32 __ndr_size;
- [value(ndr_size_dom_sid28(&sid,ndr->flags))] uint32 __ndr_size_sid;
- GUID guid;
- dom_sid28 sid;
- [value(strlen_m(dn))] uint32 __ndr_size_dn;
- [charset(UTF16)] uint16 dn[__ndr_size_dn+1];
- } drsuapi_DsReplicaObjectIdentifier3;
-
- typedef [public,gensize] struct {
- [value(ndr_size_drsuapi_DsReplicaObjectIdentifier3Binary(r, ndr->flags))] uint32 __ndr_size;
- [value(ndr_size_dom_sid28(&sid,ndr->flags))] uint32 __ndr_size_sid;
- GUID guid;
- dom_sid28 sid;
- [value(strlen_m(dn))] uint32 __ndr_size_dn;
- [charset(UTF16)] uint16 dn[__ndr_size_dn+1];
- [value(binary.length + 4)] uint32 __ndr_size_binary;
- [flag(NDR_REMAINING)] DATA_BLOB binary;
- } drsuapi_DsReplicaObjectIdentifier3Binary;
-
- typedef [public] struct {
- drsuapi_DsAttributeId attid;
- drsuapi_DsAttributeValueCtr value_ctr;
- } drsuapi_DsReplicaAttribute;
-
- typedef struct {
- [range(0,1048576)] uint32 num_attributes;
- [size_is(num_attributes)] drsuapi_DsReplicaAttribute *attributes;
- } drsuapi_DsReplicaAttributeCtr;
-
- typedef [public] bitmap {
- DRSUAPI_DS_REPLICA_OBJECT_FROM_MASTER = 0x00000001,
- DRSUAPI_DS_REPLICA_OBJECT_DYNAMIC = 0x00000002,
- DRSUAPI_DS_REPLICA_OBJECT_REMOTE_MODIFY = 0x00010000
- } drsuapi_DsReplicaObjectFlags;
-
- typedef [public] struct {
- drsuapi_DsReplicaObjectIdentifier *identifier;
- drsuapi_DsReplicaObjectFlags flags;
- drsuapi_DsReplicaAttributeCtr attribute_ctr;
- } drsuapi_DsReplicaObject;
-
- typedef struct {
- uint32 version;
- NTTIME_1sec originating_change_time;
- GUID originating_invocation_id;
- hyper originating_usn;
- } drsuapi_DsReplicaMetaData;
-
- typedef [public] struct {
- [range(0,1048576)] uint32 count;
- [size_is(count)] drsuapi_DsReplicaMetaData meta_data[];
- } drsuapi_DsReplicaMetaDataCtr;
-
- typedef [public,noprint] struct {
- drsuapi_DsReplicaObjectListItemEx *next_object;
- drsuapi_DsReplicaObject object;
- boolean32 is_nc_prefix;
- GUID *parent_object_guid;
- drsuapi_DsReplicaMetaDataCtr *meta_data_ctr;
- } drsuapi_DsReplicaObjectListItemEx;
-
- typedef [public,gensize] struct {
- GUID source_dsa_guid; /* the 'objectGUID' field of the CN=NTDS Settings object */
- GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
- drsuapi_DsReplicaObjectIdentifier *naming_context;
- drsuapi_DsReplicaHighWaterMark old_highwatermark;
- drsuapi_DsReplicaHighWaterMark new_highwatermark;
- drsuapi_DsReplicaCursorCtrEx *uptodateness_vector;
- drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr;
- drsuapi_DsExtendedError extended_ret; /* w2k sends the nc_object_count value here */
- uint32 object_count;
- /* this +55 is sometimes +56, so I don't know where this comes from... --metze */
- [value(ndr_size_drsuapi_DsGetNCChangesCtr1(r,ndr->flags)+55)] uint32 __ndr_size;
- drsuapi_DsReplicaObjectListItemEx *first_object;
- boolean32 more_data;
- } drsuapi_DsGetNCChangesCtr1;
-
- /*
- * if the DRSUAPI_DS_LINKED_ATTRIBUTE_FLAG_ACTIVE flag
- * isn't there it means the value is deleted
- */
- typedef [public] bitmap {
- DRSUAPI_DS_LINKED_ATTRIBUTE_FLAG_ACTIVE = 0x00000001
- } drsuapi_DsLinkedAttributeFlags;
-
- typedef [public] struct {
- drsuapi_DsReplicaObjectIdentifier *identifier;
- drsuapi_DsAttributeId attid;
- drsuapi_DsAttributeValue value;
- drsuapi_DsLinkedAttributeFlags flags;
- NTTIME_1sec originating_add_time;
- drsuapi_DsReplicaMetaData meta_data;
- } drsuapi_DsReplicaLinkedAttribute;
-
- typedef [public,gensize] struct {
- GUID source_dsa_guid; /* the 'objectGUID' field of the CN=NTDS Settings object */
- GUID source_dsa_invocation_id; /* the 'invocationId' field of the CN=NTDS Settings object */
- drsuapi_DsReplicaObjectIdentifier *naming_context;
- drsuapi_DsReplicaHighWaterMark old_highwatermark;
- drsuapi_DsReplicaHighWaterMark new_highwatermark;
- drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector;
- drsuapi_DsReplicaOIDMapping_Ctr mapping_ctr;
- drsuapi_DsExtendedError extended_ret;
- uint32 object_count;
- /* this +55 is sometimes +56, so I don't know where this comes from... --metze */
- [value(ndr_size_drsuapi_DsGetNCChangesCtr6(r,ndr->flags)+55)] uint32 __ndr_size;
- drsuapi_DsReplicaObjectListItemEx *first_object;
- boolean32 more_data;
- uint32 nc_object_count; /* estimated amount of objects in the whole NC */
- uint32 nc_linked_attributes_count; /* estimated amount of linked values in the whole NC */
- [range(0,1048576)] uint32 linked_attributes_count;
- [size_is(linked_attributes_count)] drsuapi_DsReplicaLinkedAttribute *linked_attributes;
- WERROR drs_error;
- } drsuapi_DsGetNCChangesCtr6;
-
- typedef struct {
- uint32 decompressed_length;
- uint32 compressed_length;
- [subcontext(4),subcontext_size(compressed_length),
- compression(NDR_COMPRESSION_MSZIP,compressed_length,decompressed_length)]
- drsuapi_DsGetNCChangesCtr1 *ctr1;
- } drsuapi_DsGetNCChangesMSZIPCtr1;
-
- typedef struct {
- uint32 decompressed_length;
- uint32 compressed_length;
- [subcontext(4),subcontext_size(compressed_length),
- compression(NDR_COMPRESSION_MSZIP,compressed_length,decompressed_length)]
- drsuapi_DsGetNCChangesCtr6 *ctr6;
- } drsuapi_DsGetNCChangesMSZIPCtr6;
-
- typedef struct {
- uint32 decompressed_length;
- uint32 compressed_length;
- [subcontext(4),subcontext_size(compressed_length),
- compression(NDR_COMPRESSION_XPRESS,compressed_length,decompressed_length)]
- drsuapi_DsGetNCChangesCtr1 *ctr1;
- } drsuapi_DsGetNCChangesXPRESSCtr1;
-
- typedef struct {
- uint32 decompressed_length;
- uint32 compressed_length;
- [subcontext(4),subcontext_size(compressed_length),
- compression(NDR_COMPRESSION_XPRESS,compressed_length,decompressed_length)]
- drsuapi_DsGetNCChangesCtr6 *ctr6;
- } drsuapi_DsGetNCChangesXPRESSCtr6;
-
- typedef [enum16bit] enum {
- DRSUAPI_COMPRESSION_TYPE_MSZIP = 2,
- DRSUAPI_COMPRESSION_TYPE_XPRESS = 3
- } drsuapi_DsGetNCChangesCompressionType;
-
- typedef [nodiscriminant,flag(NDR_PAHEX)] union {
- [case(1|(DRSUAPI_COMPRESSION_TYPE_MSZIP<<16))] drsuapi_DsGetNCChangesMSZIPCtr1 mszip1;
- [case(6|(DRSUAPI_COMPRESSION_TYPE_MSZIP<<16))] drsuapi_DsGetNCChangesMSZIPCtr6 mszip6;
- [case(1|(DRSUAPI_COMPRESSION_TYPE_XPRESS<<16))] drsuapi_DsGetNCChangesXPRESSCtr1 xpress1;
- [case(6|(DRSUAPI_COMPRESSION_TYPE_XPRESS<<16))] drsuapi_DsGetNCChangesXPRESSCtr6 xpress6;
- } drsuapi_DsGetNCChangesCompressedCtr;
-
- typedef struct {
- /*
- * this is a bit ugly, as the compression depends on the flags
- * in the DsBind(), but only w2k uses DsGetNCChangesReq5
- * and will get DsGetNCChangesCtr2 replies, and w2k only knowns
- * about MSZIP and level 1 replies
- */
- [switch_is(1|(DRSUAPI_COMPRESSION_TYPE_MSZIP<<16))] drsuapi_DsGetNCChangesCompressedCtr ctr;
- } drsuapi_DsGetNCChangesCtr2;
-
- typedef struct {
- [range(0,6)] int32 level;
- [range(2,3)] drsuapi_DsGetNCChangesCompressionType type;
- [switch_is(level | (type<<16))] drsuapi_DsGetNCChangesCompressedCtr ctr;
- } drsuapi_DsGetNCChangesCtr7;
-
- typedef [switch_type(int32)] union {
- [case(1)] drsuapi_DsGetNCChangesCtr1 ctr1;
- [case(2)] drsuapi_DsGetNCChangesCtr2 ctr2;
- [case(6)] drsuapi_DsGetNCChangesCtr6 ctr6;
- [case(7)] drsuapi_DsGetNCChangesCtr7 ctr7;
- } drsuapi_DsGetNCChangesCtr;
-
- WERROR drsuapi_DsGetNCChanges(
- [in] policy_handle *bind_handle,
- [in] int32 level,
- [in,ref,switch_is(level)] drsuapi_DsGetNCChangesRequest *req,
- [out,ref] int32 *level_out,
- [out,ref,switch_is(*level_out)] drsuapi_DsGetNCChangesCtr *ctr
- );
-
- /*****************/
- /* Function 0x04 */
- typedef bitmap {
- DRSUAPI_DS_REPLICA_UPDATE_ASYNCHRONOUS_OPERATION = 0x00000001,
- DRSUAPI_DS_REPLICA_UPDATE_WRITEABLE = 0x00000002,
- DRSUAPI_DS_REPLICA_UPDATE_ADD_REFERENCE = 0x00000004,
- DRSUAPI_DS_REPLICA_UPDATE_DELETE_REFERENCE = 0x00000008,
- DRSUAPI_DS_REPLICA_UPDATE_0x00000010 = 0x00000010
- } drsuapi_DsReplicaUpdateRefsOptions;
-
- typedef struct {
- [ref] drsuapi_DsReplicaObjectIdentifier *naming_context;
- [ref,charset(DOS),string] uint8 *dest_dsa_dns_name;
- GUID dest_dsa_guid;
- drsuapi_DsReplicaUpdateRefsOptions options;
- } drsuapi_DsReplicaUpdateRefsRequest1;
-
- typedef [switch_type(int32)] union {
- [case(1)] drsuapi_DsReplicaUpdateRefsRequest1 req1;
- } drsuapi_DsReplicaUpdateRefsRequest;
-
- WERROR drsuapi_DsReplicaUpdateRefs(
- [in] policy_handle *bind_handle,
- [in] int32 level,
- [in,switch_is(level)] drsuapi_DsReplicaUpdateRefsRequest req
- );
-
- /*****************/
- /* Function 0x05 */
- typedef bitmap {
- DRSUAPI_DS_REPLICA_ADD_ASYNCHRONOUS_OPERATION = 0x00000001,
- DRSUAPI_DS_REPLICA_ADD_WRITEABLE = 0x00000002
- /* TODO ... */
- } drsuapi_DsReplicaAddOptions;
-
- WERROR DRSUAPI_REPLICA_ADD();
-
- /*****************/
- /* Function 0x06 */
- typedef bitmap {
- DRSUAPI_DS_REPLICA_DELETE_ASYNCHRONOUS_OPERATION = 0x00000001,
- DRSUAPI_DS_REPLICA_DELETE_WRITEABLE = 0x00000002
- /* TODO ... */
- } drsuapi_DsReplicaDeleteOptions;
-
- WERROR DRSUAPI_REPLICA_DEL();
-
- /*****************/
- /* Function 0x07 */
- typedef bitmap {
- DRSUAPI_DS_REPLICA_MODIFY_ASYNCHRONOUS_OPERATION = 0x00000001,
- DRSUAPI_DS_REPLICA_MODIFY_WRITEABLE = 0x00000002
- } drsuapi_DsReplicaModifyOptions;
-
- WERROR DRSUAPI_REPLICA_MODIFY();
-
- /*****************/
- /* Function 0x08 */
- WERROR DRSUAPI_VERIFY_NAMES();
-
- /*****************/
- /* Function 0x09 */
-
- /* how are type 4 and 7 different from 2 and 3 ? */
- typedef [v1_enum] enum {
- DRSUAPI_DS_MEMBERSHIP_TYPE_UNIVERSAL_AND_DOMAIN_GROUPS = 1,
- DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_LOCAL_GROUPS = 2,
- DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_GROUPS = 3,
- DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_LOCAL_GROUPS2 = 4,
- DRSUAPI_DS_MEMBERSHIP_TYPE_UNIVERSAL_GROUPS = 5,
- DRSUAPI_DS_MEMBERSHIP_TYPE_GROUPMEMBERS = 6,
- DRSUAPI_DS_MEMBERSHIP_TYPE_DOMAIN_GROUPS2 = 7
- } drsuapi_DsMembershipType;
-
- typedef struct {
- NTSTATUS status;
- [range(0,10000)] uint32 num_memberships;
- [range(0,10000)] uint32 num_sids;
- [size_is(num_memberships)] drsuapi_DsReplicaObjectIdentifier **info_array;
- [size_is(num_memberships)] samr_GroupAttrs *group_attrs;
- [size_is(num_sids)] dom_sid28 **sids;
- } drsuapi_DsGetMembershipsCtr1;
-
- typedef [switch_type(int32)] union {
- [case(1)] drsuapi_DsGetMembershipsCtr1 ctr1;
- } drsuapi_DsGetMembershipsCtr;
-
- const int DRSUAPI_DS_MEMBERSHIP_FLAG_GROUP_ATTR = 0x1;
-
- typedef struct {
- [range(1,10000)] uint32 count;
- [size_is(count)] drsuapi_DsReplicaObjectIdentifier **info_array;
- uint32 flags;
- drsuapi_DsMembershipType type;
- drsuapi_DsReplicaObjectIdentifier *domain;
- } drsuapi_DsGetMembershipsRequest1;
-
- typedef [switch_type(int32)] union {
- [case(1)] drsuapi_DsGetMembershipsRequest1 req1;
- } drsuapi_DsGetMembershipsRequest;
-
- WERROR drsuapi_DsGetMemberships(
- [in] policy_handle *bind_handle,
- [in] int32 level,
- [in,ref] [switch_is(level)] drsuapi_DsGetMembershipsRequest *req,
- [out,ref] int32 *level_out,
- [out,ref] [switch_is(*level_out)] drsuapi_DsGetMembershipsCtr *ctr
- );
-
- /*****************/
- /* Function 0x0a */
- WERROR DRSUAPI_INTER_DOMAIN_MOVE();
-
- /*****************/
- /* Function 0x0b */
- typedef struct {
- uint32 unknown1;
- uint32 unknown2;
- [range(0,0x00A00000)] uint32 length;
- [size_is(length)] uint8 *data;
- } drsuapi_DsGetNT4ChangeLogRequest1;
-
- typedef [switch_type(uint32)] union {
- [case(1)] drsuapi_DsGetNT4ChangeLogRequest1 req1;
- } drsuapi_DsGetNT4ChangeLogRequest;
-
- typedef struct {
- [range(0,0x00A00000)] uint32 length1;
- [range(0,0x00A00000)] uint32 length2;
- hyper unknown1;
- NTTIME time2;
- hyper unknown3;
- NTTIME time4;
- hyper unknown5;
- NTTIME time6;
- NTSTATUS status;
- [size_is(length1)] uint8 *data1;
- [size_is(length2)] uint8 *data2;
- } drsuapi_DsGetNT4ChangeLogInfo1;
-
- typedef [switch_type(uint32)] union {
- [case(1)] drsuapi_DsGetNT4ChangeLogInfo1 info1;
- } drsuapi_DsGetNT4ChangeLogInfo;
-
- WERROR drsuapi_DsGetNT4ChangeLog(
- [in] policy_handle *bind_handle,
- [in] uint32 level,
- [in,ref] [switch_is(level)] drsuapi_DsGetNT4ChangeLogRequest *req,
- [out,ref] uint32 *level_out,
- [out,ref] [switch_is(*level_out)] drsuapi_DsGetNT4ChangeLogInfo *info
- );
-
- /*****************/
- /* Function 0x0c */
- typedef [v1_enum] enum {
- DRSUAPI_DS_NAME_STATUS_OK = 0,
- DRSUAPI_DS_NAME_STATUS_RESOLVE_ERROR = 1,
- DRSUAPI_DS_NAME_STATUS_NOT_FOUND = 2,
- DRSUAPI_DS_NAME_STATUS_NOT_UNIQUE = 3,
- DRSUAPI_DS_NAME_STATUS_NO_MAPPING = 4,
- DRSUAPI_DS_NAME_STATUS_DOMAIN_ONLY = 5,
- DRSUAPI_DS_NAME_STATUS_NO_SYNTACTICAL_MAPPING = 6,
- DRSUAPI_DS_NAME_STATUS_TRUST_REFERRAL = 7
- } drsuapi_DsNameStatus;
-
- typedef [v1_enum] enum {
- DRSUAPI_DS_NAME_FLAG_NO_FLAGS = 0x0,
- DRSUAPI_DS_NAME_FLAG_SYNTACTICAL_ONLY = 0x1,
- DRSUAPI_DS_NAME_FLAG_EVAL_AT_DC = 0x2,
- DRSUAPI_DS_NAME_FLAG_GCVERIFY = 0x4,
- DRSUAPI_DS_NAME_FLAG_TRUST_REFERRAL = 0x8
- } drsuapi_DsNameFlags;
-
- typedef [v1_enum] enum {
- DRSUAPI_DS_NAME_FORMAT_UKNOWN = 0,
- DRSUAPI_DS_NAME_FORMAT_FQDN_1779 = 1,
- DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT = 2,
- DRSUAPI_DS_NAME_FORMAT_DISPLAY = 3,
- DRSUAPI_DS_NAME_FORMAT_GUID = 6,
- DRSUAPI_DS_NAME_FORMAT_CANONICAL = 7,
- DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL = 8,
- DRSUAPI_DS_NAME_FORMAT_CANONICAL_EX = 9,
- DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL = 10,
- DRSUAPI_DS_NAME_FORMAT_SID_OR_SID_HISTORY = 11,
- DRSUAPI_DS_NAME_FORMAT_DNS_DOMAIN = 12
- } drsuapi_DsNameFormat;
-
- typedef struct {
- [string,charset(UTF16)] uint16 *str;
- } drsuapi_DsNameString;
-
- typedef struct {
- uint32 codepage; /* 0x000004e4 - 1252 is german codepage*/
- uint32 language; /* 0x00000407 - german language ID*/
- drsuapi_DsNameFlags format_flags;
- drsuapi_DsNameFormat format_offered;
- drsuapi_DsNameFormat format_desired;
- [range(1,10000)] uint32 count;
- [size_is(count)] drsuapi_DsNameString *names;
- } drsuapi_DsNameRequest1;
-
- typedef [switch_type(int32)] union {
- [case(1)] drsuapi_DsNameRequest1 req1;
- } drsuapi_DsNameRequest;
-
- typedef struct {
- drsuapi_DsNameStatus status;
- [charset(UTF16),string] uint16 *dns_domain_name;
- [charset(UTF16),string] uint16 *result_name;
- } drsuapi_DsNameInfo1;
-
- typedef struct {
- uint32 count;
- [size_is(count)] drsuapi_DsNameInfo1 *array;
- } drsuapi_DsNameCtr1;
-
- typedef [switch_type(int32)] union {
- [case(1)] drsuapi_DsNameCtr1 *ctr1;
- } drsuapi_DsNameCtr;
-
- WERROR drsuapi_DsCrackNames(
- [in] policy_handle *bind_handle,
- [in] int32 level,
- [in,ref,switch_is(level)] drsuapi_DsNameRequest *req,
- [out,ref] int32 *level_out,
- [out,ref,switch_is(*level_out)] drsuapi_DsNameCtr *ctr
- );
-
- /*****************/
- /* Function 0x0d */
- typedef [v1_enum] enum {
- DRSUAPI_DS_SPN_OPERATION_ADD = 0,
- DRSUAPI_DS_SPN_OPERATION_REPLACE= 1,
- DRSUAPI_DS_SPN_OPERATION_DELETE = 2
- } drsuapi_DsSpnOperation;
-
- typedef struct {
- drsuapi_DsSpnOperation operation;
- uint32 unknown1;
- [charset(UTF16),string] uint16 *object_dn;
- [range(0,10000)] uint32 count;
- [size_is(count)] drsuapi_DsNameString *spn_names;
- } drsuapi_DsWriteAccountSpnRequest1;
-
- typedef [switch_type(int32)] union {
- [case(1)] drsuapi_DsWriteAccountSpnRequest1 req1;
- } drsuapi_DsWriteAccountSpnRequest;
-
- typedef struct {
- WERROR status;
- } drsuapi_DsWriteAccountSpnResult1;
-
- typedef [switch_type(int32)] union {
- [case(1)] drsuapi_DsWriteAccountSpnResult1 res1;
- } drsuapi_DsWriteAccountSpnResult;
-
- WERROR drsuapi_DsWriteAccountSpn(
- [in] policy_handle *bind_handle,
- [in] int32 level,
- [in,ref,switch_is(level)] drsuapi_DsWriteAccountSpnRequest *req,
- [out,ref] int32 *level_out,
- [out,ref,switch_is(*level_out)] drsuapi_DsWriteAccountSpnResult *res
- );
-
- /*****************/
- /* Function 0x0e */
- typedef struct {
- [charset(UTF16),string] uint16 *server_dn;
- [charset(UTF16),string] uint16 *domain_dn;
- uint32 unknown; /* 0x000000001 */
- } drsuapi_DsRemoveDSServerRequest1;
-
- typedef [switch_type(int32)] union {
- [case(1)] drsuapi_DsRemoveDSServerRequest1 req1;
- } drsuapi_DsRemoveDSServerRequest;
-
- typedef struct {
- WERROR status;
- } drsuapi_DsRemoveDSServerResult1;
-
- typedef [switch_type(int32)] union {
- [case(1)] drsuapi_DsRemoveDSServerResult1 res1;
- } drsuapi_DsRemoveDSServerResult;
-
- WERROR drsuapi_DsRemoveDSServer(
- [in] policy_handle *bind_handle,
- [in] int32 level,
- [in,ref,switch_is(level)] drsuapi_DsRemoveDSServerRequest *req,
- [out,ref] int32 *level_out,
- [out,ref,switch_is(*level_out)] drsuapi_DsRemoveDSServerResult *res
- );
-
- /*****************/
- /* Function 0x0f */
- WERROR DRSUAPI_REMOVE_DS_DOMAIN();
-
- /*****************/
- /* Function 0x10 */
- typedef struct {
- [charset(UTF16),string] uint16 *domain_name; /* netbios or dns */
- int32 level; /* specifies the switch level for the request */
- } drsuapi_DsGetDCInfoRequest1;
-
- typedef [switch_type(int32)] union {
- [case(1)] drsuapi_DsGetDCInfoRequest1 req1;
- } drsuapi_DsGetDCInfoRequest;
-
- typedef struct {
- [charset(UTF16),string] uint16 *netbios_name;
- [charset(UTF16),string] uint16 *dns_name;
- [charset(UTF16),string] uint16 *site_name;
- [charset(UTF16),string] uint16 *computer_dn;
- [charset(UTF16),string] uint16 *server_dn;
- uint32 is_pdc;
- uint32 is_enabled;
- } drsuapi_DsGetDCInfo1;
-
- typedef struct {
- [range(0,10000)] uint32 count;
- [size_is(count)] drsuapi_DsGetDCInfo1 *array;
- } drsuapi_DsGetDCInfoCtr1;
-
- typedef struct {
- [charset(UTF16),string] uint16 *netbios_name;
- [charset(UTF16),string] uint16 *dns_name;
- [charset(UTF16),string] uint16 *site_name;
- [charset(UTF16),string] uint16 *site_dn;
- [charset(UTF16),string] uint16 *computer_dn;
- [charset(UTF16),string] uint16 *server_dn;
- [charset(UTF16),string] uint16 *ntds_dn;
- uint32 is_pdc;
- uint32 is_enabled;
- uint32 is_gc;
- GUID site_guid;
- GUID computer_guid;
- GUID server_guid;
- GUID ntds_guid;
- } drsuapi_DsGetDCInfo2;
-
- typedef struct {
- [range(0,10000)] uint32 count;
- [size_is(count)] drsuapi_DsGetDCInfo2 *array;
- } drsuapi_DsGetDCInfoCtr2;
-
- typedef struct {
- [charset(UTF16),string] uint16 *netbios_name;
- [charset(UTF16),string] uint16 *dns_name;
- [charset(UTF16),string] uint16 *site_name;
- [charset(UTF16),string] uint16 *site_dn;
- [charset(UTF16),string] uint16 *computer_dn;
- [charset(UTF16),string] uint16 *server_dn;
- [charset(UTF16),string] uint16 *ntds_dn;
- uint32 is_pdc;
- uint32 is_enabled;
- uint32 is_gc;
- uint32 is_rodc;
- GUID site_guid;
- GUID computer_guid;
- GUID server_guid;
- GUID ntds_guid;
- } drsuapi_DsGetDCInfo3;
-
- typedef struct {
- [range(0,10000)] uint32 count;
- [size_is(count)] drsuapi_DsGetDCInfo3 *array;
- } drsuapi_DsGetDCInfoCtr3;
-
- /*
- * this represents an active connection to the
- * Directory System Agent (DSA)
- * this can be via LDAP or DRSUAPI
- */
- typedef struct {
- [flag(NDR_BIG_ENDIAN)] ipv4address client_ip_address;
- uint32 unknown2;
- uint32 connection_time; /* in seconds */
- uint32 unknown4;
- uint32 unknown5;
- uint32 unknown6;
- /*
- * client_account can be the following:
- * "W2K3\Administrator"
- * "Administrator@W2K3"
- * "cn=Administrator,cn=Users,DC=w2k3,DC=vmnet1,DC=vm,DC=base"
- * ""
- * or NULL
- */
- [charset(UTF16),string] uint16 *client_account;
- } drsuapi_DsGetDCConnection01;
-
- typedef struct {
- [range(0,10000)] uint32 count;
- [size_is(count)] drsuapi_DsGetDCConnection01 *array;
- } drsuapi_DsGetDCConnectionCtr01;
-
- typedef [v1_enum] enum {
- DRSUAPI_DC_INFO_CTR_1 = 1,
- DRSUAPI_DC_INFO_CTR_2 = 2,
- DRSUAPI_DC_INFO_CTR_3 = 3,
- DRSUAPI_DC_CONNECTION_CTR_01 = -1
- } drsuapi_DsGetDCInfoCtrLevels;
-
- typedef [switch_type(int32)] union {
- [case(DRSUAPI_DC_INFO_CTR_1)] drsuapi_DsGetDCInfoCtr1 ctr1;
- [case(DRSUAPI_DC_INFO_CTR_2)] drsuapi_DsGetDCInfoCtr2 ctr2;
- [case(DRSUAPI_DC_INFO_CTR_3)] drsuapi_DsGetDCInfoCtr3 ctr3;
- [case(DRSUAPI_DC_CONNECTION_CTR_01)] drsuapi_DsGetDCConnectionCtr01 ctr01;
- } drsuapi_DsGetDCInfoCtr;
-
- WERROR drsuapi_DsGetDomainControllerInfo(
- [in] policy_handle *bind_handle,
- [in] int32 level,
- [in,ref,switch_is(level)] drsuapi_DsGetDCInfoRequest *req,
- [out,ref] int32 *level_out,
- [out,ref,switch_is(*level_out)] drsuapi_DsGetDCInfoCtr *ctr
- );
-
- /*****************/
- /* Function 0x11 */
- typedef [public,noprint] struct {
- drsuapi_DsReplicaObjectListItem *next_object;
- drsuapi_DsReplicaObject object;
- } drsuapi_DsReplicaObjectListItem;
-
- /*
- * The DsAddEntry() call which creates a nTDSDSA object,
- * also adds a servicePrincipalName in the following form
- * to the computer account of the new domain controller
- * referenced by the "serverReferenece" attribute.
- *
- * E3514235-4B06-11D1-AB04-00C04FC2DCD2/<new-ntdsdsa-object-guid-as-string>/<domain-dns-name>
- *
- * also note that the "serverReference" isn't added to the new object!
- */
- const char *DRSUAPI_NTDSDSA_KRB5_SERVICE_GUID = "E3514235-4B06-11D1-AB04-00C04FC2DCD2";
-
- /*
- * please note the the current idl
- * for DsAddEntry does only parse
- * what I saw between 2 w2k3 boxes
- * in my dssync experiments I got some other replies
- * so all I want to say is that this is very incomplete yet...
- * --metze
- */
- typedef struct {
- drsuapi_DsReplicaObjectListItem first_object;
- } drsuapi_DsAddEntryRequest2;
-
- typedef [switch_type(int32)] union {
- [case(2)] drsuapi_DsAddEntryRequest2 req2;
- } drsuapi_DsAddEntryRequest;
-
- typedef struct {
- uint32 unknown1;
- WERROR status;
- uint32 unknown2;
- uint16 unknown3;
- } drsuapi_DsAddEntryErrorInfoX;
-
- typedef struct {
- [range(0,10485760)] uint32 size;
- [size_is(size)] uint8 *data;
- } drsuapi_DsAddEntryExtraErrorBuffer;
-
- typedef struct {
- drsuapi_DsAddEntryErrorInfoX error;
- drsuapi_DsAttributeId attid;
- uint32 unknown2;
- drsuapi_DsAddEntryExtraErrorBuffer buffer;
- } drsuapi_DsAddEntryExtraError1;
-
- typedef /*[noprint]*/ struct {
- drsuapi_DsAddEntryErrorListItem1 *next;
- drsuapi_DsAddEntryExtraError1 error;
- } drsuapi_DsAddEntryErrorListItem1;
-
- typedef struct {
- drsuapi_DsReplicaObjectIdentifier *id;
- WERROR status;
- drsuapi_DsAddEntryErrorListItem1 first;
- } drsuapi_DsAddEntryErrorInfo1;
-
- typedef [switch_type(uint32)] union {
- [case(1)] drsuapi_DsAddEntryErrorInfo1 error1;
-/* [case(2)] drsuapi_DsAddEntryErrorInfo2 error2;
- [case(3)] drsuapi_DsAddEntryErrorInfo3 error3;
-*/ [case(4)] drsuapi_DsAddEntryErrorInfoX errorX;
- [case(5)] drsuapi_DsAddEntryErrorInfoX errorX;
- [case(6)] drsuapi_DsAddEntryErrorInfoX errorX;
- [case(7)] drsuapi_DsAddEntryErrorInfoX errorX;
- } drsuapi_DsAddEntryErrorInfo;
-
- typedef struct {
- WERROR status;
- uint32 level;
- [switch_is(level)] drsuapi_DsAddEntryErrorInfo *info;
- } drsuapi_DsAddEntryError1;
-
- typedef [switch_type(uint32)] union {
- [case(1)] drsuapi_DsAddEntryError1 info1;
- } drsuapi_DsAddEntryError;
-
- typedef struct {
- GUID guid;
- dom_sid28 sid;
- } drsuapi_DsReplicaObjectIdentifier2;
-
- typedef struct {
- drsuapi_DsReplicaObjectIdentifier *id;
- uint32 unknown1;
- drsuapi_DsAddEntryErrorInfoX error;
- [range(0,10000)] uint32 count;
- [size_is(count)] drsuapi_DsReplicaObjectIdentifier2 *objects;
- } drsuapi_DsAddEntryCtr2;
-
- typedef struct {
- drsuapi_DsReplicaObjectIdentifier *id;
- uint32 level;
- [switch_is(level)] drsuapi_DsAddEntryError *error;
- [range(0,10000)] uint32 count;
- [size_is(count)] drsuapi_DsReplicaObjectIdentifier2 *objects;
- } drsuapi_DsAddEntryCtr3;
-
- typedef [switch_type(int32)] union {
- [case(2)] drsuapi_DsAddEntryCtr2 ctr2;
- [case(3)] drsuapi_DsAddEntryCtr3 ctr3;
- } drsuapi_DsAddEntryCtr;
-
- [public] WERROR drsuapi_DsAddEntry(
- [in] policy_handle *bind_handle,
- [in] int32 level,
- [in,ref,switch_is(level)] drsuapi_DsAddEntryRequest *req,
- [out,ref] int32 *level_out,
- [out,ref,switch_is(*level_out)] drsuapi_DsAddEntryCtr *ctr
- );
-
- /*****************/
- /* Function 0x12 */
- WERROR DRSUAPI_EXECUTE_KCC();
-
- /*****************/
- /* Function 0x13 */
- typedef [v1_enum] enum {
- DRSUAPI_DS_REPLICA_GET_INFO = 1,
- DRSUAPI_DS_REPLICA_GET_INFO2 = 2
- } drsuapi_DsReplicaGetInfoLevel;
-
- typedef [v1_enum] enum {
- DRSUAPI_DS_REPLICA_INFO_NEIGHBORS = 0,
- DRSUAPI_DS_REPLICA_INFO_CURSORS = 1,
- DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA = 2,
- DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES = 3,
- DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES = 4,
- DRSUAPI_DS_REPLICA_INFO_PENDING_OPS = 5,
- DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA = 6,
- DRSUAPI_DS_REPLICA_INFO_CURSORS2 = 7,
- DRSUAPI_DS_REPLICA_INFO_CURSORS3 = 8,
- DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2 = 9,
- DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2 = 10,
- DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02 = -2,
- DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04 = -4,
- DRSUAPI_DS_REPLICA_INFO_CURSORS05 = -5,
- DRSUAPI_DS_REPLICA_INFO_06 = -6
- } drsuapi_DsReplicaInfoType;
-
- typedef struct {
- drsuapi_DsReplicaInfoType info_type;
- [charset(UTF16),string] uint16 *object_dn;
- GUID guid1;
- } drsuapi_DsReplicaGetInfoRequest1;
-
- typedef struct {
- drsuapi_DsReplicaInfoType info_type;
- [charset(UTF16),string] uint16 *object_dn;
- GUID guid1;
- uint32 unknown1;
- [charset(UTF16),string] uint16 *string1;
- [charset(UTF16),string] uint16 *string2;
- uint32 unknown2;
- } drsuapi_DsReplicaGetInfoRequest2;
-
- typedef [switch_type(drsuapi_DsReplicaGetInfoLevel)] union {
- [case(DRSUAPI_DS_REPLICA_GET_INFO)] drsuapi_DsReplicaGetInfoRequest1 req1;
- [case(DRSUAPI_DS_REPLICA_GET_INFO2)] drsuapi_DsReplicaGetInfoRequest2 req2;
- } drsuapi_DsReplicaGetInfoRequest;
-
- typedef struct {
- [charset(UTF16),string] uint16 *naming_context_dn;
- [charset(UTF16),string] uint16 *source_dsa_obj_dn;
- [charset(UTF16),string] uint16 *source_dsa_address;
- [charset(UTF16),string] uint16 *transport_obj_dn;
- drsuapi_DsReplicaNeighbourFlags replica_flags;
- uint32 reserved;
- GUID naming_context_obj_guid;
- GUID source_dsa_obj_guid;
- GUID source_dsa_invocation_id;
- GUID transport_obj_guid;
- hyper tmp_highest_usn;
- hyper highest_usn;
- NTTIME last_success;
- NTTIME last_attempt;
- WERROR result_last_attempt;
- uint32 consecutive_sync_failures;
- } drsuapi_DsReplicaNeighbour;
-
- typedef struct {
- uint32 count;
- uint32 reserved;
- [size_is(count)] drsuapi_DsReplicaNeighbour array[];
- } drsuapi_DsReplicaNeighbourCtr;
-
- typedef struct {
- uint32 count;
- uint32 reserved;
- [size_is(count)] drsuapi_DsReplicaCursor array[];
- } drsuapi_DsReplicaCursorCtr;
-
- typedef struct {
- [charset(UTF16),string] uint16 *attribute_name;
- uint32 version;
- NTTIME originating_change_time;
- GUID originating_invocation_id;
- hyper originating_usn;
- hyper local_usn;
- } drsuapi_DsReplicaObjMetaData;
-
- typedef struct {
- uint32 count;
- uint32 reserved;
- [size_is(count)] drsuapi_DsReplicaObjMetaData array[];
- } drsuapi_DsReplicaObjMetaDataCtr;
-
- typedef struct {
- [charset(UTF16),string] uint16 *dsa_obj_dn;
- GUID dsa_obj_guid;
- NTTIME first_failure;
- uint32 num_failures;
- WERROR last_result;
- } drsuapi_DsReplicaKccDsaFailure;
-
- typedef struct {
- uint32 count;
- uint32 reserved;
- [size_is(count)] drsuapi_DsReplicaKccDsaFailure array[];
- } drsuapi_DsReplicaKccDsaFailuresCtr;
-
- typedef enum {
- DRSUAPI_DS_REPLICA_OP_TYPE_SYNC = 0,
- DRSUAPI_DS_REPLICA_OP_TYPE_ADD = 1,
- DRSUAPI_DS_REPLICA_OP_TYPE_DELETE = 2,
- DRSUAPI_DS_REPLICA_OP_TYPE_MODIFY = 3,
- DRSUAPI_DS_REPLICA_OP_TYPE_UPDATE_REFS = 4
- } drsuapi_DsReplicaOpType;
-
- typedef [switch_type(drsuapi_DsReplicaOpType)] union {
- [case(DRSUAPI_DS_REPLICA_OP_TYPE_SYNC)] drsuapi_DsReplicaSyncOptions sync;
- [case(DRSUAPI_DS_REPLICA_OP_TYPE_ADD)] drsuapi_DsReplicaAddOptions add;
- [case(DRSUAPI_DS_REPLICA_OP_TYPE_DELETE)] drsuapi_DsReplicaDeleteOptions op_delete;
- [case(DRSUAPI_DS_REPLICA_OP_TYPE_MODIFY)] drsuapi_DsReplicaModifyOptions modify;
- [case(DRSUAPI_DS_REPLICA_OP_TYPE_UPDATE_REFS)] drsuapi_DsReplicaUpdateRefsOptions update_refs;
- [default] uint32 unknown;
- } drsuapi_DsRplicaOpOptions;
-
- typedef struct {
- NTTIME operation_start;
- uint32 serial_num; /* unique till reboot */
- uint32 priority;
- drsuapi_DsReplicaOpType operation_type;
- [switch_is(operation_type)] drsuapi_DsRplicaOpOptions options;
- [charset(UTF16),string] uint16 *nc_dn;
- [charset(UTF16),string] uint16 *remote_dsa_obj_dn;
- [charset(UTF16),string] uint16 *remote_dsa_address;
- GUID nc_obj_guid;
- GUID remote_dsa_obj_guid;
- } drsuapi_DsReplicaOp;
-
- typedef struct {
- NTTIME time;
- uint32 count;
- [size_is(count)] drsuapi_DsReplicaOp array[];
- } drsuapi_DsReplicaOpCtr;
-
- typedef struct {
- [charset(UTF16),string] uint16 *attribute_name;
- [charset(UTF16),string] uint16 *object_dn;
- [value(ndr_size_DATA_BLOB(0,binary,0))] uint32 __ndr_size_binary;
- DATA_BLOB *binary;
- NTTIME deleted;
- NTTIME created;
- uint32 version;
- NTTIME originating_change_time;
- GUID originating_invocation_id;
- hyper originating_usn;
- hyper local_usn;
- } drsuapi_DsReplicaAttrValMetaData;
-
- typedef struct {
- uint32 count;
- int32 enumeration_context;
- [size_is(count)] drsuapi_DsReplicaAttrValMetaData array[];
- } drsuapi_DsReplicaAttrValMetaDataCtr;
-
- typedef struct {
- uint32 count;
- int32 enumeration_context;
- [size_is(count)] drsuapi_DsReplicaCursor2 array[];
- } drsuapi_DsReplicaCursor2Ctr;
-
- typedef struct {
- GUID source_dsa_invocation_id;
- hyper highest_usn;
- NTTIME last_sync_success;
- [charset(UTF16),string] uint16 *source_dsa_obj_dn;
- } drsuapi_DsReplicaCursor3;
-
- typedef struct {
- uint32 count;
- int32 enumeration_context;
- [size_is(count)] drsuapi_DsReplicaCursor3 array[];
- } drsuapi_DsReplicaCursor3Ctr;
-
- typedef struct {
- [charset(UTF16),string] uint16 *attribute_name;
- uint32 version;
- NTTIME originating_change_time;
- GUID originating_invocation_id;
- hyper originating_usn;
- hyper local_usn;
- [charset(UTF16),string] uint16 *originating_dsa_dn;
- } drsuapi_DsReplicaObjMetaData2;
-
- typedef struct {
- uint32 count;
- int32 enumeration_context;
- [size_is(count)] drsuapi_DsReplicaObjMetaData2 array[];
- } drsuapi_DsReplicaObjMetaData2Ctr;
-
- typedef struct {
- [charset(UTF16),string] uint16 *attribute_name;
- [charset(UTF16),string] uint16 *object_dn;
- [value(ndr_size_DATA_BLOB(0,binary,0))] uint32 __ndr_size_binary;
- DATA_BLOB *binary;
- NTTIME deleted;
- NTTIME created;
- uint32 version;
- NTTIME originating_change_time;
- GUID originating_invocation_id;
- hyper originating_usn;
- hyper local_usn;
- [charset(UTF16),string] uint16 *originating_dsa_dn;
- } drsuapi_DsReplicaAttrValMetaData2;
-
- typedef struct {
- uint32 count;
- int32 enumeration_context;
- [size_is(count)] drsuapi_DsReplicaAttrValMetaData2 array[];
- } drsuapi_DsReplicaAttrValMetaData2Ctr;
-
- typedef struct {
- hyper u1; /* session number? */
- uint32 u2;
- uint32 u3;
- GUID bind_guid;
- NTTIME_1sec bind_time;
- [flag(NDR_BIG_ENDIAN)] ipv4address client_ip_address;
- uint32 u5; /* this is the same value the client used as pid in the DsBindInfoX struct */
- } drsuapi_DsReplicaConnection04;
-
- typedef struct {
- [range(0,10000)] uint32 count;
- uint32 reserved;
- [size_is(count)] drsuapi_DsReplicaConnection04 array[];
- } drsuapi_DsReplicaConnection04Ctr;
-
- typedef struct {
- [charset(UTF16),string] uint16 *str1;
- uint32 u1;
- uint32 u2;
- uint32 u3;
- uint32 u4;
- uint32 u5;
- hyper u6;
- uint32 u7;
- } drsuapi_DsReplica06;
-
- typedef struct {
- [range(0,256)] uint32 count;
- uint32 reserved;
- [size_is(count)] drsuapi_DsReplica06 array[];
- } drsuapi_DsReplica06Ctr;
-
- typedef [switch_type(drsuapi_DsReplicaInfoType)] union {
- [case(DRSUAPI_DS_REPLICA_INFO_NEIGHBORS)] drsuapi_DsReplicaNeighbourCtr *neighbours;
- [case(DRSUAPI_DS_REPLICA_INFO_CURSORS)] drsuapi_DsReplicaCursorCtr *cursors;
- [case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA)] drsuapi_DsReplicaObjMetaDataCtr *objmetadata;
- [case(DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES)] drsuapi_DsReplicaKccDsaFailuresCtr *connectfailures;
- [case(DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES)] drsuapi_DsReplicaKccDsaFailuresCtr *linkfailures;
- [case(DRSUAPI_DS_REPLICA_INFO_PENDING_OPS)] drsuapi_DsReplicaOpCtr *pendingops;
- [case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA)] drsuapi_DsReplicaAttrValMetaDataCtr *attrvalmetadata;
- [case(DRSUAPI_DS_REPLICA_INFO_CURSORS2)] drsuapi_DsReplicaCursor2Ctr *cursors2;
- [case(DRSUAPI_DS_REPLICA_INFO_CURSORS3)] drsuapi_DsReplicaCursor3Ctr *cursors3;
- [case(DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2)] drsuapi_DsReplicaObjMetaData2Ctr *objmetadata2;
- [case(DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2)] drsuapi_DsReplicaAttrValMetaData2Ctr *attrvalmetadata2;
- [case(DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02)] drsuapi_DsReplicaNeighbourCtr *neighbours02;
- [case(DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04)] drsuapi_DsReplicaConnection04Ctr *connections04;
- [case(DRSUAPI_DS_REPLICA_INFO_CURSORS05)] drsuapi_DsReplicaCursorCtrEx *cursors05;
- [case(DRSUAPI_DS_REPLICA_INFO_06)] drsuapi_DsReplica06Ctr *i06;
- } drsuapi_DsReplicaInfo;
-
- WERROR drsuapi_DsReplicaGetInfo(
- [in] policy_handle *bind_handle,
- [in] drsuapi_DsReplicaGetInfoLevel level,
- [in,ref,switch_is(level)] drsuapi_DsReplicaGetInfoRequest *req,
- [out,ref] drsuapi_DsReplicaInfoType *info_type,
- [out,ref,switch_is(*info_type)] drsuapi_DsReplicaInfo *info
- );
-
- /*****************/
- /* Function 0x14 */
- WERROR DRSUAPI_ADD_SID_HISTORY();
-
- /*****************/
- /* Function 0x15 */
-
- typedef struct {
- [range(0,10000)] uint32 num_entries;
- [size_is(num_entries)] drsuapi_DsGetMembershipsCtr1 **ctrl_array;
- } drsuapi_DsGetMemberships2Ctr1;
-
- typedef [switch_type(int32)] union {
- [case(1)] drsuapi_DsGetMembershipsCtr1 ctr1;
- } drsuapi_DsGetMemberships2Ctr;
-
- typedef struct {
- [range(1,10000)] uint32 num_req;
- [size_is(num_req)] drsuapi_DsGetMembershipsRequest1 **req_array;
- } drsuapi_DsGetMemberships2Request1;
-
- typedef [switch_type(int32)] union {
- [case(1)] drsuapi_DsGetMemberships2Request1 req1;
- } drsuapi_DsGetMemberships2Request;
-
- WERROR drsuapi_DsGetMemberships2(
- [in] policy_handle *bind_handle,
- [in] int32 level,
- [in,ref] [switch_is(level)] drsuapi_DsGetMemberships2Request *req,
- [out,ref] int32 *level_out,
- [out,ref] [switch_is(*level_out)] drsuapi_DsGetMemberships2Ctr *ctr
- );
-
-
- /*****************/
- /* Function 0x16 */
- WERROR DRSUAPI_REPLICA_VERIFY_OBJECTS();
-
- /*****************/
- /* Function 0x17 */
- WERROR DRSUAPI_GET_OBJECT_EXISTENCE();
-
- /*****************/
- /* Function 0x18 */
- typedef struct {
- WERROR error_code;
- uint32 site_cost;
- } drsuapi_DsSiteCostInfo;
-
- typedef struct {
- [range(0,10000)] uint32 num_info;
- [size_is(num_info)] drsuapi_DsSiteCostInfo *info;
- uint32 unknown;
- } drsuapi_QuerySitesByCostCtr1;
-
- typedef [switch_type(int32)] union {
- [case(1)] drsuapi_QuerySitesByCostCtr1 ctr1;
- } drsuapi_QuerySitesByCostCtr;
-
- typedef struct {
- [charset(UTF16),string] uint16 *site_from;
- [range(1,10000)] uint32 num_req;
- [size_is(num_req)] [charset(UTF16),string] uint16 **site_to;
- uint32 flags;
- } drsuapi_QuerySitesByCostRequest1;
-
- typedef [switch_type(int32)] union {
- [case(1)] drsuapi_QuerySitesByCostRequest1 req1;
- } drsuapi_QuerySitesByCostRequest;
-
- WERROR drsuapi_QuerySitesByCost(
- [in] policy_handle *bind_handle,
- [in] int32 level,
- [in,ref] [switch_is(level)] drsuapi_QuerySitesByCostRequest *req,
- [out,ref] int32 *level_out,
- [out,ref] [switch_is(*level_out)] drsuapi_QuerySitesByCostCtr *ctr
- );
-}
diff --git a/source3/librpc/idl/dssetup.idl b/source3/librpc/idl/dssetup.idl
deleted file mode 100644
index af6350cc43..0000000000
--- a/source3/librpc/idl/dssetup.idl
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- 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();
-}
diff --git a/source3/librpc/idl/echo.idl b/source3/librpc/idl/echo.idl
deleted file mode 100644
index 5ea37f1ac1..0000000000
--- a/source3/librpc/idl/echo.idl
+++ /dev/null
@@ -1,127 +0,0 @@
-
-[
- uuid("60a15ec5-4de8-11d7-a637-005056a20182"),
- endpoint("ncacn_np:[\\pipe\\rpcecho]", "ncacn_ip_tcp:", "ncalrpc:"),
- pointer_default(unique),
- version(1.0),
- helpstring("Simple echo pipe")
-]
-interface rpcecho
-{
- /* Add one to an integer */
- void echo_AddOne(
- [in] uint32 in_data,
- [out] uint32 *out_data
- );
- /* Echo an array of bytes back at the caller */
- void echo_EchoData(
- [in] uint32 len,
- [in] [size_is(len)] uint8 in_data[],
- [out] [size_is(len)] uint8 out_data[]
- );
- /* Sink data to the server */
- void echo_SinkData(
- [in] uint32 len,
- [in,size_is(len)] uint8 data[]
- );
- /* Source data from server */
- void echo_SourceData(
- [in] uint32 len,
- [out,size_is(len)] uint8 data[]
- );
-
- /* test strings */
- void echo_TestCall (
- [in,string,charset(UTF16)] uint16 *s1,
- [out,string,charset(UTF16)] uint16 **s2
- );
-
-
- /* test some alignment issues */
- typedef struct {
- uint8 v;
- } echo_info1;
-
- typedef struct {
- uint16 v;
- } echo_info2;
-
- typedef struct {
- uint32 v;
- } echo_info3;
-
- struct echo_info4 {
- hyper v;
- };
-
- typedef struct {
- uint8 v1;
- hyper v2;
- } echo_info5;
-
- typedef struct {
- uint8 v1;
- echo_info1 info1;
- } echo_info6;
-
- typedef struct {
- uint8 v1;
- 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)] struct echo_info4 info4;
- [case(5)] echo_info5 info5;
- [case(6)] echo_info6 info6;
- [case(7)] echo_info7 info7;
- } echo_Info;
-
- NTSTATUS echo_TestCall2 (
- [in] uint16 level,
- [out,switch_is(level)] echo_Info *info
- );
-
- uint32 echo_TestSleep(
- [in] uint32 seconds
- );
-
- typedef enum {
- ECHO_ENUM1 = 1,
- ECHO_ENUM2 = 2
- } echo_Enum1;
-
- typedef [v1_enum] enum {
- ECHO_ENUM1_32 = 1,
- ECHO_ENUM2_32 = 2
- } echo_Enum1_32;
-
- typedef struct {
- echo_Enum1 e1;
- echo_Enum1_32 e2;
- } echo_Enum2;
-
- typedef [switch_type(uint16)] union {
- [case(ECHO_ENUM1)] echo_Enum1 e1;
- [case(ECHO_ENUM2)] echo_Enum2 e2;
- } echo_Enum3;
-
- void echo_TestEnum(
- [in,out,ref] echo_Enum1 *foo1,
- [in,out,ref] echo_Enum2 *foo2,
- [in,out,ref,switch_is(*foo1)] echo_Enum3 *foo3
- );
-
- typedef struct {
- uint32 x;
- [size_is(x)] uint16 surrounding[*];
- } echo_Surrounding;
-
- void echo_TestSurrounding(
- [in,out,ref] echo_Surrounding *data
- );
-
- uint16 echo_TestDoublePointer([in] uint16 ***data);
-}
diff --git a/source3/librpc/idl/epmapper.idl b/source3/librpc/idl/epmapper.idl
deleted file mode 100644
index 5611c3de18..0000000000
--- a/source3/librpc/idl/epmapper.idl
+++ /dev/null
@@ -1,302 +0,0 @@
-#include "idl_types.h"
-
-/*
- endpoint mapper interface
- Related links:
- http://www.opengroup.org/onlinepubs/9629399/apdxl.htm : Details on towers
-http://www.opengroup.org/onlinepubs/9629399/chap6.htm#tagcjh_11_02_03_01: binding strings
-
-*/
-
-[
- uuid("e1af8308-5d1f-11c9-91a4-08002b14a0fa"),
- version(3.0),
- endpoint("ncacn_np:[\\pipe\\epmapper]", "ncacn_ip_tcp:[135]",
- "ncalrpc:[EPMAPPER]"),
- helpstring("EndPoint Mapper"),
- pointer_default(ptr)
-]
-interface epmapper
-{
-
- /*
- note that the following IDL won't work in MIDL, and in fact
- that the full towers/floors representation of epm cannot be
- represented in MIDL at all. I decided to represent it using
- the extended IDL syntax in pidl to make it easier to work
- with.
- */
-
- const int EPMAPPER_STATUS_NO_MORE_ENTRIES = 0x16c9a0d6;
- const int EPMAPPER_STATUS_NO_MEMORY = 0x16C9A012;
- const int EPMAPPER_STATUS_OK = 0;
-
-
-
- typedef [enum8bit] enum {
-
- /* Level 4 and higher */
- EPM_PROTOCOL_DNET_NSP = 0x04,
- EPM_PROTOCOL_OSI_TP4 = 0x05,
- EPM_PROTOCOL_OSI_CLNS = 0x06,
- EPM_PROTOCOL_TCP = 0x07,
- EPM_PROTOCOL_UDP = 0x08,
- EPM_PROTOCOL_IP = 0x09,
- /* These 4 are protocol identifiers, always at level 3 or lower */
- EPM_PROTOCOL_NCADG = 0x0a, /* Connectionless RPC */
- EPM_PROTOCOL_NCACN = 0x0b,
- EPM_PROTOCOL_NCALRPC = 0x0c, /* Local RPC */
- EPM_PROTOCOL_UUID = 0x0d,
- EPM_PROTOCOL_IPX = 0x0e,
- EPM_PROTOCOL_SMB = 0x0f,
- EPM_PROTOCOL_PIPE = 0x10,
- EPM_PROTOCOL_NETBIOS = 0x11,
- EPM_PROTOCOL_NETBEUI = 0x12,
- EPM_PROTOCOL_SPX = 0x13,
- EPM_PROTOCOL_NB_IPX = 0x14, /* NetBIOS over IPX */
- EPM_PROTOCOL_DSP = 0x16, /* AppleTalk Data Stream Protocol */
- EPM_PROTOCOL_DDP = 0x17, /* AppleTalk Data Datagram Protocol */
- EPM_PROTOCOL_APPLETALK = 0x18, /* AppleTalk */
- EPM_PROTOCOL_VINES_SPP = 0x1a,
- EPM_PROTOCOL_VINES_IPC = 0x1b, /* Inter Process Communication */
- EPM_PROTOCOL_STREETTALK = 0x1c, /* Vines Streettalk */
- EPM_PROTOCOL_HTTP = 0x1f,
- EPM_PROTOCOL_UNIX_DS = 0x20, /* Unix domain socket */
- EPM_PROTOCOL_NULL = 0x21
- } epm_protocol;
-
- typedef struct {
- /*FIXME */
- } epm_rhs_dnet_nsp;
-
- typedef struct {
- /*FIXME*/
- } epm_rhs_osi_tp4;
-
- typedef struct {
- /*FIXME*/
- } epm_rhs_osi_clns;
-
- typedef struct {
- uint16 port;
- } epm_rhs_udp;
-
- typedef struct {
- uint16 port;
- } epm_rhs_tcp;
-
- typedef struct {
- ipv4address ipaddr;
- } epm_rhs_ip;
-
- typedef struct {
- uint16 minor_version;
- } epm_rhs_ncadg;
-
- typedef struct {
- uint16 minor_version;
- } epm_rhs_ncacn;
-
- typedef struct {
- [flag(NDR_REMAINING)] DATA_BLOB unknown;
- } epm_rhs_uuid;
-
- typedef struct {
- /*FIXME */
- } epm_rhs_ipx;
-
- typedef struct {
- astring unc;
- } epm_rhs_smb;
-
- typedef struct {
- astring path;
- } epm_rhs_pipe;
-
- typedef struct {
- astring name;
- } epm_rhs_netbios;
-
- typedef struct {
- } epm_rhs_netbeui;
-
- typedef struct {
- } epm_rhs_spx;
-
- typedef struct {
- } epm_rhs_nb_ipx;
-
- typedef struct {
- uint16 port;
- } epm_rhs_http;
-
- typedef struct {
- astring path;
- } epm_rhs_unix_ds;
-
- typedef struct {
- } epm_rhs_null;
-
- typedef struct {
- uint16 minor_version;
- } epm_rhs_ncalrpc;
-
- typedef struct {
- } epm_rhs_appletalk;
-
- typedef struct {
- } epm_rhs_atalk_stream;
-
- typedef struct {
- } epm_rhs_atalk_datagram;
-
- typedef struct {
- uint16 port;
- } epm_rhs_vines_spp;
-
- typedef struct {
- uint16 port;
- } epm_rhs_vines_ipc;
-
- typedef struct {
- astring streettalk;
- } epm_rhs_streettalk;
-
- typedef [flag(NDR_BIG_ENDIAN),nodiscriminant] union {
- [case(EPM_PROTOCOL_DNET_NSP)] epm_rhs_dnet_nsp dnet_nsp;
- [case(EPM_PROTOCOL_OSI_TP4)] epm_rhs_osi_tp4 osi_tp4;
- [case(EPM_PROTOCOL_OSI_CLNS)] epm_rhs_osi_clns osi_clns;
- [case(EPM_PROTOCOL_TCP)] epm_rhs_tcp tcp;
- [case(EPM_PROTOCOL_UDP)] epm_rhs_udp udp;
- [case(EPM_PROTOCOL_IP)] epm_rhs_ip ip;
- [case(EPM_PROTOCOL_NCADG)] epm_rhs_ncadg ncadg;
- [case(EPM_PROTOCOL_NCACN)] epm_rhs_ncacn ncacn;
- [case(EPM_PROTOCOL_NCALRPC)] epm_rhs_ncalrpc ncalrpc;
- [case(EPM_PROTOCOL_UUID)] epm_rhs_uuid uuid;
- [case(EPM_PROTOCOL_IPX)] epm_rhs_ipx ipx;
- [case(EPM_PROTOCOL_SMB)] epm_rhs_smb smb;
- [case(EPM_PROTOCOL_PIPE)] epm_rhs_pipe pipe;
- [case(EPM_PROTOCOL_NETBIOS)] epm_rhs_netbios netbios;
- [case(EPM_PROTOCOL_NETBEUI)] epm_rhs_netbeui netbeui;
- [case(EPM_PROTOCOL_SPX)] epm_rhs_spx spx;
- [case(EPM_PROTOCOL_NB_IPX)] epm_rhs_nb_ipx nb_ipx;
- [case(EPM_PROTOCOL_DSP)] epm_rhs_atalk_stream atalk_stream;
- [case(EPM_PROTOCOL_DDP)] epm_rhs_atalk_datagram atalk_datagram;
- [case(EPM_PROTOCOL_APPLETALK)] epm_rhs_appletalk appletalk;
- [case(EPM_PROTOCOL_VINES_SPP)] epm_rhs_vines_spp vines_spp;
- [case(EPM_PROTOCOL_VINES_IPC)] epm_rhs_vines_ipc vines_ipc;
- [case(EPM_PROTOCOL_STREETTALK)] epm_rhs_streettalk streettalk;
- [case(EPM_PROTOCOL_HTTP)] epm_rhs_http http;
- [case(EPM_PROTOCOL_UNIX_DS)] epm_rhs_unix_ds unix_ds;
- [case(EPM_PROTOCOL_NULL)] epm_rhs_null null;
- [default] [flag(NDR_REMAINING)] DATA_BLOB unknown;
- } epm_rhs;
-
- typedef struct {
- epm_protocol protocol;
- [flag(NDR_REMAINING)] DATA_BLOB lhs_data;
- } epm_lhs;
-
- typedef struct {
- [subcontext(2)] epm_lhs lhs;
- [subcontext(2),switch_is(lhs.protocol)] epm_rhs rhs;
- } epm_floor;
-
- /* note that the NDR_NOALIGN flag is inherited by all nested
- structures. All of the towers/floors stuff is
- non-aligned. I wonder what sort of wicked substance these
- guys were smoking?
- */
- typedef [gensize,flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN)] struct {
- uint16 num_floors;
- epm_floor floors[num_floors];
- } epm_tower;
-
- typedef struct {
- [value(ndr_size_epm_tower(&tower, ndr->flags))] uint32 tower_length;
- [subcontext(4)] epm_tower tower;
- } epm_twr_t;
-
- typedef struct {
- GUID object;
- epm_twr_t *tower;
- ascstr2 annotation;
- } epm_entry_t;
-
- typedef struct {
- GUID uuid;
- uint16 vers_major;
- uint16 vers_minor;
- } rpc_if_id_t;
-
- /**********************/
- /* Function 0x0 */
- error_status_t epm_Insert(
- [in] uint32 num_ents,
- [in,size_is(num_ents)] epm_entry_t entries[],
- [in] uint32 replace
- );
-
- /**********************/
- /* Function 0x1 */
- error_status_t epm_Delete(
- [in] uint32 num_ents,
- [in, size_is(num_ents)] epm_entry_t entries[]
- );
-
- /**********************/
- /* Function 0x02 */
- error_status_t epm_Lookup(
- [in] uint32 inquiry_type,
- [in,ptr] GUID *object,
- [in,ptr] rpc_if_id_t *interface_id,
- [in] uint32 vers_option,
- [in,out] policy_handle *entry_handle,
- [in] uint32 max_ents,
- [out] uint32 *num_ents,
- [out, length_is(*num_ents), size_is(max_ents)] epm_entry_t entries[]
- );
-
-
- /**********************/
- /* Function 0x03 */
-
- typedef struct {
- epm_twr_t *twr;
- } epm_twr_p_t;
-
- [public] error_status_t epm_Map(
- [in,ptr] GUID *object,
- [in,ptr] epm_twr_t *map_tower,
- [in,out] policy_handle *entry_handle,
- [in] uint32 max_towers,
- [out] uint32 *num_towers,
- [out, length_is(*num_towers), size_is(max_towers)] epm_twr_p_t towers[]
- );
-
-
- /**********************/
- /* Function 0x04 */
- error_status_t epm_LookupHandleFree(
- [in,out] policy_handle *entry_handle
- );
-
- /**********************/
- /* Function 0x05 */
- error_status_t epm_InqObject(
- [in] GUID *epm_object
- );
-
-
- /**********************/
- /* Function 0x06 */
- error_status_t epm_MgmtDelete(
- [in] uint32 object_speced,
- [in,ptr] GUID *object,
- [in,ptr] epm_twr_t *tower
- );
-
- /**********************/
- /* Function 0x07 */
- error_status_t epm_MapAuth();
-}
diff --git a/source3/librpc/idl/eventlog.idl b/source3/librpc/idl/eventlog.idl
deleted file mode 100644
index 18b1a0e454..0000000000
--- a/source3/librpc/idl/eventlog.idl
+++ /dev/null
@@ -1,181 +0,0 @@
-#include "idl_types.h"
-
-/*
- eventlog interface definition
-*/
-
-import "lsa.idl", "security.idl";
-
-[ uuid("82273fdc-e32a-18c3-3f78-827929dc23ea"),
- version(0.0),
- helpstring("Event Logger")
-] interface eventlog
-{
- typedef bitmap {
- EVENTLOG_SEQUENTIAL_READ = 0x0001,
- EVENTLOG_SEEK_READ = 0x0002,
- EVENTLOG_FORWARDS_READ = 0x0004,
- EVENTLOG_BACKWARDS_READ = 0x0008
- } eventlogReadFlags;
-
- typedef bitmap {
- EVENTLOG_SUCCESS = 0x0000,
- EVENTLOG_ERROR_TYPE = 0x0001,
- EVENTLOG_WARNING_TYPE = 0x0002,
- EVENTLOG_INFORMATION_TYPE = 0x0004,
- EVENTLOG_AUDIT_SUCCESS = 0x0008,
- EVENTLOG_AUDIT_FAILURE = 0x0010
- } eventlogEventTypes;
-
- typedef struct {
- uint16 unknown0;
- uint16 unknown1;
- } eventlog_OpenUnknown0;
-
- typedef [public] struct {
- uint32 size;
- uint32 reserved;
- uint32 record_number;
- uint32 time_generated;
- uint32 time_written;
- uint32 event_id;
- uint16 event_type;
- uint16 num_of_strings;
- uint16 event_category;
- uint16 reserved_flags;
- uint32 closing_record_number;
- uint32 stringoffset;
- uint32 sid_length;
- uint32 sid_offset;
- uint32 data_length;
- uint32 data_offset;
- nstring source_name;
- nstring computer_name;
- nstring strings[num_of_strings];
- astring raw_data;
- } eventlog_Record;
-
- /******************/
- /* Function: 0x00 */
- NTSTATUS eventlog_ClearEventLogW(
- [in] policy_handle *handle,
- [in,unique] lsa_String *backupfile
- );
-
- /******************/
- /* Function: 0x01 */
- NTSTATUS eventlog_BackupEventLogW();
-
- /******************/
- /* Function: 0x02 */
- NTSTATUS eventlog_CloseEventLog(
- [in,out] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x03 */
- NTSTATUS eventlog_DeregisterEventSource();
-
- /******************/
- /* Function: 0x04 */
- NTSTATUS eventlog_GetNumRecords(
- [in] policy_handle *handle,
- [out] uint32 *number
- );
-
- /******************/
- /* Function: 0x05 */
- NTSTATUS eventlog_GetOldestRecord(
- [in] policy_handle *handle,
- [out,ref] uint32 *oldest_entry
- );
-
- /******************/
- /* Function: 0x06 */
- NTSTATUS eventlog_ChangeNotify();
-
- /******************/
- /* Function: 0x07 */
- NTSTATUS eventlog_OpenEventLogW(
- [in,unique] eventlog_OpenUnknown0 *unknown0,
- [in,ref] lsa_String *logname,
- [in,ref] lsa_String *servername,
- [in] uint32 unknown2,
- [in] uint32 unknown3,
- [out] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x08 */
- NTSTATUS eventlog_RegisterEventSourceW();
-
- /******************/
- /* Function: 0x09 */
- NTSTATUS eventlog_OpenBackupEventLogW();
-
- /******************/
- /* Function: 0x0a */
- NTSTATUS eventlog_ReadEventLogW(
- [in] policy_handle *handle,
- [in] uint32 flags,
- [in] uint32 offset,
- [in] [range(0,0x7FFFF)] uint32 number_of_bytes,
- [out,ref,size_is(number_of_bytes)] uint8 *data,
- [out,ref] uint32 *sent_size,
- [out,ref] uint32 *real_size
- );
-
- /*****************/
- /* Function 0x0b */
- NTSTATUS eventlog_ReportEventW();
-
- /*****************/
- /* Function 0x0c */
- NTSTATUS eventlog_ClearEventLogA();
-
- /******************/
- /* Function: 0x0d */
- NTSTATUS eventlog_BackupEventLogA();
-
- /*****************/
- /* Function 0x0e */
- NTSTATUS eventlog_OpenEventLogA();
-
- /*****************/
- /* Function 0x0f */
- NTSTATUS eventlog_RegisterEventSourceA();
-
- /*****************/
- /* Function 0x10 */
- NTSTATUS eventlog_OpenBackupEventLogA();
-
- /*****************/
- /* Function 0x11 */
- NTSTATUS eventlog_ReadEventLogA();
-
- /*****************/
- /* Function 0x12 */
- NTSTATUS eventlog_ReportEventA();
-
- /*****************/
- /* Function 0x13 */
- NTSTATUS eventlog_RegisterClusterSvc();
-
- /*****************/
- /* Function 0x14 */
- NTSTATUS eventlog_DeregisterClusterSvc();
-
- /*****************/
- /* Function 0x15 */
- NTSTATUS eventlog_WriteClusterEvents();
-
- /*****************/
- /* Function 0x16 */
- NTSTATUS eventlog_GetLogIntormation();
-
- /*****************/
- /* Function 0x17 */
- NTSTATUS eventlog_FlushEventLog(
- [in] policy_handle *handle
- );
-}
diff --git a/source3/librpc/idl/idl_types.h b/source3/librpc/idl/idl_types.h
deleted file mode 100644
index f21f3e660d..0000000000
--- a/source3/librpc/idl/idl_types.h
+++ /dev/null
@@ -1,86 +0,0 @@
-#define STR_ASCII LIBNDR_FLAG_STR_ASCII
-#define STR_LEN4 LIBNDR_FLAG_STR_LEN4
-#define STR_SIZE4 LIBNDR_FLAG_STR_SIZE4
-#define STR_SIZE2 LIBNDR_FLAG_STR_SIZE2
-#define STR_NOTERM LIBNDR_FLAG_STR_NOTERM
-#define STR_NULLTERM LIBNDR_FLAG_STR_NULLTERM
-#define STR_BYTESIZE LIBNDR_FLAG_STR_BYTESIZE
-#define STR_FIXLEN32 LIBNDR_FLAG_STR_FIXLEN32
-#define STR_FIXLEN15 LIBNDR_FLAG_STR_FIXLEN15
-#define STR_CONFORMANT LIBNDR_FLAG_STR_CONFORMANT
-#define STR_CHARLEN LIBNDR_FLAG_STR_CHARLEN
-#define STR_UTF8 LIBNDR_FLAG_STR_UTF8
-
-/*
- a UCS2 string prefixed with [size], 32 bits
-*/
-#define lstring [flag(STR_SIZE4)] string
-
-/*
- a null terminated UCS2 string
-*/
-#define nstring [flag(STR_NULLTERM)] string
-
-/*
- fixed length 32 character UCS-2 string
-*/
-#define string32 [flag(STR_FIXLEN32)] string
-
-/*
- fixed length 16 character ascii string
-*/
-#define astring15 [flag(STR_ASCII|STR_FIXLEN15)] string
-
-/*
- an ascii string prefixed with [offset] [length], both 32 bits
- null terminated
-*/
-#define ascstr2 [flag(STR_ASCII|STR_LEN4)] string
-
-/*
- an ascii string prefixed with [size], 32 bits
-*/
-#define asclstr [flag(STR_ASCII|STR_SIZE4)] string
-
-/*
- an ascii string prefixed with [size], 16 bits
- null terminated
-*/
-#define ascstr3 [flag(STR_ASCII|STR_SIZE2)] string
-
-/*
- an ascii string prefixed with [size] [offset] [length], all 32 bits
- not null terminated
-*/
-#define ascstr_noterm [flag(STR_NOTERM|STR_ASCII|STR_SIZE4|STR_LEN4)] string
-
-/*
- a null terminated ascii string
-*/
-#define astring [flag(STR_ASCII|STR_NULLTERM)] string
-
-/*
- a null terminated UTF8 string
-*/
-#define utf8string [flag(STR_UTF8|STR_NULLTERM)] string
-
-/*
- a null terminated UCS2 string
-*/
-#define nstring_array [flag(STR_NULLTERM)] string_array
-
-#define NDR_NOALIGN LIBNDR_FLAG_NOALIGN
-#define NDR_REMAINING LIBNDR_FLAG_REMAINING
-#define NDR_ALIGN2 LIBNDR_FLAG_ALIGN2
-#define NDR_ALIGN4 LIBNDR_FLAG_ALIGN4
-#define NDR_ALIGN8 LIBNDR_FLAG_ALIGN8
-
-/* this flag is used to force a section of IDL as little endian. It is
- needed for the epmapper IDL, which is defined as always being LE */
-#define NDR_LITTLE_ENDIAN LIBNDR_FLAG_LITTLE_ENDIAN
-#define NDR_BIG_ENDIAN LIBNDR_FLAG_BIGENDIAN
-
-/*
- this is used to control formatting of uint8 arrays
-*/
-#define NDR_PAHEX LIBNDR_PRINT_ARRAY_HEX
diff --git a/source3/librpc/idl/initshutdown.idl b/source3/librpc/idl/initshutdown.idl
deleted file mode 100644
index 8815a9a29e..0000000000
--- a/source3/librpc/idl/initshutdown.idl
+++ /dev/null
@@ -1,46 +0,0 @@
-#include "idl_types.h"
-
-/*
- initshutdown interface definition
-*/
-
-[
- uuid("894de0c0-0d55-11d3-a322-00c04fa321a1"),
- version(1.0),
- endpoint("ncacn_np:[\\pipe\\InitShutdown]"),
- pointer_default(unique),
- helpstring("Init shutdown service")
-] interface initshutdown
-{
- typedef struct {
- [value(strlen_m_term(name))] uint32 name_size;
- [flag(STR_LEN4|STR_NOTERM)] string name;
- } initshutdown_String_sub;
-
- typedef [public] struct {
- [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;
-
- WERROR initshutdown_Init(
- [in,unique] uint16 *hostname,
- [in,unique] initshutdown_String *message,
- [in] uint32 timeout,
- [in] uint8 force_apps,
- [in] uint8 do_reboot
- );
-
- WERROR initshutdown_Abort(
- [in,unique] uint16 *server
- );
-
- WERROR initshutdown_InitEx(
- [in,unique] uint16 *hostname,
- [in,unique] initshutdown_String *message,
- [in] uint32 timeout,
- [in] uint8 force_apps,
- [in] uint8 do_reboot,
- [in] uint32 reason
- );
-}
diff --git a/source3/librpc/idl/krb5pac.idl b/source3/librpc/idl/krb5pac.idl
deleted file mode 100644
index c039502d23..0000000000
--- a/source3/librpc/idl/krb5pac.idl
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- krb5 PAC
-*/
-
-#include "idl_types.h"
-
-import "security.idl", "netlogon.idl", "samr.idl";
-
-[
- uuid("12345778-1234-abcd-0000-00000000"),
- version(0.0),
- pointer_default(unique),
- helpstring("Active Directory KRB5 PAC")
-]
-interface krb5pac
-{
- typedef struct {
- NTTIME logon_time;
- [value(2*strlen_m(account_name))] uint16 size;
- [charset(UTF16)] uint8 account_name[size];
- } PAC_LOGON_NAME;
-
- typedef [public,flag(NDR_PAHEX)] struct {
- uint32 type;
- [flag(NDR_REMAINING)] DATA_BLOB signature;
- } PAC_SIGNATURE_DATA;
-
- typedef [gensize] struct {
- netr_SamInfo3 info3;
- dom_sid2 *res_group_dom_sid;
- samr_RidWithAttributeArray res_groups;
- } PAC_LOGON_INFO;
-
- typedef struct {
- [value(2*strlen_m(upn_name))] uint16 upn_size;
- uint16 upn_offset;
- [value(2*strlen_m(domain_name))] uint16 domain_size;
- uint16 domain_offset;
- uint16 unknown3; /* 0x01 */
- uint16 unknown4;
- uint32 unknown5;
- [charset(UTF16)] uint8 upn_name[upn_size+2];
- [charset(UTF16)] uint8 domain_name[domain_size+2];
- uint32 unknown6; /* padding */
- } PAC_UNKNOWN_12;
-
- typedef [public] struct {
- [value(0x00081001)] uint32 unknown1;
- [value(0xCCCCCCCC)] uint32 unknown2;
- [value(NDR_ROUND(ndr_size_PAC_LOGON_INFO(info, ndr->flags)+4,8))] uint32 _ndr_size;
- [value(0x00000000)] uint32 unknown3;
- PAC_LOGON_INFO *info;
- } PAC_LOGON_INFO_CTR;
-
- typedef [public,v1_enum] enum {
- PAC_TYPE_LOGON_INFO = 1,
- PAC_TYPE_SRV_CHECKSUM = 6,
- PAC_TYPE_KDC_CHECKSUM = 7,
- PAC_TYPE_LOGON_NAME = 10,
- PAC_TYPE_CONSTRAINED_DELEGATION = 11,
- PAC_TYPE_UNKNOWN_12 = 12
- } PAC_TYPE;
-
- typedef struct {
- [flag(NDR_REMAINING)] DATA_BLOB remaining;
- } DATA_BLOB_REM;
-
- typedef [public,nodiscriminant,gensize] union {
- [case(PAC_TYPE_LOGON_INFO)] PAC_LOGON_INFO_CTR logon_info;
- [case(PAC_TYPE_SRV_CHECKSUM)] PAC_SIGNATURE_DATA srv_cksum;
- [case(PAC_TYPE_KDC_CHECKSUM)] PAC_SIGNATURE_DATA kdc_cksum;
- [case(PAC_TYPE_LOGON_NAME)] PAC_LOGON_NAME logon_name;
- [default] [subcontext(0)] DATA_BLOB_REM unknown;
- /* [case(PAC_TYPE_UNKNOWN_12)] PAC_UNKNOWN_12 unknown; */
- } PAC_INFO;
-
- typedef [public,nopush,nopull,noprint] struct {
- PAC_TYPE type;
- [value(_ndr_size_PAC_INFO(info, type, 0))] uint32 _ndr_size;
- [relative,switch_is(type),subcontext(0),subcontext_size(_subcontext_size_PAC_INFO(r, ndr->flags)),flag(NDR_ALIGN8)] PAC_INFO *info;
- [value(0)] uint32 _pad; /* Top half of a 64 bit pointer? */
- } PAC_BUFFER;
-
- typedef [public] struct {
- uint32 num_buffers;
- uint32 version;
- PAC_BUFFER buffers[num_buffers];
- } PAC_DATA;
-
- typedef [public] struct {
- PAC_TYPE type;
- uint32 ndr_size;
- [relative,subcontext(0),subcontext_size(NDR_ROUND(ndr_size,8)),flag(NDR_ALIGN8)] DATA_BLOB_REM *info;
- [value(0)] uint32 _pad; /* Top half of a 64 bit pointer? */
- } PAC_BUFFER_RAW;
-
- typedef [public] struct {
- uint32 num_buffers;
- uint32 version;
- PAC_BUFFER_RAW buffers[num_buffers];
- } PAC_DATA_RAW;
-
- void decode_pac(
- [in] PAC_DATA pac
- );
-
- void decode_pac_raw(
- [in] PAC_DATA_RAW pac
- );
-
- void decode_login_info(
- [in] PAC_LOGON_INFO logon_info
- );
-
- /* used for samba3 netsamlogon cache */
- typedef [public] struct {
- time_t timestamp;
- netr_SamInfo3 info3;
- } netsamlogoncache_entry;
-}
diff --git a/source3/librpc/idl/libnetapi.idl b/source3/librpc/idl/libnetapi.idl
index 039dcf4152..f2f4a16c12 100644
--- a/source3/librpc/idl/libnetapi.idl
+++ b/source3/librpc/idl/libnetapi.idl
@@ -517,7 +517,9 @@ interface libnetapi
uint32 usriX_code_page;
string usriX_profile;
string usriX_home_dir_drive;
+ uint32 usriX_user_id;
uint32 usriX_primary_group_id;
+ uint32 usriX_password_expired;
} USER_INFO_X;
[nopush,nopull] NET_API_STATUS NetUserAdd(
diff --git a/source3/librpc/idl/lsa.idl b/source3/librpc/idl/lsa.idl
index cb16f64dab..a443448871 100644
--- a/source3/librpc/idl/lsa.idl
+++ b/source3/librpc/idl/lsa.idl
@@ -4,7 +4,7 @@
lsa interface definition
*/
-import "security.idl";
+import "misc.idl", "security.idl";
[ uuid("12345778-1234-abcd-ef00-0123456789ab"),
version(0.0),
@@ -14,6 +14,7 @@ import "security.idl";
] interface lsarpc
{
typedef bitmap security_secinfo security_secinfo;
+ typedef bitmap kerb_EncTypes kerb_EncTypes;
typedef [public,noejs] struct {
[value(2*strlen_m(string))] uint16 length;
@@ -108,7 +109,7 @@ import "security.idl";
/******************/
/* Function: 0x05 */
- NTSTATUS lsa_ChangePassword ();
+ [todo] NTSTATUS lsa_ChangePassword ();
/******************/
@@ -160,12 +161,11 @@ import "security.idl";
typedef struct {
uint32 percent_full;
- uint32 log_size;
- NTTIME retention_time;
+ uint32 maximum_log_size;
+ hyper retention_time;
uint8 shutdown_in_progress;
- NTTIME time_to_shutdown;
+ hyper time_to_shutdown;
uint32 next_audit_record;
- uint32 unknown;
} lsa_AuditLogInfo;
typedef [v1_enum] enum {
@@ -203,9 +203,13 @@ import "security.idl";
lsa_String name;
} lsa_PDAccountInfo;
+ typedef [v1_enum] enum {
+ LSA_ROLE_BACKUP=2,
+ LSA_ROLE_PRIMARY=3
+ } lsa_Role;
+
typedef struct {
- uint16 unknown; /* an midl padding bug? */
- uint16 role;
+ lsa_Role role;
} lsa_ServerRole;
typedef struct {
@@ -224,7 +228,7 @@ import "security.idl";
typedef struct {
hyper modified_id;
- NTTIME db_create_time;
+ NTTIME_hyper db_create_time;
} lsa_ModificationInfo;
typedef struct {
@@ -232,7 +236,6 @@ import "security.idl";
} lsa_AuditFullSetInfo;
typedef struct {
- uint16 unknown; /* an midl padding bug? */
uint8 shutdown_on_full;
uint8 log_is_full;
} lsa_AuditFullQueryInfo;
@@ -260,10 +263,12 @@ import "security.idl";
LSA_POLICY_INFO_ROLE=6,
LSA_POLICY_INFO_REPLICA=7,
LSA_POLICY_INFO_QUOTA=8,
- LSA_POLICY_INFO_DB=9,
+ LSA_POLICY_INFO_MOD=9,
LSA_POLICY_INFO_AUDIT_FULL_SET=10,
LSA_POLICY_INFO_AUDIT_FULL_QUERY=11,
- LSA_POLICY_INFO_DNS=12
+ LSA_POLICY_INFO_DNS=12,
+ LSA_POLICY_INFO_DNS_INT=13,
+ LSA_POLICY_INFO_L_ACCOUNT_DOMAIN=14
} lsa_PolicyInfo;
typedef [switch_type(uint16)] union {
@@ -275,10 +280,12 @@ import "security.idl";
[case(LSA_POLICY_INFO_ROLE)] lsa_ServerRole role;
[case(LSA_POLICY_INFO_REPLICA)] lsa_ReplicaSourceInfo replica;
[case(LSA_POLICY_INFO_QUOTA)] lsa_DefaultQuotaInfo quota;
- [case(LSA_POLICY_INFO_DB)] lsa_ModificationInfo db;
+ [case(LSA_POLICY_INFO_MOD)] lsa_ModificationInfo mod;
[case(LSA_POLICY_INFO_AUDIT_FULL_SET)] lsa_AuditFullSetInfo auditfullset;
[case(LSA_POLICY_INFO_AUDIT_FULL_QUERY)] lsa_AuditFullQueryInfo auditfullquery;
[case(LSA_POLICY_INFO_DNS)] lsa_DnsDomainInfo dns;
+ [case(LSA_POLICY_INFO_DNS_INT)] lsa_DnsDomainInfo dns;
+ [case(LSA_POLICY_INFO_L_ACCOUNT_DOMAIN)] lsa_DomainInfo l_account_domain;
} lsa_PolicyInformation;
NTSTATUS lsa_QueryInfoPolicy(
@@ -297,7 +304,7 @@ import "security.idl";
/******************/
/* Function: 0x09 */
- NTSTATUS lsa_ClearAuditLog ();
+ [todo] NTSTATUS lsa_ClearAuditLog ();
/******************/
/* Function: 0x0a */
@@ -334,7 +341,7 @@ import "security.idl";
/* Function: 0x0c */
[public] NTSTATUS lsa_CreateTrustedDomain(
- [in] policy_handle *handle,
+ [in] policy_handle *policy_handle,
[in] lsa_DomainInfo *info,
[in] uint32 access_mask,
[out] policy_handle *trustdom_handle
@@ -362,7 +369,7 @@ import "security.idl";
/******************/
/* Function: 0x0e */
- typedef enum {
+ typedef [public] enum {
SID_NAME_USE_NONE = 0,/* NOTUSED */
SID_NAME_USER = 1, /* user */
SID_NAME_DOM_GRP = 2, /* domain group */
@@ -409,7 +416,8 @@ import "security.idl";
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_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2 = 6,
+ LSA_LOOKUP_NAMES_RODC_REFERRAL_TO_FULL_DC = 7
} lsa_LookupNamesLevel;
[public] NTSTATUS lsa_LookupNames (
@@ -506,28 +514,44 @@ import "security.idl";
);
/* Function: 0x15 */
- NTSTATUS lsa_GetQuotasForAccount();
+ [todo] NTSTATUS lsa_GetQuotasForAccount();
/* Function: 0x16 */
- NTSTATUS lsa_SetQuotasForAccount();
+ [todo] NTSTATUS lsa_SetQuotasForAccount();
+ typedef [bitmap32bit] bitmap {
+ LSA_POLICY_MODE_INTERACTIVE = 0x00000001,
+ LSA_POLICY_MODE_NETWORK = 0x00000002,
+ LSA_POLICY_MODE_BATCH = 0x00000004,
+ LSA_POLICY_MODE_SERVICE = 0x00000010,
+ LSA_POLICY_MODE_PROXY = 0x00000020,
+ LSA_POLICY_MODE_DENY_INTERACTIVE = 0x00000040,
+ LSA_POLICY_MODE_DENY_NETWORK = 0x00000080,
+ LSA_POLICY_MODE_DENY_BATCH = 0x00000100,
+ LSA_POLICY_MODE_DENY_SERVICE = 0x00000200,
+ LSA_POLICY_MODE_REMOTE_INTERACTIVE = 0x00000400,
+ LSA_POLICY_MODE_DENY_REMOTE_INTERACTIVE = 0x00000800,
+ LSA_POLICY_MODE_ALL = 0x00000FF7,
+ LSA_POLICY_MODE_ALL_NT4 = 0x00000037
+ } lsa_SystemAccessModeFlags;
+
/* Function: 0x17 */
NTSTATUS lsa_GetSystemAccessAccount(
- [in] policy_handle *handle,
+ [in] policy_handle *handle,
[out,ref] uint32 *access_mask
);
/* Function: 0x18 */
NTSTATUS lsa_SetSystemAccessAccount(
- [in] policy_handle *handle,
- [in] uint32 access_mask
+ [in] policy_handle *handle,
+ [in] uint32 access_mask
);
/* Function: 0x19 */
NTSTATUS lsa_OpenTrustedDomain(
[in] policy_handle *handle,
[in] dom_sid2 *sid,
- [in] uint32 access_mask,
+ [in] uint32 access_mask,
[out] policy_handle *trustdom_handle
);
@@ -543,22 +567,53 @@ import "security.idl";
} lsa_DATA_BUF2;
typedef enum {
- LSA_TRUSTED_DOMAIN_INFO_NAME = 1,
- LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS_INFO = 2,
- LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET = 3,
- LSA_TRUSTED_DOMAIN_INFO_PASSWORD = 4,
- LSA_TRUSTED_DOMAIN_INFO_BASIC = 5,
- LSA_TRUSTED_DOMAIN_INFO_INFO_EX = 6,
- LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO = 7,
- LSA_TRUSTED_DOMAIN_INFO_FULL_INFO = 8,
- LSA_TRUSTED_DOMAIN_INFO_11 = 11,
- LSA_TRUSTED_DOMAIN_INFO_INFO_ALL = 12
+ LSA_TRUSTED_DOMAIN_INFO_NAME = 1,
+ LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS = 2,
+ LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET = 3,
+ LSA_TRUSTED_DOMAIN_INFO_PASSWORD = 4,
+ LSA_TRUSTED_DOMAIN_INFO_BASIC = 5,
+ LSA_TRUSTED_DOMAIN_INFO_INFO_EX = 6,
+ LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO = 7,
+ LSA_TRUSTED_DOMAIN_INFO_FULL_INFO = 8,
+ LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL = 9,
+ LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL = 10,
+ LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL = 11,
+ LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL = 12,
+ LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES = 13
} lsa_TrustDomInfoEnum;
+ typedef [public,bitmap32bit] bitmap {
+ LSA_TRUST_DIRECTION_INBOUND = 0x00000001,
+ LSA_TRUST_DIRECTION_OUTBOUND = 0x00000002
+ } lsa_TrustDirection;
+
+ typedef [v1_enum] enum {
+ LSA_TRUST_TYPE_DOWNLEVEL = 0x00000001,
+ LSA_TRUST_TYPE_UPLEVEL = 0x00000002,
+ LSA_TRUST_TYPE_MIT = 0x00000003
+ } lsa_TrustType;
+
+ typedef [public,bitmap32bit] bitmap {
+ LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE = 0x00000001,
+ LSA_TRUST_ATTRIBUTE_UPLEVEL_ONLY = 0x00000002,
+ LSA_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN = 0x00000004,
+ LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE = 0x00000008,
+ LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION = 0x00000010,
+ LSA_TRUST_ATTRIBUTE_WITHIN_FOREST = 0x00000020,
+ LSA_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL = 0x00000040,
+ LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION = 0x00000080
+ } lsa_TrustAttributes;
+
typedef struct {
lsa_StringLarge netbios_name;
} lsa_TrustDomainInfoName;
+
+ typedef struct {
+ uint32 entries;
+ [size_is(entries)] lsa_StringLarge *netbios_names;
+ } lsa_TrustDomainInfoControllers;
+
typedef struct {
uint32 posix_offset;
} lsa_TrustDomainInfoPosixOffset;
@@ -576,15 +631,22 @@ import "security.idl";
typedef struct {
lsa_StringLarge domain_name;
lsa_StringLarge netbios_name;
- dom_sid2 *sid;
- uint32 trust_direction;
- uint32 trust_type;
- uint32 trust_attributes;
+ dom_sid2 *sid;
+ lsa_TrustDirection trust_direction;
+ lsa_TrustType trust_type;
+ lsa_TrustAttributes trust_attributes;
} lsa_TrustDomainInfoInfoEx;
+ typedef [public,v1_enum] enum {
+ TRUST_AUTH_TYPE_NONE = 0,
+ TRUST_AUTH_TYPE_NT4OWF = 1,
+ TRUST_AUTH_TYPE_CLEAR = 2,
+ TRUST_AUTH_TYPE_VERSION = 3
+ } lsa_TrustAuthType;
+
typedef struct {
NTTIME_hyper last_update_time;
- uint32 secret_type;
+ lsa_TrustAuthType AuthType;
lsa_DATA_BUF2 data;
} lsa_TrustDomainInfoBuffer;
@@ -604,27 +666,58 @@ import "security.idl";
} lsa_TrustDomainInfoFullInfo;
typedef struct {
- lsa_TrustDomainInfoInfoEx info_ex;
- lsa_DATA_BUF2 data1;
- } lsa_TrustDomainInfo11;
+ lsa_DATA_BUF2 auth_blob;
+ } lsa_TrustDomainInfoAuthInfoInternal;
+
+ typedef struct {
+ lsa_TrustDomainInfoInfoEx info_ex;
+ lsa_TrustDomainInfoPosixOffset posix_offset;
+ lsa_TrustDomainInfoAuthInfoInternal auth_info;
+ } lsa_TrustDomainInfoFullInfoInternal;
typedef struct {
lsa_TrustDomainInfoInfoEx info_ex;
- lsa_DATA_BUF2 data1;
+ uint32 forest_trust_length;
+ [size_is(forest_trust_length)] uint8 *forest_trust_data;
+ } lsa_TrustDomainInfoInfoEx2Internal;
+
+ typedef struct {
+ lsa_TrustDomainInfoInfoEx2Internal info;
lsa_TrustDomainInfoPosixOffset posix_offset;
lsa_TrustDomainInfoAuthInfo auth_info;
- } lsa_TrustDomainInfoInfoAll;
+ } lsa_TrustDomainInfoFullInfo2Internal;
+
+ typedef struct {
+ kerb_EncTypes enc_types;
+ } lsa_TrustDomainInfoSupportedEncTypes;
typedef [switch_type(lsa_TrustDomInfoEnum)] union {
- [case(LSA_TRUSTED_DOMAIN_INFO_NAME)] lsa_TrustDomainInfoName name;
- [case(LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET)] lsa_TrustDomainInfoPosixOffset posix_offset;
- [case(LSA_TRUSTED_DOMAIN_INFO_PASSWORD)] lsa_TrustDomainInfoPassword password;
- [case(LSA_TRUSTED_DOMAIN_INFO_BASIC)] lsa_TrustDomainInfoBasic info_basic;
- [case(LSA_TRUSTED_DOMAIN_INFO_INFO_EX)] lsa_TrustDomainInfoInfoEx info_ex;
- [case(LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO)] lsa_TrustDomainInfoAuthInfo auth_info;
- [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)] lsa_TrustDomainInfoFullInfo full_info;
- [case(LSA_TRUSTED_DOMAIN_INFO_11)] lsa_TrustDomainInfo11 info11;
- [case(LSA_TRUSTED_DOMAIN_INFO_INFO_ALL)] lsa_TrustDomainInfoInfoAll info_all;
+ [case(LSA_TRUSTED_DOMAIN_INFO_NAME)]
+ lsa_TrustDomainInfoName name;
+ [case(LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS)]
+ lsa_TrustDomainInfoControllers controllers;
+ [case(LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET)]
+ lsa_TrustDomainInfoPosixOffset posix_offset;
+ [case(LSA_TRUSTED_DOMAIN_INFO_PASSWORD)]
+ lsa_TrustDomainInfoPassword password;
+ [case(LSA_TRUSTED_DOMAIN_INFO_BASIC)]
+ lsa_TrustDomainInfoBasic info_basic;
+ [case(LSA_TRUSTED_DOMAIN_INFO_INFO_EX)]
+ lsa_TrustDomainInfoInfoEx info_ex;
+ [case(LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO)]
+ lsa_TrustDomainInfoAuthInfo auth_info;
+ [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)]
+ lsa_TrustDomainInfoFullInfo full_info;
+ [case(LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL)]
+ lsa_TrustDomainInfoAuthInfoInternal auth_info_internal;
+ [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL)]
+ lsa_TrustDomainInfoFullInfoInternal full_info_internal;
+ [case(LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL)]
+ lsa_TrustDomainInfoInfoEx2Internal info_ex2_internal;
+ [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL)]
+ lsa_TrustDomainInfoFullInfo2Internal full_info2_internal;
+ [case(LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES)]
+ lsa_TrustDomainInfoSupportedEncTypes enc_types;
} lsa_TrustedDomainInfo;
/* Function: 0x1a */
@@ -635,7 +728,11 @@ import "security.idl";
);
/* Function: 0x1b */
- NTSTATUS lsa_SetInformationTrustedDomain();
+ NTSTATUS lsa_SetInformationTrustedDomain(
+ [in] policy_handle *trustdom_handle,
+ [in] lsa_TrustDomInfoEnum level,
+ [in,switch_is(level)] lsa_TrustedDomainInfo *info
+ );
/* Function: 0x1c */
[public] NTSTATUS lsa_OpenSecret(
@@ -695,9 +792,10 @@ import "security.idl";
[out,ref] uint16 *returned_language_id
);
- /* Function: 0x22 */
- NTSTATUS lsa_DeleteObject(
- [in,out] policy_handle *handle
+ /*******************/
+ /* Function: 0x22 */
+ NTSTATUS lsa_DeleteObject (
+ [in,out] policy_handle *handle
);
/*******************/
@@ -732,7 +830,7 @@ import "security.idl";
[in,ref] dom_sid2 *sid,
[in,ref] lsa_RightSet *rights
);
-
+
/**********************/
/* Function: 0x26 */
NTSTATUS lsa_RemoveAccountRights (
@@ -751,7 +849,13 @@ import "security.idl";
);
/* Function: 0x28 */
- NTSTATUS lsa_SetTrustedDomainInfo();
+ NTSTATUS lsa_SetTrustedDomainInfo(
+ [in] policy_handle *handle,
+ [in] dom_sid2 *dom_sid,
+ [in] lsa_TrustDomInfoEnum level,
+ [in,switch_is(level)] lsa_TrustedDomainInfo *info
+ );
+
/* Function: 0x29 */
NTSTATUS lsa_DeleteTrustedDomain(
[in] policy_handle *handle,
@@ -759,9 +863,9 @@ import "security.idl";
);
/* Function: 0x2a */
- NTSTATUS lsa_StorePrivateData();
+ [todo] NTSTATUS lsa_StorePrivateData();
/* Function: 0x2b */
- NTSTATUS lsa_RetrievePrivateData();
+ [todo] NTSTATUS lsa_RetrievePrivateData();
/**********************/
@@ -811,7 +915,7 @@ import "security.idl";
NTSTATUS lsa_SetTrustedDomainInfoByName(
[in] policy_handle *handle,
[in] lsa_String trusted_domain,
- [in] lsa_TrustDomInfoEnum level,
+ [in] lsa_TrustDomInfoEnum level,
[in,unique,switch_is(level)] lsa_TrustedDomainInfo *info
);
@@ -832,9 +936,15 @@ import "security.idl";
[in] uint32 max_size
);
-
/* Function 0x33 */
- NTSTATUS lsa_CreateTrustedDomainEx();
+ NTSTATUS lsa_CreateTrustedDomainEx(
+ [in] policy_handle *policy_handle,
+ [in] lsa_TrustDomainInfoInfoEx *info,
+ [in] lsa_TrustDomainInfoAuthInfoInternal *auth_info,
+ [in] uint32 access_mask,
+ [out] policy_handle *trustdom_handle
+ );
+
/* Function 0x34 */
NTSTATUS lsa_CloseTrustedDomainEx(
@@ -892,7 +1002,7 @@ import "security.idl";
);
/* Function 0x38 */
- NTSTATUS lsa_TestCall();
+ [todo] NTSTATUS lsa_TestCall();
/**********************/
/* Function 0x39 */
@@ -943,36 +1053,42 @@ import "security.idl";
[in,out,ref] lsa_TransSidArray2 *sids,
[in] lsa_LookupNamesLevel level,
[in,out,ref] uint32 *count,
- [in] uint32 unknown1,
- [in] uint32 unknown2
+ [in] uint32 lookup_options,
+ [in] uint32 client_revision /* LSA_CLIENT_REVISION* */
);
/* Function 0x3b */
- NTSTATUS lsa_CreateTrustedDomainEx2();
+ NTSTATUS lsa_CreateTrustedDomainEx2(
+ [in] policy_handle *policy_handle,
+ [in] lsa_TrustDomainInfoInfoEx *info,
+ [in] lsa_TrustDomainInfoAuthInfoInternal *auth_info,
+ [in] uint32 access_mask,
+ [out] policy_handle *trustdom_handle
+ );
/* Function 0x3c */
- NTSTATUS lsa_CREDRWRITE();
+ [todo] NTSTATUS lsa_CREDRWRITE();
/* Function 0x3d */
- NTSTATUS lsa_CREDRREAD();
+ [todo] NTSTATUS lsa_CREDRREAD();
/* Function 0x3e */
- NTSTATUS lsa_CREDRENUMERATE();
+ [todo] NTSTATUS lsa_CREDRENUMERATE();
/* Function 0x3f */
- NTSTATUS lsa_CREDRWRITEDOMAINCREDENTIALS();
+ [todo] NTSTATUS lsa_CREDRWRITEDOMAINCREDENTIALS();
/* Function 0x40 */
- NTSTATUS lsa_CREDRREADDOMAINCREDENTIALS();
+ [todo] NTSTATUS lsa_CREDRREADDOMAINCREDENTIALS();
/* Function 0x41 */
- NTSTATUS lsa_CREDRDELETE();
+ [todo] NTSTATUS lsa_CREDRDELETE();
/* Function 0x42 */
- NTSTATUS lsa_CREDRGETTARGETINFO();
+ [todo] NTSTATUS lsa_CREDRGETTARGETINFO();
/* Function 0x43 */
- NTSTATUS lsa_CREDRPROFILELOADED();
+ [todo] NTSTATUS lsa_CREDRPROFILELOADED();
/**********************/
/* Function 0x44 */
@@ -980,7 +1096,7 @@ import "security.idl";
lsa_SidType sid_type;
dom_sid2 *sid;
uint32 sid_index;
- uint32 unknown;
+ uint32 flags;
} lsa_TranslatedSid3;
typedef struct {
@@ -996,21 +1112,21 @@ import "security.idl";
[in,out,ref] lsa_TransSidArray3 *sids,
[in] lsa_LookupNamesLevel level,
[in,out,ref] uint32 *count,
- [in] uint32 unknown1,
- [in] uint32 unknown2
+ [in] uint32 lookup_options,
+ [in] uint32 client_revision /* LSA_CLIENT_REVISION* */
);
/* Function 0x45 */
- NTSTATUS lsa_CREDRGETSESSIONTYPES();
+ [todo] NTSTATUS lsa_CREDRGETSESSIONTYPES();
/* Function 0x46 */
- NTSTATUS lsa_LSARREGISTERAUDITEVENT();
+ [todo] NTSTATUS lsa_LSARREGISTERAUDITEVENT();
/* Function 0x47 */
- NTSTATUS lsa_LSARGENAUDITEVENT();
+ [todo] NTSTATUS lsa_LSARGENAUDITEVENT();
/* Function 0x48 */
- NTSTATUS lsa_LSARUNREGISTERAUDITEVENT();
+ [todo] NTSTATUS lsa_LSARUNREGISTERAUDITEVENT();
/* Function 0x49 */
typedef struct {
@@ -1058,10 +1174,10 @@ import "security.idl";
);
/* Function 0x4a */
- NTSTATUS lsa_LSARSETFORESTTRUSTINFORMATION();
+ [todo] NTSTATUS lsa_LSARSETFORESTTRUSTINFORMATION();
/* Function 0x4b */
- NTSTATUS lsa_CREDRRENAME();
+ [todo] NTSTATUS lsa_CREDRRENAME();
/*****************/
/* Function 0x4c */
@@ -1076,6 +1192,11 @@ import "security.idl";
[in] uint32 unknown2
);
+ const int LSA_CLIENT_REVISION_NO_DNS = 0x00000001;
+ const int LSA_CLIENT_REVISION_DNS = 0x00000002;
+
+ const int LSA_LOOKUP_OPTIONS_NO_ISOLATED = 0x80000000;
+
/* Function 0x4d */
NTSTATUS lsa_LookupNames4(
[in,range(0,1000)] uint32 num_names,
@@ -1084,20 +1205,20 @@ import "security.idl";
[in,out,ref] lsa_TransSidArray3 *sids,
[in] lsa_LookupNamesLevel level,
[in,out,ref] uint32 *count,
- [in] uint32 unknown1,
- [in] uint32 unknown2
+ [in] uint32 lookup_options,
+ [in] uint32 client_revision /* LSA_CLIENT_REVISION* */
);
/* Function 0x4e */
- NTSTATUS lsa_LSAROPENPOLICYSCE();
+ [todo] NTSTATUS lsa_LSAROPENPOLICYSCE();
/* Function 0x4f */
- NTSTATUS lsa_LSARADTREGISTERSECURITYEVENTSOURCE();
+ [todo] NTSTATUS lsa_LSARADTREGISTERSECURITYEVENTSOURCE();
/* Function 0x50 */
- NTSTATUS lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE();
+ [todo] NTSTATUS lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE();
/* Function 0x51 */
- NTSTATUS lsa_LSARADTREPORTSECURITYEVENT();
+ [todo] NTSTATUS lsa_LSARADTREPORTSECURITYEVENT();
}
diff --git a/source3/librpc/idl/misc.idl b/source3/librpc/idl/misc.idl
deleted file mode 100644
index 132a81f138..0000000000
--- a/source3/librpc/idl/misc.idl
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- miscellaneous IDL structures
-*/
-
-
-[
- pointer_default(unique)
-]
-interface misc
-{
- typedef [public,noprint,gensize,noejs] struct {
- uint32 time_low;
- uint16 time_mid;
- uint16 time_hi_and_version;
- uint8 clock_seq[2];
- uint8 node[6];
- } GUID;
-
- typedef [public] struct {
- GUID uuid;
- uint32 if_version;
- } ndr_syntax_id;
-
- typedef [public] struct {
- uint32 handle_type;
- GUID uuid;
- } policy_handle;
-
- /* secure channel types */
- /* Only SEC_CHAN_WKSTA can forward requests to other domains. */
-
- typedef [public] enum {
- SEC_CHAN_WKSTA = 2,
- SEC_CHAN_DOMAIN = 4,
- SEC_CHAN_BDC = 6
- } netr_SchannelType;
-
- /* SAM database types */
- typedef [public,v1_enum] enum {
- SAM_DATABASE_DOMAIN = 0, /* Domain users and groups */
- SAM_DATABASE_BUILTIN = 1, /* BUILTIN users and groups */
- SAM_DATABASE_PRIVS = 2 /* Privileges */
- } netr_SamDatabaseID;
-
- typedef [public,v1_enum] enum {
- SAMR_REJECT_OTHER = 0,
- SAMR_REJECT_TOO_SHORT = 1,
- SAMR_REJECT_IN_HISTORY = 2,
- SAMR_REJECT_COMPLEXITY = 5
- } samr_RejectReason;
-}
diff --git a/source3/librpc/idl/nbt.idl b/source3/librpc/idl/nbt.idl
deleted file mode 100644
index 9f5c4a9a5f..0000000000
--- a/source3/librpc/idl/nbt.idl
+++ /dev/null
@@ -1,781 +0,0 @@
-#include "idl_types.h"
-
-/*
- IDL structures for NBT operations
-
- NBT is not traditionally encoded using IDL/NDR. This is a bit of an
- experiment, and I may well switch us back to a more traditional
- encoding if it doesn't work out
-*/
-
-import "misc.idl", "security.idl", "svcctl.idl", "samr.idl";
-[
-helper("libcli/nbt/libnbt.h")
-]
-interface nbt
-{
- const int NBT_NAME_SERVICE_PORT = 137;
- const int NBT_DGRAM_SERVICE_PORT = 138;
-
- typedef [bitmap16bit] bitmap {
- NBT_RCODE = 0x000F,
- NBT_FLAG_BROADCAST = 0x0010,
- NBT_FLAG_RECURSION_AVAIL = 0x0080,
- NBT_FLAG_RECURSION_DESIRED = 0x0100,
- NBT_FLAG_TRUNCATION = 0x0200,
- NBT_FLAG_AUTHORITIVE = 0x0400,
- NBT_OPCODE = 0x7800,
- NBT_FLAG_REPLY = 0x8000
- } nbt_operation;
-
- /* the opcodes are in the operation field, masked with
- NBT_OPCODE */
- typedef enum {
- NBT_OPCODE_QUERY = (0x0<<11),
- NBT_OPCODE_REGISTER = (0x5<<11),
- NBT_OPCODE_RELEASE = (0x6<<11),
- NBT_OPCODE_WACK = (0x7<<11),
- NBT_OPCODE_REFRESH = (0x8<<11),
- NBT_OPCODE_REFRESH2 = (0x9<<11),
- NBT_OPCODE_MULTI_HOME_REG = (0xf<<11)
- } nbt_opcode;
-
- /* rcode values */
- typedef enum {
- NBT_RCODE_OK = 0x0,
- NBT_RCODE_FMT = 0x1,
- NBT_RCODE_SVR = 0x2,
- NBT_RCODE_NAM = 0x3,
- NBT_RCODE_IMP = 0x4,
- NBT_RCODE_RFS = 0x5,
- NBT_RCODE_ACT = 0x6,
- NBT_RCODE_CFT = 0x7
- } nbt_rcode;
-
- /* we support any 8bit name type, but by defining the common
- ones here we get better debug displays */
- typedef [enum8bit] enum {
- NBT_NAME_CLIENT = 0x00,
- NBT_NAME_MS = 0x01,
- NBT_NAME_USER = 0x03,
- NBT_NAME_SERVER = 0x20,
- NBT_NAME_PDC = 0x1B,
- NBT_NAME_LOGON = 0x1C,
- NBT_NAME_MASTER = 0x1D,
- NBT_NAME_BROWSER = 0x1E
- } nbt_name_type;
-
- /* the ndr parser for nbt_name is separately defined in
- nbtname.c (along with the parsers for nbt_string) */
- typedef [public,nopull,nopush] struct {
- string name;
- string scope;
- nbt_name_type type;
- } nbt_name;
-
- typedef [enum16bit] enum {
- NBT_QCLASS_IP = 0x01
- } nbt_qclass;
-
- typedef [enum16bit] enum {
- NBT_QTYPE_ADDRESS = 0x0001,
- NBT_QTYPE_NAMESERVICE = 0x0002,
- NBT_QTYPE_NULL = 0x000A,
- NBT_QTYPE_NETBIOS = 0x0020,
- NBT_QTYPE_STATUS = 0x0021
- } nbt_qtype;
-
- typedef struct {
- nbt_name name;
- nbt_qtype question_type;
- nbt_qclass question_class;
- } nbt_name_question;
-
- /* these are the possible values of the NBT_NM_OWNER_TYPE
- field */
- typedef enum {
- NBT_NODE_B = 0x0000,
- NBT_NODE_P = 0x2000,
- NBT_NODE_M = 0x4000,
- NBT_NODE_H = 0x6000
- } nbt_node_type;
-
- typedef [bitmap16bit] bitmap {
- NBT_NM_PERMANENT = 0x0200,
- NBT_NM_ACTIVE = 0x0400,
- NBT_NM_CONFLICT = 0x0800,
- NBT_NM_DEREGISTER = 0x1000,
- NBT_NM_OWNER_TYPE = 0x6000,
- NBT_NM_GROUP = 0x8000
- } nb_flags;
-
- typedef struct {
- nb_flags nb_flags;
- ipv4address ipaddr;
- } nbt_rdata_address;
-
- typedef struct {
- uint16 length;
- nbt_rdata_address addresses[length/6];
- } nbt_rdata_netbios;
-
- typedef struct {
- uint8 unit_id[6];
- uint8 jumpers;
- uint8 test_result;
- uint16 version_number;
- uint16 period_of_statistics;
- uint16 number_of_crcs;
- uint16 number_alignment_errors;
- uint16 number_of_collisions;
- uint16 number_send_aborts;
- uint32 number_good_sends;
- uint32 number_good_receives;
- uint16 number_retransmits;
- uint16 number_no_resource_conditions;
- uint16 number_free_command_blocks;
- uint16 total_number_command_blocks;
- uint16 max_total_number_command_blocks;
- uint16 number_pending_sessions;
- uint16 max_number_pending_sessions;
- uint16 max_total_sessions_possible;
- uint16 session_data_packet_size;
- } nbt_statistics;
-
- typedef struct {
- [charset(DOS)] uint8 name[15];
- nbt_name_type type;
- nb_flags nb_flags;
- } nbt_status_name;
-
- typedef struct {
- [value(num_names * 18 + 47)] uint16 length;
- uint8 num_names;
- nbt_status_name names[num_names];
- nbt_statistics statistics;
- } nbt_rdata_status;
-
- typedef struct {
- uint16 length;
- uint8 data[length];
- } nbt_rdata_data;
-
- typedef [nodiscriminant] union {
- [case(NBT_QTYPE_NETBIOS)] nbt_rdata_netbios netbios;
- [case(NBT_QTYPE_STATUS)] nbt_rdata_status status;
- [default] nbt_rdata_data data;
- } nbt_rdata;
-
-/*
- * this macro works arround the problem
- * that we need to use nbt_rdata_data
- * together with NBT_QTYPE_NETBIOS
- * for WACK replies
- */
-#define NBT_RES_REC_LEVEL(rr_type, rdata) (\
- (((rr_type) == NBT_QTYPE_NETBIOS) && \
- talloc_check_name(ndr, "struct ndr_push") && \
- ((rdata).data.length == 2)) \
- ? 0 : rr_type)
-
- typedef [flag(LIBNDR_PRINT_ARRAY_HEX)] struct {
- nbt_name name;
- nbt_qtype rr_type;
- nbt_qclass rr_class;
- uint32 ttl;
- [switch_is(NBT_RES_REC_LEVEL(rr_type, rdata))] nbt_rdata rdata;
- } nbt_res_rec;
-
- typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
- uint16 name_trn_id;
- nbt_operation operation;
- uint16 qdcount;
- uint16 ancount;
- uint16 nscount;
- uint16 arcount;
- nbt_name_question questions[qdcount];
- nbt_res_rec answers[ancount];
- nbt_res_rec nsrecs[nscount];
- nbt_res_rec additional[arcount];
- [flag(NDR_REMAINING)] DATA_BLOB padding;
- } nbt_name_packet;
-
-
- /*
- NBT DGRAM packets (UDP/138)
- */
-
- typedef [enum8bit] enum {
- DGRAM_DIRECT_UNIQUE = 0x10,
- DGRAM_DIRECT_GROUP = 0x11,
- DGRAM_BCAST = 0x12,
- DGRAM_ERROR = 0x13,
- DGRAM_QUERY = 0x14,
- DGRAM_QUERY_POSITIVE = 0x15,
- DGRAM_QUERY_NEGATIVE = 0x16
- } dgram_msg_type;
-
- typedef [bitmap8bit] bitmap {
- DGRAM_FLAG_MORE = 0x01,
- DGRAM_FLAG_FIRST = 0x02,
- DGRAM_FLAG_NODE_TYPE = 0x0C
- } dgram_flags;
-
- typedef [enum8bit] enum {
- DGRAM_NODE_B = 0x00,
- DGRAM_NODE_P = 0x04,
- DGRAM_NODE_M = 0x08,
- DGRAM_NODE_NBDD = 0x0C
- } dgram_node_type;
-
- /* a dgram_message is the main dgram body in general use */
-
- /* the most common datagram type is a SMB_TRANSACTION
- operation, where a SMB packet is used in the data section
- of a dgram_message to hold a trans request, which in turn
- holds a small command structure. It's a very strange beast
- indeed. To make the code cleaner we define a basic SMB
- packet in IDL here. This is not a general purpose SMB
- packet, and won't be used in the core SMB client/server
- code, but it does make working with these types of dgrams
- easier */
-
- const string NBT_MAILSLOT_NETLOGON = "\\MAILSLOT\\NET\\NETLOGON";
- const string NBT_MAILSLOT_NTLOGON = "\\MAILSLOT\\NET\\NTLOGON";
- const string NBT_MAILSLOT_GETDC = "\\MAILSLOT\\NET\\GETDC";
- const string NBT_MAILSLOT_BROWSE = "\\MAILSLOT\\BROWSE";
-
- typedef [enum8bit] enum {
- SMB_TRANSACTION = 0x25
- } smb_command;
-
- typedef struct {
- [range(17,17),value(17)] uint8 wct;
- uint16 total_param_count;
- uint16 total_data_count;
- uint16 max_param_count;
- uint16 max_data_count;
- uint8 max_setup_count;
- uint8 pad;
- uint16 trans_flags;
- uint32 timeout;
- uint16 reserved;
- uint16 param_count;
- uint16 param_offset;
- uint16 data_count;
- uint16 data_offset;
- [range(3,3),value(3)] uint8 setup_count;
- uint8 pad2;
- uint16 opcode;
- uint16 priority;
- uint16 _class;
- [value(strlen(mailslot_name)+1+data.length)]
- uint16 byte_count;
- astring mailslot_name;
- [flag(NDR_REMAINING)] DATA_BLOB data;
- } smb_trans_body;
-
- typedef [nodiscriminant] union {
- [case(SMB_TRANSACTION)] smb_trans_body trans;
- } smb_body;
-
-
- typedef [flag(NDR_NOALIGN|NDR_LITTLE_ENDIAN|NDR_PAHEX),public] struct {
- smb_command smb_command;
- uint8 err_class;
- uint8 pad;
- uint16 err_code;
- uint8 flags;
- uint16 flags2;
- uint16 pid_high;
- uint8 signature[8];
- uint16 reserved;
- uint16 tid;
- uint16 pid;
- uint16 vuid;
- uint16 mid;
- [switch_is(smb_command)] smb_body body;
- } dgram_smb_packet;
-
- const uint32 DGRAM_SMB = 0xff534d42; /* 0xffSMB */
-
- typedef [nodiscriminant] union {
- [case(DGRAM_SMB)] dgram_smb_packet smb;
- } dgram_message_body;
-
- typedef struct {
- uint16 length;
- uint16 offset;
- nbt_name source_name;
- nbt_name dest_name;
- uint32 dgram_body_type;
- [switch_is(dgram_body_type)] dgram_message_body body;
- } dgram_message;
-
- typedef [enum8bit] enum {
- DGRAM_ERROR_NAME_NOT_PRESENT = 0x82,
- DGRAM_ERROR_INVALID_SOURCE = 0x83,
- DGRAM_ERROR_INVALID_DEST = 0x84
- } dgram_err_code;
-
- typedef [nodiscriminant] union {
- [case(DGRAM_DIRECT_UNIQUE)] dgram_message msg;
- [case(DGRAM_DIRECT_GROUP)] dgram_message msg;
- [case(DGRAM_BCAST)] dgram_message msg;
- [case(DGRAM_ERROR)] dgram_err_code error;
- [case(DGRAM_QUERY)] nbt_name dest_name;
- [case(DGRAM_QUERY_POSITIVE)] nbt_name dest_name;
- [case(DGRAM_QUERY_NEGATIVE)] nbt_name dest_name;
- } dgram_data;
-
- typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct {
- dgram_msg_type msg_type;
- dgram_flags flags;
- uint16 dgram_id;
- ipv4address src_addr;
- uint16 src_port;
- [switch_is(msg_type)] dgram_data data;
- } nbt_dgram_packet;
-
-
- /*******************************************/
- /* \MAILSLOT\NET\NETLOGON mailslot requests */
- typedef enum {
- NETLOGON_QUERY_FOR_PDC = 0x7,
- NETLOGON_ANNOUNCE_UAS = 0xa,
- NETLOGON_RESPONSE_FROM_PDC = 0xc,
- NETLOGON_QUERY_FOR_PDC2 = 0x12,
- NETLOGON_RESPONSE_FROM_PDC2 = 0x17,
- NETLOGON_RESPONSE_FROM_PDC_USER = 0x19
- } nbt_netlogon_command;
-
- typedef [flag(NDR_LITTLE_ENDIAN),bitmap32bit] bitmap {
- NETLOGON_VERSION_1 = 0x00000001,
- NETLOGON_VERSION_5 = 0x00000002,
- NETLOGON_VERSION_5EX = 0x00000004,
- NETLOGON_VERSION_5EX_WITH_IP = 0x00000008,
- NETLOGON_VERSION_WITH_CLOSEST_SITE = 0x00000010,
- NETLOGON_VERSION_AVOID_NT4_EMUL = 0x01000000,
- NETLOGON_VERSION_PDC = 0x10000000,
- NETLOGON_VERSION_IP = 0x20000000,
- NETLOGON_VERSION_LOCAL = 0x40000000,
- NETLOGON_VERSION_GC = 0x80000000
- } nbt_netlogon_version;
-
- /* query for pdc request */
- typedef struct {
- astring computer_name;
- astring mailslot_name;
- [flag(NDR_ALIGN2)] DATA_BLOB _pad;
- nstring unicode_name;
- nbt_netlogon_version nt_version;
- uint16 lmnt_token;
- uint16 lm20_token;
- } nbt_netlogon_query_for_pdc;
-
- /* query for pdc request - new style */
- typedef struct {
- uint16 request_count;
- nstring computer_name;
- nstring user_name;
- astring mailslot_name;
- uint32 unknown[2];
- nbt_netlogon_version nt_version;
- uint16 lmnt_token;
- uint16 lm20_token;
- } nbt_netlogon_query_for_pdc2;
-
- /* response from pdc */
- typedef struct {
- astring pdc_name;
- [flag(NDR_ALIGN2)] DATA_BLOB _pad;
- nstring unicode_pdc_name;
- nstring domain_name;
- nbt_netlogon_version nt_version;
- uint16 lmnt_token;
- uint16 lm20_token;
- } nbt_netlogon_response_from_pdc;
-
- typedef [bitmap32bit] bitmap {
- NBT_SERVER_PDC = 0x00000001,
- NBT_SERVER_GC = 0x00000004,
- NBT_SERVER_LDAP = 0x00000008,
- NBT_SERVER_DS = 0x00000010,
- NBT_SERVER_KDC = 0x00000020,
- NBT_SERVER_TIMESERV = 0x00000040,
- NBT_SERVER_CLOSEST = 0x00000080,
- NBT_SERVER_WRITABLE = 0x00000100,
- NBT_SERVER_GOOD_TIMESERV = 0x00000200,
- NBT_SERVER_NDNC = 0x00000400,
- NBT_SERVER_SELECT_SECRET_DOMAIN_6 = 0x00000800,
- NBT_SERVER_FULL_SECRET_DOMAIN_6 = 0x00001000
- } nbt_server_type;
-
- typedef struct {
- uint32 family;
- [flag(NDR_BIG_ENDIAN)] ipv4address pdc_ip;
- [flag(NDR_REMAINING)] DATA_BLOB remaining;
- } nbt_dc_sock_addr;
-
- /* response from pdc - type2 */
- typedef struct {
- [flag(NDR_ALIGN4)] DATA_BLOB _pad;
- nbt_server_type server_type;
- GUID domain_uuid;
- nbt_string forest;
- nbt_string dns_domain;
- nbt_string pdc_dns_name;
- nbt_string domain;
- nbt_string pdc_name;
- nbt_string user_name;
- nbt_string server_site;
- nbt_string client_site;
- uint8 dc_sock_addr_size;
- [subcontext(0),subcontext_size(dc_sock_addr_size)] nbt_dc_sock_addr dc_sock_addr;
- nbt_netlogon_version nt_version;
- uint16 lmnt_token;
- uint16 lm20_token;
- } nbt_netlogon_response_from_pdc2;
-
- typedef enum netr_SamDatabaseID netr_SamDatabaseID;
-
- /* announce change to UAS or SAM */
- typedef struct {
- netr_SamDatabaseID db_index;
- hyper serial;
- NTTIME timestamp;
- } nbt_db_change;
-
- /* used to announce SAM changes */
- typedef struct {
- uint32 serial_lo;
- time_t timestamp;
- uint32 pulse;
- uint32 random;
- astring pdc_name;
- astring domain;
- [flag(NDR_ALIGN2)] DATA_BLOB _pad;
- nstring unicode_pdc_name;
- nstring unicode_domain;
- uint32 db_count;
- nbt_db_change dbchange[db_count];
- [value(ndr_size_dom_sid0(&sid, ndr->flags))] uint32 sid_size;
- [subcontext(0),subcontext_size(sid_size)] dom_sid0 sid;
- nbt_netlogon_version nt_version;
- uint16 lmnt_token;
- uint16 lm20_token;
- } nbt_netlogon_announce_uas;
-
- typedef [nodiscriminant] union {
- [case(NETLOGON_QUERY_FOR_PDC)] nbt_netlogon_query_for_pdc pdc;
- [case(NETLOGON_QUERY_FOR_PDC2)] nbt_netlogon_query_for_pdc2 pdc2;
- [case(NETLOGON_ANNOUNCE_UAS)] nbt_netlogon_announce_uas uas;
- [case(NETLOGON_RESPONSE_FROM_PDC)] nbt_netlogon_response_from_pdc response;
- [case(NETLOGON_RESPONSE_FROM_PDC2)] nbt_netlogon_response_from_pdc2 response2;
- [case(NETLOGON_RESPONSE_FROM_PDC_USER)] nbt_netlogon_response_from_pdc2 response2;
- } nbt_netlogon_request;
-
- typedef [flag(NDR_NOALIGN),public] struct {
- nbt_netlogon_command command;
- [switch_is(command)] nbt_netlogon_request req;
- } nbt_netlogon_packet;
-
- /*******************************************/
- /* CLDAP netlogon response */
-
- /* note that these structures are very similar to, but not
- quite identical to, the netlogon structures above */
-
- typedef struct {
- nbt_netlogon_command type;
- nstring pdc_name;
- nstring user_name;
- nstring domain_name;
- [value(1)] nbt_netlogon_version nt_version;
- uint16 lmnt_token;
- uint16 lm20_token;
- } nbt_cldap_netlogon_1;
-
- typedef struct {
- nbt_netlogon_command type;
- nstring pdc_name;
- nstring user_name;
- nstring domain_name;
- GUID domain_uuid;
- GUID unknown_uuid;
- nbt_string forest;
- nbt_string dns_domain;
- nbt_string pdc_dns_name;
- ipv4address pdc_ip;
- nbt_server_type server_type;
- [value(3)] nbt_netlogon_version nt_version;
- uint16 lmnt_token;
- uint16 lm20_token;
- } nbt_cldap_netlogon_3;
-
- typedef [public] struct {
- nbt_netlogon_command type;
- uint16 sbz;
- nbt_server_type server_type;
- GUID domain_uuid;
- nbt_string forest;
- nbt_string dns_domain;
- nbt_string pdc_dns_name;
- nbt_string domain;
- nbt_string pdc_name;
- nbt_string user_name;
- nbt_string server_site;
- nbt_string client_site;
- [value(5)] nbt_netlogon_version nt_version;
- uint16 lmnt_token;
- uint16 lm20_token;
- } nbt_cldap_netlogon_5;
-
- typedef struct {
- nbt_netlogon_command type;
- uint16 sbz;
- nbt_server_type server_type;
- GUID domain_uuid;
- nbt_string forest;
- nbt_string dns_domain;
- nbt_string pdc_dns_name;
- nbt_string domain;
- nbt_string pdc_name;
- nbt_string user_name;
- nbt_string server_site;
- nbt_string client_site;
- uint8 dc_sock_addr_size;
- [subcontext(0),subcontext_size(dc_sock_addr_size)] nbt_dc_sock_addr dc_sock_addr;
- [value(13)] nbt_netlogon_version nt_version;
- uint16 lmnt_token;
- uint16 lm20_token;
- } nbt_cldap_netlogon_13;
-
- typedef [public] struct {
- nbt_netlogon_command type;
- uint16 sbz;
- nbt_server_type server_type;
- GUID domain_uuid;
- nbt_string forest;
- nbt_string dns_domain;
- nbt_string pdc_dns_name;
- nbt_string domain;
- nbt_string pdc_name;
- nbt_string user_name;
- nbt_string server_site;
- nbt_string client_site;
- nbt_string next_closest_site;
- [value(15)] nbt_netlogon_version nt_version;
- uint16 lmnt_token;
- uint16 lm20_token;
- } nbt_cldap_netlogon_15;
-
- typedef [public] struct {
- nbt_netlogon_command type;
- uint16 sbz;
- nbt_server_type server_type;
- GUID domain_uuid;
- nbt_string forest;
- nbt_string dns_domain;
- nbt_string pdc_dns_name;
- nbt_string domain;
- nbt_string pdc_name;
- nbt_string user_name;
- nbt_string server_site;
- nbt_string client_site;
- uint8 dc_sock_addr_size;
- [subcontext(0),subcontext_size(dc_sock_addr_size)] nbt_dc_sock_addr dc_sock_addr;
- nbt_string next_closest_site;
- [value(29)] nbt_netlogon_version nt_version;
- uint16 lmnt_token;
- uint16 lm20_token;
- } nbt_cldap_netlogon_29;
-
- typedef [flag(NDR_NOALIGN),public,nodiscriminant] union {
- [case(0)] nbt_cldap_netlogon_1 logon1;
- [case(1)] nbt_cldap_netlogon_1 logon1;
- [case(2)] nbt_cldap_netlogon_3 logon3;
- [case(3)] nbt_cldap_netlogon_3 logon3;
- [case(4)] nbt_cldap_netlogon_5 logon5;
- [case(5)] nbt_cldap_netlogon_5 logon5;
- [case(6)] nbt_cldap_netlogon_5 logon5;
- [case(7)] nbt_cldap_netlogon_5 logon5;
- [case(8)] nbt_cldap_netlogon_13 logon13;
- [case(9)] nbt_cldap_netlogon_13 logon13;
- [case(10)] nbt_cldap_netlogon_13 logon13;
- [case(11)] nbt_cldap_netlogon_13 logon13;
- [case(12)] nbt_cldap_netlogon_13 logon13;
- [case(13)] nbt_cldap_netlogon_13 logon13;
- [case(14)] nbt_cldap_netlogon_13 logon13;
- [case(15)] nbt_cldap_netlogon_13 logon13;
- [case(16)] nbt_cldap_netlogon_1 logon1;
- [case(17)] nbt_cldap_netlogon_1 logon1;
- [case(18)] nbt_cldap_netlogon_3 logon3;
- [case(19)] nbt_cldap_netlogon_3 logon3;
- [case(20)] nbt_cldap_netlogon_15 logon15;
- [case(21)] nbt_cldap_netlogon_15 logon15;
- [case(22)] nbt_cldap_netlogon_15 logon15;
- [case(23)] nbt_cldap_netlogon_15 logon15;
- [case(24)] nbt_cldap_netlogon_15 logon15;
- [case(25)] nbt_cldap_netlogon_15 logon15;
- [case(26)] nbt_cldap_netlogon_15 logon15;
- [case(27)] nbt_cldap_netlogon_15 logon15;
- [case(28)] nbt_cldap_netlogon_15 logon15;
- [case(29)] nbt_cldap_netlogon_29 logon29;
- [case(30)] nbt_cldap_netlogon_29 logon29;
- [case(31)] nbt_cldap_netlogon_29 logon29;
- } nbt_cldap_netlogon;
-
- /*******************************************/
- /* \MAILSLOT\NET\NTLOGON mailslot requests */
- typedef enum {
- NTLOGON_SAM_LOGON = 0x12,
- NTLOGON_SAM_LOGON_REPLY = 0x13,
- NTLOGON_SAM_LOGON_REPLY15 = 0x15,
- NTLOGON_RESPONSE_FROM_PDC2 = 0x17
- } nbt_ntlogon_command;
-
- typedef struct {
- uint16 request_count;
- nstring computer_name;
- nstring user_name;
- astring mailslot_name;
- samr_AcctFlags acct_control;
- [value(ndr_size_dom_sid0(&sid, ndr->flags))] uint32 sid_size;
- [subcontext(0),subcontext_size(sid_size)] dom_sid0 sid;
- nbt_netlogon_version nt_version;
- uint16 lmnt_token;
- uint16 lm20_token;
- } nbt_ntlogon_sam_logon;
-
- typedef struct {
- nstring server;
- nstring user_name;
- nstring domain;
- nbt_netlogon_version nt_version;
- uint16 lmnt_token;
- uint16 lm20_token;
- } nbt_ntlogon_sam_logon_reply;
-
- typedef [nodiscriminant] union {
- [case(NTLOGON_SAM_LOGON)] nbt_ntlogon_sam_logon logon;
- [case(NTLOGON_SAM_LOGON_REPLY)] nbt_ntlogon_sam_logon_reply reply;
- [case(NTLOGON_SAM_LOGON_REPLY15)] nbt_ntlogon_sam_logon_reply reply;
- [case(NTLOGON_RESPONSE_FROM_PDC2)] nbt_netlogon_response_from_pdc2 reply2;
- } nbt_ntlogon_request;
-
- typedef [flag(NDR_NOALIGN),public] struct {
- nbt_ntlogon_command command;
- [switch_is(command)] nbt_ntlogon_request req;
- } nbt_ntlogon_packet;
-
- /********************************************************/
- /* \MAILSLOT\BROWSE mailslot requests */
- /* for details see http://ubiqx.org/cifs/Browsing.html */
- /********************************************************/
- typedef bitmap svcctl_ServerType svcctl_ServerType;
-
- typedef [enum8bit] enum {
- HostAnnouncement = 1,
- AnnouncementRequest = 2,
- Election = 8,
- GetBackupListReq = 9,
- GetBackupListResp = 10,
- BecomeBackup = 11,
- DomainAnnouncement = 12,
- MasterAnnouncement = 13,
- ResetBrowserState = 14,
- LocalMasterAnnouncement = 15
- } nbt_browse_opcode;
-
- typedef struct {
- uint8 UpdateCount;
- uint32 Periodicity;
- [charset(DOS)] uint8 ServerName[16];
- uint8 OSMajor;
- uint8 OSMinor;
- svcctl_ServerType ServerType;
- uint8 BroMajorVer;
- uint8 BroMinorVer;
- uint16 Signature;
- astring Comment;
- } nbt_browse_host_announcement;
-
- typedef struct {
- uint8 Unused;
- astring ResponseName;
- } nbt_browse_announcement_request;
-
- typedef struct {
- uint8 Version;
- uint32 Criteria;
- uint32 UpTime; /* In milliseconds */
- uint32 Reserved; /* Must be zero */
- astring ServerName;
- } nbt_browse_election_request;
-
- typedef struct {
- uint8 ReqCount;
- uint32 Token;
- } nbt_browse_backup_list_request;
-
- typedef struct {
- uint8 BackupCount;
- uint32 Token;
- nbt_name BackupServerList[BackupCount];/* TODO: this is wrong */
- } nbt_browse_backup_list_response;
-
- typedef struct {
- astring BrowserName;
- } nbt_browse_become_backup;
-
- typedef struct {
- uint8 UpdateCount;
- uint32 Periodicity;
- [charset(DOS)] uint8 ServerName[16];
- uint8 OSMajor;
- uint8 OSMinor;
- svcctl_ServerType ServerType;
- uint32 MysteriousField;
- astring Comment;
- } nbt_browse_domain_announcement;
-
- typedef struct {
- astring ServerName;
- } nbt_browse_master_announcement;
-
- typedef struct {
- uint8 Command;
- } nbt_browse_reset_state;
-
- typedef struct {
- uint8 UpdateCount;
- uint32 Periodicity;
- [charset(DOS)] uint8 ServerName[16];
- uint8 OSMajor;
- uint8 OSMinor;
- svcctl_ServerType ServerType;
- uint8 BroMajorVer;
- uint8 BroMinorVer;
- uint16 Signature;
- astring Comment;
- } nbt_browse_local_master_announcement;
-
- typedef [nodiscriminant] union {
- [case(HostAnnouncement)] nbt_browse_host_announcement host_annoucement;
- [case(AnnouncementRequest)] nbt_browse_announcement_request announcement_request;
- [case(Election)] nbt_browse_election_request election_request;
- [case(GetBackupListReq)] nbt_browse_backup_list_request backup_list_request;
- [case(GetBackupListResp)] nbt_browse_backup_list_response backup_list_response;
- [case(BecomeBackup)] nbt_browse_become_backup become_backup;
- [case(DomainAnnouncement)] nbt_browse_domain_announcement domain_announcement;
- [case(MasterAnnouncement)] nbt_browse_master_announcement master_announcement;
- [case(ResetBrowserState)] nbt_browse_reset_state reset_browser_state;
- [case(LocalMasterAnnouncement)] nbt_browse_local_master_announcement local_master_announcement;
- } nbt_browse_payload;
-
- typedef [public,flag(NDR_NOALIGN)] struct {
- nbt_browse_opcode opcode;
- [switch_is(opcode)] nbt_browse_payload payload;
- } nbt_browse_packet;
-}
diff --git a/source3/librpc/idl/netlogon.idl b/source3/librpc/idl/netlogon.idl
index 74535fc073..b4e34a07ab 100644
--- a/source3/librpc/idl/netlogon.idl
+++ b/source3/librpc/idl/netlogon.idl
@@ -4,7 +4,7 @@
who contributed!
*/
-import "lsa.idl", "samr.idl", "security.idl", "nbt.idl";
+import "misc.idl", "lsa.idl", "samr.idl", "security.idl", "nbt.idl";
#include "idl_types.h"
@@ -135,13 +135,32 @@ interface netlogon
netr_ChallengeResponse lm;
} netr_NetworkInfo;
- typedef [public,switch_type(uint16)] union {
- [case(1)] netr_PasswordInfo *password;
- [case(2)] netr_NetworkInfo *network;
- [case(3)] netr_PasswordInfo *password;
- [case(5)] netr_PasswordInfo *password;
- [case(6)] netr_NetworkInfo *network;
- } netr_LogonInfo;
+ typedef [flag(NDR_PAHEX)] struct {
+ netr_IdentityInfo identity_info;
+ lsa_String package_name;
+ uint32 length;
+ [size_is(length)] uint8 *data;
+ } netr_GenericInfo;
+
+ typedef enum {
+ NetlogonInteractiveInformation = 1,
+ NetlogonNetworkInformation = 2,
+ NetlogonServiceInformation = 3,
+ NetlogonGenericInformation = 4,
+ NetlogonInteractiveTransitiveInformation = 5,
+ NetlogonNetworkTransitiveInformation = 6,
+ NetlogonServiceTransitiveInformation = 7
+ } netr_LogonInfoClass;
+
+ typedef [public,switch_type(netr_LogonInfoClass)] union {
+ [case(NetlogonInteractiveInformation)] netr_PasswordInfo *password;
+ [case(NetlogonNetworkInformation)] netr_NetworkInfo *network;
+ [case(NetlogonServiceInformation)] netr_PasswordInfo *password;
+ [case(NetlogonGenericInformation)] netr_GenericInfo *generic;
+ [case(NetlogonInteractiveTransitiveInformation)] netr_PasswordInfo *password;
+ [case(NetlogonNetworkTransitiveInformation)] netr_NetworkInfo *network;
+ [case(NetlogonServiceTransitiveInformation)] netr_PasswordInfo *password;
+ } netr_LogonLevel;
typedef [public,flag(NDR_PAHEX)] struct {
uint8 key[16];
@@ -234,12 +253,25 @@ interface netlogon
lsa_String unknown4;
} netr_PacInfo;
+ typedef [flag(NDR_PAHEX)] struct {
+ uint32 length;
+ [size_is(length)] uint8 *data;
+ } netr_GenericInfo2;
+
+ typedef enum {
+ NetlogonValidationUasInfo = 1,
+ NetlogonValidationSamInfo = 2,
+ NetlogonValidationSamInfo2 = 3,
+ NetlogonValidationGenericInfo2 = 5,
+ NetlogonValidationSamInfo4 = 6
+ } netr_ValidationInfoClass;
+
typedef [public,switch_type(uint16)] union {
- [case(2)] netr_SamInfo2 *sam2;
- [case(3)] netr_SamInfo3 *sam3;
+ [case(NetlogonValidationSamInfo)] netr_SamInfo2 *sam2;
+ [case(NetlogonValidationSamInfo2)] netr_SamInfo3 *sam3;
[case(4)] netr_PacInfo *pac;
- [case(5)] netr_PacInfo *pac;
- [case(6)] netr_SamInfo6 *sam6;
+ [case(NetlogonValidationGenericInfo2)] netr_GenericInfo2 *generic;
+ [case(NetlogonValidationSamInfo4)] netr_SamInfo6 *sam6;
} netr_Validation;
typedef [public, flag(NDR_PAHEX)] struct {
@@ -251,21 +283,16 @@ interface netlogon
time_t timestamp;
} netr_Authenticator;
- typedef enum {
- INTERACTIVE_LOGON_TYPE = 1,
- NET_LOGON_TYPE = 2
- } netr_LogonLevel;
-
NTSTATUS netr_LogonSamLogon(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,unique] [string,charset(UTF16)] uint16 *computer_name,
- [in,unique] netr_Authenticator *credential,
- [in,out,unique] netr_Authenticator *return_authenticator,
- [in] netr_LogonLevel logon_level,
- [in,ref] [switch_is(logon_level)] netr_LogonInfo *logon,
- [in] uint16 validation_level,
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,unique] [string,charset(UTF16)] uint16 *computer_name,
+ [in,unique] netr_Authenticator *credential,
+ [in,out,unique] netr_Authenticator *return_authenticator,
+ [in] netr_LogonInfoClass logon_level,
+ [in,ref] [switch_is(logon_level)] netr_LogonLevel *logon,
+ [in] uint16 validation_level,
[out,ref] [switch_is(validation_level)] netr_Validation *validation,
- [out,ref] uint8 *authoritative
+ [out,ref] uint8 *authoritative
);
@@ -277,8 +304,8 @@ interface netlogon
[in,unique] [string,charset(UTF16)] uint16 *computer_name,
[in,unique] netr_Authenticator *credential,
[in,out,unique] netr_Authenticator *return_authenticator,
- [in] netr_LogonLevel logon_level,
- [in] [switch_is(logon_level)] netr_LogonInfo logon
+ [in] netr_LogonInfoClass logon_level,
+ [in] [switch_is(logon_level)] netr_LogonLevel logon
);
@@ -423,7 +450,7 @@ interface netlogon
typedef struct {
lsa_String domain_name;
- lsa_String comment;
+ lsa_String oem_information; /* comment */
dlong force_logoff_time;
uint16 min_password_length;
uint16 password_history_length;
@@ -1056,11 +1083,11 @@ interface netlogon
/*****************/
/* Function 0x15 */
- WERROR netr_NETRLOGONDUMMYROUTINE1();
+ [todo] WERROR netr_NETRLOGONDUMMYROUTINE1();
/****************/
/* Function 0x16 */
- WERROR netr_NETRLOGONSETSERVICEBITS();
+ [todo] WERROR netr_NETRLOGONSETSERVICEBITS();
/****************/
/* Function 0x17 */
@@ -1072,11 +1099,11 @@ interface netlogon
/****************/
/* Function 0x18 */
- WERROR netr_NETRLOGONCOMPUTESERVERDIGEST();
+ [todo] WERROR netr_NETRLOGONCOMPUTESERVERDIGEST();
/****************/
/* Function 0x19 */
- WERROR netr_NETRLOGONCOMPUTECLIENTDIGEST();
+ [todo] WERROR netr_NETRLOGONCOMPUTECLIENTDIGEST();
/****************/
/* Function 0x1a */
@@ -1111,6 +1138,16 @@ interface netlogon
/****************/
/* Function 0x1d */
+ typedef [bitmap32bit] bitmap {
+ NETR_TRUST_FLAG_IN_FOREST = 0x00000001,
+ NETR_TRUST_FLAG_OUTBOUND = 0x00000002,
+ NETR_TRUST_FLAG_TREEROOT = 0x00000004,
+ NETR_TRUST_FLAG_PRIMARY = 0x00000008,
+ NETR_TRUST_FLAG_NATIVE = 0x00000010,
+ NETR_TRUST_FLAG_INBOUND = 0x00000020,
+ NETR_TRUST_FLAG_MIT_KRB5 = 0x00000080,
+ NETR_TRUST_FLAG_AES = 0x00000100
+ } netr_TrustFlags;
typedef [flag(NDR_PAHEX)] struct {
uint16 length;
@@ -1139,25 +1176,60 @@ interface netlogon
} netr_DomainQuery;
typedef struct {
+ /* these first 3 values come from the fact windows
+ actually encodes this structure as a UNICODE_STRING
+ - see MS-NRPC section 2.2.1.3.9 */
+ [value(8)] uint32 length;
+ [value(0)] uint32 dummy;
+ [value(8)] uint32 size;
+ netr_TrustFlags flags;
+ uint32 parent_index;
+ uint32 trust_type;
+ uint32 trust_attributes;
+ } netr_trust_extension;
+
+ typedef struct {
+ uint16 length; /* value is 16 when info != NULL, otherwise 0 */
+ [value(length)] uint16 size; /* value is 16 when info != NULL, otherwise 0 */
+ netr_trust_extension *info;
+ } netr_trust_extension_container;
+
+ typedef struct {
lsa_String domainname;
lsa_String fulldomainname;
lsa_String forest;
GUID guid;
dom_sid2 *sid;
- netr_BinaryString unknown1[4];
- uint32 unknown[4];
+ netr_trust_extension_container trust_extension;
+ lsa_String dummystring[3];
+ uint32 dummy[4];
} netr_DomainTrustInfo;
typedef struct {
+ uint32 policy_size;
+ [size_is(policy_size)] uint8 *policy;
+ } netr_LsaPolicyInfo;
+
+ typedef [public,bitmap32bit] bitmap {
+ NETR_WS_FLAG_HANDLES_INBOUND_TRUSTS = 0x00000001,
+ NETR_WS_FLAG_HANDLES_SPN_UPDATE = 0x00000002
+ } netr_WorkstationFlags;
+
+ typedef struct {
netr_DomainTrustInfo domaininfo;
uint32 num_trusts;
[size_is(num_trusts)] netr_DomainTrustInfo *trusts;
- uint32 unknown[14]; /* room for expansion? */
+ netr_LsaPolicyInfo lsa_policy;
+ lsa_String dns_hostname;
+ lsa_String dummystring[3];
+ netr_WorkstationFlags workstation_flags;
+ uint32 supported_enc_types;
+ uint32 dummy[2];
} netr_DomainInfo1;
typedef union {
[case(1)] netr_DomainInfo1 *info1;
- [case(2)] netr_DomainInfo1 *info1;
+ [case(2)] netr_DomainInfo1 *info2;
} netr_DomainInfo;
NTSTATUS netr_LogonGetDomainInfo(
@@ -1201,7 +1273,7 @@ interface netlogon
/****************/
/* Function 0x20 */
- WERROR netr_NETRLOGONSENDTOSAM();
+ [todo] WERROR netr_NETRLOGONSENDTOSAM();
/****************/
/* Function 0x21 */
@@ -1237,19 +1309,10 @@ interface netlogon
/****************/
/* Function 0x23 */
- WERROR netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN();
+ [todo] WERROR netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN();
/****************/
/* Function 0x24 */
- typedef [bitmap32bit] bitmap {
- NETR_TRUST_FLAG_IN_FOREST = 0x00000001,
- NETR_TRUST_FLAG_OUTBOUND = 0x00000002,
- NETR_TRUST_FLAG_TREEROOT = 0x00000004,
- NETR_TRUST_FLAG_PRIMARY = 0x00000008,
- NETR_TRUST_FLAG_NATIVE = 0x00000010,
- NETR_TRUST_FLAG_INBOUND = 0x00000020
- } netr_TrustFlags;
-
typedef [v1_enum] enum {
NETR_TRUST_TYPE_DOWNLEVEL = 1,
NETR_TRUST_TYPE_UPLEVEL = 2,
@@ -1321,8 +1384,8 @@ interface netlogon
NTSTATUS netr_LogonSamLogonEx(
[in,unique] [string,charset(UTF16)] uint16 *server_name,
[in,unique] [string,charset(UTF16)] uint16 *computer_name,
- [in] netr_LogonLevel logon_level,
- [in,ref] [switch_is(logon_level)] netr_LogonInfo *logon,
+ [in] netr_LogonInfoClass logon_level,
+ [in,ref] [switch_is(logon_level)] netr_LogonLevel *logon,
[in] uint16 validation_level,
[out,ref] [switch_is(validation_level)] netr_Validation *validation,
[out,ref] uint8 *authoritative,
@@ -1394,8 +1457,8 @@ interface netlogon
[in,unique] [string,charset(UTF16)] uint16 *computer_name,
[in,unique] netr_Authenticator *credential,
[in,out,unique] netr_Authenticator *return_authenticator,
- [in] netr_LogonLevel logon_level,
- [in] [switch_is(logon_level)] netr_LogonInfo logon,
+ [in] netr_LogonInfoClass 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,
@@ -1404,5 +1467,5 @@ interface netlogon
/****************/
/* Function 0x2e */
- WERROR netr_NETRSERVERGETTRUSTINFO();
+ [todo] WERROR netr_NETRSERVERGETTRUSTINFO();
}
diff --git a/source3/librpc/idl/notify.idl b/source3/librpc/idl/notify.idl
deleted file mode 100644
index c4e633c254..0000000000
--- a/source3/librpc/idl/notify.idl
+++ /dev/null
@@ -1,56 +0,0 @@
-#include "idl_types.h"
-
-/*
- IDL structures for notify change code
-
- this defines the structures used in the notify database code, and
- the change notify buffers
-*/
-
-[
- pointer_default(unique)
-]
-interface notify
-{
-
- /* structure used in the notify database */
- typedef [public] struct {
- server_id server;
- uint32 filter; /* filter to apply in this directory */
- uint32 subdir_filter; /* filter to apply in child directories */
- utf8string path;
- uint32 path_len; /* saves some computation on search */
- pointer private_data;
- } notify_entry;
-
- /*
- to allow for efficient search for matching entries, we
- divide them by the directory depth, with a separate array
- per depth. The entries within each depth are sorted by path,
- allowing for a bisection search.
-
- The max_mask and max_mask_subdir at each depth is the
- bitwise or of the filters and subdir filters for all entries
- at that depth. This allows a depth to be quickly skipped if
- no entries will match the target filter
- */
- typedef struct {
- uint32 max_mask;
- uint32 max_mask_subdir;
- uint32 num_entries;
- notify_entry entries[num_entries];
- } notify_depth;
-
- typedef [public] struct {
- uint32 num_depths;
- notify_depth depth[num_depths];
- } notify_array;
-
- /* structure sent between servers in notify messages */
- typedef [public] struct {
- uint32 action;
- utf8string path;
- pointer private_data;
- } notify_event;
-
-}
diff --git a/source3/librpc/idl/ntsvcs.idl b/source3/librpc/idl/ntsvcs.idl
deleted file mode 100644
index bac2549c73..0000000000
--- a/source3/librpc/idl/ntsvcs.idl
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
- plug and play services
-*/
-[
- uuid("8d9f4e40-a03d-11ce-8f69-08003e30051b"),
- version(1.0),
- helpstring("Plug and Play services")
-]
-interface ntsvcs
-{
- /******************/
- /* Function: 0x00 */
-
- WERROR PNP_Disconnect();
-
- /******************/
- /* Function: 0x01 */
-
- WERROR PNP_Connect();
-
- /******************/
- /* Function: 0x02 */
-
- WERROR PNP_GetVersion(
- [out,ref] uint16 *version
- );
-
- /******************/
- /* Function: 0x03 */
-
- WERROR PNP_GetGlobalState();
-
- /******************/
- /* Function: 0x04 */
-
- WERROR PNP_InitDetection();
-
- /******************/
- /* Function: 0x05 */
-
- WERROR PNP_ReportLogOn();
-
- /******************/
- /* Function: 0x06 */
-
- WERROR PNP_ValidateDeviceInstance(
- [in,ref] [string,charset(UTF16)] uint16 *devicepath,
- [in] uint32 flags
- );
-
- /******************/
- /* Function: 0x07 */
-
- WERROR PNP_GetRootDeviceInstance();
-
- /******************/
- /* Function: 0x08 */
-
- WERROR PNP_GetRelatedDeviceInstance();
-
- /******************/
- /* Function: 0x09 */
-
- WERROR PNP_EnumerateSubKeys();
-
- /******************/
- /* Function: 0x0a */
-
- WERROR PNP_GetDeviceList();
-
- /******************/
- /* Function: 0x0b */
-
- WERROR PNP_GetDeviceListSize(
- [in,unique] [string,charset(UTF16)] uint16 *devicename,
- [out,ref] uint32 *size,
- [in] uint32 flags
- );
-
- /******************/
- /* Function: 0x0c */
-
- WERROR PNP_GetDepth();
-
- /******************/
- /* Function: 0x0d */
-
- const int DEV_REGPROP_DESC = 1;
-
- WERROR PNP_GetDeviceRegProp(
- [in,ref] [string,charset(UTF16)] uint16 *devicepath,
- [in] uint32 property,
- [in,out,ref] uint32 *unknown1,
- [out,ref] [size_is(*buffer_size)] [length_is(*buffer_size)] uint8 *buffer,
- [in,out,ref] uint32 *buffer_size,
- [in,out,ref] uint32 *needed,
- [in] uint32 unknown3
- );
-
- /******************/
- /* Function: 0x0e */
-
- WERROR PNP_SetDeviceRegProp();
-
- /******************/
- /* Function: 0x0f */
-
- WERROR PNP_GetClassInstance();
-
- /******************/
- /* Function: 0x10 */
-
- WERROR PNP_CreateKey();
-
- /******************/
- /* Function: 0x11 */
-
- WERROR PNP_DeleteRegistryKey();
-
- /******************/
- /* Function: 0x12 */
-
- WERROR PNP_GetClassCount();
-
- /******************/
- /* Function: 0x13 */
-
- WERROR PNP_GetClassName();
-
- /******************/
- /* Function: 0x14 */
-
- WERROR PNP_DeleteClassKey();
-
- /******************/
- /* Function: 0x15 */
-
- WERROR PNP_GetInterfaceDeviceAlias();
-
- /******************/
- /* Function: 0x16 */
-
- WERROR PNP_GetInterfaceDeviceList();
-
- /******************/
- /* Function: 0x17 */
-
- WERROR PNP_GetInterfaceDeviceListSize();
-
- /******************/
- /* Function: 0x18 */
-
- WERROR PNP_RegisterDeviceClassAssociation();
-
- /******************/
- /* Function: 0x19 */
-
- WERROR PNP_UnregisterDeviceClassAssociation();
-
- /******************/
- /* Function: 0x1a */
-
- WERROR PNP_GetClassRegProp();
-
- /******************/
- /* Function: 0x1b */
-
- WERROR PNP_SetClassRegProp();
-
- /******************/
- /* Function: 0x1c */
-
- WERROR PNP_CreateDevInst();
-
- /******************/
- /* Function: 0x1d */
-
- WERROR PNP_DeviceInstanceAction();
-
- /******************/
- /* Function: 0x1e */
-
- WERROR PNP_GetDeviceStatus();
-
- /******************/
- /* Function: 0x1f */
-
- WERROR PNP_SetDeviceProblem();
-
- /******************/
- /* Function: 0x20 */
-
- WERROR PNP_DisableDevInst();
-
- /******************/
- /* Function: 0x21 */
-
- WERROR PNP_UninstallDevInst();
-
- /******************/
- /* Function: 0x22 */
-
- WERROR PNP_AddID();
-
- /******************/
- /* Function: 0x23 */
-
- WERROR PNP_RegisterDriver();
-
- /******************/
- /* Function: 0x24 */
-
- WERROR PNP_QueryRemove();
-
- /******************/
- /* Function: 0x25 */
-
- WERROR PNP_RequestDeviceEject();
-
- /******************/
- /* Function: 0x26 */
-
- WERROR PNP_IsDockStationPresent();
-
- /******************/
- /* Function: 0x27 */
-
- WERROR PNP_RequestEjectPC();
-
- /******************/
- /* Function: 0x28 */
-
- WERROR PNP_HwProfFlags(
- [in] uint32 unknown1,
- [in,ref] [string,charset(UTF16)] uint16 *devicepath,
- [in] uint32 unknown2,
- [in,out,ref] uint32 *unknown3,
- [in,out,unique] uint16 *unknown4,
- [in,unique] [string,charset(UTF16)] uint16 *unknown5,
- [out,unique] [string,charset(UTF16)] uint16 **unknown5a,
- [in] uint32 unknown6,
- [in] uint32 unknown7
- );
-
- /******************/
- /* Function: 0x29 */
-
- typedef struct {
- uint32 unknown1;
- uint16 unknown2[160];
- uint32 unknown3;
- } PNP_HwProfInfo;
-
- WERROR PNP_GetHwProfInfo(
- [in] uint32 idx,
- [in,out,ref] PNP_HwProfInfo *info,
- [in] uint32 unknown1,
- [in] uint32 unknown2
- );
-
- /******************/
- /* Function: 0x2a */
-
- WERROR PNP_AddEmptyLogConf();
-
- /******************/
- /* Function: 0x2b */
-
- WERROR PNP_FreeLogConf();
-
- /******************/
- /* Function: 0x2c */
-
- WERROR PNP_GetFirstLogConf();
-
- /******************/
- /* Function: 0x2d */
-
- WERROR PNP_GetNextLogConf();
-
- /******************/
- /* Function: 0x2e */
-
- WERROR PNP_GetLogConfPriority();
-
- /******************/
- /* Function: 0x2f */
-
- WERROR PNP_AddResDes();
-
- /******************/
- /* Function: 0x30 */
-
- WERROR PNP_FreeResDes();
-
- /******************/
- /* Function: 0x31 */
-
- WERROR PNP_GetNextResDes();
-
- /******************/
- /* Function: 0x32 */
-
- WERROR PNP_GetResDesData();
-
- /******************/
- /* Function: 0x33 */
-
- WERROR PNP_GetResDesDataSize();
-
- /******************/
- /* Function: 0x34 */
-
- WERROR PNP_ModifyResDes();
-
- /******************/
- /* Function: 0x35 */
-
- WERROR PNP_DetectResourceLimit();
-
- /******************/
- /* Function: 0x36 */
-
- WERROR PNP_QueryResConfList();
-
- /******************/
- /* Function: 0x37 */
-
- WERROR PNP_SetHwProf();
-
- /******************/
- /* Function: 0x38 */
-
- WERROR PNP_QueryArbitratorFreeData();
-
- /******************/
- /* Function: 0x39 */
-
- WERROR PNP_QueryArbitratorFreeSize();
-
- /******************/
- /* Function: 0x3a */
-
- WERROR PNP_RunDetection();
-
- /******************/
- /* Function: 0x3b */
-
- WERROR PNP_RegisterNotification();
-
- /******************/
- /* Function: 0x3c */
-
- WERROR PNP_UnregisterNotification();
-
- /******************/
- /* Function: 0x3d */
-
- WERROR PNP_GetCustomDevProp();
-
- /******************/
- /* Function: 0x3e */
-
- WERROR PNP_GetVersionInternal();
-
- /******************/
- /* Function: 0x3f */
-
- WERROR PNP_GetBlockedDriverInfo();
-
- /******************/
- /* Function: 0x40 */
-
- WERROR PNP_GetServerSideDeviceInstallFlags();
-}
diff --git a/source3/librpc/idl/samr.idl b/source3/librpc/idl/samr.idl
index e823d1d77b..cd5fe07845 100644
--- a/source3/librpc/idl/samr.idl
+++ b/source3/librpc/idl/samr.idl
@@ -208,7 +208,7 @@ import "misc.idl", "lsa.idl", "security.idl";
typedef struct {
NTTIME force_logoff_time;
- lsa_String comment;
+ lsa_String oem_information; /* comment */
lsa_String domain_name;
lsa_String primary; /* PDC name if this is a BDC */
udlong sequence_num;
@@ -218,15 +218,15 @@ import "misc.idl", "lsa.idl", "security.idl";
uint32 num_users;
uint32 num_groups;
uint32 num_aliases;
- } samr_DomInfo2;
+ } samr_DomGeneralInformation;
typedef struct {
NTTIME force_logoff_time;
} samr_DomInfo3;
typedef struct {
- lsa_String comment;
- } samr_DomInfo4;
+ lsa_String oem_information; /* comment */
+ } samr_DomOEMInformation;
typedef struct {
lsa_String domain_name;
@@ -250,11 +250,11 @@ import "misc.idl", "lsa.idl", "security.idl";
} samr_DomInfo9;
typedef struct {
- samr_DomInfo2 info2;
+ samr_DomGeneralInformation general;
hyper lockout_duration;
hyper lockout_window;
uint16 lockout_threshold;
- } samr_DomInfo11;
+ } samr_DomGeneralInformation2;
typedef struct {
hyper lockout_duration;
@@ -271,15 +271,15 @@ import "misc.idl", "lsa.idl", "security.idl";
typedef [switch_type(uint16)] union {
[case(1)] samr_DomInfo1 info1;
- [case(2)] samr_DomInfo2 info2;
+ [case(2)] samr_DomGeneralInformation general;
[case(3)] samr_DomInfo3 info3;
- [case(4)] samr_DomInfo4 info4;
+ [case(4)] samr_DomOEMInformation oem;
[case(5)] samr_DomInfo5 info5;
[case(6)] samr_DomInfo6 info6;
[case(7)] samr_DomInfo7 info7;
[case(8)] samr_DomInfo8 info8;
[case(9)] samr_DomInfo9 info9;
- [case(11)] samr_DomInfo11 info11;
+ [case(11)] samr_DomGeneralInformation2 general2;
[case(12)] samr_DomInfo12 info12;
[case(13)] samr_DomInfo13 info13;
} samr_DomainInfo;
diff --git a/source3/librpc/idl/security.idl b/source3/librpc/idl/security.idl
deleted file mode 100644
index c1dfe272e9..0000000000
--- a/source3/librpc/idl/security.idl
+++ /dev/null
@@ -1,376 +0,0 @@
-#include "idl_types.h"
-
-/*
- 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")
-
-/* same struct as dom_sid but in a variable byte buffer, which is maybe empty in NDR */
-cpp_quote("#define dom_sid0 dom_sid")
-
-[
- pointer_default(unique)
-]
-interface security
-{
- /*
- access masks are divided up like this:
- 0xabccdddd
- where
- a = generic rights bits SEC_GENERIC_
- b = flags SEC_FLAG_
- c = standard rights bits SEC_STD_
- d = object type specific bits SEC_{FILE,DIR,REG,xxx}_
-
- common combinations of bits are prefixed with SEC_RIGHTS_
- */
- const int SEC_MASK_GENERIC = 0xF0000000;
- const int SEC_MASK_FLAGS = 0x0F000000;
- const int SEC_MASK_STANDARD = 0x00FF0000;
- const int SEC_MASK_SPECIFIC = 0x0000FFFF;
-
- /* generic bits */
- const int SEC_GENERIC_ALL = 0x10000000;
- const int SEC_GENERIC_EXECUTE = 0x20000000;
- const int SEC_GENERIC_WRITE = 0x40000000;
- const int SEC_GENERIC_READ = 0x80000000;
-
- /* flag bits */
- const int SEC_FLAG_SYSTEM_SECURITY = 0x01000000;
- const int SEC_FLAG_MAXIMUM_ALLOWED = 0x02000000;
-
- /* standard bits */
- const int SEC_STD_DELETE = 0x00010000;
- const int SEC_STD_READ_CONTROL = 0x00020000;
- const int SEC_STD_WRITE_DAC = 0x00040000;
- const int SEC_STD_WRITE_OWNER = 0x00080000;
- const int SEC_STD_SYNCHRONIZE = 0x00100000;
- const int SEC_STD_REQUIRED = 0x000F0000;
- const int SEC_STD_ALL = 0x001F0000;
-
- /* file specific bits */
- const int SEC_FILE_READ_DATA = 0x00000001;
- const int SEC_FILE_WRITE_DATA = 0x00000002;
- const int SEC_FILE_APPEND_DATA = 0x00000004;
- const int SEC_FILE_READ_EA = 0x00000008;
- const int SEC_FILE_WRITE_EA = 0x00000010;
- const int SEC_FILE_EXECUTE = 0x00000020;
- const int SEC_FILE_READ_ATTRIBUTE = 0x00000080;
- const int SEC_FILE_WRITE_ATTRIBUTE = 0x00000100;
- const int SEC_FILE_ALL = 0x000001ff;
-
- /* directory specific bits */
- const int SEC_DIR_LIST = 0x00000001;
- const int SEC_DIR_ADD_FILE = 0x00000002;
- const int SEC_DIR_ADD_SUBDIR = 0x00000004;
- const int SEC_DIR_READ_EA = 0x00000008;
- const int SEC_DIR_WRITE_EA = 0x00000010;
- const int SEC_DIR_TRAVERSE = 0x00000020;
- const int SEC_DIR_DELETE_CHILD = 0x00000040;
- const int SEC_DIR_READ_ATTRIBUTE = 0x00000080;
- const int SEC_DIR_WRITE_ATTRIBUTE = 0x00000100;
-
- /* registry entry specific bits */
- const int SEC_REG_QUERY_VALUE = 0x00000001;
- const int SEC_REG_SET_VALUE = 0x00000002;
- const int SEC_REG_CREATE_SUBKEY = 0x00000004;
- const int SEC_REG_ENUM_SUBKEYS = 0x00000008;
- const int SEC_REG_NOTIFY = 0x00000010;
- const int SEC_REG_CREATE_LINK = 0x00000020;
-
- /* ldap specific access bits */
- const int SEC_ADS_CREATE_CHILD = 0x00000001;
- const int SEC_ADS_DELETE_CHILD = 0x00000002;
- const int SEC_ADS_LIST = 0x00000004;
- const int SEC_ADS_SELF_WRITE = 0x00000008;
- const int SEC_ADS_READ_PROP = 0x00000010;
- const int SEC_ADS_WRITE_PROP = 0x00000020;
- const int SEC_ADS_DELETE_TREE = 0x00000040;
- const int SEC_ADS_LIST_OBJECT = 0x00000080;
- const int SEC_ADS_CONTROL_ACCESS = 0x00000100;
-
- /* generic->specific mappings for files */
- const int SEC_RIGHTS_FILE_READ = SEC_STD_READ_CONTROL |
- SEC_STD_SYNCHRONIZE |
- SEC_FILE_READ_DATA |
- SEC_FILE_READ_ATTRIBUTE |
- SEC_FILE_READ_EA;
-
- const int 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;
-
- const int SEC_RIGHTS_FILE_EXECUTE = SEC_STD_SYNCHRONIZE |
- SEC_STD_READ_CONTROL |
- SEC_FILE_READ_ATTRIBUTE |
- SEC_FILE_EXECUTE;
-
- const int SEC_RIGHTS_FILE_ALL = SEC_STD_ALL | SEC_FILE_ALL;
-
- /* generic->specific mappings for directories (same as files) */
- const int SEC_RIGHTS_DIR_READ = SEC_RIGHTS_FILE_READ;
- const int SEC_RIGHTS_DIR_WRITE = SEC_RIGHTS_FILE_WRITE;
- const int SEC_RIGHTS_DIR_EXECUTE = SEC_RIGHTS_FILE_EXECUTE;
- const int SEC_RIGHTS_DIR_ALL = SEC_RIGHTS_FILE_ALL;
-
-
- /***************************************************************/
- /* WELL KNOWN SIDS */
-
- /* a NULL sid */
- 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";
-
- /* SECURITY_CREATOR_SID_AUTHORITY */
- const string SID_CREATOR_OWNER_DOMAIN = "S-1-3";
- const string SID_CREATOR_OWNER = "S-1-3-0";
- 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";
- const string SID_NT_BATCH = "S-1-5-3";
- const string SID_NT_INTERACTIVE = "S-1-5-4";
- const string SID_NT_SERVICE = "S-1-5-6";
- const string SID_NT_ANONYMOUS = "S-1-5-7";
- const string SID_NT_PROXY = "S-1-5-8";
- const string SID_NT_ENTERPRISE_DCS = "S-1-5-9";
- const string SID_NT_SELF = "S-1-5-10";
- const string SID_NT_AUTHENTICATED_USERS = "S-1-5-11";
- const string SID_NT_RESTRICTED = "S-1-5-12";
- const string SID_NT_TERMINAL_SERVER_USERS = "S-1-5-13";
- const string SID_NT_REMOTE_INTERACTIVE = "S-1-5-14";
- const string SID_NT_THIS_ORGANISATION = "S-1-5-15";
- const string SID_NT_SYSTEM = "S-1-5-18";
- const string SID_NT_LOCAL_SERVICE = "S-1-5-19";
- 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";
- const string SID_BUILTIN_GUESTS = "S-1-5-32-546";
- const string SID_BUILTIN_POWER_USERS = "S-1-5-32-547";
- const string SID_BUILTIN_ACCOUNT_OPERATORS = "S-1-5-32-548";
- const string SID_BUILTIN_SERVER_OPERATORS = "S-1-5-32-549";
- const string SID_BUILTIN_PRINT_OPERATORS = "S-1-5-32-550";
- const string SID_BUILTIN_BACKUP_OPERATORS = "S-1-5-32-551";
- const string SID_BUILTIN_REPLICATOR = "S-1-5-32-552";
- const string SID_BUILTIN_RAS_SERVERS = "S-1-5-32-553";
- const string SID_BUILTIN_PREW2K = "S-1-5-32-554";
-
- /* well-known domain RIDs */
- const int DOMAIN_RID_LOGON = 9;
- const int DOMAIN_RID_ADMINISTRATOR = 500;
- 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;
- const int DOMAIN_RID_ENTERPRISE_ADMINS = 519;
-
-
- /*
- privilege IDs. Please keep the IDs below 64. If we get more
- than 64 then we need to change security_token
- */
- typedef enum {
- 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
- } sec_privilege;
-
- typedef [bitmap8bit] bitmap {
- SEC_ACE_FLAG_OBJECT_INHERIT = 0x01,
- SEC_ACE_FLAG_CONTAINER_INHERIT = 0x02,
- SEC_ACE_FLAG_NO_PROPAGATE_INHERIT = 0x04,
- SEC_ACE_FLAG_INHERIT_ONLY = 0x08,
- SEC_ACE_FLAG_INHERITED_ACE = 0x10,
- SEC_ACE_FLAG_VALID_INHERIT = 0x0f,
- SEC_ACE_FLAG_SUCCESSFUL_ACCESS = 0x40,
- SEC_ACE_FLAG_FAILED_ACCESS = 0x80
- } security_ace_flags;
-
- typedef [enum8bit] enum {
- 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
- } security_ace_type;
-
- typedef [bitmap32bit] bitmap {
- SEC_ACE_OBJECT_TYPE_PRESENT = 0x00000001,
- SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT = 0x00000002
- } security_ace_object_flags;
-
- typedef [nodiscriminant] union {
- /* this is the 'schemaIDGUID' attribute of the attribute object in the schema naming context */
- [case(SEC_ACE_OBJECT_TYPE_PRESENT)] GUID type;
- [default];
- } security_ace_object_type;
-
- typedef [nodiscriminant] union {
- /* this is the 'schemaIDGUID' attribute of the objectclass object in the schema naming context
- * (of the parent container)
- */
- [case(SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)] GUID inherited_type;
- [default];
- } security_ace_object_inherited_type;
-
- typedef struct {
- security_ace_object_flags flags;
- [switch_is(flags & SEC_ACE_OBJECT_TYPE_PRESENT)] security_ace_object_type type;
- [switch_is(flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT)] security_ace_object_inherited_type inherited_type;
- } security_ace_object;
-
- typedef [nodiscriminant] union {
- [case(SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT)] security_ace_object object;
- [case(SEC_ACE_TYPE_ACCESS_DENIED_OBJECT)] security_ace_object object;
- [case(SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT)] security_ace_object object;
- [case(SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT)] security_ace_object object;
- [default];
- } security_ace_object_ctr;
-
- typedef [public,gensize,nosize] struct {
- security_ace_type type; /* SEC_ACE_TYPE_* */
- security_ace_flags flags; /* SEC_ACE_FLAG_* */
- [value(ndr_size_security_ace(r,ndr->flags))] uint16 size;
- uint32 access_mask;
- [switch_is(type)] security_ace_object_ctr object;
- dom_sid trustee;
- } security_ace;
-
- typedef enum {
- SECURITY_ACL_REVISION_NT4 = 2,
- SECURITY_ACL_REVISION_ADS = 4
- } security_acl_revision;
-
- const uint NT4_ACL_REVISION = SECURITY_ACL_REVISION_NT4;
-
- typedef [public,gensize,nosize] struct {
- security_acl_revision revision;
- [value(ndr_size_security_acl(r,ndr->flags))] uint16 size;
- [range(0,1000)] uint32 num_aces;
- security_ace aces[num_aces];
- } security_acl;
-
- /* default revision for new ACLs */
- typedef [enum8bit] enum {
- SECURITY_DESCRIPTOR_REVISION_1 = 1
- } security_descriptor_revision;
-
- const int SD_REVISION = SECURITY_DESCRIPTOR_REVISION_1;
-
- /* security_descriptor->type bits */
- typedef [bitmap16bit] bitmap {
- SEC_DESC_OWNER_DEFAULTED = 0x0001,
- SEC_DESC_GROUP_DEFAULTED = 0x0002,
- SEC_DESC_DACL_PRESENT = 0x0004,
- SEC_DESC_DACL_DEFAULTED = 0x0008,
- SEC_DESC_SACL_PRESENT = 0x0010,
- SEC_DESC_SACL_DEFAULTED = 0x0020,
- SEC_DESC_DACL_TRUSTED = 0x0040,
- SEC_DESC_SERVER_SECURITY = 0x0080,
- SEC_DESC_DACL_AUTO_INHERIT_REQ = 0x0100,
- SEC_DESC_SACL_AUTO_INHERIT_REQ = 0x0200,
- SEC_DESC_DACL_AUTO_INHERITED = 0x0400,
- SEC_DESC_SACL_AUTO_INHERITED = 0x0800,
- SEC_DESC_DACL_PROTECTED = 0x1000,
- SEC_DESC_SACL_PROTECTED = 0x2000,
- SEC_DESC_RM_CONTROL_VALID = 0x4000,
- SEC_DESC_SELF_RELATIVE = 0x8000
- } security_descriptor_type;
-
- typedef [gensize,nosize,public,flag(NDR_LITTLE_ENDIAN)] struct {
- security_descriptor_revision revision;
- security_descriptor_type type; /* SEC_DESC_xxxx flags */
- [relative] dom_sid *owner_sid;
- [relative] dom_sid *group_sid;
- [relative] security_acl *sacl; /* system ACL */
- [relative] security_acl *dacl; /* user (discretionary) ACL */
- } security_descriptor;
-
- typedef [public] struct {
- [range(0,0x40000),value(ndr_size_security_descriptor(sd,ndr->flags))] uint32 sd_size;
- [subcontext(4)] security_descriptor *sd;
- } sec_desc_buf;
-
- typedef [public] struct {
- dom_sid *user_sid;
- dom_sid *group_sid;
- uint32 num_sids;
- [size_is(num_sids)] dom_sid *sids[*];
- udlong privilege_mask;
- } security_token;
-
- /* bits that determine which parts of a security descriptor
- are being queried/set */
- typedef [public,bitmap32bit] bitmap {
- SECINFO_OWNER = 0x00000001,
- SECINFO_GROUP = 0x00000002,
- SECINFO_DACL = 0x00000004,
- SECINFO_SACL = 0x00000008,
- SECINFO_UNPROTECTED_SACL = 0x10000000,
- SECINFO_UNPROTECTED_DACL = 0x20000000,
- SECINFO_PROTECTED_SACL = 0x40000000,
- SECINFO_PROTECTED_DACL = 0x80000000
- } security_secinfo;
-}
diff --git a/source3/librpc/idl/spoolss.idl b/source3/librpc/idl/spoolss.idl
deleted file mode 100644
index 2144393ebd..0000000000
--- a/source3/librpc/idl/spoolss.idl
+++ /dev/null
@@ -1,1571 +0,0 @@
-#include "idl_types.h"
-
-/*
- spoolss interface definitions
-*/
-import "security.idl", "winreg.idl";
-
-[ uuid("12345678-1234-abcd-ef00-0123456789ab"),
- version(1.0),
- endpoint("ncacn_np:[\\pipe\\spoolss]"),
- pointer_default(unique),
- helpstring("Spooler SubSystem"),
- helper("librpc/ndr/ndr_spoolss_buf.h")
-] interface spoolss
-{
- typedef [v1_enum] enum winreg_Type winreg_Type;
- typedef struct {
- uint16 year;
- uint16 month;
- uint16 day_of_week;
- uint16 day;
- uint16 hour;
- uint16 minute;
- uint16 second;
- uint16 millisecond;
- } spoolss_Time;
-
- typedef struct {
- [relative] nstring *printername;
- [relative] nstring *servername;
- uint32 cjobs;
- uint32 total_jobs;
- uint32 total_bytes;
- spoolss_Time time;
- uint32 global_counter;
- uint32 total_pages;
- uint32 version;
- uint32 unknown10;
- uint32 unknown11;
- uint32 unknown12;
- uint32 session_counter;
- uint32 unknown14;
- uint32 printer_errors;
- uint32 unknown16;
- uint32 unknown17;
- uint32 unknown18;
- uint32 unknown19;
- uint32 change_id;
- uint32 unknown21;
- uint32 status;
- uint32 unknown23;
- uint32 c_setprinter;
- uint16 unknown25;
- uint16 unknown26;
- uint32 unknown27;
- uint32 unknown28;
- uint32 unknown29;
- } spoolss_PrinterInfo0;
-
- typedef [public,gensize] struct {
- [charset(UTF16)] uint16 devicename[32];
- uint16 specversion;
- uint16 driverversion;
- uint16 size;
- [value(r->driverextra_data.length)] uint16 __driverextra_length;
- uint32 fields;
- uint16 orientation;
- uint16 papersize;
- uint16 paperlength;
- uint16 paperwidth;
- uint16 scale;
- uint16 copies;
- uint16 defaultsource;
- uint16 printquality;
- uint16 color;
- uint16 duplex;
- uint16 yresolution;
- uint16 ttoption;
- uint16 collate;
- [charset(UTF16)] uint16 formname[32];
- uint16 logpixels;
- uint32 bitsperpel;
- uint32 pelswidth;
- uint32 pelsheight;
- uint32 displayflags;
- uint32 displayfrequency;
- uint32 icmmethod;
- uint32 icmintent;
- uint32 mediatype;
- uint32 dithertype;
- uint32 reserved1;
- uint32 reserved2;
- uint32 panningwidth;
- uint32 panningheight;
- [subcontext_size(__driverextra_length),subcontext(0),flag(NDR_REMAINING)] DATA_BLOB driverextra_data;
- } spoolss_DeviceMode;
-
- typedef [public] bitmap {
- PRINTER_ENUM_DEFAULT = 0x00000001,
- PRINTER_ENUM_LOCAL = 0x00000002,
- PRINTER_ENUM_CONNECTIONS = 0x00000004,
- PRINTER_ENUM_FAVORITE = 0x00000004,
- PRINTER_ENUM_NAME = 0x00000008,
- PRINTER_ENUM_REMOTE = 0x00000010,
- PRINTER_ENUM_SHARED = 0x00000020,
- PRINTER_ENUM_NETWORK = 0x00000040,
- PRINTER_ENUM_EXPAND = 0x00004000,
- PRINTER_ENUM_CONTAINER = 0x00008000,
- PRINTER_ENUM_ICON1 = 0x00010000,
- PRINTER_ENUM_ICON2 = 0x00020000,
- PRINTER_ENUM_ICON3 = 0x00040000,
- PRINTER_ENUM_ICON4 = 0x00080000,
- PRINTER_ENUM_ICON5 = 0x00100000,
- PRINTER_ENUM_ICON6 = 0x00200000,
- PRINTER_ENUM_ICON7 = 0x00400000,
- PRINTER_ENUM_ICON8 = 0x00800000,
- PRINTER_ENUM_HIDE = 0x01000000
- } spoolss_EnumPrinterFlags;
-
- typedef struct {
- spoolss_EnumPrinterFlags flags;
- [relative] nstring *name;
- [relative] nstring *description;
- [relative] nstring *comment;
- } spoolss_PrinterInfo1;
-
- typedef bitmap {
- PRINTER_ATTRIBUTE_QUEUED = 0x00000001,
- PRINTER_ATTRIBUTE_DIRECT = 0x00000002,
- PRINTER_ATTRIBUTE_DEFAULT = 0x00000004,
- PRINTER_ATTRIBUTE_SHARED = 0x00000008,
- PRINTER_ATTRIBUTE_NETWORK = 0x00000010,
- PRINTER_ATTRIBUTE_HIDDEN = 0x00000020,
- PRINTER_ATTRIBUTE_LOCAL = 0x00000040,
- PRINTER_ATTRIBUTE_ENABLE_DEVQ = 0x00000080,
- PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS = 0x00000100,
- PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST = 0x00000200,
- PRINTER_ATTRIBUTE_WORK_OFFLINE = 0x00000400,
- PRINTER_ATTRIBUTE_ENABLE_BIDI = 0x00000800,
- PRINTER_ATTRIBUTE_RAW_ONLY = 0x00001000,
- PRINTER_ATTRIBUTE_PUBLISHED = 0x00002000,
- PRINTER_ATTRIBUTE_FAX = 0x00004000,
- PRINTER_ATTRIBUTE_TS = 0x00008000
- } spoolss_PrinterAttributes;
-
- typedef bitmap {
- PRINTER_STATUS_PAUSED = 0x00000001,
- PRINTER_STATUS_ERROR = 0x00000002,
- PRINTER_STATUS_PENDING_DELETION = 0x00000004,
- PRINTER_STATUS_PAPER_JAM = 0x00000008,
- PRINTER_STATUS_PAPER_OUT = 0x00000010,
- PRINTER_STATUS_MANUAL_FEED = 0x00000020,
- PRINTER_STATUS_PAPER_PROBLEM = 0x00000040,
- PRINTER_STATUS_OFFLINE = 0x00000080,
- PRINTER_STATUS_IO_ACTIVE = 0x00000100,
- PRINTER_STATUS_BUSY = 0x00000200,
- PRINTER_STATUS_PRINTING = 0x00000400,
- PRINTER_STATUS_OUTPUT_BIN_FULL = 0x00000800,
- PRINTER_STATUS_NOT_AVAILABLE = 0x00001000,
- PRINTER_STATUS_WAITING = 0x00002000,
- PRINTER_STATUS_PROCESSING = 0x00004000,
- PRINTER_STATUS_INITIALIZING = 0x00008000,
- PRINTER_STATUS_WARMING_UP = 0x00010000,
- PRINTER_STATUS_TONER_LOW = 0x00020000,
- PRINTER_STATUS_NO_TONER = 0x00040000,
- PRINTER_STATUS_PAGE_PUNT = 0x00080000,
- PRINTER_STATUS_USER_INTERVENTION= 0x00100000,
- PRINTER_STATUS_OUT_OF_MEMORY = 0x00200000,
- PRINTER_STATUS_DOOR_OPEN = 0x00400000,
- PRINTER_STATUS_SERVER_UNKNOWN = 0x00800000,
- PRINTER_STATUS_POWER_SAVE = 0x01000000
- } spoolss_PrinterStatus;
-
- typedef struct {
- [relative] nstring *servername;
- [relative] nstring *printername;
- [relative] nstring *sharename;
- [relative] nstring *portname;
- [relative] nstring *drivername;
- [relative] nstring *comment;
- [relative] nstring *location;
- [relative,subcontext(0)] spoolss_DeviceMode *devmode;
- [relative] nstring *sepfile;
- [relative] nstring *printprocessor;
- [relative] nstring *datatype;
- [relative] nstring *parameters;
- [relative,subcontext(0)] security_descriptor *secdesc;
- spoolss_PrinterAttributes attributes;
- uint32 priority;
- uint32 defaultpriority;
- uint32 starttime;
- uint32 untiltime;
- spoolss_PrinterStatus status;
- uint32 cjobs;
- uint32 averageppm;
- } spoolss_PrinterInfo2;
-
- typedef struct {
- [relative,subcontext(0)] security_descriptor *secdesc;
- } spoolss_PrinterInfo3;
-
- typedef struct {
- [relative] nstring *printername;
- [relative] nstring *servername;
- spoolss_PrinterAttributes attributes;
- } spoolss_PrinterInfo4;
-
- typedef struct {
- [relative] nstring *printername;
- [relative] nstring *portname;
- spoolss_PrinterAttributes attributes;
- uint32 device_not_selected_timeout;
- uint32 transmission_retry_timeout;
- } spoolss_PrinterInfo5;
-
- typedef struct {
- spoolss_PrinterStatus status;
- } spoolss_PrinterInfo6;
-
- typedef bitmap {
- DSPRINT_PUBLISH = 0x00000001,
- DSPRINT_UPDATE = 0x00000002,
- DSPRINT_UNPUBLISH = 0x00000004,
- DSPRINT_REPUBLISH = 0x00000008,
- DSPRINT_PENDING = 0x80000000
- } spoolss_DsPrintAction;
-
- typedef struct {
- [relative] nstring *guid; /* text form of printer guid */
- spoolss_DsPrintAction action;
- } spoolss_PrinterInfo7;
-
- typedef struct {
- [relative,subcontext(0)] spoolss_DeviceMode *devmode;
- } spoolss_DeviceModeInfo;
-
- typedef [nodiscriminant,relative_base,public] union {
- [case(0)] spoolss_PrinterInfo0 info0;
- [case(1)] spoolss_PrinterInfo1 info1;
- [case(2)] spoolss_PrinterInfo2 info2;
- [case(3)] spoolss_PrinterInfo3 info3;
- [case(4)] spoolss_PrinterInfo4 info4;
- [case(5)] spoolss_PrinterInfo5 info5;
- [case(6)] spoolss_PrinterInfo6 info6;
- [case(7)] spoolss_PrinterInfo7 info7;
- [case(8)] spoolss_DeviceModeInfo info8;
- [case(9)] spoolss_DeviceModeInfo info9;
- [default];
- } spoolss_PrinterInfo;
-
- /******************/
- /* Function: 0x00 */
- /* we are using this as internal parsing code */
- [public,noopnum,noprint] WERROR _spoolss_EnumPrinters(
- [in] spoolss_EnumPrinterFlags flags,
- [in,unique] [string,charset(UTF16)] uint16 *server,
- [in] uint32 level,
- [in,unique] DATA_BLOB *buffer,
- [in] uint32 offered,
- [out,unique] DATA_BLOB *info,
- [out] uint32 needed,
- [out] uint32 count
- );
- [public,noopnum,noprint] void __spoolss_EnumPrinters(
- [in] uint32 level,
- [in] uint32 count,
- [out,switch_is(level)] spoolss_PrinterInfo info[count]
- );
- [nopull,nopush] WERROR spoolss_EnumPrinters(
- [in] spoolss_EnumPrinterFlags flags,
- [in,unique] [string,charset(UTF16)] uint16 *server,
- [in] uint32 level,
- [in,unique] DATA_BLOB *buffer,
- [in] uint32 offered,
- /* what we have here is a subcontext containing an array of no discriminant unions
- * and the array has no size in front
- */
- [out,unique,switch_is(level),size_is(count)] spoolss_PrinterInfo *info,
- [out] uint32 needed,
- [out] uint32 count
- );
-
- /******************/
- /* Function: 0x01 */
- typedef struct {
- [value(_ndr_size_spoolss_DeviceMode(devmode, ndr->flags))] uint32 _ndr_size;
- [subcontext(4),subcontext_size(_ndr_size)] spoolss_DeviceMode *devmode;
- } spoolss_DevmodeContainer;
-
- [public] WERROR spoolss_OpenPrinter(
- [in,unique] [string,charset(UTF16)] uint16 *printername,
- [in,unique] [string,charset(UTF16)] uint16 *datatype,
- [in] spoolss_DevmodeContainer devmode_ctr,
- [in] uint32 access_mask,
- [out,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x02 */
- typedef struct {
- uint32 job_id;
- [relative] nstring *printer_name;
- [relative] nstring *server_name;
- [relative] nstring *user_name;
- [relative] nstring *document_name;
- [relative] nstring *data_type;
- [relative] nstring *text_status;
- uint32 status;
- uint32 priority;
- uint32 position;
- uint32 total_pages;
- uint32 pages_printed;
- spoolss_Time time;
- } spoolss_JobInfo1;
-
- typedef [nodiscriminant,relative_base,public] union {
- [case(1)] spoolss_JobInfo1 info1;
- [case(2)]; /* TODO */
- [case(3)]; /* TODO */
- [default];
- } spoolss_JobInfo;
-
- typedef struct {
- uint32 level;
- [switch_is(level)] spoolss_JobInfo info;
- } spoolss_JobInfoContainer;
-
- typedef [v1_enum] enum {
- SPOOLSS_JOB_CONTROL_PAUSE = 1,
- SPOOLSS_JOB_CONTROL_RESUME = 2,
- SPOOLSS_JOB_CONTROL_CANCEL = 3,
- SPOOLSS_JOB_CONTROL_RESTART = 4,
- SPOOLSS_JOB_CONTROL_DELETE = 5,
- SPOOLSS_JOB_CONTROL_SEND_TO_PRINTER = 6,
- SPOOLSS_JOB_CONTROL_LAST_PAGE_EJECTED = 7
- } spoolss_JobControl;
-
- WERROR spoolss_SetJob(
- [in,ref] policy_handle *handle,
- [in] uint32 job_id,
- [in,unique] spoolss_JobInfoContainer *ctr,
- [in] spoolss_JobControl command
- );
-
- /******************/
- /* Function: 0x03 */
- WERROR spoolss_GetJob(
- [in,ref] policy_handle *handle,
- [in] uint32 job_id,
- [in] uint32 level,
- [in,unique] DATA_BLOB *buffer,
- [in] uint32 offered,
- [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_JobInfo *info,
- [out] uint32 needed
- );
-
- /******************/
- /* Function: 0x04 */
- [public,noopnum,noprint] WERROR _spoolss_EnumJobs(
- [in,ref] policy_handle *handle,
- [in] uint32 firstjob,
- [in] uint32 numjobs,
- [in] uint32 level,
- [in,unique] DATA_BLOB *buffer,
- [in] uint32 offered,
- [out,unique] DATA_BLOB *info,
- [out] uint32 needed,
- [out] uint32 count
- );
- [public,noopnum,noprint] void __spoolss_EnumJobs(
- [in] uint32 level,
- [in] uint32 count,
- [out,switch_is(level)] spoolss_JobInfo info[count]
- );
- [nopull,nopush] WERROR spoolss_EnumJobs(
- [in,ref] policy_handle *handle,
- [in] uint32 firstjob,
- [in] uint32 numjobs,
- [in] uint32 level,
- [in,unique] DATA_BLOB *buffer,
- [in] uint32 offered,
- [out,unique,switch_is(level),size_is(count)] spoolss_JobInfo *info,
- [out] uint32 needed,
- [out] uint32 count
- );
-
- /******************/
- /* Function: 0x05 */
- WERROR spoolss_AddPrinter(
- /* This function is not implemented in Samba 3 as no
- clients have been observed using it. */
- );
-
- /******************/
- /* Function: 0x06 */
- WERROR spoolss_DeletePrinter(
- );
-
- /******************/
- /* Function: 0x07 */
- typedef [v1_enum] enum {
- SPOOLSS_PRINTER_CONTROL_UNPAUSE = 0,
- SPOOLSS_PRINTER_CONTROL_PAUSE = 1,
- SPOOLSS_PRINTER_CONTROL_RESUME = 2,
- SPOOLSS_PRINTER_CONTROL_PURGE = 3,
- SPOOLSS_PRINTER_CONTROL_SET_STATUS = 4
- } spoolss_PrinterControl;
-
- typedef [switch_type(uint32)] union {
- [case(0)] spoolss_PrinterInfo0 *info0;
- [case(1)] spoolss_PrinterInfo1 *info1;
- [case(2)] spoolss_PrinterInfo2 *info2;
- [case(3)] spoolss_PrinterInfo3 *info3;
- [case(4)] spoolss_PrinterInfo4 *info4;
- [case(5)] spoolss_PrinterInfo5 *info5;
- [case(6)] spoolss_PrinterInfo6 *info6;
- [case(7)] spoolss_PrinterInfo7 *info7;
- [case(8)] spoolss_DeviceModeInfo *info8;
- [case(9)] spoolss_DeviceModeInfo *info9;
- [default];
- } spoolss_SetPrinterInfo;
-
- WERROR spoolss_SetPrinter(
- [in,ref] policy_handle *handle,
- [in] uint32 level,
- [in,switch_is(level)] spoolss_SetPrinterInfo info,
- [in] spoolss_DevmodeContainer devmode_ctr,
- [in] sec_desc_buf secdesc_ctr,
- [in] spoolss_PrinterControl command
- );
-
- /******************/
- /* Function: 0x08 */
- [public] WERROR spoolss_GetPrinter(
- [in,ref] policy_handle *handle,
- [in] uint32 level,
- [in,unique] DATA_BLOB *buffer,
- [in] uint32 offered,
- [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_PrinterInfo *info,
- [out] uint32 needed
- );
-
- /******************/
- /* Function: 0x09 */
- WERROR spoolss_AddPrinterDriver(
- );
-
- typedef struct {
- [relative] nstring *driver_name;
- } spoolss_DriverInfo1;
-
- typedef [v1_enum] enum {
- SPOOLSS_DRIVER_VERSION_9X = 0,
- SPOOLSS_DRIVER_VERSION_NT35 = 1,
- SPOOLSS_DRIVER_VERSION_NT4 = 2,
- SPOOLSS_DRIVER_VERSION_200X = 3
- } spoolss_DriverOSVersion;
-
- typedef struct {
- spoolss_DriverOSVersion version;
- [relative] nstring *driver_name;
- [relative] nstring *architecture;
- [relative] nstring *driver_path;
- [relative] nstring *data_file;
- [relative] nstring *config_file;
- } spoolss_DriverInfo2;
-
- typedef struct {
- spoolss_DriverOSVersion version;
- [relative] nstring *driver_name;
- [relative] nstring *architecture;
- [relative] nstring *driver_path;
- [relative] nstring *data_file;
- [relative] nstring *config_file;
- [relative] nstring *help_file;
- [relative] nstring_array *dependent_files;
- [relative] nstring *monitor_name;
- [relative] nstring *default_datatype;
- } spoolss_DriverInfo3;
-
- typedef struct {
- spoolss_DriverOSVersion version;
- [relative] nstring *driver_name;
- [relative] nstring *architecture;
- [relative] nstring *driver_path;
- [relative] nstring *data_file;
- [relative] nstring *config_file;
- [relative] nstring *help_file;
- [relative] nstring_array *dependent_files;
- [relative] nstring *monitor_name;
- [relative] nstring *default_datatype;
- [relative] nstring_array *previous_names;
- } spoolss_DriverInfo4;
-
- typedef struct {
- spoolss_DriverOSVersion version;
- [relative] nstring *driver_name;
- [relative] nstring *architecture;
- [relative] nstring *driver_path;
- [relative] nstring *data_file;
- [relative] nstring *config_file;
- uint32 driver_attributes;
- uint32 config_version;
- uint32 driver_version;
- } spoolss_DriverInfo5;
-
- typedef struct {
- spoolss_DriverOSVersion version;
- [relative] nstring *driver_name;
- [relative] nstring *architecture;
- [relative] nstring *driver_path;
- [relative] nstring *data_file;
- [relative] nstring *config_file;
- [relative] nstring *help_file;
- [relative] nstring_array *dependent_files;
- [relative] nstring *monitor_name;
- [relative] nstring *default_datatype;
- [relative] nstring_array *previous_names;
- NTTIME driver_data;
- hyper driver_version;
- [relative] nstring *manufacturer_name;
- [relative] nstring *manufacturer_url;
- [relative] nstring *hardware_id;
- [relative] nstring *provider;
- } spoolss_DriverInfo6;
-
- typedef [nodiscriminant,relative_base,public] union {
- [case(1)] spoolss_DriverInfo1 info1;
- [case(2)] spoolss_DriverInfo2 info2;
- [case(3)] spoolss_DriverInfo3 info3;
- [case(4)] spoolss_DriverInfo4 info4;
- [case(5)] spoolss_DriverInfo5 info5;
- [case(6)] spoolss_DriverInfo6 info6;
- [default];
- } spoolss_DriverInfo;
-
- /******************/
- /* Function: 0x0a */
- [public,noopnum,noprint] WERROR _spoolss_EnumPrinterDrivers(
- [in,unique] [string,charset(UTF16)] uint16 *server,
- [in,unique] [string,charset(UTF16)] uint16 *environment,
- [in] uint32 level,
- [in,unique] DATA_BLOB *buffer,
- [in] uint32 offered,
- [out,unique] DATA_BLOB *info,
- [out] uint32 needed,
- [out] uint32 count
- );
- [public,noopnum,noprint] void __spoolss_EnumPrinterDrivers(
- [in] uint32 level,
- [in] uint32 count,
- [out,switch_is(level)] spoolss_DriverInfo info[count]
- );
- [nopull,nopush] WERROR spoolss_EnumPrinterDrivers(
- [in,unique] [string,charset(UTF16)] uint16 *server,
- [in,unique] [string,charset(UTF16)] uint16 *environment,
- [in] uint32 level,
- [in,unique] DATA_BLOB *buffer,
- [in] uint32 offered,
- [out,unique,switch_is(level),size_is(count)] spoolss_DriverInfo *info,
- [out] uint32 needed,
- [out] uint32 count
- );
-
- /******************/
- /* Function: 0x0b */
- WERROR spoolss_GetPrinterDriver(
- );
-
- /******************/
- /* Function: 0x0c */
- typedef struct {
- nstring directory_name;
- } spoolss_DriverDirectoryInfo1;
-
- /* NOTE: it's seems that w2k3 completly ignores the level
- in its server code
- */
- typedef [nodiscriminant,relative_base,gensize,public] union {
- [case(1)] spoolss_DriverDirectoryInfo1 info1;
- [default] spoolss_DriverDirectoryInfo1 info1;
- } spoolss_DriverDirectoryInfo;
-
- [public] WERROR spoolss_GetPrinterDriverDirectory(
- [in,unique] [string,charset(UTF16)] uint16 *server,
- [in,unique] [string,charset(UTF16)] uint16 *environment,
- [in] uint32 level,
- [in,unique] DATA_BLOB *buffer,
- [in] uint32 offered,
- [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_DriverDirectoryInfo *info,
- [out] uint32 needed
- );
-
- /******************/
- /* Function: 0x0d */
- WERROR spoolss_DeletePrinterDriver(
- [in,ref] policy_handle *handle,
- [in,unique] [string,charset(UTF16)] uint16 *server,
- [in] [string,charset(UTF16)] uint16 architecture[],
- [in] [string,charset(UTF16)] uint16 driver[]
- );
-
- /******************/
- /* Function: 0x0e */
- WERROR spoolss_AddPrintProcessor(
- );
-
- /******************/
- /* Function: 0x0f */
- typedef struct {
- [relative] nstring *print_processor_name;
- } spoolss_PrintProcessorInfo1;
-
- typedef [nodiscriminant,relative_base,public] union {
- [case(1)] spoolss_PrintProcessorInfo1 info1;
- [default];
- } spoolss_PrintProcessorInfo;
-
- [public,noopnum,noprint] WERROR _spoolss_EnumPrintProcessors(
- [in,unique] [string,charset(UTF16)] uint16 *servername,
- [in,unique] [string,charset(UTF16)] uint16 *environment,
- [in] uint32 level,
- [in,unique] DATA_BLOB *buffer,
- [in] uint32 offered,
- [out,unique] DATA_BLOB *info,
- [out] uint32 needed,
- [out] uint32 count
- );
- [public,noopnum,noprint] void __spoolss_EnumPrintProcessors(
- [in] uint32 level,
- [in] uint32 count,
- [out,switch_is(level)] spoolss_PrintProcessorInfo info[count]
- );
- [nopull,nopush] WERROR spoolss_EnumPrintProcessors(
- [in,unique] [string,charset(UTF16)] uint16 *servername,
- [in,unique] [string,charset(UTF16)] uint16 *environment,
- [in] uint32 level,
- [in,unique] DATA_BLOB *buffer,
- [in] uint32 offered,
- [out,unique,switch_is(level),size_is(count)] spoolss_PrintProcessorInfo *info,
- [out] uint32 needed,
- [out] uint32 count
- );
-
- /******************/
- /* Function: 0x10 */
- WERROR spoolss_GetPrintProcessorDirectory(
- );
-
- /******************/
- /* Function: 0x11 */
- typedef struct {
- [string,charset(UTF16)] uint16 *document_name;
- [string,charset(UTF16)] uint16 *output_file;
- [string,charset(UTF16)] uint16 *datatype;
- } spoolss_DocumentInfo1;
-
- typedef [switch_type(uint32)] union {
- [case(1)] spoolss_DocumentInfo1 *info1;
- [case(2)]; /* TODO */
- [case(3)]; /* TODO */
- [default];
- } spoolss_DocumentInfo;
-
- WERROR spoolss_StartDocPrinter(
- [in,ref] policy_handle *handle,
- [in] uint32 level,
- [in,switch_is(level)] spoolss_DocumentInfo info,
- [out] uint32 job_id
- );
-
- /******************/
- /* Function: 0x12 */
- WERROR spoolss_StartPagePrinter(
- [in,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x13 */
- WERROR spoolss_WritePrinter(
- [in,ref] policy_handle *handle,
- [in] DATA_BLOB data,
- [in,value(r->in.data.length)] uint32 _data_size,
- [out] uint32 num_written
- );
-
- /******************/
- /* Function: 0x14 */
- WERROR spoolss_EndPagePrinter(
- [in,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x15 */
- WERROR spoolss_AbortPrinter(
- [in,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x16 */
- WERROR spoolss_ReadPrinter(
- [in,ref] policy_handle *handle,
- [in] uint32 data_size,
- [out] DATA_BLOB data,
- [out,value(r->out.data.length)] uint32 _data_size
- );
-
- /******************/
- /* Function: 0x17 */
- WERROR spoolss_EndDocPrinter(
- [in,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x18 */
- WERROR spoolss_AddJob(
- );
-
- /******************/
- /* Function: 0x19 */
- WERROR spoolss_ScheduleJob(
- );
-
- /******************/
- /* Function: 0x1a */
- const string SPOOLSS_ARCHITECTURE_NT_X86 = "Windows NT x86";
-
- typedef [public,gensize] struct {
- [value(ndr_size_spoolss_OSVersion(r,ndr->flags))] uint32 _ndr_size;
- uint32 major;
- uint32 minor;
- uint32 build;
- [value(2)] uint32 unknown;
- [subcontext(0),subcontext_size(256)] nstring extra_string;
- } spoolss_OSVersion;
-
- typedef [public,gensize] struct {
- [value(ndr_size_spoolss_OSVersionEx(r,ndr->flags))] uint32 _ndr_size;
- uint32 major;
- uint32 minor;
- uint32 build;
- [value(2)] uint32 unknown1;
- [subcontext(0),subcontext_size(256)] nstring extra_string;
- uint32 unknown2;/* service pack number? I saw 0 from w2k3 and 1 from winxp sp1*/
- uint32 unknown3;/* hmm? w2k3: 131346(0x20112) winxp sp1: 503382272 0x1E010100 */
- } spoolss_OSVersionEx;
-
- typedef [v1_enum] enum {
- SPOOLSS_PRINTER_DATA_TYPE_NULL = 0,
- SPOOLSS_PRINTER_DATA_TYPE_STRING = 1,
- SPOOLSS_PRINTER_DATA_TYPE_BINARY = 3,
- SPOOLSS_PRINTER_DATA_TYPE_UINT32 = 4,
- SPOOLSS_PRINTER_DATA_TYPE_STRING_ARRAY = 7
- } spoolss_PrinterDataType;
-
- typedef [nodiscriminant,public,gensize] union {
- [case(SPOOLSS_PRINTER_DATA_TYPE_NULL)];
- [case(SPOOLSS_PRINTER_DATA_TYPE_STRING)] nstring string;
- [case(SPOOLSS_PRINTER_DATA_TYPE_BINARY),flag(NDR_REMAINING)] DATA_BLOB binary;
- [case(SPOOLSS_PRINTER_DATA_TYPE_UINT32)] uint32 value;
- [case(SPOOLSS_PRINTER_DATA_TYPE_STRING_ARRAY)] nstring_array string_array;
- [default,flag(NDR_REMAINING)] DATA_BLOB data;
- } spoolss_PrinterData;
-
- [noopnum,noprint,public] WERROR _spoolss_GetPrinterData(
- [in,ref] policy_handle *handle,
- [in] [string,charset(UTF16)] uint16 value_name[],
- [in] uint32 offered,
- [out] spoolss_PrinterDataType type,
- [out] DATA_BLOB data,
- [out] uint32 needed
- );
- [noopnum,noprint,public] void __spoolss_GetPrinterData(
- [in] spoolss_PrinterDataType type,
- [out,switch_is(type)] spoolss_PrinterData data
- );
- [nopull,nopush,public] WERROR spoolss_GetPrinterData(
- [in,ref] policy_handle *handle,
- [in] [string,charset(UTF16)] uint16 value_name[],
- [in] uint32 offered,
- [out] spoolss_PrinterDataType type,
- [out,subcontext(4),subcontext_size(offered),switch_is(type)] spoolss_PrinterData data,
- [out] uint32 needed
- );
-
- /******************/
- /* Function: 0x1b */
- [noopnum,nopull,noprint,public] WERROR _spoolss_SetPrinterData(
- [in,ref] policy_handle *handle,
- [in] [string,charset(UTF16)] uint16 value_name[],
- [in] spoolss_PrinterDataType type,
- [in] DATA_BLOB data,
- [in] uint32 _offered
- );
- [noopnum,nopull,noprint,public] void __spoolss_SetPrinterData(
- [in] spoolss_PrinterDataType type,
- [out,switch_is(type)] spoolss_PrinterData data
- );
- [nopush] WERROR spoolss_SetPrinterData(
- [in,ref] policy_handle *handle,
- [in] [string,charset(UTF16)] uint16 value_name[],
- [in] spoolss_PrinterDataType type,
- [in,subcontext(4),switch_is(type)] spoolss_PrinterData data,
- [in,value(ndr_size_spoolss_PrinterData(&data,type,flags))] uint32 _offered
- );
-
- /******************/
- /* Function: 0x1c */
- WERROR spoolss_WaitForPrinterChange(
- );
-
- /******************/
- /* Function: 0x1d */
- [public] WERROR spoolss_ClosePrinter(
- [in,out,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x1e */
- typedef [v1_enum] enum {
- SPOOLSS_FORM_USER = 0,
- SPOOLSS_FORM_BUILTIN = 1,
- SPOOLSS_FORM_PRINTER = 2
- } spoolss_FormFlags;
-
- typedef struct {
- uint32 width;
- uint32 height;
- } spoolss_FormSize;
-
- typedef struct {
- uint32 left;
- uint32 top;
- uint32 right;
- uint32 bottom;
- } spoolss_FormArea;
-
- typedef struct {
- spoolss_FormFlags flags;
- [relative] nstring *form_name;
- spoolss_FormSize size;
- spoolss_FormArea area;
- } spoolss_FormInfo1;
-
- typedef [nodiscriminant,relative_base,public,gensize] union {
- [case(1)] spoolss_FormInfo1 info1;
- [default];
- } spoolss_FormInfo;
-
- typedef struct {
- spoolss_FormFlags flags;
- [string,charset(UTF16)] uint16 *form_name;
- spoolss_FormSize size;
- spoolss_FormArea area;
- } spoolss_AddFormInfo1;
-
- typedef [switch_type(uint32)] union {
- [case(1)] spoolss_AddFormInfo1 *info1;
- } spoolss_AddFormInfo;
-
- WERROR spoolss_AddForm(
- [in,ref] policy_handle *handle,
- [in] uint32 level,
- [in,switch_is(level)] spoolss_AddFormInfo info
- );
-
- /******************/
- /* Function: 0x1f */
- WERROR spoolss_DeleteForm(
- [in,ref] policy_handle *handle,
- [in] [string,charset(UTF16)] uint16 form_name[]
- );
-
- /******************/
- /* Function: 0x20 */
- WERROR spoolss_GetForm(
- [in,ref] policy_handle *handle,
- [in] [string,charset(UTF16)] uint16 form_name[],
- [in] uint32 level,
- [in,unique] DATA_BLOB *buffer,
- [in] uint32 offered,
- [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_FormInfo *info,
- [out] uint32 needed
- );
-
- /******************/
- /* Function: 0x21 */
- WERROR spoolss_SetForm(
- [in,ref] policy_handle *handle,
- [in] [string,charset(UTF16)] uint16 form_name[],
- [in] uint32 level,
- [in,switch_is(level)] spoolss_AddFormInfo info
- );
-
- /******************/
- /* Function: 0x22 */
- [public,noopnum,noprint] WERROR _spoolss_EnumForms(
- [in,ref] policy_handle *handle,
- [in] uint32 level,
- [in,unique] DATA_BLOB *buffer,
- [in] uint32 offered,
- [out,unique] DATA_BLOB *info,
- [out] uint32 needed,
- [out] uint32 count
- );
- [public,noopnum,noprint] void __spoolss_EnumForms(
- [in] uint32 level,
- [in] uint32 count,
- [out,switch_is(level)] spoolss_FormInfo info[count]
- );
- [nopull,nopush] WERROR spoolss_EnumForms(
- [in,ref] policy_handle *handle,
- [in] uint32 level,
- [in,unique] DATA_BLOB *buffer,
- [in] uint32 offered,
- [out,unique,switch_is(level),size_is(count)] spoolss_FormInfo *info,
- [out] uint32 needed,
- [out] uint32 count
- );
-
- typedef struct {
- [relative] nstring *port_name;
- } spoolss_PortInfo1;
-
- typedef bitmap {
- SPOOLSS_PORT_TYPE_WRITE = 0x00000001,
- SPOOLSS_PORT_TYPE_READ = 0x00000002,
- SPOOLSS_PORT_TYPE_REDIRECTED = 0x00000004,
- SPOOLSS_PORT_TYPE_NET_ATTACHED = 0x00000008
- } spoolss_PortType;
-
- typedef struct {
- [relative] nstring *port_name;
- [relative] nstring *monitor_name;
- [relative] nstring *description;
- spoolss_PortType port_type;
- uint32 reserved;
- } spoolss_PortInfo2;
-
- typedef [nodiscriminant,relative_base,public] union {
- [case(1)] spoolss_PortInfo1 info1;
- [case(2)] spoolss_PortInfo2 info2;
- [case(3)]; /* TODO */
- [default];
- } spoolss_PortInfo;
-
- /******************/
- /* Function: 0x23 */
- [public,noopnum,noprint] WERROR _spoolss_EnumPorts(
- [in,unique] [string,charset(UTF16)] uint16 *servername,
- [in] uint32 level,
- [in,unique] DATA_BLOB *buffer,
- [in] uint32 offered,
- [out,unique] DATA_BLOB *info,
- [out] uint32 needed,
- [out] uint32 count
- );
- [public,noopnum,noprint] void __spoolss_EnumPorts(
- [in] uint32 level,
- [in] uint32 count,
- [out,switch_is(level)] spoolss_PortInfo info[count]
- );
- [nopull,nopush] WERROR spoolss_EnumPorts(
- [in,unique] [string,charset(UTF16)] uint16 *servername,
- [in] uint32 level,
- [in,unique] DATA_BLOB *buffer,
- [in] uint32 offered,
- [out,unique,switch_is(level),size_is(count)] spoolss_PortInfo *info,
- [out] uint32 needed,
- [out] uint32 count
- );
-
- /******************/
- /* Function: 0x24 */
- typedef struct {
- [relative] nstring *monitor_name;
- } spoolss_MonitorInfo1;
-
- typedef struct {
- [relative] nstring *monitor_name;
- [relative] nstring *environment;
- [relative] nstring *dll_name;
- } spoolss_MonitorInfo2;
-
- typedef [nodiscriminant,relative_base,public] union {
- [case(1)] spoolss_MonitorInfo1 info1;
- [case(2)] spoolss_MonitorInfo2 info2;
- [default];
- } spoolss_MonitorInfo;
-
- [public,noopnum,noprint] WERROR _spoolss_EnumMonitors(
- [in,unique] [string,charset(UTF16)] uint16 *servername,
- [in] uint32 level,
- [in,unique] DATA_BLOB *buffer,
- [in] uint32 offered,
- [out,unique] DATA_BLOB *info,
- [out] uint32 needed,
- [out] uint32 count
- );
- [public,noopnum,noprint] void __spoolss_EnumMonitors(
- [in] uint32 level,
- [in] uint32 count,
- [out,switch_is(level)] spoolss_MonitorInfo info[count]
- );
- [nopull,nopush] WERROR spoolss_EnumMonitors(
- [in,unique] [string,charset(UTF16)] uint16 *servername,
- [in] uint32 level,
- [in,unique] DATA_BLOB *buffer,
- [in] uint32 offered,
- [out,unique,switch_is(level),size_is(count)] spoolss_MonitorInfo *info,
- [out] uint32 needed,
- [out] uint32 count
- );
-
- /******************/
- /* Function: 0x25 */
- WERROR spoolss_AddPort(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in] uint32 unknown,
- [in] [string,charset(UTF16)] uint16 monitor_name[]
- );
-
- /******************/
- /* Function: 0x26 */
- WERROR spoolss_ConfigurePort(
- );
-
- /******************/
- /* Function: 0x27 */
- WERROR spoolss_DeletePort(
- );
-
- /******************/
- /* Function: 0x28 */
- WERROR spoolss_CreatePrinterIC(
- );
-
- /******************/
- /* Function: 0x29 */
- WERROR spoolss_PlayGDIScriptOnPrinterIC(
- );
-
- /******************/
- /* Function: 0x2a */
- WERROR spoolss_DeletePrinterIC(
- );
-
- /******************/
- /* Function: 0x2b */
- WERROR spoolss_AddPrinterConnection(
- );
-
- /******************/
- /* Function: 0x2c */
- WERROR spoolss_DeletePrinterConnection(
- );
-
- /******************/
- /* Function: 0x2d */
- WERROR spoolss_PrinterMessageBox(
- /* Marked as obsolete in MSDN. "Not necessary and has
- no effect". */
- );
-
- /******************/
- /* Function: 0x2e */
- WERROR spoolss_AddMonitor(
- );
-
- /******************/
- /* Function: 0x2f */
- WERROR spoolss_DeleteMonitor(
- );
-
- /******************/
- /* Function: 0x30 */
- WERROR spoolss_DeletePrintProcessor(
- );
-
- /******************/
- /* Function: 0x31 */
- WERROR spoolss_AddPrintProvidor(
- );
-
- /******************/
- /* Function: 0x32 */
- WERROR spoolss_DeletePrintProvidor(
- );
-
- /******************/
- /* Function: 0x33 */
- WERROR spoolss_EnumPrintProcDataTypes(
- );
-
- /******************/
- /* Function: 0x34 */
- WERROR spoolss_ResetPrinter(
- );
-
- /******************/
- /* Function: 0x35 */
- WERROR spoolss_GetPrinterDriver2(
- [in,ref] policy_handle *handle,
- [in,unique] [string,charset(UTF16)] uint16 *architecture,
- [in] uint32 level,
- [in,unique] DATA_BLOB *buffer,
- [in] uint32 offered,
- [in] uint32 client_major_version,
- [in] uint32 client_minor_version,
- [out,unique] DATA_BLOB *info,
- [out] uint32 needed,
- [out] uint32 server_major_version,
- [out] uint32 server_minor_version
- );
-
- /******************/
- /* Function: 0x36 */
- WERROR spoolss_FindFirstPrinterChangeNotification(
- );
-
- /******************/
- /* Function: 0x37 */
- WERROR spoolss_FindNextPrinterChangeNotification(
- );
-
- /******************/
- /* Function: 0x38 */
- [public] WERROR spoolss_FindClosePrinterNotify(
- [in,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x39 */
- WERROR spoolss_RouterFindFirstPrinterChangeNotificationOld(
- );
-
- /******************/
- /* Function: 0x3a */
- [public] WERROR spoolss_ReplyOpenPrinter(
- [in,string,charset(UTF16)] uint16 server_name[],
- [in] uint32 printer_local,
- [in] winreg_Type type,
- [in] uint32 unknown1,
- [in] uint32 unknown2,
- [out,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x3b */
- WERROR spoolss_RouterReplyPrinter(
- );
-
- /******************/
- /* Function: 0x3c */
- [public] WERROR spoolss_ReplyClosePrinter(
- [in,out,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x3d */
- WERROR spoolss_AddPortEx(
- );
-
- /******************/
- /* Function: 0x3e */
- WERROR spoolss_RouterFindFirstPrinterChangeNotification(
- );
-
- /******************/
- /* Function: 0x3f */
- WERROR spoolss_SpoolerInit(
- );
-
- /******************/
- /* Function: 0x40 */
- WERROR spoolss_ResetPrinterEx(
- );
-
- typedef [enum16bit] enum {
- SPOOLSS_FIELD_SERVER_NAME = 0,
- SPOOLSS_FIELD_PRINTER_NAME = 1,
- SPOOLSS_FIELD_SHARE_NAME = 2,
- SPOOLSS_FIELD_PORT_NAME = 3,
- SPOOLSS_FIELD_DRIVER_NAME = 4,
- SPOOLSS_FIELD_COMMENT = 5,
- SPOOLSS_FIELD_LOCATION = 6,
- SPOOLSS_FIELD_DEVMODE = 7,
- SPOOLSS_FIELD_SEPFILE = 8,
- SPOOLSS_FIELD_PRINT_PROCESSOR = 9,
- SPOOLSS_FIELD_PARAMETERS = 10,
- SPOOLSS_FIELD_DATATYPE = 11,
- SPOOLSS_FIELD_SECURITY_DESCRIPTOR=12,
- SPOOLSS_FIELD_ATTRIBUTES = 13,
- SPOOLSS_FIELD_PRIORITY = 14,
- SPOOLSS_FIELD_DEFAULT_PRIORITY = 15,
- SPOOLSS_FIELD_START_TIME = 16,
- SPOOLSS_FIELD_UNTIL_TIME = 17,
- SPOOLSS_FIELD_STATUS = 18,
- SPOOLSS_FIELD_STATUS_STRING = 19,
- SPOOLSS_FIELD_CJOBS = 20,
- SPOOLSS_FIELD_AVERAGE_PPM = 21,
- SPOOLSS_FIELD_TOTAL_PAGES = 22,
- SPOOLSS_FIELD_PAGES_PRINTED = 23,
- SPOOLSS_FIELD_TOTAL_BYTES = 24,
- SPOOLSS_FIELD_BYTES_PRINTED = 25
- } spoolss_Field;
-
- typedef [enum16bit] enum {
- SPOOLSS_NOTIFY_PRINTER = 0,
- SPOOLSS_NOTIFY_JOB = 1
- } spoolss_NotifyType;
-
- /******************/
- /* Function: 0x41 */
- typedef struct {
- spoolss_NotifyType type;
- uint16 u1;
- uint32 u2;
- uint32 u3;
- uint32 count;
- [size_is(count)] spoolss_Field *fields;
- } spoolss_NotifyOptionsArray;
-
- typedef struct {
- uint32 version;
- uint32 flags;
- uint32 count;
- [size_is(count)] spoolss_NotifyOptionsArray *options;
- } spoolss_NotifyOptionsContainer;
-
- [public] WERROR spoolss_RemoteFindFirstPrinterChangeNotifyEx(
- [in,ref] policy_handle *handle,
- [in] uint32 flags,
- [in] uint32 options,
- [in,unique] [string,charset(UTF16)] uint16 *str,
- [in] uint32 printer_local,
- [in,unique] spoolss_NotifyOptionsContainer *t1
- );
-
- /******************/
- /* Function: 0x42 */
- WERROR spoolss_RouterRefreshPrinterChangeNotification(
- );
-
- typedef struct {
- uint32 size;
- [size_is(size/2),unique,charset(UTF16)] uint16 *string;
- } spoolss_NotifyUTF16String;
-
- typedef struct {
- uint32 size;
- [size_is(size),charset(DOS)] uint8 *string;
- } spoolss_NotifyDOSString;
-
- typedef struct {
- uint16 data[8];
- } spoolss_NotifyBlobData;
-
- typedef struct {
- uint32 len;
- [unique] spoolss_NotifyBlobData *data;
- } spoolss_NotifyBlob;
-
- typedef [switch_type(uint32)] union {
- [case(1)] dlong integer;
- [case(2)] spoolss_NotifyUTF16String utf16_string;
- [case(3)] spoolss_NotifyDOSString ascii_string;
- [case(4)] spoolss_NotifyBlob blob;
- [case(5)] spoolss_NotifyDOSString ascii_string;
- } spoolss_NotifyData;
-
- typedef struct {
- spoolss_NotifyType type;
- spoolss_Field field;
- uint32 variable_type;
- uint32 job_id;
- [switch_is(variable_type)] spoolss_NotifyData data;
- } spoolss_Notify;
-
- typedef struct {
- uint32 version;
- uint32 flags;
- uint32 count;
- [size_is(count)] spoolss_Notify notifies[];
- } spoolss_NotifyInfo;
-
- /******************/
- /* Function: 0x43 */
- [public] WERROR spoolss_RemoteFindNextPrinterChangeNotifyEx(
- [in,ref] policy_handle *handle,
- [in] uint32 change_low,
- [in,unique] spoolss_NotifyOptionsContainer *container,
- [out, unique] spoolss_NotifyInfo *info
- );
-
- /******************/
- /* Function: 0x44 */
- WERROR spoolss_44(
- );
-
- typedef struct {
- uint32 size;
- [string,charset(UTF16)] uint16 *client;
- [string,charset(UTF16)] uint16 *user;
- uint32 build;
- uint32 major;
- uint32 minor;
- uint32 processor;
- } spoolss_UserLevel1;
-
- typedef union {
- [case(1)] spoolss_UserLevel1 *level1;
- } spoolss_UserLevel;
-
- typedef bitmap {
- SERVER_ACCESS_ADMINISTER = 0x00000001,
- SERVER_ACCESS_ENUMERATE = 0x00000002,
- PRINTER_ACCESS_ADMINISTER = 0x00000004,
- PRINTER_ACCESS_USE = 0x00000008,
- JOB_ACCESS_ADMINISTER = 0x00000010
- } spoolss_AccessRights;
-
- /* Access rights for print servers */
- const int SERVER_ALL_ACCESS = SEC_STD_REQUIRED |
- SERVER_ACCESS_ADMINISTER |
- SERVER_ACCESS_ENUMERATE;
-
- const int SERVER_READ = SEC_STD_READ_CONTROL |
- SERVER_ACCESS_ENUMERATE;
-
- const int SERVER_WRITE = STANDARD_RIGHTS_WRITE_ACCESS |
- SERVER_ACCESS_ADMINISTER |
- SERVER_ACCESS_ENUMERATE;
-
- const int SERVER_EXECUTE = SEC_STD_READ_CONTROL |
- SERVER_ACCESS_ENUMERATE;
-
- /* Access rights for printers */
- const int PRINTER_ALL_ACCESS = SEC_STD_REQUIRED |
- PRINTER_ACCESS_ADMINISTER |
- PRINTER_ACCESS_USE;
-
- const int PRINTER_READ = SEC_STD_READ_CONTROL |
- PRINTER_ACCESS_USE;
-
- const int PRINTER_WRITE = STANDARD_RIGHTS_WRITE_ACCESS |
- PRINTER_ACCESS_USE;
-
- const int PRINTER_EXECUTE = SEC_STD_READ_CONTROL |
- PRINTER_ACCESS_USE;
-
- /* Access rights for jobs */
- const int JOB_ALL_ACCESS = SEC_STD_REQUIRED |
- JOB_ACCESS_ADMINISTER;
-
- const int JOB_READ = SEC_STD_READ_CONTROL |
- JOB_ACCESS_ADMINISTER;
-
- const int JOB_WRITE = STANDARD_RIGHTS_WRITE_ACCESS |
- JOB_ACCESS_ADMINISTER;
-
- const int JOB_EXECUTE = SEC_STD_READ_CONTROL |
- JOB_ACCESS_ADMINISTER;
-
- /* ACE masks for various print permissions */
- const int PRINTER_ACE_FULL_CONTROL = SEC_GENERIC_ALL |
- PRINTER_ALL_ACCESS;
-
- const int PRINTER_ACE_MANAGE_DOCUMENTS = SEC_GENERIC_ALL |
- READ_CONTROL_ACCESS;
-
- const int PRINTER_ACE_PRINT = GENERIC_EXECUTE_ACCESS |
- READ_CONTROL_ACCESS |
- PRINTER_ACCESS_USE;
-
- /******************/
- /* Function: 0x45 */
- [public] WERROR spoolss_OpenPrinterEx(
- [in,unique] [string,charset(UTF16)] uint16 *printername,
- [in,unique] [string,charset(UTF16)] uint16 *datatype,
- [in] spoolss_DevmodeContainer devmode_ctr,
- [in] uint32 access_mask,
- [in] uint32 level,
- [in,switch_is(level)] spoolss_UserLevel userlevel,
- [out,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x46 */
- WERROR spoolss_AddPrinterEx(
- [in,unique] [string,charset(UTF16)] uint16 *server,
- [in] uint32 level,
- [in,unique,switch_is(level)] spoolss_PrinterInfo *info,
- [in] spoolss_DevmodeContainer devmode_ctr,
- [in,unique] security_descriptor *secdesc,
- [in] uint32 ulevel,
- [in,switch_is(ulevel)] spoolss_UserLevel userlevel
- );
-
- /******************/
- /* Function: 0x47 */
- WERROR spoolss_47(
- );
-
- /******************/
- /* Function: 0x48 */
- WERROR spoolss_EnumPrinterData(
- [in,ref] policy_handle *handle,
- [in] uint32 enum_index,
- [out,ref,size_is(value_offered/2),charset(UTF16)] uint16 *value_name,
- [in] uint32 value_offered,
- [out,ref] uint32 *value_needed,
- [out,ref] uint32 *printerdata_type,
- [out,ref] DATA_BLOB *buffer,
- [in] uint32 data_offered,
- [out,ref] uint32 *data_needed
- );
-
- /******************/
- /* Function: 0x49 */
- WERROR spoolss_DeletePrinterData(
- [in,ref] policy_handle *handle,
- [in] [string,charset(UTF16)] uint16 value_name[]
- );
-
- /******************/
- /* Function: 0x4a */
- WERROR spoolss_4a(
- );
-
- /******************/
- /* Function: 0x4b */
- WERROR spoolss_4b(
- );
-
- /******************/
- /* Function: 0x4c */
- WERROR spoolss_4c(
- );
-
- /******************/
- /* Function: 0x4d */
- WERROR spoolss_SetPrinterDataEx(
- [in,ref] policy_handle *handle,
- [in] [string,charset(UTF16)] uint16 key_name[],
- [in] [string,charset(UTF16)] uint16 value_name[],
- [in] uint32 type,
- [in] DATA_BLOB buffer,
- [in] uint32 offered
- );
-
- /******************/
- /* Function: 0x4e */
- WERROR spoolss_GetPrinterDataEx(
- [in,ref] policy_handle *handle,
- [in] [string,charset(UTF16)] uint16 key_name[],
- [in] [string,charset(UTF16)] uint16 value_name[],
- [in] uint32 offered,
- [out] uint32 type,
- [out] DATA_BLOB buffer,
- [out] uint32 needed
- );
-
- /******************/
- /* Function: 0x4f */
- [public] WERROR spoolss_EnumPrinterDataEx(
- [in,ref] policy_handle *handle,
- [in] [string,charset(UTF16)] uint16 key_name[],
- [in] uint32 offered,
- [out] DATA_BLOB buffer,
- [out] uint32 needed,
- [out] uint32 count
- );
-
- /******************/
- /* Function: 0x50 */
- [public] WERROR spoolss_EnumPrinterKey(
- [in, ref] policy_handle *handle,
- [in] [string,charset(UTF16)] uint16 key_name[],
- [out] uint32 key_buffer_size,
- [out] uint16 key_buffer[key_buffer_size],
- [in,out] uint32 needed
- );
-
- /******************/
- /* Function: 0x51 */
- WERROR spoolss_DeletePrinterDataEx(
- [in,ref] policy_handle *handle,
- [in] [string,charset(UTF16)] uint16 key_name[],
- [in] [string,charset(UTF16)] uint16 value_name[]
- );
-
- /******************/
- /* Function: 0x52 */
- WERROR spoolss_DeletePrinterKey(
- );
-
- /******************/
- /* Function: 0x53 */
- WERROR spoolss_53(
- );
-
- /******************/
- /* Function: 0x54 */
- WERROR spoolss_DeletePrinterDriverEx(
- );
-
- /******************/
- /* Function: 0x55 */
- WERROR spoolss_55(
- );
-
- /******************/
- /* Function: 0x56 */
- WERROR spoolss_56(
- );
-
- /******************/
- /* Function: 0x57 */
- WERROR spoolss_57(
- );
-
- /******************/
- /* Function: 0x58 */
- WERROR spoolss_XcvData(
- [in,ref] policy_handle *handle,
- [in] [string,charset(UTF16)] uint16 function_name[],
- [in] DATA_BLOB in_data,
- [in,value(r->in.in_data.length)] uint32 _in_data_length,
- [in] uint32 offered,
- [in] uint32 unknown1,
- [out] DATA_BLOB out_data,
- [out] uint32 needed,
- [out] uint32 unknown2
- );
-
- /******************/
- /* Function: 0x59 */
- [public] WERROR spoolss_AddPrinterDriverEx(
- );
-
- /******************/
- /* Function: 0x5a */
- WERROR spoolss_5a(
- );
-
- /******************/
- /* Function: 0x5b */
- WERROR spoolss_5b(
- );
-
- /******************/
- /* Function: 0x5c */
- WERROR spoolss_5c(
- );
-
- /******************/
- /* Function: 0x5d */
- WERROR spoolss_5d(
- );
-
- /******************/
- /* Function: 0x5e */
- WERROR spoolss_5e(
- );
-
- /******************/
- /* Function: 0x5f */
- WERROR spoolss_5f(
- );
-}
diff --git a/source3/librpc/idl/srvsvc.idl b/source3/librpc/idl/srvsvc.idl
index 0bbd24a5dd..39d72b73da 100644
--- a/source3/librpc/idl/srvsvc.idl
+++ b/source3/librpc/idl/srvsvc.idl
@@ -3,7 +3,6 @@
/*
srvsvc interface definitions
*/
-
import "security.idl", "svcctl.idl";
[ uuid("4b324fc8-1670-01d3-1278-5a47bf6ee188"),
@@ -1377,7 +1376,7 @@ import "security.idl", "svcctl.idl";
/******************/
/* Function: 0x22 */
- WERROR srvsvc_NETRPRNAMECANONICALIZE(
+ [todo] WERROR srvsvc_NETRPRNAMECANONICALIZE(
);
/******************/
@@ -1470,56 +1469,56 @@ import "security.idl", "svcctl.idl";
/******************/
/* Function: 0x2b */
- WERROR srvsvc_NETRDFSGETVERSION(
+ [todo] WERROR srvsvc_NETRDFSGETVERSION(
);
/******************/
/* Function: 0x2c */
- WERROR srvsvc_NETRDFSCREATELOCALPARTITION(
+ [todo] WERROR srvsvc_NETRDFSCREATELOCALPARTITION(
);
/******************/
/* Function: 0x2d */
- WERROR srvsvc_NETRDFSDELETELOCALPARTITION(
+ [todo] WERROR srvsvc_NETRDFSDELETELOCALPARTITION(
);
/******************/
/* Function: 0x2e */
- WERROR srvsvc_NETRDFSSETLOCALVOLUMESTATE(
+ [todo] WERROR srvsvc_NETRDFSSETLOCALVOLUMESTATE(
);
/******************/
/* Function: 0x2f */
- WERROR srvsvc_NETRDFSSETSERVERINFO(
+ [todo] WERROR srvsvc_NETRDFSSETSERVERINFO(
);
/******************/
/* Function: 0x30 */
- WERROR srvsvc_NETRDFSCREATEEXITPOINT(
+ [todo] WERROR srvsvc_NETRDFSCREATEEXITPOINT(
);
/******************/
/* Function: 0x31 */
- WERROR srvsvc_NETRDFSDELETEEXITPOINT(
+ [todo] WERROR srvsvc_NETRDFSDELETEEXITPOINT(
);
/******************/
/* Function: 0x32 */
- WERROR srvsvc_NETRDFSMODIFYPREFIX(
+ [todo] WERROR srvsvc_NETRDFSMODIFYPREFIX(
);
/******************/
/* Function: 0x33 */
- WERROR srvsvc_NETRDFSFIXLOCALVOLUME(
+ [todo] WERROR srvsvc_NETRDFSFIXLOCALVOLUME(
);
/******************/
/* Function: 0x34 */
- WERROR srvsvc_NETRDFSMANAGERREPORTSITEINFO(
+ [todo] WERROR srvsvc_NETRDFSMANAGERREPORTSITEINFO(
);
/******************/
/* Function: 0x35 */
- WERROR srvsvc_NETRSERVERTRANSPORTDELEX(
+ [todo] WERROR srvsvc_NETRSERVERTRANSPORTDELEX(
);
}
diff --git a/source3/librpc/idl/svcctl.idl b/source3/librpc/idl/svcctl.idl
deleted file mode 100644
index 5a843d04ef..0000000000
--- a/source3/librpc/idl/svcctl.idl
+++ /dev/null
@@ -1,528 +0,0 @@
-#include "idl_types.h"
-
-/*
- svcctl interface definitions
-*/
-
-[ uuid("367abb81-9844-35f1-ad32-98f038001003"),
- version(2.0),
- pointer_default(unique),
- endpoint("ncacn_np:[\\pipe\\svcctl]", "ncalrpc:"),
- helpstring("Service Control")
-] interface svcctl
-{
- typedef struct {
- uint32 is_locked;
- [string,charset(UTF16)] uint16 *lock_owner;
- uint32 lock_duration;
- } SERVICE_LOCK_STATUS;
-
- typedef struct {
- uint32 type;
- uint32 state;
- uint32 controls_accepted;
- WERROR win32_exit_code;
- uint32 service_exit_code;
- uint32 check_point;
- uint32 wait_hint;
- } SERVICE_STATUS;
-
- typedef struct {
- [relative] astring *service_name;
- [relative] astring *display_name;
- SERVICE_STATUS status;
- } ENUM_SERVICE_STATUS;
-
- const int SERVICE_TYPE_KERNEL_DRIVER = 0x01;
- const int SERVICE_TYPE_FS_DRIVER = 0x02;
- const int SERVICE_TYPE_ADAPTER = 0x04;
- const int SERVICE_TYPE_RECOGNIZER_DRIVER = 0x08;
- const int SERVICE_TYPE_DRIVER=SERVICE_TYPE_KERNEL_DRIVER|SERVICE_TYPE_FS_DRIVER|SERVICE_TYPE_RECOGNIZER_DRIVER;
- const int SERVICE_TYPE_WIN32_OWN_PROCESS = 0x10;
- const int SERVICE_TYPE_WIN32_SHARE_PROCESS = 0x20;
- const int SERVICE_TYPE_WIN32=SERVICE_TYPE_WIN32_OWN_PROCESS|SERVICE_TYPE_WIN32_SHARE_PROCESS;
-
- const int SERVICE_STATE_ACTIVE = 0x01;
- const int SERVICE_STATE_INACTIVE = 0x02;
- const int SERVICE_STATE_ALL = 0x03;
-
- typedef [public,bitmap32bit] bitmap {
- SV_TYPE_WORKSTATION = 0x00000001,
- SV_TYPE_SERVER = 0x00000002,
- SV_TYPE_SQLSERVER = 0x00000004,
- SV_TYPE_DOMAIN_CTRL = 0x00000008,
- SV_TYPE_DOMAIN_BAKCTRL = 0x00000010,
- SV_TYPE_TIME_SOURCE = 0x00000020,
- SV_TYPE_AFP = 0x00000040,
- SV_TYPE_NOVELL = 0x00000080,
-
- SV_TYPE_DOMAIN_MEMBER = 0x00000100,
- SV_TYPE_PRINTQ_SERVER = 0x00000200,
- SV_TYPE_DIALIN_SERVER = 0x00000400,
- SV_TYPE_SERVER_UNIX = 0x00000800,
- SV_TYPE_NT = 0x00001000,
- SV_TYPE_WFW = 0x00002000,
- SV_TYPE_SERVER_MFPN = 0x00004000,
- SV_TYPE_SERVER_NT = 0x00008000,
- SV_TYPE_POTENTIAL_BROWSER = 0x00010000,
- SV_TYPE_BACKUP_BROWSER = 0x00020000,
- SV_TYPE_MASTER_BROWSER = 0x00040000,
- SV_TYPE_DOMAIN_MASTER = 0x00080000,
- SV_TYPE_SERVER_OSF = 0x00100000,
- SV_TYPE_SERVER_VMS = 0x00200000,
- SV_TYPE_WIN95_PLUS = 0x00400000,
- SV_TYPE_DFS_SERVER = 0x00800000,
- SV_TYPE_ALTERNATE_XPORT = 0x20000000,
- SV_TYPE_LOCAL_LIST_ONLY = 0x40000000,
- SV_TYPE_DOMAIN_ENUM = 0x80000000
- } svcctl_ServerType;
-
- const uint32 SV_TYPE_ALL = 0xFFFFFFFF;
-
- /*****************/
- /* Function 0x00 */
- WERROR svcctl_CloseServiceHandle(
- [in,out,ref] policy_handle *handle
- );
-
- /*****************/
- /* Function 0x01 */
-
- typedef enum {
- FIXME=1
- } SERVICE_CONTROL;
-
- WERROR svcctl_ControlService(
- [in,ref] policy_handle *handle,
- [in] uint32 control,
- [out,ref] SERVICE_STATUS *service_status
- );
-
- /*****************/
- /* Function 0x02 */
- WERROR svcctl_DeleteService(
- [in,ref] policy_handle *handle
- );
-
- /*****************/
- /* Function 0x03 */
-
- WERROR svcctl_LockServiceDatabase(
- [in,ref] policy_handle *handle,
- [out,ref] policy_handle *lock
- );
-
- /*****************/
- /* Function 0x04 */
- WERROR svcctl_QueryServiceObjectSecurity(
- [in] policy_handle *handle,
- [in] uint32 security_flags,
- [out,ref,size_is(buffer_size)] uint8 *buffer,
- [in,range(0,0x40000)] uint32 buffer_size,
- [out,ref,range(0,0x40000)] uint32 *needed
- );
-
- /*****************/
- /* Function 0x05 */
- WERROR svcctl_SetServiceObjectSecurity(
- [in] policy_handle *handle,
- [in] uint32 security_flags,
- [in,ref,size_is(buffer_size)] uint8 *buffer,
- [in] uint32 buffer_size
- );
-
- /*****************/
- /* Function 0x06 */
- WERROR svcctl_QueryServiceStatus(
- [in,ref] policy_handle *handle,
- [out,ref] SERVICE_STATUS *service_status
- );
-
- /*****************/
- /* Function 0x07 */
- WERROR svcctl_SetServiceStatus(
- );
-
- /*****************/
- /* Function 0x08 */
- WERROR svcctl_UnlockServiceDatabase(
- [in,out,ref] policy_handle *lock
- );
-
- /*****************/
- /* Function 0x09 */
- WERROR svcctl_NotifyBootConfigStatus(
- );
-
- /*****************/
- /* Function 0x0a */
- WERROR svcctl_SCSetServiceBitsW(
- [in,ref] policy_handle *handle,
- [in] uint32 bits,
- [in] boolean32 bitson,
- [in] boolean32 immediate
- );
-
- /*****************/
- /* Function 0x0b */
- WERROR svcctl_ChangeServiceConfigW(
- [in,ref] policy_handle *handle,
- [in] uint32 type,
- [in] uint32 start,
- [in] uint32 error,
- [in,unique] [string,charset(UTF16)] uint16 *binary_path,
- [in,unique] [string,charset(UTF16)] uint16 *load_order_group,
- [out,ref] uint32 *tag_id,
- [in,unique] [string,charset(UTF16)] uint16 *dependencies,
- [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
- [in,unique] [string,charset(UTF16)] uint16 *password,
- [in,unique] [string,charset(UTF16)] uint16 *display_name
- );
-
- /*****************/
- /* Function 0x0c */
- WERROR svcctl_CreateServiceW(
- [in,ref] policy_handle *scmanager_handle,
- [in] [string,charset(UTF16)] uint16 ServiceName[],
- [in,unique] [string,charset(UTF16)] uint16 *DisplayName,
- [in] uint32 desired_access,
- [in] uint32 type,
- [in] uint32 start_type,
- [in] uint32 error_control,
- [in] [string,charset(UTF16)] uint16 binary_path[],
- [in,unique] [string,charset(UTF16)] uint16 *LoadOrderGroupKey,
- [in,out,unique] uint32 *TagId,
- [in,unique,size_is(dependencies_size)] uint8 *dependencies,
- [in] uint32 dependencies_size,
- [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
- [in,unique,size_is(password_size)] uint8 *password,
- [in] uint32 password_size,
- [out,ref] policy_handle *handle
- );
-
- /*****************/
- /* Function 0x0d */
- WERROR svcctl_EnumDependentServicesW(
- [in,ref] policy_handle *service,
- [in] uint32 state,
- [out,ref,size_is(buf_size)] uint8 *service_status,
- [in,range(0,0x40000)] uint32 buf_size,
- [out,ref,range(0,0x40000)] uint32 *bytes_needed,
- [out,ref,range(0,0x40000)] uint32 *services_returned
- );
-
- /*****************/
- /* Function 0x0e */
- WERROR svcctl_EnumServicesStatusW(
- [in,ref] policy_handle *handle,
- [in] uint32 type,
- [in] uint32 state,
- [in] uint32 buf_size,
- [out,size_is(buf_size)] uint8 service[*],
- [out,ref] uint32 *bytes_needed,
- [out,ref] uint32 *services_returned,
- [in,out,unique] uint32 *resume_handle
- );
-
- /*****************/
- /* Function 0x0f */
- typedef [bitmap32bit] bitmap {
- SC_RIGHT_MGR_CONNECT = 0x0001,
- SC_RIGHT_MGR_CREATE_SERVICE = 0x0002,
- SC_RIGHT_MGR_ENUMERATE_SERVICE = 0x0004,
- SC_RIGHT_MGR_LOCK = 0x0008,
- SC_RIGHT_MGR_QUERY_LOCK_STATUS = 0x0010,
- SC_RIGHT_MGR_MODIFY_BOOT_CONFIG = 0x0020
- } svcctl_MgrAccessMask;
-
- WERROR svcctl_OpenSCManagerW(
- [in,unique] [string,charset(UTF16)] uint16 *MachineName,
- [in,unique] [string,charset(UTF16)] uint16 *DatabaseName,
- [in] svcctl_MgrAccessMask access_mask,
- [out,ref] policy_handle *handle
- );
-
- /*****************/
- /* Function 0x10 */
- typedef [bitmap32bit] bitmap {
- SC_RIGHT_SVC_QUERY_CONFIG = 0x0001,
- SC_RIGHT_SVC_CHANGE_CONFIG = 0x0002,
- SC_RIGHT_SVC_QUERY_STATUS = 0x0004,
- SC_RIGHT_SVC_ENUMERATE_DEPENDENTS = 0x0008,
- SC_RIGHT_SVC_START = 0x0010,
- SC_RIGHT_SVC_STOP = 0x0020,
- SC_RIGHT_SVC_PAUSE_CONTINUE = 0x0040,
- SC_RIGHT_SVC_INTERROGATE = 0x0080,
- SC_RIGHT_SVC_USER_DEFINED_CONTROL = 0x0100
- } svcctl_ServiceAccessMask;
-
- WERROR svcctl_OpenServiceW(
- [in,ref] policy_handle *scmanager_handle,
- [in] [string,charset(UTF16)] uint16 ServiceName[],
- [in] svcctl_ServiceAccessMask access_mask,
- [out,ref] policy_handle *handle
- );
-
- /*****************/
- /* Function 0x11 */
- WERROR svcctl_QueryServiceConfigW(
- [in,ref] policy_handle *handle,
- [out] uint8 query[buf_size], /*QUERY_SERVICE_CONFIG */
- [in] uint32 buf_size,
- [out,ref] uint32 *bytes_needed
- );
-
- /*****************/
- /* Function 0x12 */
- WERROR svcctl_QueryServiceLockStatusW(
- [in,ref] policy_handle *handle,
- [in] uint32 buf_size,
- [out,ref] SERVICE_LOCK_STATUS *lock_status,
- [out,ref] uint32 *required_buf_size
- );
-
- /*****************/
- /* Function 0x13 */
- WERROR svcctl_StartServiceW(
- [in,ref] policy_handle *handle,
- [in] uint32 NumArgs,
- [in,unique/*FIXME:,length_is(NumArgs)*/] [string,charset(UTF16)] uint16 *Arguments
- );
-
- /*****************/
- /* Function 0x14 */
- WERROR svcctl_GetServiceDisplayNameW(
- [in,ref] policy_handle *handle,
- [in,unique] [string,charset(UTF16)] uint16 *service_name,
- [out,ref] [string,charset(UTF16)] uint16 **display_name,
- [in,out,unique] uint32 *display_name_length
- );
-
- /*****************/
- /* Function 0x15 */
- WERROR svcctl_GetServiceKeyNameW(
- [in,ref] policy_handle *handle,
- [in,unique] [string,charset(UTF16)] uint16 *service_name,
- [out,ref] [string,charset(UTF16)] uint16 **key_name,
- [in,out,unique] uint32 *display_name_length
- );
-
- /*****************/
- /* Function 0x16 */
- WERROR svcctl_SCSetServiceBitsA(
- [in,ref] policy_handle *handle,
- [in] uint32 bits,
- [in] boolean32 bitson,
- [in] boolean32 immediate
- );
-
- /*****************/
- /* Function 0x17 */
- WERROR svcctl_ChangeServiceConfigA(
- [in,ref] policy_handle *handle,
- [in] uint32 type,
- [in] uint32 start,
- [in] uint32 error,
- [in,unique] [string,charset(UTF16)] uint16 *binary_path,
- [in,unique] [string,charset(UTF16)] uint16 *load_order_group,
- [out,ref] uint32 *tag_id,
- [in,unique] [string,charset(UTF16)] uint16 *dependencies,
- [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
- [in,unique] [string,charset(UTF16)] uint16 *password,
- [in,unique] [string,charset(UTF16)] uint16 *display_name
- );
-
- /*****************/
- /* Function 0x18 */
- WERROR svcctl_CreateServiceA(
- [in,ref] policy_handle *handle,
- [in,unique] [string,charset(UTF16)] uint16 *ServiceName,
- [in,unique] [string,charset(UTF16)] uint16 *DisplayName,
- [in] uint32 desired_access,
- [in] uint32 type,
- [in] uint32 start_type,
- [in] uint32 error_control,
- [in,unique] [string,charset(UTF16)] uint16 *binary_path,
- [in,unique] [string,charset(UTF16)] uint16 *LoadOrderGroupKey,
- [out,unique] uint32 *TagId,
- [in,unique] [string,charset(UTF16)] uint16 *dependencies,
- [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
- [in,unique] [string,charset(UTF16)] uint16 *password
- );
-
- /*****************/
- /* Function 0x19 */
- WERROR svcctl_EnumDependentServicesA(
- [in,ref] policy_handle *service,
- [in] uint32 state,
- [out,unique] ENUM_SERVICE_STATUS *service_status,
- [in] uint32 buf_size,
- [out,ref] uint32 *bytes_needed,
- [out,ref] uint32 *services_returned
- );
-
- /*****************/
- /* Function 0x1a */
- WERROR svcctl_EnumServicesStatusA(
- [in,ref] policy_handle *handle,
- [in] uint32 type,
- [in] uint32 state,
- [in] uint32 buf_size,
- [out,size_is(buf_size)] uint8 service[*],
- [out,ref] uint32 *bytes_needed,
- [out,ref] uint32 *services_returned,
- [in,out,unique] uint32 *resume_handle
- );
-
- /*****************/
- /* Function 0x1b */
- WERROR svcctl_OpenSCManagerA(
- [in,unique] [string,charset(UTF16)] uint16 *MachineName,
- [in,unique] [string,charset(UTF16)] uint16 *DatabaseName,
- [in] uint32 access_mask,
- [out,ref] policy_handle *handle
- );
-
- /*****************/
- /* Function 0x1c */
- WERROR svcctl_OpenServiceA(
- [in,ref] policy_handle *scmanager_handle,
- [in,unique] [string,charset(UTF16)] uint16 *ServiceName,
- [in] uint32 access_mask
- );
-
- /*****************/
- /* Function 0x1d */
- WERROR svcctl_QueryServiceConfigA(
- [in,ref] policy_handle *handle,
- [out] uint8 query[buf_size], /*QUERYU_SERVICE_CONFIG */
- [in] uint32 buf_size,
- [out,ref] uint32 *bytes_needed
- );
-
- /*****************/
- /* Function 0x1e */
- WERROR svcctl_QueryServiceLockStatusA(
- [in,ref] policy_handle *handle,
- [in] uint32 buf_size,
- [out,ref] SERVICE_LOCK_STATUS *lock_status,
- [out,ref] uint32 *required_buf_size
- );
-
- /*****************/
- /* Function 0x1f */
- WERROR svcctl_StartServiceA(
- [in,ref] policy_handle *handle,
- [in] uint32 NumArgs,
- [in,unique/*FIXME:,length_is(NumArgs)*/] [string,charset(UTF16)] uint16 *Arguments
- );
-
- /*****************/
- /* Function 0x20 */
- WERROR svcctl_GetServiceDisplayNameA(
- [in,ref] policy_handle *handle,
- [in,unique] [string,charset(UTF16)] uint16 *service_name,
- [out,ref] [string,charset(UTF16)] uint16 **display_name,
- [in,out,unique] uint32 *display_name_length
- );
-
- /*****************/
- /* Function 0x21 */
- WERROR svcctl_GetServiceKeyNameA(
- [in,ref] policy_handle *handle,
- [in,unique] [string,charset(UTF16)] uint16 *service_name,
- [out,ref] [string,charset(UTF16)] uint16 **key_name,
- [in,out,unique] uint32 *display_name_length
- );
-
- /*****************/
- /* Function 0x22 */
- WERROR svcctl_GetCurrentGroupeStateW(
- );
-
- /*****************/
- /* Function 0x23 */
- WERROR svcctl_EnumServiceGroupW(
- );
-
- /*****************/
- /* Function 0x24 */
- WERROR svcctl_ChangeServiceConfig2A(
- [in,ref] policy_handle *handle,
- [in] uint32 info_level,
- [in,unique] uint8 *info
- );
-
- /*****************/
- /* Function 0x25 */
- WERROR svcctl_ChangeServiceConfig2W(
- [in,ref] policy_handle *handle,
- [in] uint32 info_level,
- [in,unique] uint8 *info
- );
-
- /*****************/
- /* Function 0x26 */
- WERROR svcctl_QueryServiceConfig2A(
- [in,ref] policy_handle *handle,
- [in] uint32 info_level,
- [out] uint8 buffer[buf_size],
- [in] uint32 buf_size,
- [out,ref] uint32 *bytes_needed
- );
-
- /*****************/
- /* Function 0x27 */
- WERROR svcctl_QueryServiceConfig2W(
- [in,ref] policy_handle *handle,
- [in] uint32 info_level,
- [out] uint8 buffer[buf_size],
- [in] uint32 buf_size,
- [out,ref] uint32 *bytes_needed
- );
-
- /*****************/
- /* Function 0x28 */
- WERROR svcctl_QueryServiceStatusEx(
- [in,ref] policy_handle *handle,
- [in] uint32 info_level,
- [out] uint8 buffer[buf_size],
- [in] uint32 buf_size,
- [out,ref] uint32 *bytes_needed
- );
-
- /*****************/
- /* Function 0x29 */
- WERROR EnumServicesStatusExA(
- [in,ref] policy_handle *scmanager,
- [in] uint32 info_level,
- [in] uint32 type,
- [in] uint32 state,
- [out] uint8 services[buf_size],
- [in] uint32 buf_size,
- [out,ref] uint32 *bytes_needed,
- [out,ref] uint32 *service_returned,
- [in,out,unique] uint32 *resume_handle,
- [out,ref] [string,charset(UTF16)] uint16 **group_name
- );
-
- /*****************/
- /* Function 0x2a */
- WERROR EnumServicesStatusExW(
- [in,ref] policy_handle *scmanager,
- [in] uint32 info_level,
- [in] uint32 type,
- [in] uint32 state,
- [out] uint8 services[buf_size],
- [in] uint32 buf_size,
- [out,ref] uint32 *bytes_needed,
- [out,ref] uint32 *service_returned,
- [in,out,unique] uint32 *resume_handle,
- [out,ref] [string,charset(UTF16)] uint16 **group_name
- );
-
- /*****************/
- /* Function 0x2b */
- WERROR svcctl_SCSendTSMessage(
- );
-}
diff --git a/source3/librpc/idl/winreg.idl b/source3/librpc/idl/winreg.idl
deleted file mode 100644
index 2f02419af5..0000000000
--- a/source3/librpc/idl/winreg.idl
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- winreg interface definition
-*/
-
-import "lsa.idl", "initshutdown.idl", "security.idl";
-
-[
- uuid("338cd001-2244-31f1-aaaa-900038001003"),
- version(1.0),
- endpoint("ncacn_np:[\\pipe\\winreg]","ncacn_ip_tcp:","ncalrpc:"),
- pointer_default(unique),
- helpstring("Remote Registry Service")
-] interface winreg
-{
- typedef bitmap security_secinfo security_secinfo;
-
- typedef [bitmap32bit] bitmap {
- KEY_QUERY_VALUE = 0x00001,
- KEY_SET_VALUE = 0x00002,
- KEY_CREATE_SUB_KEY = 0x00004,
- KEY_ENUMERATE_SUB_KEYS = 0x00008,
- KEY_NOTIFY = 0x00010,
- KEY_CREATE_LINK = 0x00020,
- KEY_WOW64_64KEY = 0x00100,
- KEY_WOW64_32KEY = 0x00200
- } winreg_AccessMask;
-
- typedef [v1_enum] enum {
- REG_NONE = 0,
- REG_SZ = 1,
- REG_EXPAND_SZ = 2,
- REG_BINARY = 3,
- REG_DWORD = 4,
- REG_DWORD_BIG_ENDIAN = 5,
- REG_LINK = 6,
- REG_MULTI_SZ = 7,
- REG_RESOURCE_LIST = 8,
- REG_FULL_RESOURCE_DESCRIPTOR = 9,
- REG_RESOURCE_REQUIREMENTS_LIST = 10,
- REG_QWORD = 11
- } winreg_Type;
-
- typedef [public,noejs] struct {
- [value(strlen_m_term(name)*2)] uint16 name_len;
- [value(strlen_m_term(name)*2)] uint16 name_size;
- [string,charset(UTF16)] uint16 *name;
- } winreg_String;
-
- /******************/
- /* Function: 0x00 */
- WERROR winreg_OpenHKCR(
- [in,unique] uint16 *system_name,
- [in] winreg_AccessMask access_mask,
- [out,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x01 */
- WERROR winreg_OpenHKCU(
- [in,unique] uint16 *system_name,
- [in] winreg_AccessMask access_mask,
- [out,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x02 */
- WERROR winreg_OpenHKLM(
- [in,unique] uint16 *system_name,
- [in] winreg_AccessMask access_mask,
- [out,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x03 */
- WERROR winreg_OpenHKPD(
- [in,unique] uint16 *system_name,
- [in] winreg_AccessMask access_mask,
- [out,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x04 */
- WERROR winreg_OpenHKU(
- [in,unique] uint16 *system_name,
- [in] winreg_AccessMask access_mask,
- [out,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x05 */
- WERROR winreg_CloseKey(
- [in,out,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x06 */
-
- typedef struct {
- [size_is(size),length_is(len)] uint8 *data;
- uint32 size;
- uint32 len;
- } KeySecurityData;
-
- typedef struct {
- uint32 length;
- KeySecurityData sd;
- boolean8 inherit;
- } winreg_SecBuf;
-
- typedef [v1_enum] enum {
- REG_ACTION_NONE = 0, /* used by caller */
- REG_CREATED_NEW_KEY = 1,
- REG_OPENED_EXISTING_KEY = 2
- } winreg_CreateAction;
-
- WERROR winreg_CreateKey(
- [in,ref] policy_handle *handle,
- [in] winreg_String name,
- [in] winreg_String keyclass,
- [in] uint32 options,
- [in] winreg_AccessMask access_mask,
- [in,unique] winreg_SecBuf *secdesc,
- [out,ref] policy_handle *new_handle,
- [in,out,unique] winreg_CreateAction *action_taken
- );
-
- /******************/
- /* Function: 0x07 */
- WERROR winreg_DeleteKey(
- [in,ref] policy_handle *handle,
- [in] winreg_String key
- );
-
- /******************/
- /* Function: 0x08 */
- WERROR winreg_DeleteValue(
- [in,ref] policy_handle *handle,
- [in] winreg_String value
- );
-
- typedef struct {
- [value(strlen_m_term_null(name)*2)] uint16 length;
- /* size cannot be auto-set by value() as it is the
- amount of space the server is allowed to use for this
- string in the reply, not its current size */
- uint16 size;
- [size_is(size/2),length_is(length/2),charset(UTF16)] uint16 *name;
- } winreg_StringBuf;
-
- /******************/
- /* Function: 0x09 */
- WERROR winreg_EnumKey(
- [in,ref] policy_handle *handle,
- [in] uint32 enum_index,
- [in,out,ref] winreg_StringBuf *name,
- [in,out,unique] winreg_StringBuf *keyclass,
- [in,out,unique] NTTIME *last_changed_time
- );
-
- typedef struct {
- [value(strlen_m_term(name)*2)] uint16 length;
- /* size cannot be auto-set by value() as it is the
- amount of space the server is allowed to use for this
- string in the reply, not its current size */
- uint16 size;
- [size_is(size/2),length_is(length/2),charset(UTF16)] uint16 *name;
- } winreg_ValNameBuf;
-
- /******************/
- /* Function: 0x0a */
-
- WERROR winreg_EnumValue(
- [in,ref] policy_handle *handle,
- [in] uint32 enum_index,
- [in,out,ref] winreg_ValNameBuf *name,
- [in,out,unique] winreg_Type *type,
- [in,out,unique,size_is(*size),length_is(*length)] uint8 *value,
- [in,out,unique] uint32 *size,
- [in,out,unique] uint32 *length
- );
-
- /******************/
- /* Function: 0x0b */
- WERROR winreg_FlushKey(
- [in,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x0c */
- WERROR winreg_GetKeySecurity(
- [in,ref] policy_handle *handle,
- [in] security_secinfo sec_info,
- [in,out,ref] KeySecurityData *sd
- );
-
- /******************/
- /* Function: 0x0d */
- WERROR winreg_LoadKey(
- [in,ref] policy_handle *handle,
- [in,unique] winreg_String *keyname,
- [in,unique] winreg_String *filename
- );
-
- /******************/
- /* Function: 0x0e */
- WERROR winreg_NotifyChangeKeyValue(
- [in,ref] policy_handle *handle,
- [in] uint8 watch_subtree,
- [in] uint32 notify_filter,
- [in] uint32 unknown,
- [in] winreg_String string1,
- [in] winreg_String string2,
- [in] uint32 unknown2
- );
-
- /******************/
- /* Function: 0x0f */
- WERROR winreg_OpenKey(
- [in,ref] policy_handle *parent_handle,
- [in] winreg_String keyname,
- [in] uint32 unknown,
- [in] winreg_AccessMask access_mask,
- [out,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x10 */
- WERROR winreg_QueryInfoKey(
- [in,ref] policy_handle *handle,
- [in,out,ref] winreg_String *classname,
- [out,ref] uint32 *num_subkeys,
- [out,ref] uint32 *max_subkeylen,
- [out,ref] uint32 *max_classlen,
- [out,ref] uint32 *num_values,
- [out,ref] uint32 *max_valnamelen,
- [out,ref] uint32 *max_valbufsize,
- [out,ref] uint32 *secdescsize,
- [out,ref] NTTIME *last_changed_time
- );
-
- /******************/
- /* Function: 0x11 */
- WERROR winreg_QueryValue(
- [in,ref] policy_handle *handle,
- [in,ref] winreg_String *value_name,
- [in,out,unique] winreg_Type *type,
- [in,out,unique,size_is(*data_size),length_is(*value_length)] uint8 *data,
- [in,out,unique] uint32 *data_size,
- [in,out,unique] uint32 *value_length
- );
-
- /******************/
- /* Function: 0x12 */
- WERROR winreg_ReplaceKey(
- );
-
- /******************/
- /* Function: 0x13 */
- WERROR winreg_RestoreKey(
- [in,ref] policy_handle *handle,
- [in,ref] winreg_String *filename,
- [in] uint32 flags
- );
-
- /******************/
- /* Function: 0x14 */
-
- typedef struct {
- uint32 data_size;
- KeySecurityData sec_data;
- uint8 inherit;
- } KeySecurityAttribute;
-
- WERROR winreg_SaveKey(
- [in,ref] policy_handle *handle,
- [in,ref] winreg_String *filename,
- [in,unique] KeySecurityAttribute *sec_attrib
- );
-
- /******************/
- /* Function: 0x15 */
- WERROR winreg_SetKeySecurity(
- [in,ref] policy_handle *handle,
- [in] winreg_AccessMask access_mask,
- [in,ref] KeySecurityData *sd
- );
-
- /******************/
- /* Function: 0x16 */
- WERROR winreg_SetValue(
- [in,ref] policy_handle *handle,
- [in] winreg_String name,
- [in] winreg_Type type,
- [in,size_is(size),ref] uint8 *data,
- [in] uint32 size
- );
-
- /******************/
- /* Function: 0x17 */
- WERROR winreg_UnLoadKey(
- );
-
- /******************/
- /* Function: 0x18 */
- WERROR winreg_InitiateSystemShutdown(
- [in,unique] uint16 *hostname,
- [in,unique] initshutdown_String *message,
- [in] uint32 timeout,
- [in] uint8 force_apps,
- [in] uint8 do_reboot
- );
-
- /******************/
- /* Function: 0x19 */
- WERROR winreg_AbortSystemShutdown(
- [in,unique] uint16 *server
- );
-
- /******************/
- /* Function: 0x1a */
- WERROR winreg_GetVersion(
- [in,ref] policy_handle *handle,
- [out,ref] uint32 *version
- );
-
- /******************/
- /* Function: 0x1b */
- WERROR winreg_OpenHKCC(
- [in,unique] uint16 *system_name,
- [in] winreg_AccessMask access_mask,
- [out,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x1c */
- WERROR winreg_OpenHKDD(
- [in,unique] uint16 *system_name,
- [in] winreg_AccessMask access_mask,
- [out,ref] policy_handle *handle
- );
-
- typedef struct {
- winreg_String *name;
- winreg_Type type;
- uint32 offset;
- uint32 length;
- } QueryMultipleValue;
-
- /******************/
- /* Function: 0x1d */
- WERROR winreg_QueryMultipleValues(
- [in,ref] policy_handle *key_handle,
- [in,out,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values,
- [in] uint32 num_values,
- [in,out,unique,size_is(*buffer_size),length_is(*buffer_size)] uint8 *buffer,
- [in,out,ref] uint32 *buffer_size
- );
-
- /******************/
- /* Function: 0x1e */
- WERROR winreg_InitiateSystemShutdownEx(
- [in,unique] uint16 *hostname,
- [in,unique] initshutdown_String *message,
- [in] uint32 timeout,
- [in] uint8 force_apps,
- [in] uint8 do_reboot,
- [in] uint32 reason
- );
-
- /******************/
- /* Function: 0x1f */
- WERROR winreg_SaveKeyEx(
- );
-
- /******************/
- /* Function: 0x20 */
- WERROR winreg_OpenHKPT(
- [in,unique] uint16 *system_name,
- [in] winreg_AccessMask access_mask,
- [out,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x21 */
- WERROR winreg_OpenHKPN(
- [in,unique] uint16 *system_name,
- [in] winreg_AccessMask access_mask,
- [out,ref] policy_handle *handle
- );
-
- /******************/
- /* Function: 0x22 */
- WERROR winreg_QueryMultipleValues2(
- );
-}
diff --git a/source3/librpc/idl/wkssvc.idl b/source3/librpc/idl/wkssvc.idl
deleted file mode 100644
index 9340990e99..0000000000
--- a/source3/librpc/idl/wkssvc.idl
+++ /dev/null
@@ -1,795 +0,0 @@
-#include "idl_types.h"
-
-/*
- wkssvc interface definitions
-*/
-
-import "srvsvc.idl", "lsa.idl";
-
-[ uuid("6bffd098-a112-3610-9833-46c3f87e345a"),
- version(1.0),
- pointer_default(unique),
- helpstring("Workstation Service"),
- endpoint("ncacn_np:[\\pipe\\wkssvc]","ncacn_ip_tcp:","ncalrpc:")
-] interface wkssvc
-{
- typedef [v1_enum] enum srvsvc_PlatformId srvsvc_PlatformId;
-
-#define BOOL uint32
-
- /******************/
- /* Function: 0x00 */
-
- typedef struct {
- srvsvc_PlatformId platform_id;
- [string,charset(UTF16)] uint16 *server_name;
- [string,charset(UTF16)] uint16 *domain_name;
- uint32 version_major;
- uint32 version_minor;
- } wkssvc_NetWkstaInfo100;
-
- typedef struct {
- srvsvc_PlatformId platform_id;
- [string,charset(UTF16)] uint16 *server_name;
- [string,charset(UTF16)] uint16 *domain_name;
- uint32 version_major;
- uint32 version_minor;
- [string,charset(UTF16)] uint16 *lan_root;
- } wkssvc_NetWkstaInfo101;
-
- typedef struct {
- srvsvc_PlatformId platform_id;
- [string,charset(UTF16)] uint16 *server_name;
- [string,charset(UTF16)] uint16 *domain_name;
- uint32 version_major;
- uint32 version_minor;
- [string,charset(UTF16)] uint16 *lan_root;
- uint32 logged_on_users;
- } wkssvc_NetWkstaInfo102;
-
- /* FIXME: 302, 402 */
-
- typedef struct {
- uint32 char_wait;
- uint32 collection_time;
- uint32 maximum_collection_count;
- uint32 keep_connection;
- uint32 max_commands;
- uint32 session_timeout;
- uint32 size_char_buf;
- uint32 max_threads;
- uint32 lock_quota;
- uint32 lock_increment;
- uint32 lock_maximum;
- uint32 pipe_increment;
- uint32 pipe_maximum;
- uint32 cache_file_timeout;
- uint32 dormant_file_limit;
- uint32 read_ahead_throughput;
- uint32 num_mailslot_buffers;
- uint32 num_srv_announce_buffers;
- uint32 max_illegal_dgram_events;
- uint32 dgram_event_reset_freq;
- BOOL log_election_packets;
- BOOL use_opportunistic_locking;
- BOOL use_unlock_behind;
- BOOL use_close_behind;
- BOOL buf_named_pipes;
- BOOL use_lock_read_unlock;
- BOOL utilize_nt_caching;
- BOOL use_raw_read;
- BOOL use_raw_write;
- BOOL use_write_raw_data;
- BOOL use_encryption;
- BOOL buf_files_deny_write;
- BOOL buf_read_only_files;
- BOOL force_core_create_mode;
- BOOL use_512_byte_max_transfer;
- } wkssvc_NetWkstaInfo502;
-
- typedef struct {
- uint32 char_wait;
- } wkssvc_NetWkstaInfo1010;
-
- typedef struct {
- uint32 collection_time;
- } wkssvc_NetWkstaInfo1011;
-
- typedef struct {
- uint32 maximum_collection_count;
- } wkssvc_NetWkstaInfo1012;
-
- typedef struct {
- uint32 keep_connection;
- } wkssvc_NetWkstaInfo1013;
-
- typedef struct {
- uint32 session_timeout;
- } wkssvc_NetWkstaInfo1018;
-
- typedef struct {
- uint32 size_char_buf;
- } wkssvc_NetWkstaInfo1023;
-
- typedef struct {
- uint32 errorlog_sz;
- } wkssvc_NetWkstaInfo1027;
-
- /* downlevel */
- typedef struct {
- uint32 print_buf_time;
- } wkssvc_NetWkstaInfo1028;
-
- /* downlevel */
- typedef struct {
- uint32 wrk_heuristics;
- } wkssvc_NetWkstaInfo1032;
-
- typedef struct {
- uint32 max_threads;
- } wkssvc_NetWkstaInfo1033;
-
- typedef struct {
- uint32 lock_quota;
- } wkssvc_NetWkstaInfo1041;
-
- typedef struct {
- uint32 lock_increment;
- } wkssvc_NetWkstaInfo1042;
-
- typedef struct {
- uint32 lock_maximum;
- } wkssvc_NetWkstaInfo1043;
-
- typedef struct {
- uint32 pipe_increment;
- } wkssvc_NetWkstaInfo1044;
-
- typedef struct {
- uint32 pipe_maximum;
- } wkssvc_NetWkstaInfo1045;
-
- typedef struct {
- uint32 dormant_file_limit;
- } wkssvc_NetWkstaInfo1046;
-
- typedef struct {
- uint32 cache_file_timeout;
- } wkssvc_NetWkstaInfo1047;
-
- typedef struct {
- uint32 use_opportunistic_locking;
- } wkssvc_NetWkstaInfo1048;
-
- typedef struct {
- uint32 use_unlock_behind;
- } wkssvc_NetWkstaInfo1049;
-
- typedef struct {
- uint32 use_close_behind;
- } wkssvc_NetWkstaInfo1050;
-
- typedef struct {
- uint32 buf_named_pipes;
- } wkssvc_NetWkstaInfo1051;
-
- typedef struct {
- uint32 use_lock_read_unlock;
- } wkssvc_NetWkstaInfo1052;
-
- typedef struct {
- uint32 utilize_nt_caching;
- } wkssvc_NetWkstaInfo1053;
-
- typedef struct {
- uint32 use_raw_read;
- } wkssvc_NetWkstaInfo1054;
-
- typedef struct {
- uint32 use_raw_write;
- } wkssvc_NetWkstaInfo1055;
-
- typedef struct {
- uint32 use_write_raw_data;
- } wkssvc_NetWkstaInfo1056;
-
- typedef struct {
- uint32 use_encryption;
- } wkssvc_NetWkstaInfo1057;
-
- typedef struct {
- uint32 buf_files_deny_write;
- } wkssvc_NetWkstaInfo1058;
-
- typedef struct {
- uint32 buf_read_only_files;
- } wkssvc_NetWkstaInfo1059;
-
- typedef struct {
- uint32 force_core_create_mode;
- } wkssvc_NetWkstaInfo1060;
-
- typedef struct {
- uint32 use_512_byte_max_transfer;
- } wkssvc_NetWkstaInfo1061;
-
- typedef struct {
- uint32 read_ahead_throughput;
- } wkssvc_NetWkstaInfo1062;
-
- typedef union {
- [case(100)] wkssvc_NetWkstaInfo100 *info100;
- [case(101)] wkssvc_NetWkstaInfo101 *info101;
- [case(102)] wkssvc_NetWkstaInfo102 *info102;
- [case(502)] wkssvc_NetWkstaInfo502 *info502;
- [case(1010)] wkssvc_NetWkstaInfo1010 *info1010;
- [case(1011)] wkssvc_NetWkstaInfo1011 *info1011;
- [case(1012)] wkssvc_NetWkstaInfo1012 *info1012;
- [case(1013)] wkssvc_NetWkstaInfo1013 *info1013;
- [case(1018)] wkssvc_NetWkstaInfo1018 *info1018;
- [case(1023)] wkssvc_NetWkstaInfo1023 *info1023;
- [case(1027)] wkssvc_NetWkstaInfo1027 *info1027;
- [case(1028)] wkssvc_NetWkstaInfo1028 *info1028;
- [case(1032)] wkssvc_NetWkstaInfo1032 *info1032;
- [case(1033)] wkssvc_NetWkstaInfo1033 *info1033;
- [case(1041)] wkssvc_NetWkstaInfo1041 *info1041;
- [case(1042)] wkssvc_NetWkstaInfo1042 *info1042;
- [case(1043)] wkssvc_NetWkstaInfo1043 *info1043;
- [case(1044)] wkssvc_NetWkstaInfo1044 *info1044;
- [case(1045)] wkssvc_NetWkstaInfo1045 *info1045;
- [case(1046)] wkssvc_NetWkstaInfo1046 *info1046;
- [case(1047)] wkssvc_NetWkstaInfo1047 *info1047;
- [case(1048)] wkssvc_NetWkstaInfo1048 *info1048;
- [case(1049)] wkssvc_NetWkstaInfo1049 *info1049;
- [case(1050)] wkssvc_NetWkstaInfo1050 *info1050;
- [case(1051)] wkssvc_NetWkstaInfo1051 *info1051;
- [case(1052)] wkssvc_NetWkstaInfo1052 *info1052;
- [case(1053)] wkssvc_NetWkstaInfo1053 *info1053;
- [case(1054)] wkssvc_NetWkstaInfo1054 *info1054;
- [case(1055)] wkssvc_NetWkstaInfo1055 *info1055;
- [case(1056)] wkssvc_NetWkstaInfo1056 *info1056;
- [case(1057)] wkssvc_NetWkstaInfo1057 *info1057;
- [case(1058)] wkssvc_NetWkstaInfo1058 *info1058;
- [case(1059)] wkssvc_NetWkstaInfo1059 *info1059;
- [case(1060)] wkssvc_NetWkstaInfo1060 *info1060;
- [case(1061)] wkssvc_NetWkstaInfo1061 *info1061;
- [case(1062)] wkssvc_NetWkstaInfo1062 *info1062;
- [default] ;
- } wkssvc_NetWkstaInfo;
-
- WERROR wkssvc_NetWkstaGetInfo(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in] uint32 level,
- [out,switch_is(level),ref] wkssvc_NetWkstaInfo *info
- );
-
-
- /******************/
- /* Function: 0x01 */
- WERROR wkssvc_NetWkstaSetInfo(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in] uint32 level,
- [in,switch_is(level),ref] wkssvc_NetWkstaInfo *info,
- [in,out,ref] uint32 *parm_error
- );
-
-
- /*****************************/
- /* Function 0x02 */
- typedef struct {
- [string,charset(UTF16)] uint16 *user_name;
- } wkssvc_NetrWkstaUserInfo0;
-
- typedef struct {
- uint32 entries_read;
- [size_is(entries_read)] wkssvc_NetrWkstaUserInfo0 *user0;
- } wkssvc_NetWkstaEnumUsersCtr0;
-
- typedef struct {
- [string,charset(UTF16)] uint16 *user_name;
- [string,charset(UTF16)] uint16 *logon_domain;
- [string,charset(UTF16)] uint16 *other_domains;
- [string,charset(UTF16)] uint16 *logon_server;
- } wkssvc_NetrWkstaUserInfo1;
-
- typedef struct {
- uint32 entries_read;
- [size_is(entries_read)] wkssvc_NetrWkstaUserInfo1 *user1;
- } wkssvc_NetWkstaEnumUsersCtr1;
-
- typedef [switch_type(uint32)] union {
- [case(0)] wkssvc_NetWkstaEnumUsersCtr0 *user0;
- [case(1)] wkssvc_NetWkstaEnumUsersCtr1 *user1;
- } wkssvc_NetWkstaEnumUsersCtr;
-
- typedef struct {
- uint32 level;
- [switch_is(level)] wkssvc_NetWkstaEnumUsersCtr ctr;
- } wkssvc_NetWkstaEnumUsersInfo;
-
- WERROR wkssvc_NetWkstaEnumUsers(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,out,ref] wkssvc_NetWkstaEnumUsersInfo *info,
- [in] uint32 prefmaxlen,
- [out,ref] uint32 *entries_read,
- [in,out,unique] uint32 *resume_handle
- );
-
- /*****************************/
- /* Function 0x03 */
- typedef struct {
- [string,charset(UTF16)] uint16 *other_domains;
- } wkssvc_NetrWkstaUserInfo1101;
-
- typedef [switch_type(uint32)] union {
- [case(0)] wkssvc_NetrWkstaUserInfo0 *info0;
- [case(1)] wkssvc_NetrWkstaUserInfo1 *info1;
- [case(1101)] wkssvc_NetrWkstaUserInfo1101 *info1101;
- } wkssvc_NetrWkstaUserInfo;
-
- WERROR wkssvc_NetrWkstaUserGetInfo(
- [in,unique] [string,charset(UTF16)] uint16 *unknown,
- [in] uint32 level,
- [out,ref] [switch_is(level)] wkssvc_NetrWkstaUserInfo *info
- );
-
- /*****************************/
- /* Function 0x04 */
- WERROR wkssvc_NetrWkstaUserSetInfo(
- [in,unique] [string,charset(UTF16)] uint16 *unknown,
- [in] uint32 level,
- [in,ref] [switch_is(level)] wkssvc_NetrWkstaUserInfo *info,
- [in,out,unique] uint32 *parm_err
- );
-
- /*****************************/
- /* Function 0x05 */
-
- typedef struct {
- uint32 quality_of_service;
- uint32 vc_count;
- [string,charset(UTF16)] uint16 *name;
- [string,charset(UTF16)] uint16 *address;
- uint32 wan_link;
- } wkssvc_NetWkstaTransportInfo0;
-
- typedef struct {
- uint32 count;
- [size_is(count)] wkssvc_NetWkstaTransportInfo0 *array;
- } wkssvc_NetWkstaTransportCtr0;
-
- typedef union {
- [case(0)] wkssvc_NetWkstaTransportCtr0 *ctr0;
- } wkssvc_NetWkstaTransportCtr;
-
- typedef struct {
- uint32 level;
- [switch_is(level)] wkssvc_NetWkstaTransportCtr ctr;
- } wkssvc_NetWkstaTransportInfo;
-
- WERROR wkssvc_NetWkstaTransportEnum (
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,out,ref] wkssvc_NetWkstaTransportInfo *info,
- [in] uint32 max_buffer,
- [out,ref] uint32 *total_entries,
- [in,out,unique] uint32 *resume_handle
- );
-
- /*****************************/
- /* Function 0x06 */
- /* only supported on NT */
- WERROR wkssvc_NetrWkstaTransportAdd(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in] uint32 level, /* must be 0 */
- [in,ref] wkssvc_NetWkstaTransportInfo0 *info0,
- [in,out,unique] uint32 *parm_err
- );
-
- /*****************************/
- /* Function 0x07 */
- /* only supported on NT */
- WERROR wkssvc_NetrWkstaTransportDel(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,unique] [string,charset(UTF16)] uint16 *transport_name,
- [in] uint32 unknown3
- );
-
- /*****************************/
- /* Function 0x08 */
- typedef struct {
- [string,charset(UTF16)] uint16 *unknown1;
- [string,charset(UTF16)] uint16 *unknown2;
- } wkssvc_NetrUseInfo3;
-
- typedef struct {
- [string,charset(UTF16)] uint16 *local;
- [string,charset(UTF16)] uint16 *remote;
- [string,charset(UTF16)] uint16 *password;
- uint32 status;
- uint32 asg_type;
- uint32 ref_count;
- uint32 use_count;
- [string,charset(UTF16)] uint16 *user_name;
- [string,charset(UTF16)] uint16 *domain_name;
- } wkssvc_NetrUseInfo2;
-
- typedef struct {
- [string,charset(UTF16)] uint16 *local;
- [string,charset(UTF16)] uint16 *remote;
- [string,charset(UTF16)] uint16 *password;
- uint32 status;
- uint32 asg_type;
- uint32 ref_count;
- uint32 use_count;
- } wkssvc_NetrUseInfo1;
-
- typedef struct {
- [string,charset(UTF16)] uint16 *local;
- [string,charset(UTF16)] uint16 *remote;
- } wkssvc_NetrUseInfo0;
-
- typedef [switch_type(uint32)] union {
- [case(0)] wkssvc_NetrUseInfo0 *info0;
- [case(1)] wkssvc_NetrUseInfo1 *info1;
- [case(2)] wkssvc_NetrUseInfo2 *info2;
- [case(3)] wkssvc_NetrUseInfo3 *info3;
- } wkssvc_NetrUseGetInfoCtr;
-
- WERROR wkssvc_NetrUseAdd(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in] uint32 level,
- [in,ref] [switch_is(level)] wkssvc_NetrUseGetInfoCtr *ctr,
- [in,out,unique] uint32 *parm_err
- );
-
- /*****************************/
- /* Function 0x09 */
- WERROR wkssvc_NetrUseGetInfo(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,ref] [string,charset(UTF16)] uint16 *use_name,
- [in] uint32 level,
- [out,ref] [switch_is(level)] wkssvc_NetrUseGetInfoCtr *ctr
- );
-
- /*****************************/
- /* Function 0x0a */
- WERROR wkssvc_NetrUseDel(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,ref] [string,charset(UTF16)] uint16 *use_name,
- [in] uint32 force_cond
- );
-
- /*****************************/
- /* Function 0x0b */
- typedef struct {
- uint32 count;
- [size_is(count)] wkssvc_NetrUseInfo2 *array;
- } wkssvc_NetrUseEnumCtr2;
-
- typedef struct {
- uint32 count;
- [size_is(count)] wkssvc_NetrUseInfo1 *array;
- } wkssvc_NetrUseEnumCtr1;
-
- typedef struct {
- uint32 count;
- [size_is(count)] wkssvc_NetrUseInfo0 *array;
- } wkssvc_NetrUseEnumCtr0;
-
- typedef [switch_type(uint32)] union {
- [case(0)] wkssvc_NetrUseEnumCtr0 *ctr0;
- [case(1)] wkssvc_NetrUseEnumCtr1 *ctr1;
- [case(2)] wkssvc_NetrUseEnumCtr2 *ctr2;
- } wkssvc_NetrUseEnumCtr;
-
- typedef struct {
- uint32 level;
- [switch_is(level)] wkssvc_NetrUseEnumCtr ctr;
- } wkssvc_NetrUseEnumInfo;
-
- WERROR wkssvc_NetrUseEnum(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,out,ref] wkssvc_NetrUseEnumInfo *info,
- [in] uint32 prefmaxlen,
- [out,ref] uint32 *entries_read,
- [in,out,unique] uint32 *resume_handle
- );
-
- /*****************************/
- /* Function 0x0c */
- WERROR wkssvc_NetrMessageBufferSend(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,ref] [string,charset(UTF16)] uint16 *message_name,
- [in,unique] [string,charset(UTF16)] uint16 *message_sender_name,
- [in,ref] [size_is(message_size)] uint8 *message_buffer,
- [in] uint32 message_size
- );
-
- /*****************************/
- /* Function 0x0d */
- typedef struct {
- hyper unknown1;
- hyper unknown2;
- hyper unknown3;
- hyper unknown4;
- hyper unknown5;
- hyper unknown6;
- hyper unknown7;
- hyper unknown8;
- hyper unknown9;
- hyper unknown10;
- hyper unknown11;
- hyper unknown12;
- hyper unknown13;
- uint32 unknown14;
- uint32 unknown15;
- uint32 unknown16;
- uint32 unknown17;
- uint32 unknown18;
- uint32 unknown19;
- uint32 unknown20;
- uint32 unknown21;
- uint32 unknown22;
- uint32 unknown23;
- uint32 unknown24;
- uint32 unknown25;
- uint32 unknown26;
- uint32 unknown27;
- uint32 unknown28;
- uint32 unknown29;
- uint32 unknown30;
- uint32 unknown31;
- uint32 unknown32;
- uint32 unknown33;
- uint32 unknown34;
- uint32 unknown35;
- uint32 unknown36;
- uint32 unknown37;
- uint32 unknown38;
- uint32 unknown39;
- uint32 unknown40;
- } wkssvc_NetrWorkstationStatistics;
-
- WERROR wkssvc_NetrWorkstationStatisticsGet(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,unique] [string,charset(UTF16)] uint16 *unknown2,
- [in] uint32 unknown3,
- [in] uint32 unknown4,
- [out,ref] wkssvc_NetrWorkstationStatistics **info
- );
-
- /*****************************/
- /* Function 0x0e */
- WERROR wkssvc_NetrLogonDomainNameAdd(
- [in,ref] [string,charset(UTF16)] uint16 *domain_name
- );
-
- /*****************************/
- /* Function 0x0f */
- WERROR wkssvc_NetrLogonDomainNameDel(
- [in,ref] [string,charset(UTF16)] uint16 *domain_name
- );
-
- /*****************************/
- /* Function 0x10 */
- WERROR wkssvc_NetrJoinDomain(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,ref] [string,charset(UTF16)] uint16 *domain_name,
- [in,unique] [string,charset(UTF16)] uint16 *account_ou,
- [in,unique] [string,charset(UTF16)] uint16 *Account,
- [in,unique] [string,charset(UTF16)] uint16 *password,
- [in] wkssvc_joinflags join_flags
- );
-
- /*****************************/
- /* Function 0x11 */
- WERROR wkssvc_NetrUnjoinDomain(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,unique] [string,charset(UTF16)] uint16 *Account,
- [in,unique] [string,charset(UTF16)] uint16 *password,
- [in] wkssvc_joinflags unjoin_flags
- );
-
- /*****************************/
- /* Function 0x12 */
- typedef [bitmap32bit] bitmap {
- /* TRUE: create the account in the domain */
- WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE = 0x00000002
- } wkssvc_renameflags;
-
- WERROR wkssvc_NetrRenameMachineInDomain(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,unique] [string,charset(UTF16)] uint16 *NewMachineName,
- [in,unique] [string,charset(UTF16)] uint16 *Account,
- [in,unique] [string,charset(UTF16)] uint16 *password,
- [in] wkssvc_renameflags RenameOptions
- );
-
- /*****************************/
- /* Function 0x13 */
- typedef enum {
- NetSetupUnknown = 0,
- NetSetupMachine = 1,
- NetSetupWorkgroup = 2,
- NetSetupDomain = 3,
- NetSetupNonExistentDomain = 4,
- NetSetupDnsMachine = 5
- } wkssvc_NetValidateNameType;
-
- WERROR wkssvc_NetrValidateName(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,ref] [string,charset(UTF16)] uint16 *name,
- [in,unique] [string,charset(UTF16)] uint16 *Account,
- [in,unique] [string,charset(UTF16)] uint16 *Password,
- [in] wkssvc_NetValidateNameType name_type
- );
-
- /*****************************/
- /* Function 0x14 */
- typedef enum {
- NET_SETUP_UNKNOWN_STATUS = 0,
- NET_SETUP_UNJOINED = 1,
- NET_SETUP_WORKGROUP_NAME = 2,
- NET_SETUP_DOMAIN_NAME = 3
- } wkssvc_NetJoinStatus;
-
- WERROR wkssvc_NetrGetJoinInformation(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,out,ref] [string,charset(UTF16)] uint16 **name_buffer,
- [out,ref] wkssvc_NetJoinStatus *name_type
- );
-
- /*****************************/
- /* Function 0x15 */
- WERROR wkssvc_NetrGetJoinableOus(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,ref] [string,charset(UTF16)] uint16 *domain_name,
- [in,unique] [string,charset(UTF16)] uint16 *Account,
- [in,unique] [string,charset(UTF16)] uint16 *unknown,
- [in,out,ref] uint32 *num_ous,
- /*
- * this is a [ref] pointer to a [unique] pointer to an
- * array of [unique] pointers to a string array
- */
- [out,ref] [size_is(,*num_ous)] [string,charset(UTF16)] uint16 ***ous
- );
-
- typedef [flag(NDR_PAHEX)] struct {
- uint8 data[524];
- } wkssvc_PasswordBuffer;
-
- typedef [bitmap32bit] bitmap {
- WKSSVC_JOIN_FLAGS_JOIN_WITH_NEW_NAME = 0x00000400,
- WKSSVC_JOIN_FLAGS_JOIN_DC_ACCOUNT = 0x00000200,
- /* TRUE: defer setting the SPN and dNSHostName until a rename operation */
- WKSSVC_JOIN_FLAGS_DEFER_SPN = 0x00000100,
-
- /* TRUE: set the machine password to the provided one after the join completes */
- WKSSVC_JOIN_FLAGS_MACHINE_PWD_PASSED = 0x00000080,
-
- /* TRUE: perform an unsecured join */
- WKSSVC_JOIN_FLAGS_JOIN_UNSECURE = 0x00000040,
-
- /* TRUE: allow the join to complete even if the account already exists */
- WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED = 0x00000020,
-
- /* TRUE: this join is part of a w9x upgrade */
- WKSSVC_JOIN_FLAGS_WIN9X_UPGRADE = 0x00000010,
-
- /* TRUE: delete the account when the domain is left */
- WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE = 0x00000004,
-
- /* TRUE: create the account in the domain */
- WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE = 0x00000002,
-
- /* TRUE: join domain FALSE: join workgroup */
- WKSSVC_JOIN_FLAGS_JOIN_TYPE = 0x00000001
-
- } wkssvc_joinflags;
-
- /*****************************/
- /* Function 0x16 */
- WERROR wkssvc_NetrJoinDomain2 (
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,ref] [string,charset(UTF16)] uint16 *domain_name,
- [in,unique] [string,charset(UTF16)] uint16 *account_ou,
- [in,unique] [string,charset(UTF16)] uint16 *admin_account,
- [in,unique] wkssvc_PasswordBuffer *encrypted_password,
- [in] wkssvc_joinflags join_flags
- );
-
- /*****************************/
- /* Function 0x17 */
- WERROR wkssvc_NetrUnjoinDomain2 (
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,unique] [string,charset(UTF16)] uint16 *account,
- [in,unique] wkssvc_PasswordBuffer *encrypted_password,
- [in] wkssvc_joinflags unjoin_flags
- );
-
- /*****************************/
- /* Function 0x18 */
- WERROR wkssvc_NetrRenameMachineInDomain2(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,unique] [string,charset(UTF16)] uint16 *NewMachineName,
- [in,unique] [string,charset(UTF16)] uint16 *Account,
- [in,unique] wkssvc_PasswordBuffer *EncryptedPassword,
- [in] wkssvc_renameflags RenameOptions
- );
-
- /*****************************/
- /* Function 0x19 */
- WERROR wkssvc_NetrValidateName2(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,ref] [string,charset(UTF16)] uint16 *name,
- [in,unique] [string,charset(UTF16)] uint16 *Account,
- [in,unique] wkssvc_PasswordBuffer *EncryptedPassword,
- [in] wkssvc_NetValidateNameType name_type
- );
-
- /*****************************/
- /* Function 0x1a */
- WERROR wkssvc_NetrGetJoinableOus2(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,ref] [string,charset(UTF16)] uint16 *domain_name,
- [in,unique] [string,charset(UTF16)] uint16 *Account,
- [in,unique] wkssvc_PasswordBuffer *EncryptedPassword,
- [in,out,ref] uint32 *num_ous,
- /*
- * this is a [ref] pointer to a [unique] pointer to an
- * array of [unique] pointers to a string array
- */
- [out,ref] [size_is(,*num_ous)] [string,charset(UTF16)] uint16 ***ous
- );
-
- /*****************************/
- /* Function 0x1b */
- WERROR wkssvc_NetrAddAlternateComputerName(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,unique] [string,charset(UTF16)] uint16 *NewAlternateMachineName,
- [in,unique] [string,charset(UTF16)] uint16 *Account,
- [in,unique] wkssvc_PasswordBuffer *EncryptedPassword,
- [in] uint32 Reserved
- );
-
- /*****************************/
- /* Function 0x1c */
- WERROR wkssvc_NetrRemoveAlternateComputerName(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,unique] [string,charset(UTF16)] uint16 *AlternateMachineNameToRemove,
- [in,unique] [string,charset(UTF16)] uint16 *Account,
- [in,unique] wkssvc_PasswordBuffer *EncryptedPassword,
- [in] uint32 Reserved
- );
-
- /*****************************/
- /* Function 0x1d */
- WERROR wkssvc_NetrSetPrimaryComputername(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in,unique] [string,charset(UTF16)] uint16 *primary_name,
- [in,unique] [string,charset(UTF16)] uint16 *Account,
- [in,unique] wkssvc_PasswordBuffer *EncryptedPassword,
- [in] uint32 Reserved
- );
-
- /*****************************/
- /* Function 0x1e */
- typedef enum {
- NetPrimaryComputerName = 0,
- NetAlternateComputerNames = 1,
- NetAllComputerNames = 2,
- NetComputerNameTypeMax = 3
- } wkssvc_ComputerNameType;
-
- typedef struct {
- uint32 count;
- [size_is(count)] lsa_String *computer_name;
- } wkssvc_ComputerNamesCtr;
-
- WERROR wkssvc_NetrEnumerateComputerNames(
- [in,unique] [string,charset(UTF16)] uint16 *server_name,
- [in] wkssvc_ComputerNameType name_type,
- [in] uint32 Reserved,
- [out,ref] wkssvc_ComputerNamesCtr **ctr
- );
-}
diff --git a/source3/librpc/idl/xattr.idl b/source3/librpc/idl/xattr.idl
deleted file mode 100644
index 23af2df404..0000000000
--- a/source3/librpc/idl/xattr.idl
+++ /dev/null
@@ -1,54 +0,0 @@
-#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;
-
- /* we store the NT ACL a NTACL xattr. It is versioned so we
- can later add other acl attribs (such as posix acl mapping)
-
- we put this xattr in the security namespace to ensure that
- only trusted users can write to the ACL
-
- stored in "security.NTACL"
-
- Version 1. raw SD stored as Samba4 does it.
- Version 2. raw SD + last changed timestamp so we
- can discard if this doesn't match the POSIX st_ctime.
- */
-
- const char *XATTR_NTACL_NAME = "security.NTACL";
-
- typedef [public] struct {
- security_descriptor *sd;
- NTTIME last_changed;
- } security_descriptor_timestamp;
-
- typedef [switch_type(uint16)] union {
- [case(1)] security_descriptor *sd;
- [case(2)] security_descriptor_timestamp *sd_ts;
- } xattr_NTACL_Info;
-
- typedef [public] struct {
- uint16 version;
- [switch_is(version)] xattr_NTACL_Info info;
- } xattr_NTACL;
-
-}
diff --git a/source3/librpc/ndr/libndr.h b/source3/librpc/ndr/libndr.h
deleted file mode 100644
index 155f5f1f7d..0000000000
--- a/source3/librpc/ndr/libndr.h
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- rpc interface definitions
- Copyright (C) Andrew Tridgell 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/>.
-*/
-
-#ifndef __LIBNDR_H__
-#define __LIBNDR_H__
-
-#define _PRINTF_ATTRIBUTE(a,b)
-
-#include "librpc/gen_ndr/misc.h"
-#include "librpc/gen_ndr/security.h"
-
-/*
- this provides definitions for the libcli/rpc/ MSRPC library
-*/
-
-
-/*
- this is used by the token store/retrieve code
-*/
-struct ndr_token_list {
- struct ndr_token_list *next, *prev;
- const void *key;
- uint32_t value;
-};
-
-/* this is the base structure passed to routines that
- parse MSRPC formatted data
-
- note that in Samba4 we use separate routines and structures for
- MSRPC marshalling and unmarshalling. Also note that these routines
- are being kept deliberately very simple, and are not tied to a
- particular transport
-*/
-struct ndr_pull {
- uint32_t flags; /* LIBNDR_FLAG_* */
- uint8_t *data;
- uint32_t data_size;
- uint32_t offset;
-
- uint32_t relative_base_offset;
- struct ndr_token_list *relative_base_list;
-
- struct ndr_token_list *relative_list;
- struct ndr_token_list *array_size_list;
- struct ndr_token_list *array_length_list;
- struct ndr_token_list *switch_list;
-
- TALLOC_CTX *current_mem_ctx;
-
- /* this is used to ensure we generate unique reference IDs
- between request and reply */
- uint32_t ptr_count;
-};
-
-struct ndr_pull_save {
- uint32_t data_size;
- uint32_t offset;
- struct ndr_pull_save *next;
-};
-
-/* structure passed to functions that generate NDR formatted data */
-struct ndr_push {
- uint32_t flags; /* LIBNDR_FLAG_* */
- uint8_t *data;
- uint32_t alloc_size;
- uint32_t offset;
-
- uint32_t relative_base_offset;
- struct ndr_token_list *relative_base_list;
-
- struct ndr_token_list *switch_list;
- struct ndr_token_list *relative_list;
- struct ndr_token_list *nbt_string_list;
- struct ndr_token_list *full_ptr_list;
-
- /* this is used to ensure we generate unique reference IDs */
- uint32_t ptr_count;
-};
-
-struct ndr_push_save {
- uint32_t offset;
- struct ndr_push_save *next;
-};
-
-
-/* structure passed to functions that print IDL structures */
-struct ndr_print {
- uint32_t flags; /* LIBNDR_FLAG_* */
- uint32_t depth;
- struct ndr_token_list *switch_list;
- void (*print)(struct ndr_print *, const char *, ...) PRINTF_ATTRIBUTE(2,3);
- void *private_data;
-};
-
-#define LIBNDR_FLAG_BIGENDIAN (1<<0)
-#define LIBNDR_FLAG_NOALIGN (1<<1)
-
-#define LIBNDR_FLAG_STR_ASCII (1<<2)
-#define LIBNDR_FLAG_STR_LEN4 (1<<3)
-#define LIBNDR_FLAG_STR_SIZE4 (1<<4)
-#define LIBNDR_FLAG_STR_NOTERM (1<<5)
-#define LIBNDR_FLAG_STR_NULLTERM (1<<6)
-#define LIBNDR_FLAG_STR_SIZE2 (1<<7)
-#define LIBNDR_FLAG_STR_BYTESIZE (1<<8)
-#define LIBNDR_FLAG_STR_FIXLEN32 (1<<9)
-#define LIBNDR_FLAG_STR_CONFORMANT (1<<10)
-#define LIBNDR_FLAG_STR_CHARLEN (1<<11)
-#define LIBNDR_FLAG_STR_UTF8 (1<<12)
-#define LIBNDR_FLAG_STR_FIXLEN15 (1<<13)
-#define LIBNDR_STRING_FLAGS (0x7FFC)
-
-
-#define LIBNDR_FLAG_REF_ALLOC (1<<20)
-#define LIBNDR_FLAG_REMAINING (1<<21)
-#define LIBNDR_FLAG_ALIGN2 (1<<22)
-#define LIBNDR_FLAG_ALIGN4 (1<<23)
-#define LIBNDR_FLAG_ALIGN8 (1<<24)
-
-#define LIBNDR_ALIGN_FLAGS (LIBNDR_FLAG_ALIGN2|LIBNDR_FLAG_ALIGN4|LIBNDR_FLAG_ALIGN8)
-
-#define LIBNDR_PRINT_ARRAY_HEX (1<<25)
-#define LIBNDR_PRINT_SET_VALUES (1<<26)
-
-/* used to force a section of IDL to be little-endian */
-#define LIBNDR_FLAG_LITTLE_ENDIAN (1<<27)
-
-/* used to check if alignment padding is zero */
-#define LIBNDR_FLAG_PAD_CHECK (1<<28)
-
-/* set if an object uuid will be present */
-#define LIBNDR_FLAG_OBJECT_PRESENT (1<<30)
-
-/* set to avoid recursion in ndr_size_*() calculation */
-#define LIBNDR_FLAG_NO_NDR_SIZE (1<<31)
-
-/* 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)
-#define NDR_PRINT_BOTH_DEBUG(type, p) NDR_PRINT_FUNCTION_DEBUG(type, NDR_BOTH, p)
-#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 {
- NDR_ERR_SUCCESS = 0,
- NDR_ERR_ARRAY_SIZE,
- NDR_ERR_BAD_SWITCH,
- NDR_ERR_OFFSET,
- NDR_ERR_RELATIVE,
- NDR_ERR_CHARCNV,
- NDR_ERR_LENGTH,
- NDR_ERR_SUBCONTEXT,
- NDR_ERR_COMPRESSION,
- NDR_ERR_STRING,
- NDR_ERR_VALIDATE,
- NDR_ERR_BUFSIZE,
- NDR_ERR_ALLOC,
- NDR_ERR_RANGE,
- NDR_ERR_TOKEN,
- NDR_ERR_IPV4ADDRESS,
- NDR_ERR_INVALID_POINTER,
- NDR_ERR_UNREAD_BYTES
-};
-
-#define NDR_ERR_CODE_IS_SUCCESS(x) (x == NDR_ERR_SUCCESS)
-
-#define NDR_ERR_HAVE_NO_MEMORY(x) do { \
- if (NULL == (x)) { \
- return NDR_ERR_ALLOC; \
- } \
-} while (0)
-
-enum ndr_compression_alg {
- NDR_COMPRESSION_MSZIP = 2,
- NDR_COMPRESSION_XPRESS = 3
-};
-
-/*
- flags passed to control parse flow
-*/
-#define NDR_SCALARS 1
-#define NDR_BUFFERS 2
-
-/*
- flags passed to ndr_print_*()
-*/
-#define NDR_IN 1
-#define NDR_OUT 2
-#define NDR_BOTH 3
-#define NDR_SET_VALUES 4
-
-#define NDR_PULL_NEED_BYTES(ndr, n) do { \
- if ((n) > ndr->data_size || ndr->offset + (n) > ndr->data_size) { \
- return ndr_pull_error(ndr, NDR_ERR_BUFSIZE, "Pull bytes %u", (unsigned)n); \
- } \
-} while(0)
-
-#define NDR_ALIGN(ndr, n) ndr_align_size(ndr->offset, n)
-
-#define NDR_ROUND(size, n) (((size)+((n)-1)) & ~((n)-1))
-
-#define NDR_PULL_ALIGN(ndr, n) do { \
- if (!(ndr->flags & LIBNDR_FLAG_NOALIGN)) { \
- if (ndr->flags & LIBNDR_FLAG_PAD_CHECK) { \
- ndr_check_padding(ndr, n); \
- } \
- ndr->offset = (ndr->offset + (n-1)) & ~(n-1); \
- } \
- if (ndr->offset > ndr->data_size) { \
- return ndr_pull_error(ndr, NDR_ERR_BUFSIZE, "Pull align %u", (unsigned)n); \
- } \
-} while(0)
-
-#define NDR_PUSH_NEED_BYTES(ndr, n) NDR_CHECK(ndr_push_expand(ndr, n))
-
-#define NDR_PUSH_ALIGN(ndr, n) do { \
- if (!(ndr->flags & LIBNDR_FLAG_NOALIGN)) { \
- uint32_t _pad = ((ndr->offset + (n-1)) & ~(n-1)) - ndr->offset; \
- while (_pad--) NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, 0)); \
- } \
-} while(0)
-
-/* these are used to make the error checking on each element in libndr
- less tedious, hopefully making the code more readable */
-#define NDR_CHECK(call) do { \
- enum ndr_err_code _status; \
- _status = call; \
- if (!NDR_ERR_CODE_IS_SUCCESS(_status)) { \
- return _status; \
- } \
-} while (0)
-
-#define NDR_PULL_GET_MEM_CTX(ndr) (ndr->current_mem_ctx)
-
-#define NDR_PULL_SET_MEM_CTX(ndr, mem_ctx, flgs) do {\
- if ( !(flgs) || (ndr->flags & flgs) ) {\
- if (!(mem_ctx)) {\
- return ndr_pull_error(ndr, NDR_ERR_ALLOC, "NDR_PULL_SET_MEM_CTX(NULL): %s\n", __location__); \
- }\
- ndr->current_mem_ctx = discard_const(mem_ctx);\
- }\
-} while(0)
-
-#define _NDR_PULL_FIX_CURRENT_MEM_CTX(ndr) do {\
- if (!ndr->current_mem_ctx) {\
- ndr->current_mem_ctx = talloc_new(ndr);\
- if (!ndr->current_mem_ctx) {\
- return ndr_pull_error(ndr, NDR_ERR_ALLOC, "_NDR_PULL_FIX_CURRENT_MEM_CTX() failed: %s\n", __location__); \
- }\
- }\
-} while(0)
-
-#define NDR_PULL_ALLOC(ndr, s) do { \
- _NDR_PULL_FIX_CURRENT_MEM_CTX(ndr);\
- (s) = talloc_ptrtype(ndr->current_mem_ctx, (s)); \
- if (!(s)) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Alloc %s failed: %s\n", # s, __location__); \
-} while (0)
-
-#define NDR_PULL_ALLOC_N(ndr, s, n) do { \
- _NDR_PULL_FIX_CURRENT_MEM_CTX(ndr);\
- (s) = talloc_array_ptrtype(ndr->current_mem_ctx, (s), n); \
- if (!(s)) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Alloc %u * %s failed: %s\n", (unsigned)n, # s, __location__); \
-} while (0)
-
-
-#define NDR_PUSH_ALLOC_SIZE(ndr, s, size) do { \
- (s) = talloc_array(ndr, uint8_t, size); \
- if (!(s)) return ndr_push_error(ndr, NDR_ERR_ALLOC, "push alloc %u failed: %s\n", (unsigned)size, __location__); \
-} while (0)
-
-#define NDR_PUSH_ALLOC(ndr, s) do { \
- (s) = talloc_ptrtype(ndr, (s)); \
- if (!(s)) return ndr_push_error(ndr, NDR_ERR_ALLOC, "push alloc %s failed: %s\n", # s, __location__); \
-} while (0)
-
-/* these are used when generic fn pointers are needed for ndr push/pull fns */
-typedef enum ndr_err_code (*ndr_push_flags_fn_t)(struct ndr_push *, int ndr_flags, const void *);
-typedef enum ndr_err_code (*ndr_pull_flags_fn_t)(struct ndr_pull *, int ndr_flags, void *);
-typedef void (*ndr_print_fn_t)(struct ndr_print *, const char *, const void *);
-typedef void (*ndr_print_function_t)(struct ndr_print *, const char *, int, const void *);
-
-extern const struct ndr_syntax_id ndr_transfer_syntax;
-extern const struct ndr_syntax_id ndr64_transfer_syntax;
-
-struct ndr_interface_call {
- const char *name;
- size_t struct_size;
- ndr_push_flags_fn_t ndr_push;
- ndr_pull_flags_fn_t ndr_pull;
- ndr_print_function_t ndr_print;
- bool async;
-};
-
-struct ndr_interface_string_array {
- uint32_t count;
- const char * const *names;
-};
-
-struct ndr_interface_table {
- const char *name;
- struct ndr_syntax_id syntax_id;
- const char *helpstring;
- uint32_t num_calls;
- const struct ndr_interface_call *calls;
- const struct ndr_interface_string_array *endpoints;
- const struct ndr_interface_string_array *authservices;
-};
-
-struct ndr_interface_list {
- struct ndr_interface_list *prev, *next;
- const struct ndr_interface_table *table;
-};
-
-#define NDR_SCALAR_PROTO(name, type) \
-enum ndr_err_code ndr_push_ ## name(struct ndr_push *ndr, int ndr_flags, type v); \
-enum ndr_err_code ndr_pull_ ## name(struct ndr_pull *ndr, int ndr_flags, type *v); \
-void ndr_print_ ## name(struct ndr_print *ndr, const char *var_name, type v);
-
-#define NDR_BUFFER_PROTO(name, type) \
-enum ndr_err_code ndr_push_ ## name(struct ndr_push *ndr, int ndr_flags, const type *v); \
-enum ndr_err_code ndr_pull_ ## name(struct ndr_pull *ndr, int ndr_flags, type *v); \
-void ndr_print_ ## name(struct ndr_print *ndr, const char *var_name, const type *v);
-
-
-void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
-size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags);
-
-#endif /* __LIBNDR_H__ */
diff --git a/source3/librpc/ndr/ndr.c b/source3/librpc/ndr/ndr.c
deleted file mode 100644
index d94d12e146..0000000000
--- a/source3/librpc/ndr/ndr.c
+++ /dev/null
@@ -1,1101 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- libndr interface
-
- Copyright (C) Andrew Tridgell 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 provides the core routines for NDR parsing functions
-
- see http://www.opengroup.org/onlinepubs/9629399/chap14.htm for details
- of NDR encoding rules
-*/
-
-#include "includes.h"
-
-#define NDR_BASE_MARSHALL_SIZE 1024
-
-/* this guid indicates NDR encoding in a protocol tower */
-const struct ndr_syntax_id ndr_transfer_syntax = {
- { 0x8a885d04, 0x1ceb, 0x11c9, {0x9f, 0xe8}, {0x08,0x00,0x2b,0x10,0x48,0x60} },
- 2
-};
-
-const struct ndr_syntax_id ndr64_transfer_syntax = {
- { 0x71710533, 0xbeba, 0x4937, {0x83, 0x19}, {0xb5,0xdb,0xef,0x9c,0xcc,0x36} },
- 1
-};
-
-/*
- work out the number of bytes needed to align on a n byte boundary
-*/
-_PUBLIC_ size_t ndr_align_size(uint32_t offset, size_t n)
-{
- if ((offset & (n-1)) == 0) return 0;
- return n - (offset & (n-1));
-}
-
-/*
- initialise a ndr parse structure from a data blob
-*/
-_PUBLIC_ struct ndr_pull *ndr_pull_init_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx)
-{
- struct ndr_pull *ndr;
-
- ndr = talloc_zero(mem_ctx, struct ndr_pull);
- if (!ndr) return NULL;
- ndr->current_mem_ctx = mem_ctx;
-
- ndr->data = blob->data;
- ndr->data_size = blob->length;
-
- return ndr;
-}
-
-/*
- advance by 'size' bytes
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_advance(struct ndr_pull *ndr, uint32_t size)
-{
- ndr->offset += size;
- if (ndr->offset > ndr->data_size) {
- return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
- "ndr_pull_advance by %u failed",
- size);
- }
- return NDR_ERR_SUCCESS;
-}
-
-/*
- set the parse offset to 'ofs'
-*/
-static enum ndr_err_code ndr_pull_set_offset(struct ndr_pull *ndr, uint32_t ofs)
-{
- ndr->offset = ofs;
- if (ndr->offset > ndr->data_size) {
- return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
- "ndr_pull_set_offset %u failed",
- ofs);
- }
- return NDR_ERR_SUCCESS;
-}
-
-/* save the offset/size of the current ndr state */
-_PUBLIC_ void ndr_pull_save(struct ndr_pull *ndr, struct ndr_pull_save *save)
-{
- save->offset = ndr->offset;
- save->data_size = ndr->data_size;
-}
-
-/* restore the size/offset of a ndr structure */
-_PUBLIC_ void ndr_pull_restore(struct ndr_pull *ndr, struct ndr_pull_save *save)
-{
- ndr->offset = save->offset;
- ndr->data_size = save->data_size;
-}
-
-
-/* create a ndr_push structure, ready for some marshalling */
-_PUBLIC_ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx)
-{
- struct ndr_push *ndr;
-
- ndr = talloc_zero(mem_ctx, struct ndr_push);
- if (!ndr) {
- return NULL;
- }
-
- ndr->flags = 0;
- ndr->alloc_size = NDR_BASE_MARSHALL_SIZE;
- ndr->data = talloc_array(ndr, uint8_t, ndr->alloc_size);
- if (!ndr->data) {
- return NULL;
- }
-
- return ndr;
-}
-
-/* return a DATA_BLOB structure for the current ndr_push marshalled data */
-_PUBLIC_ DATA_BLOB ndr_push_blob(struct ndr_push *ndr)
-{
- DATA_BLOB blob;
- blob = data_blob_const(ndr->data, ndr->offset);
- if (ndr->alloc_size > ndr->offset) {
- ndr->data[ndr->offset] = 0;
- }
- return blob;
-}
-
-
-/*
- expand the available space in the buffer to ndr->offset + extra_size
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_expand(struct ndr_push *ndr, uint32_t extra_size)
-{
- uint32_t size = extra_size + ndr->offset;
-
- if (size < ndr->offset) {
- /* extra_size overflowed the offset */
- return ndr_push_error(ndr, NDR_ERR_BUFSIZE, "Overflow in push_expand to %u",
- size);
- }
-
- if (ndr->alloc_size > size) {
- return NDR_ERR_SUCCESS;
- }
-
- ndr->alloc_size += NDR_BASE_MARSHALL_SIZE;
- if (size+1 > ndr->alloc_size) {
- ndr->alloc_size = size+1;
- }
- ndr->data = talloc_realloc(ndr, ndr->data, uint8_t, ndr->alloc_size);
- if (!ndr->data) {
- return ndr_push_error(ndr, NDR_ERR_ALLOC, "Failed to push_expand to %u",
- ndr->alloc_size);
- }
-
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) _PRINTF_ATTRIBUTE(2,3)
-{
- va_list ap;
- char *s = NULL;
- int i, ret;
-
- va_start(ap, format);
- ret = vasprintf(&s, format, ap);
- va_end(ap);
-
- if (ret == -1) {
- return;
- }
-
- for (i=0;i<ndr->depth;i++) {
- DEBUGADD(0,(" "));
- }
-
- DEBUGADD(0,("%s\n", s));
- free(s);
-}
-
-_PUBLIC_ void ndr_print_string_helper(struct ndr_print *ndr, const char *format, ...) _PRINTF_ATTRIBUTE(2,3)
-{
- va_list ap;
- int i;
-
- for (i=0;i<ndr->depth;i++) {
- ndr->private_data = talloc_asprintf_append_buffer(
- (char *)ndr->private_data, " ");
- }
-
- va_start(ap, format);
- ndr->private_data = talloc_vasprintf_append_buffer((char *)ndr->private_data,
- format, ap);
- va_end(ap);
- ndr->private_data = talloc_asprintf_append_buffer((char *)ndr->private_data,
- "\n");
-}
-
-/*
- a useful helper function for printing idl structures via DEBUG()
-*/
-_PUBLIC_ void ndr_print_debug(ndr_print_fn_t fn, const char *name, void *ptr)
-{
- struct ndr_print *ndr;
-
- ndr = talloc_zero(NULL, struct ndr_print);
- if (!ndr) return;
- ndr->print = ndr_print_debug_helper;
- ndr->depth = 1;
- ndr->flags = 0;
- fn(ndr, name, ptr);
- talloc_free(ndr);
-}
-
-/*
- a useful helper function for printing idl unions via DEBUG()
-*/
-_PUBLIC_ void ndr_print_union_debug(ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr)
-{
- struct ndr_print *ndr;
-
- ndr = talloc_zero(NULL, struct ndr_print);
- if (!ndr) return;
- ndr->print = ndr_print_debug_helper;
- ndr->depth = 1;
- ndr->flags = 0;
- ndr_print_set_switch_value(ndr, ptr, level);
- fn(ndr, name, ptr);
- talloc_free(ndr);
-}
-
-/*
- a useful helper function for printing idl function calls via DEBUG()
-*/
-_PUBLIC_ void ndr_print_function_debug(ndr_print_function_t fn, const char *name, int flags, void *ptr)
-{
- struct ndr_print *ndr;
-
- ndr = talloc_zero(NULL, struct ndr_print);
- if (!ndr) return;
- ndr->print = ndr_print_debug_helper;
- ndr->depth = 1;
- ndr->flags = 0;
- fn(ndr, name, flags, ptr);
- talloc_free(ndr);
-}
-
-/*
- a useful helper function for printing idl structures to a string
-*/
-_PUBLIC_ char *ndr_print_struct_string(TALLOC_CTX *mem_ctx, ndr_print_fn_t fn, const char *name, void *ptr)
-{
- struct ndr_print *ndr;
- char *ret = NULL;
-
- ndr = talloc_zero(mem_ctx, struct ndr_print);
- if (!ndr) return NULL;
- ndr->private_data = talloc_strdup(ndr, "");
- if (!ndr->private_data) {
- goto failed;
- }
- ndr->print = ndr_print_string_helper;
- ndr->depth = 1;
- ndr->flags = 0;
- fn(ndr, name, ptr);
- ret = talloc_steal(mem_ctx, (char *)ndr->private_data);
-failed:
- talloc_free(ndr);
- return ret;
-}
-
-/*
- a useful helper function for printing idl unions to a string
-*/
-_PUBLIC_ char *ndr_print_union_string(TALLOC_CTX *mem_ctx, ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr)
-{
- struct ndr_print *ndr;
- char *ret = NULL;
-
- ndr = talloc_zero(mem_ctx, struct ndr_print);
- if (!ndr) return NULL;
- ndr->private_data = talloc_strdup(ndr, "");
- if (!ndr->private_data) {
- goto failed;
- }
- ndr->print = ndr_print_string_helper;
- ndr->depth = 1;
- ndr->flags = 0;
- ndr_print_set_switch_value(ndr, ptr, level);
- fn(ndr, name, ptr);
- ret = talloc_steal(mem_ctx, (char *)ndr->private_data);
-failed:
- talloc_free(ndr);
- return ret;
-}
-
-/*
- a useful helper function for printing idl function calls to a string
-*/
-_PUBLIC_ char *ndr_print_function_string(TALLOC_CTX *mem_ctx,
- ndr_print_function_t fn, const char *name,
- int flags, void *ptr)
-{
- struct ndr_print *ndr;
- char *ret = NULL;
-
- ndr = talloc_zero(mem_ctx, struct ndr_print);
- if (!ndr) return NULL;
- ndr->private_data = talloc_strdup(ndr, "");
- if (!ndr->private_data) {
- goto failed;
- }
- ndr->print = ndr_print_string_helper;
- ndr->depth = 1;
- ndr->flags = 0;
- fn(ndr, name, flags, ptr);
- ret = talloc_steal(mem_ctx, (char *)ndr->private_data);
-failed:
- talloc_free(ndr);
- return ret;
-}
-
-_PUBLIC_ void ndr_set_flags(uint32_t *pflags, uint32_t new_flags)
-{
- /* the big/little endian flags are inter-dependent */
- if (new_flags & LIBNDR_FLAG_LITTLE_ENDIAN) {
- (*pflags) &= ~LIBNDR_FLAG_BIGENDIAN;
- }
- if (new_flags & LIBNDR_FLAG_BIGENDIAN) {
- (*pflags) &= ~LIBNDR_FLAG_LITTLE_ENDIAN;
- }
- if (new_flags & LIBNDR_FLAG_REMAINING) {
- (*pflags) &= ~LIBNDR_ALIGN_FLAGS;
- }
- if (new_flags & LIBNDR_ALIGN_FLAGS) {
- (*pflags) &= ~LIBNDR_FLAG_REMAINING;
- }
- (*pflags) |= new_flags;
-}
-
-NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err)
-{
- switch (ndr_err) {
- case NDR_ERR_SUCCESS:
- return NT_STATUS_OK;
- case NDR_ERR_BUFSIZE:
- return NT_STATUS_BUFFER_TOO_SMALL;
- case NDR_ERR_TOKEN:
- return NT_STATUS_INTERNAL_ERROR;
- case NDR_ERR_ALLOC:
- return NT_STATUS_NO_MEMORY;
- case NDR_ERR_ARRAY_SIZE:
- return NT_STATUS_ARRAY_BOUNDS_EXCEEDED;
- case NDR_ERR_INVALID_POINTER:
- return NT_STATUS_INVALID_PARAMETER_MIX;
- case NDR_ERR_UNREAD_BYTES:
- return NT_STATUS_PORT_MESSAGE_TOO_LONG;
- default:
- break;
- }
-
- /* we should map all error codes to different status codes */
- return NT_STATUS_INVALID_PARAMETER;
-}
-
-/*
- * Convert an ndr error to string
- */
-
-const char *ndr_errstr(enum ndr_err_code err)
-{
- switch (err) {
- case NDR_ERR_SUCCESS:
- return "NDR_ERR_SUCCESS";
- break;
- case NDR_ERR_ARRAY_SIZE:
- return "NDR_ERR_ARRAY_SIZE";
- break;
- case NDR_ERR_BAD_SWITCH:
- return "NDR_ERR_BAD_SWITCH";
- break;
- case NDR_ERR_OFFSET:
- return "NDR_ERR_OFFSET";
- break;
- case NDR_ERR_RELATIVE:
- return "NDR_ERR_RELATIVE";
- break;
- case NDR_ERR_CHARCNV:
- return "NDR_ERR_CHARCNV";
- break;
- case NDR_ERR_LENGTH:
- return "NDR_ERR_LENGTH";
- break;
- case NDR_ERR_SUBCONTEXT:
- return "NDR_ERR_SUBCONTEXT";
- break;
- case NDR_ERR_COMPRESSION:
- return "NDR_ERR_COMPRESSION";
- break;
- case NDR_ERR_STRING:
- return "NDR_ERR_STRING";
- break;
- case NDR_ERR_VALIDATE:
- return "NDR_ERR_VALIDATE";
- break;
- case NDR_ERR_BUFSIZE:
- return "NDR_ERR_BUFSIZE";
- break;
- case NDR_ERR_ALLOC:
- return "NDR_ERR_ALLOC";
- break;
- case NDR_ERR_RANGE:
- return "NDR_ERR_RANGE";
- break;
- case NDR_ERR_TOKEN:
- return "NDR_ERR_TOKEN";
- break;
- case NDR_ERR_IPV4ADDRESS:
- return "NDR_ERR_IPV4ADDRESS";
- break;
- case NDR_ERR_INVALID_POINTER:
- return "NDR_ERR_INVALID_POINTER";
- break;
- case NDR_ERR_UNREAD_BYTES:
- return "NDR_ERR_UNREAD_BYTES";
- break;
- }
-
- return talloc_asprintf(talloc_tos(), "Unknown NDR error: %d", err);
-}
-
-/*
- return and possibly log an NDR error
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_error(struct ndr_pull *ndr,
- enum ndr_err_code ndr_err,
- const char *format, ...) _PRINTF_ATTRIBUTE(3,4)
-{
- char *s=NULL;
- va_list ap;
- int ret;
-
- va_start(ap, format);
- ret = vasprintf(&s, format, ap);
- va_end(ap);
-
- if (ret == -1) {
- return NDR_ERR_ALLOC;
- }
-
- DEBUG(1,("ndr_pull_error(%u): %s\n", ndr_err, s));
-
- free(s);
-
- return ndr_err;
-}
-
-/*
- return and possibly log an NDR error
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_error(struct ndr_push *ndr,
- enum ndr_err_code ndr_err,
- const char *format, ...) _PRINTF_ATTRIBUTE(3,4)
-{
- char *s=NULL;
- va_list ap;
- int ret;
-
- va_start(ap, format);
- ret = vasprintf(&s, format, ap);
- va_end(ap);
-
- if (ret == -1) {
- return NDR_ERR_ALLOC;
- }
-
- DEBUG(1,("ndr_push_error(%u): %s\n", ndr_err, s));
-
- free(s);
-
- return ndr_err;
-}
-
-/*
- handle subcontext buffers, which in midl land are user-marshalled, but
- we use magic in pidl to make them easier to cope with
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_subcontext_start(struct ndr_pull *ndr,
- struct ndr_pull **_subndr,
- size_t header_size,
- ssize_t size_is)
-{
- struct ndr_pull *subndr;
- uint32_t r_content_size;
-
- switch (header_size) {
- case 0: {
- uint32_t content_size = ndr->data_size - ndr->offset;
- if (size_is >= 0) {
- content_size = size_is;
- }
- r_content_size = content_size;
- break;
- }
-
- case 2: {
- uint16_t content_size;
- NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &content_size));
- if (size_is >= 0 && size_is != content_size) {
- return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) size_is(%d) mismatch content_size %d",
- (int)size_is, (int)content_size);
- }
- r_content_size = content_size;
- break;
- }
-
- case 4: {
- uint32_t content_size;
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &content_size));
- if (size_is >= 0 && size_is != content_size) {
- return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) size_is(%d) mismatch content_size %d",
- (int)size_is, (int)content_size);
- }
- r_content_size = content_size;
- break;
- }
- default:
- return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PULL) header_size %d",
- (int)header_size);
- }
-
- NDR_PULL_NEED_BYTES(ndr, r_content_size);
-
- subndr = talloc_zero(ndr, struct ndr_pull);
- NDR_ERR_HAVE_NO_MEMORY(subndr);
- subndr->flags = ndr->flags;
- subndr->current_mem_ctx = ndr->current_mem_ctx;
-
- subndr->data = ndr->data + ndr->offset;
- subndr->offset = 0;
- subndr->data_size = r_content_size;
-
- *_subndr = subndr;
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_pull_subcontext_end(struct ndr_pull *ndr,
- struct ndr_pull *subndr,
- size_t header_size,
- ssize_t size_is)
-{
- uint32_t advance;
- if (size_is >= 0) {
- advance = size_is;
- } else if (header_size > 0) {
- advance = subndr->data_size;
- } else {
- advance = subndr->offset;
- }
- NDR_CHECK(ndr_pull_advance(ndr, advance));
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_push_subcontext_start(struct ndr_push *ndr,
- struct ndr_push **_subndr,
- size_t header_size,
- ssize_t size_is)
-{
- struct ndr_push *subndr;
-
- subndr = ndr_push_init_ctx(ndr);
- NDR_ERR_HAVE_NO_MEMORY(subndr);
- subndr->flags = ndr->flags;
-
- *_subndr = subndr;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push a subcontext header
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_subcontext_end(struct ndr_push *ndr,
- struct ndr_push *subndr,
- size_t header_size,
- ssize_t size_is)
-{
- if (size_is >= 0) {
- ssize_t padding_len = size_is - subndr->offset;
- if (padding_len > 0) {
- NDR_CHECK(ndr_push_zero(subndr, padding_len));
- } else if (padding_len < 0) {
- return ndr_push_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext (PUSH) content_size %d is larger than size_is(%d)",
- (int)subndr->offset, (int)size_is);
- }
- }
-
- switch (header_size) {
- case 0:
- break;
-
- case 2:
- NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, subndr->offset));
- break;
-
- case 4:
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, subndr->offset));
- break;
-
- default:
- return ndr_push_error(ndr, NDR_ERR_SUBCONTEXT, "Bad subcontext header size %d",
- (int)header_size);
- }
-
- NDR_CHECK(ndr_push_bytes(ndr, subndr->data, subndr->offset));
- return NDR_ERR_SUCCESS;
-}
-
-/*
- store a token in the ndr context, for later retrieval
-*/
-_PUBLIC_ enum ndr_err_code ndr_token_store(TALLOC_CTX *mem_ctx,
- struct ndr_token_list **list,
- const void *key,
- uint32_t value)
-{
- struct ndr_token_list *tok;
- tok = talloc(mem_ctx, struct ndr_token_list);
- NDR_ERR_HAVE_NO_MEMORY(tok);
- tok->key = key;
- tok->value = value;
- DLIST_ADD((*list), tok);
- return NDR_ERR_SUCCESS;
-}
-
-/*
- retrieve a token from a ndr context, using cmp_fn to match the tokens
-*/
-_PUBLIC_ enum ndr_err_code ndr_token_retrieve_cmp_fn(struct ndr_token_list **list, const void *key, uint32_t *v,
- comparison_fn_t _cmp_fn, bool _remove_tok)
-{
- struct ndr_token_list *tok;
- for (tok=*list;tok;tok=tok->next) {
- if (_cmp_fn && _cmp_fn(tok->key,key)==0) goto found;
- else if (!_cmp_fn && tok->key == key) goto found;
- }
- return NDR_ERR_TOKEN;
-found:
- *v = tok->value;
- if (_remove_tok) {
- DLIST_REMOVE((*list), tok);
- talloc_free(tok);
- }
- return NDR_ERR_SUCCESS;
-}
-
-/*
- retrieve a token from a ndr context
-*/
-_PUBLIC_ enum ndr_err_code ndr_token_retrieve(struct ndr_token_list **list, const void *key, uint32_t *v)
-{
- return ndr_token_retrieve_cmp_fn(list, key, v, NULL, true);
-}
-
-/*
- peek at but don't removed a token from a ndr context
-*/
-_PUBLIC_ uint32_t ndr_token_peek(struct ndr_token_list **list, const void *key)
-{
- enum ndr_err_code status;
- uint32_t v;
-
- status = ndr_token_retrieve_cmp_fn(list, key, &v, NULL, false);
- if (!NDR_ERR_CODE_IS_SUCCESS(status)) {
- return 0;
- }
-
- return v;
-}
-
-/*
- pull an array size field and add it to the array_size_list token list
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_array_size(struct ndr_pull *ndr, const void *p)
-{
- uint32_t size;
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &size));
- return ndr_token_store(ndr, &ndr->array_size_list, p, size);
-}
-
-/*
- get the stored array size field
-*/
-_PUBLIC_ uint32_t ndr_get_array_size(struct ndr_pull *ndr, const void *p)
-{
- return ndr_token_peek(&ndr->array_size_list, p);
-}
-
-/*
- check the stored array size field
-*/
-_PUBLIC_ enum ndr_err_code ndr_check_array_size(struct ndr_pull *ndr, void *p, uint32_t size)
-{
- uint32_t stored;
- stored = ndr_token_peek(&ndr->array_size_list, p);
- if (stored != size) {
- return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
- "Bad array size - got %u expected %u\n",
- stored, size);
- }
- return NDR_ERR_SUCCESS;
-}
-
-/*
- pull an array length field and add it to the array_length_list token list
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_array_length(struct ndr_pull *ndr, const void *p)
-{
- uint32_t length, offset;
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &offset));
- if (offset != 0) {
- return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
- "non-zero array offset %u\n", offset);
- }
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &length));
- return ndr_token_store(ndr, &ndr->array_length_list, p, length);
-}
-
-/*
- get the stored array length field
-*/
-_PUBLIC_ uint32_t ndr_get_array_length(struct ndr_pull *ndr, const void *p)
-{
- return ndr_token_peek(&ndr->array_length_list, p);
-}
-
-/*
- check the stored array length field
-*/
-_PUBLIC_ enum ndr_err_code ndr_check_array_length(struct ndr_pull *ndr, void *p, uint32_t length)
-{
- uint32_t stored;
- stored = ndr_token_peek(&ndr->array_length_list, p);
- if (stored != length) {
- return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
- "Bad array length - got %u expected %u\n",
- stored, length);
- }
- return NDR_ERR_SUCCESS;
-}
-
-/*
- store a switch value
- */
-_PUBLIC_ enum ndr_err_code ndr_push_set_switch_value(struct ndr_push *ndr, const void *p, uint32_t val)
-{
- return ndr_token_store(ndr, &ndr->switch_list, p, val);
-}
-
-_PUBLIC_ enum ndr_err_code ndr_pull_set_switch_value(struct ndr_pull *ndr, const void *p, uint32_t val)
-{
- return ndr_token_store(ndr, &ndr->switch_list, p, val);
-}
-
-_PUBLIC_ enum ndr_err_code ndr_print_set_switch_value(struct ndr_print *ndr, const void *p, uint32_t val)
-{
- return ndr_token_store(ndr, &ndr->switch_list, p, val);
-}
-
-/*
- retrieve a switch value
- */
-_PUBLIC_ uint32_t ndr_push_get_switch_value(struct ndr_push *ndr, const void *p)
-{
- return ndr_token_peek(&ndr->switch_list, p);
-}
-
-_PUBLIC_ uint32_t ndr_pull_get_switch_value(struct ndr_pull *ndr, const void *p)
-{
- return ndr_token_peek(&ndr->switch_list, p);
-}
-
-_PUBLIC_ uint32_t ndr_print_get_switch_value(struct ndr_print *ndr, const void *p)
-{
- return ndr_token_peek(&ndr->switch_list, p);
-}
-
-/*
- pull a struct from a blob using NDR
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
- ndr_pull_flags_fn_t fn)
-{
- struct ndr_pull *ndr;
- ndr = ndr_pull_init_blob(blob, mem_ctx);
- NDR_ERR_HAVE_NO_MEMORY(ndr);
- NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
- return NDR_ERR_SUCCESS;
-}
-
-/*
- pull a struct from a blob using NDR - failing if all bytes are not consumed
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_struct_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
- ndr_pull_flags_fn_t fn)
-{
- struct ndr_pull *ndr;
- ndr = ndr_pull_init_blob(blob, mem_ctx);
- NDR_ERR_HAVE_NO_MEMORY(ndr);
- NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
- if (ndr->offset < ndr->data_size) {
- return ndr_pull_error(ndr, NDR_ERR_UNREAD_BYTES,
- "not all bytes consumed ofs[%u] size[%u]",
- ndr->offset, ndr->data_size);
- }
- return NDR_ERR_SUCCESS;
-}
-
-/*
- pull a union from a blob using NDR, given the union discriminator
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_union_blob(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
- uint32_t level, ndr_pull_flags_fn_t fn)
-{
- struct ndr_pull *ndr;
- ndr = ndr_pull_init_blob(blob, mem_ctx);
- NDR_ERR_HAVE_NO_MEMORY(ndr);
- NDR_CHECK(ndr_pull_set_switch_value(ndr, p, level));
- NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
- return NDR_ERR_SUCCESS;
-}
-
-/*
- pull a union from a blob using NDR, given the union discriminator,
- failing if all bytes are not consumed
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_union_blob_all(const DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
- uint32_t level, ndr_pull_flags_fn_t fn)
-{
- struct ndr_pull *ndr;
- ndr = ndr_pull_init_blob(blob, mem_ctx);
- NDR_ERR_HAVE_NO_MEMORY(ndr);
- NDR_CHECK(ndr_pull_set_switch_value(ndr, p, level));
- NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
- if (ndr->offset < ndr->data_size) {
- return ndr_pull_error(ndr, NDR_ERR_UNREAD_BYTES,
- "not all bytes consumed ofs[%u] size[%u]",
- ndr->offset, ndr->data_size);
- }
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push a struct to a blob using NDR
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, const void *p,
- ndr_push_flags_fn_t fn)
-{
- struct ndr_push *ndr;
- ndr = ndr_push_init_ctx(mem_ctx);
- NDR_ERR_HAVE_NO_MEMORY(ndr);
-
- NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
-
- *blob = ndr_push_blob(ndr);
- talloc_steal(mem_ctx, blob->data);
- talloc_free(ndr);
-
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push a union to a blob using NDR
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_union_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, void *p,
- uint32_t level, ndr_push_flags_fn_t fn)
-{
- struct ndr_push *ndr;
- ndr = ndr_push_init_ctx(mem_ctx);
- NDR_ERR_HAVE_NO_MEMORY(ndr);
-
- NDR_CHECK(ndr_push_set_switch_value(ndr, p, level));
- NDR_CHECK(fn(ndr, NDR_SCALARS|NDR_BUFFERS, p));
-
- *blob = ndr_push_blob(ndr);
- talloc_steal(mem_ctx, blob->data);
- talloc_free(ndr);
-
- return NDR_ERR_SUCCESS;
-}
-
-/*
- generic ndr_size_*() handler for structures
-*/
-_PUBLIC_ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push)
-{
- struct ndr_push *ndr;
- enum ndr_err_code status;
- size_t ret;
-
- /* avoid recursion */
- if (flags & LIBNDR_FLAG_NO_NDR_SIZE) return 0;
-
- ndr = ndr_push_init_ctx(NULL);
- if (!ndr) return 0;
- ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE;
- status = push(ndr, NDR_SCALARS|NDR_BUFFERS, discard_const(p));
- if (!NDR_ERR_CODE_IS_SUCCESS(status)) {
- talloc_free(ndr);
- return 0;
- }
- ret = ndr->offset;
- talloc_free(ndr);
- return ret;
-}
-
-/*
- generic ndr_size_*() handler for unions
-*/
-_PUBLIC_ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_fn_t push)
-{
- struct ndr_push *ndr;
- enum ndr_err_code status;
- size_t ret;
-
- /* avoid recursion */
- if (flags & LIBNDR_FLAG_NO_NDR_SIZE) return 0;
-
- ndr = ndr_push_init_ctx(NULL);
- if (!ndr) return 0;
- ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE;
-
- status = ndr_push_set_switch_value(ndr, p, level);
- if (!NDR_ERR_CODE_IS_SUCCESS(status)) {
- talloc_free(ndr);
- return 0;
- }
- status = push(ndr, NDR_SCALARS|NDR_BUFFERS, p);
- if (!NDR_ERR_CODE_IS_SUCCESS(status)) {
- talloc_free(ndr);
- return 0;
- }
- ret = ndr->offset;
- talloc_free(ndr);
- return ret;
-}
-
-/*
- get the current base for relative pointers for the push
-*/
-_PUBLIC_ uint32_t ndr_push_get_relative_base_offset(struct ndr_push *ndr)
-{
- return ndr->relative_base_offset;
-}
-
-/*
- restore the old base for relative pointers for the push
-*/
-_PUBLIC_ void ndr_push_restore_relative_base_offset(struct ndr_push *ndr, uint32_t offset)
-{
- ndr->relative_base_offset = offset;
-}
-
-/*
- setup the current base for relative pointers for the push
- called in the NDR_SCALAR stage
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_setup_relative_base_offset1(struct ndr_push *ndr, const void *p, uint32_t offset)
-{
- ndr->relative_base_offset = offset;
- return ndr_token_store(ndr, &ndr->relative_base_list, p, offset);
-}
-
-/*
- setup the current base for relative pointers for the push
- called in the NDR_BUFFERS stage
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_setup_relative_base_offset2(struct ndr_push *ndr, const void *p)
-{
- return ndr_token_retrieve(&ndr->relative_base_list, p, &ndr->relative_base_offset);
-}
-
-/*
- push a relative object - stage1
- this is called during SCALARS processing
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_relative_ptr1(struct ndr_push *ndr, const void *p)
-{
- if (p == NULL) {
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
- return NDR_ERR_SUCCESS;
- }
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_token_store(ndr, &ndr->relative_list, p, ndr->offset));
- return ndr_push_uint32(ndr, NDR_SCALARS, 0xFFFFFFFF);
-}
-
-/*
- push a relative object - stage2
- this is called during buffers processing
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_relative_ptr2(struct ndr_push *ndr, const void *p)
-{
- struct ndr_push_save save;
- uint32_t ptr_offset = 0xFFFFFFFF;
- if (p == NULL) {
- return NDR_ERR_SUCCESS;
- }
- ndr_push_save(ndr, &save);
- NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, p, &ptr_offset));
- if (ptr_offset > ndr->offset) {
- return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
- "ndr_push_relative_ptr2 ptr_offset(%u) > ndr->offset(%u)",
- ptr_offset, ndr->offset);
- }
- ndr->offset = ptr_offset;
- if (save.offset < ndr->relative_base_offset) {
- return ndr_push_error(ndr, NDR_ERR_BUFSIZE,
- "ndr_push_relative_ptr2 save.offset(%u) < ndr->relative_base_offset(%u)",
- save.offset, ndr->relative_base_offset);
- }
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, save.offset - ndr->relative_base_offset));
- ndr_push_restore(ndr, &save);
- return NDR_ERR_SUCCESS;
-}
-
-/*
- get the current base for relative pointers for the pull
-*/
-_PUBLIC_ uint32_t ndr_pull_get_relative_base_offset(struct ndr_pull *ndr)
-{
- return ndr->relative_base_offset;
-}
-
-/*
- restore the old base for relative pointers for the pull
-*/
-_PUBLIC_ void ndr_pull_restore_relative_base_offset(struct ndr_pull *ndr, uint32_t offset)
-{
- ndr->relative_base_offset = offset;
-}
-
-/*
- setup the current base for relative pointers for the pull
- called in the NDR_SCALAR stage
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_setup_relative_base_offset1(struct ndr_pull *ndr, const void *p, uint32_t offset)
-{
- ndr->relative_base_offset = offset;
- return ndr_token_store(ndr, &ndr->relative_base_list, p, offset);
-}
-
-/*
- setup the current base for relative pointers for the pull
- called in the NDR_BUFFERS stage
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_setup_relative_base_offset2(struct ndr_pull *ndr, const void *p)
-{
- return ndr_token_retrieve(&ndr->relative_base_list, p, &ndr->relative_base_offset);
-}
-
-/*
- pull a relative object - stage1
- called during SCALARS processing
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_relative_ptr1(struct ndr_pull *ndr, const void *p, uint32_t rel_offset)
-{
- rel_offset += ndr->relative_base_offset;
- if (rel_offset > ndr->data_size) {
- return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
- "ndr_pull_relative_ptr1 rel_offset(%u) > ndr->data_size(%u)",
- rel_offset, ndr->data_size);
- }
- return ndr_token_store(ndr, &ndr->relative_list, p, rel_offset);
-}
-
-/*
- pull a relative object - stage2
- called during BUFFERS processing
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_relative_ptr2(struct ndr_pull *ndr, const void *p)
-{
- uint32_t rel_offset;
- NDR_CHECK(ndr_token_retrieve(&ndr->relative_list, p, &rel_offset));
- return ndr_pull_set_offset(ndr, rel_offset);
-}
diff --git a/source3/librpc/ndr/ndr_basic.c b/source3/librpc/ndr/ndr_basic.c
deleted file mode 100644
index c8fa70b185..0000000000
--- a/source3/librpc/ndr/ndr_basic.c
+++ /dev/null
@@ -1,859 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- routines for marshalling/unmarshalling basic types
-
- Copyright (C) Andrew Tridgell 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"
-#include "system/network.h"
-#include "librpc/ndr/libndr.h"
-
-#define NDR_SVAL(ndr, ofs) (NDR_BE(ndr)?RSVAL(ndr->data,ofs):SVAL(ndr->data,ofs))
-#define NDR_IVAL(ndr, ofs) (NDR_BE(ndr)?RIVAL(ndr->data,ofs):IVAL(ndr->data,ofs))
-#define NDR_IVALS(ndr, ofs) (NDR_BE(ndr)?RIVALS(ndr->data,ofs):IVALS(ndr->data,ofs))
-#define NDR_SSVAL(ndr, ofs, v) do { if (NDR_BE(ndr)) { RSSVAL(ndr->data,ofs,v); } else SSVAL(ndr->data,ofs,v); } while (0)
-#define NDR_SIVAL(ndr, ofs, v) do { if (NDR_BE(ndr)) { RSIVAL(ndr->data,ofs,v); } else SIVAL(ndr->data,ofs,v); } while (0)
-#define NDR_SIVALS(ndr, ofs, v) do { if (NDR_BE(ndr)) { RSIVALS(ndr->data,ofs,v); } else SIVALS(ndr->data,ofs,v); } while (0)
-
-
-/*
- check for data leaks from the server by looking for non-zero pad bytes
- these could also indicate that real structure elements have been
- mistaken for padding in the IDL
-*/
-_PUBLIC_ void ndr_check_padding(struct ndr_pull *ndr, size_t n)
-{
- size_t ofs2 = (ndr->offset + (n-1)) & ~(n-1);
- int i;
- for (i=ndr->offset;i<ofs2;i++) {
- if (ndr->data[i] != 0) {
- break;
- }
- }
- if (i<ofs2) {
- DEBUG(0,("WARNING: Non-zero padding to %d: ", (int)n));
- for (i=ndr->offset;i<ofs2;i++) {
- DEBUG(0,("%02x ", ndr->data[i]));
- }
- DEBUG(0,("\n"));
- }
-
-}
-
-/*
- parse a int8_t
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_int8(struct ndr_pull *ndr, int ndr_flags, int8_t *v)
-{
- NDR_PULL_NEED_BYTES(ndr, 1);
- *v = (int8_t)CVAL(ndr->data, ndr->offset);
- ndr->offset += 1;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- parse a uint8_t
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *v)
-{
- NDR_PULL_NEED_BYTES(ndr, 1);
- *v = CVAL(ndr->data, ndr->offset);
- ndr->offset += 1;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- parse a int16_t
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_int16(struct ndr_pull *ndr, int ndr_flags, int16_t *v)
-{
- NDR_PULL_ALIGN(ndr, 2);
- NDR_PULL_NEED_BYTES(ndr, 2);
- *v = (uint16_t)NDR_SVAL(ndr, ndr->offset);
- ndr->offset += 2;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- parse a uint16_t
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_uint16(struct ndr_pull *ndr, int ndr_flags, uint16_t *v)
-{
- NDR_PULL_ALIGN(ndr, 2);
- NDR_PULL_NEED_BYTES(ndr, 2);
- *v = NDR_SVAL(ndr, ndr->offset);
- ndr->offset += 2;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- parse a int32_t
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_int32(struct ndr_pull *ndr, int ndr_flags, int32_t *v)
-{
- NDR_PULL_ALIGN(ndr, 4);
- NDR_PULL_NEED_BYTES(ndr, 4);
- *v = NDR_IVALS(ndr, ndr->offset);
- ndr->offset += 4;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- parse a uint32_t
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_uint32(struct ndr_pull *ndr, int ndr_flags, uint32_t *v)
-{
- NDR_PULL_ALIGN(ndr, 4);
- NDR_PULL_NEED_BYTES(ndr, 4);
- *v = NDR_IVAL(ndr, ndr->offset);
- ndr->offset += 4;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- parse a pointer referent identifier
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_generic_ptr(struct ndr_pull *ndr, uint32_t *v)
-{
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, v));
- if (*v != 0) {
- ndr->ptr_count++;
- }
- return NDR_ERR_SUCCESS;
-}
-
-/*
- parse a ref pointer referent identifier
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_ref_ptr(struct ndr_pull *ndr, uint32_t *v)
-{
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, v));
- /* ref pointers always point to data */
- *v = 1;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- parse a udlong
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_udlong(struct ndr_pull *ndr, int ndr_flags, uint64_t *v)
-{
- NDR_PULL_ALIGN(ndr, 4);
- NDR_PULL_NEED_BYTES(ndr, 8);
- *v = NDR_IVAL(ndr, ndr->offset);
- *v |= (uint64_t)(NDR_IVAL(ndr, ndr->offset+4)) << 32;
- ndr->offset += 8;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- parse a udlongr
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_udlongr(struct ndr_pull *ndr, int ndr_flags, uint64_t *v)
-{
- NDR_PULL_ALIGN(ndr, 4);
- NDR_PULL_NEED_BYTES(ndr, 8);
- *v = ((uint64_t)NDR_IVAL(ndr, ndr->offset)) << 32;
- *v |= NDR_IVAL(ndr, ndr->offset+4);
- ndr->offset += 8;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- parse a dlong
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_dlong(struct ndr_pull *ndr, int ndr_flags, int64_t *v)
-{
- return ndr_pull_udlong(ndr, ndr_flags, (uint64_t *)v);
-}
-
-/*
- parse a hyper
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_hyper(struct ndr_pull *ndr, int ndr_flags, uint64_t *v)
-{
- NDR_PULL_ALIGN(ndr, 8);
- return ndr_pull_udlong(ndr, ndr_flags, v);
-}
-
-/*
- parse a pointer
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_pointer(struct ndr_pull *ndr, int ndr_flags, void* *v)
-{
- uintptr_t h;
- NDR_PULL_ALIGN(ndr, sizeof(h));
- NDR_PULL_NEED_BYTES(ndr, sizeof(h));
- memcpy(&h, ndr->data+ndr->offset, sizeof(h));
- ndr->offset += sizeof(h);
- *v = (void *)h;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- pull a NTSTATUS
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_NTSTATUS(struct ndr_pull *ndr, int ndr_flags, NTSTATUS *status)
-{
- uint32_t v;
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
- *status = NT_STATUS(v);
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push a NTSTATUS
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_NTSTATUS(struct ndr_push *ndr, int ndr_flags, NTSTATUS status)
-{
- return ndr_push_uint32(ndr, ndr_flags, NT_STATUS_V(status));
-}
-
-_PUBLIC_ void ndr_print_NTSTATUS(struct ndr_print *ndr, const char *name, NTSTATUS r)
-{
- ndr->print(ndr, "%-25s: %s", name, nt_errstr(r));
-}
-
-/*
- pull a WERROR
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_WERROR(struct ndr_pull *ndr, int ndr_flags, WERROR *status)
-{
- uint32_t v;
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
- *status = W_ERROR(v);
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push a WERROR
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_WERROR(struct ndr_push *ndr, int ndr_flags, WERROR status)
-{
- return ndr_push_uint32(ndr, NDR_SCALARS, W_ERROR_V(status));
-}
-
-_PUBLIC_ void ndr_print_WERROR(struct ndr_print *ndr, const char *name, WERROR r)
-{
- ndr->print(ndr, "%-25s: %s", name, win_errstr(r));
-}
-
-/*
- parse a set of bytes
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_bytes(struct ndr_pull *ndr, uint8_t *data, uint32_t n)
-{
- NDR_PULL_NEED_BYTES(ndr, n);
- memcpy(data, ndr->data + ndr->offset, n);
- ndr->offset += n;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- pull an array of uint8
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_array_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *data, uint32_t n)
-{
- if (!(ndr_flags & NDR_SCALARS)) {
- return NDR_ERR_SUCCESS;
- }
- return ndr_pull_bytes(ndr, data, n);
-}
-
-/*
- push a int8_t
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_int8(struct ndr_push *ndr, int ndr_flags, int8_t v)
-{
- NDR_PUSH_NEED_BYTES(ndr, 1);
- SCVAL(ndr->data, ndr->offset, (uint8_t)v);
- ndr->offset += 1;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push a uint8_t
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_uint8(struct ndr_push *ndr, int ndr_flags, uint8_t v)
-{
- NDR_PUSH_NEED_BYTES(ndr, 1);
- SCVAL(ndr->data, ndr->offset, v);
- ndr->offset += 1;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push a int16_t
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_int16(struct ndr_push *ndr, int ndr_flags, int16_t v)
-{
- NDR_PUSH_ALIGN(ndr, 2);
- NDR_PUSH_NEED_BYTES(ndr, 2);
- NDR_SSVAL(ndr, ndr->offset, (uint16_t)v);
- ndr->offset += 2;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push a uint16_t
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_uint16(struct ndr_push *ndr, int ndr_flags, uint16_t v)
-{
- NDR_PUSH_ALIGN(ndr, 2);
- NDR_PUSH_NEED_BYTES(ndr, 2);
- NDR_SSVAL(ndr, ndr->offset, v);
- ndr->offset += 2;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push a int32_t
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_int32(struct ndr_push *ndr, int ndr_flags, int32_t v)
-{
- NDR_PUSH_ALIGN(ndr, 4);
- NDR_PUSH_NEED_BYTES(ndr, 4);
- NDR_SIVALS(ndr, ndr->offset, v);
- ndr->offset += 4;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push a uint32_t
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_uint32(struct ndr_push *ndr, int ndr_flags, uint32_t v)
-{
- NDR_PUSH_ALIGN(ndr, 4);
- NDR_PUSH_NEED_BYTES(ndr, 4);
- NDR_SIVAL(ndr, ndr->offset, v);
- ndr->offset += 4;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push a udlong
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_udlong(struct ndr_push *ndr, int ndr_flags, uint64_t v)
-{
- NDR_PUSH_ALIGN(ndr, 4);
- NDR_PUSH_NEED_BYTES(ndr, 8);
- NDR_SIVAL(ndr, ndr->offset, (v & 0xFFFFFFFF));
- NDR_SIVAL(ndr, ndr->offset+4, (v>>32));
- ndr->offset += 8;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push a udlongr
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_udlongr(struct ndr_push *ndr, int ndr_flags, uint64_t v)
-{
- NDR_PUSH_ALIGN(ndr, 4);
- NDR_PUSH_NEED_BYTES(ndr, 8);
- NDR_SIVAL(ndr, ndr->offset, (v>>32));
- NDR_SIVAL(ndr, ndr->offset+4, (v & 0xFFFFFFFF));
- ndr->offset += 8;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push a dlong
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_dlong(struct ndr_push *ndr, int ndr_flags, int64_t v)
-{
- return ndr_push_udlong(ndr, NDR_SCALARS, (uint64_t)v);
-}
-
-/*
- push a hyper
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_hyper(struct ndr_push *ndr, int ndr_flags, uint64_t v)
-{
- NDR_PUSH_ALIGN(ndr, 8);
- return ndr_push_udlong(ndr, NDR_SCALARS, v);
-}
-
-/*
- push a pointer
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_pointer(struct ndr_push *ndr, int ndr_flags, void* v)
-{
- uintptr_t h = (intptr_t)v;
- NDR_PUSH_ALIGN(ndr, sizeof(h));
- NDR_PUSH_NEED_BYTES(ndr, sizeof(h));
- memcpy(ndr->data+ndr->offset, &h, sizeof(h));
- ndr->offset += sizeof(h);
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_push_align(struct ndr_push *ndr, size_t size)
-{
- NDR_PUSH_ALIGN(ndr, size);
- return NDR_ERR_SUCCESS;
-}
-
-_PUBLIC_ enum ndr_err_code ndr_pull_align(struct ndr_pull *ndr, size_t size)
-{
- NDR_PULL_ALIGN(ndr, size);
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push some bytes
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_bytes(struct ndr_push *ndr, const uint8_t *data, uint32_t n)
-{
- NDR_PUSH_NEED_BYTES(ndr, n);
- memcpy(ndr->data + ndr->offset, data, n);
- ndr->offset += n;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push some zero bytes
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_zero(struct ndr_push *ndr, uint32_t n)
-{
- NDR_PUSH_NEED_BYTES(ndr, n);
- memset(ndr->data + ndr->offset, 0, n);
- ndr->offset += n;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push an array of uint8
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_array_uint8(struct ndr_push *ndr, int ndr_flags, const uint8_t *data, uint32_t n)
-{
- if (!(ndr_flags & NDR_SCALARS)) {
- return NDR_ERR_SUCCESS;
- }
- return ndr_push_bytes(ndr, data, n);
-}
-
-/*
- save the current position
- */
-_PUBLIC_ void ndr_push_save(struct ndr_push *ndr, struct ndr_push_save *save)
-{
- save->offset = ndr->offset;
-}
-
-/*
- restore the position
- */
-_PUBLIC_ void ndr_push_restore(struct ndr_push *ndr, struct ndr_push_save *save)
-{
- ndr->offset = save->offset;
-}
-
-/*
- push a unique non-zero value if a pointer is non-NULL, otherwise 0
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_unique_ptr(struct ndr_push *ndr, const void *p)
-{
- uint32_t ptr = 0;
- if (p) {
- ptr = ndr->ptr_count * 4;
- ptr |= 0x00020000;
- ndr->ptr_count++;
- }
- return ndr_push_uint32(ndr, NDR_SCALARS, ptr);
-}
-
-/*
- push a 'simple' full non-zero value if a pointer is non-NULL, otherwise 0
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_full_ptr(struct ndr_push *ndr, const void *p)
-{
- uint32_t ptr = 0;
- if (p) {
- /* Check if the pointer already exists and has an id */
- ptr = ndr_token_peek(&ndr->full_ptr_list, p);
- if (ptr == 0) {
- ndr->ptr_count++;
- ptr = ndr->ptr_count;
- ndr_token_store(ndr, &ndr->full_ptr_list, p, ptr);
- }
- }
- return ndr_push_uint32(ndr, NDR_SCALARS, ptr);
-}
-
-/*
- push always a 0, if a pointer is NULL it's a fatal error
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_ref_ptr(struct ndr_push *ndr)
-{
- return ndr_push_uint32(ndr, NDR_SCALARS, 0xAEF1AEF1);
-}
-
-
-/*
- push a NTTIME
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_NTTIME(struct ndr_push *ndr, int ndr_flags, NTTIME t)
-{
- NDR_CHECK(ndr_push_udlong(ndr, ndr_flags, t));
- return NDR_ERR_SUCCESS;
-}
-
-/*
- pull a NTTIME
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_NTTIME(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
-{
- NDR_CHECK(ndr_pull_udlong(ndr, ndr_flags, t));
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push a NTTIME
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_NTTIME_1sec(struct ndr_push *ndr, int ndr_flags, NTTIME t)
-{
- t /= 10000000;
- NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, t));
- return NDR_ERR_SUCCESS;
-}
-
-/*
- pull a NTTIME_1sec
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_NTTIME_1sec(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
-{
- NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, t));
- (*t) *= 10000000;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- pull a NTTIME_hyper
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_NTTIME_hyper(struct ndr_pull *ndr, int ndr_flags, NTTIME *t)
-{
- NDR_CHECK(ndr_pull_hyper(ndr, ndr_flags, t));
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push a NTTIME_hyper
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_NTTIME_hyper(struct ndr_push *ndr, int ndr_flags, NTTIME t)
-{
- NDR_CHECK(ndr_push_hyper(ndr, ndr_flags, t));
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push a time_t
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_time_t(struct ndr_push *ndr, int ndr_flags, time_t t)
-{
- return ndr_push_uint32(ndr, ndr_flags, t);
-}
-
-/*
- pull a time_t
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_time_t(struct ndr_pull *ndr, int ndr_flags, time_t *t)
-{
- uint32_t tt;
- NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &tt));
- *t = tt;
- return NDR_ERR_SUCCESS;
-}
-
-
-/*
- pull a ipv4address
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_ipv4address(struct ndr_pull *ndr, int ndr_flags, const char **address)
-{
- struct in_addr in;
- NDR_CHECK(ndr_pull_uint32(ndr, ndr_flags, &in.s_addr));
- in.s_addr = htonl(in.s_addr);
- *address = talloc_strdup(ndr->current_mem_ctx, inet_ntoa(in));
- NDR_ERR_HAVE_NO_MEMORY(*address);
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push a ipv4address
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_ipv4address(struct ndr_push *ndr, int ndr_flags, const char *address)
-{
- uint32_t addr;
- if (!is_ipaddress(address)) {
- return ndr_push_error(ndr, NDR_ERR_IPV4ADDRESS,
- "Invalid IPv4 address: '%s'",
- address);
- }
- addr = inet_addr(address);
- NDR_CHECK(ndr_push_uint32(ndr, ndr_flags, htonl(addr)));
- return NDR_ERR_SUCCESS;
-}
-
-/*
- print a ipv4address
-*/
-_PUBLIC_ void ndr_print_ipv4address(struct ndr_print *ndr, const char *name,
- const char *address)
-{
- ndr->print(ndr, "%-25s: %s", name, address);
-}
-
-
-_PUBLIC_ void ndr_print_struct(struct ndr_print *ndr, const char *name, const char *type)
-{
- ndr->print(ndr, "%s: struct %s", name, type);
-}
-
-_PUBLIC_ void ndr_print_enum(struct ndr_print *ndr, const char *name, const char *type,
- const char *val, uint32_t value)
-{
- if (ndr->flags & LIBNDR_PRINT_ARRAY_HEX) {
- ndr->print(ndr, "%-25s: %s (0x%X)", name, val?val:"UNKNOWN_ENUM_VALUE", value);
- } else {
- ndr->print(ndr, "%-25s: %s (%d)", name, val?val:"UNKNOWN_ENUM_VALUE", value);
- }
-}
-
-_PUBLIC_ void ndr_print_bitmap_flag(struct ndr_print *ndr, size_t size, const char *flag_name, uint32_t flag, uint32_t value)
-{
- /* this is an attempt to support multi-bit bitmap masks */
- value &= flag;
-
- while (!(flag & 1)) {
- flag >>= 1;
- value >>= 1;
- }
- if (flag == 1) {
- ndr->print(ndr, " %d: %-25s", value, flag_name);
- } else {
- ndr->print(ndr, "0x%02x: %-25s (%d)", value, flag_name, value);
- }
-}
-
-_PUBLIC_ void ndr_print_int8(struct ndr_print *ndr, const char *name, int8_t v)
-{
- ndr->print(ndr, "%-25s: %d", name, v);
-}
-
-_PUBLIC_ void ndr_print_uint8(struct ndr_print *ndr, const char *name, uint8_t v)
-{
- ndr->print(ndr, "%-25s: 0x%02x (%u)", name, v, v);
-}
-
-_PUBLIC_ void ndr_print_int16(struct ndr_print *ndr, const char *name, int16_t v)
-{
- ndr->print(ndr, "%-25s: %d", name, v);
-}
-
-_PUBLIC_ void ndr_print_uint16(struct ndr_print *ndr, const char *name, uint16_t v)
-{
- ndr->print(ndr, "%-25s: 0x%04x (%u)", name, v, v);
-}
-
-_PUBLIC_ void ndr_print_int32(struct ndr_print *ndr, const char *name, int32_t v)
-{
- ndr->print(ndr, "%-25s: %d", name, v);
-}
-
-_PUBLIC_ void ndr_print_uint32(struct ndr_print *ndr, const char *name, uint32_t v)
-{
- ndr->print(ndr, "%-25s: 0x%08x (%u)", name, v, v);
-}
-
-_PUBLIC_ void ndr_print_udlong(struct ndr_print *ndr, const char *name, uint64_t v)
-{
- ndr->print(ndr, "%-25s: 0x%016llx (%llu)", name, (unsigned long long)v, (unsigned long long)v);
-}
-
-_PUBLIC_ void ndr_print_udlongr(struct ndr_print *ndr, const char *name, uint64_t v)
-{
- ndr_print_udlong(ndr, name, v);
-}
-
-_PUBLIC_ void ndr_print_dlong(struct ndr_print *ndr, const char *name, int64_t v)
-{
- ndr->print(ndr, "%-25s: 0x%016llx (%lld)", name, (unsigned long long)v, (long long)v);
-}
-
-_PUBLIC_ void ndr_print_hyper(struct ndr_print *ndr, const char *name, uint64_t v)
-{
- ndr_print_dlong(ndr, name, v);
-}
-
-_PUBLIC_ void ndr_print_pointer(struct ndr_print *ndr, const char *name, void *v)
-{
- ndr->print(ndr, "%-25s: %p", name, v);
-}
-
-_PUBLIC_ void ndr_print_ptr(struct ndr_print *ndr, const char *name, const void *p)
-{
- if (p) {
- ndr->print(ndr, "%-25s: *", name);
- } else {
- ndr->print(ndr, "%-25s: NULL", name);
- }
-}
-
-_PUBLIC_ void ndr_print_NTTIME(struct ndr_print *ndr, const char *name, NTTIME t)
-{
- ndr->print(ndr, "%-25s: %s", name, nt_time_string(ndr, t));
-}
-
-_PUBLIC_ void ndr_print_NTTIME_1sec(struct ndr_print *ndr, const char *name, NTTIME t)
-{
- /* this is a standard NTTIME here
- * as it's already converted in the pull/push code
- */
- ndr_print_NTTIME(ndr, name, t);
-}
-
-_PUBLIC_ void ndr_print_NTTIME_hyper(struct ndr_print *ndr, const char *name, NTTIME t)
-{
- ndr_print_NTTIME(ndr, name, t);
-}
-
-_PUBLIC_ void ndr_print_time_t(struct ndr_print *ndr, const char *name, time_t t)
-{
- if (t == (time_t)-1 || t == 0) {
- ndr->print(ndr, "%-25s: (time_t)%d", name, (int)t);
- } else {
- ndr->print(ndr, "%-25s: %s", name, timestring(ndr, t));
- }
-}
-
-_PUBLIC_ void ndr_print_union(struct ndr_print *ndr, const char *name, int level, const char *type)
-{
- if (ndr->flags & LIBNDR_PRINT_ARRAY_HEX) {
- ndr->print(ndr, "%-25s: union %s(case 0x%X)", name, type, level);
- } else {
- ndr->print(ndr, "%-25s: union %s(case %d)", name, type, level);
- }
-}
-
-_PUBLIC_ void ndr_print_bad_level(struct ndr_print *ndr, const char *name, uint16_t level)
-{
- ndr->print(ndr, "UNKNOWN LEVEL %u", level);
-}
-
-_PUBLIC_ void ndr_print_array_uint8(struct ndr_print *ndr, const char *name,
- const uint8_t *data, uint32_t count)
-{
- int i;
-
- if (count <= 600 && (ndr->flags & LIBNDR_PRINT_ARRAY_HEX)) {
- char s[1202];
- for (i=0;i<count;i++) {
- snprintf(&s[i*2], 3, "%02x", data[i]);
- }
- s[i*2] = 0;
- ndr->print(ndr, "%-25s: %s", name, s);
- return;
- }
-
- ndr->print(ndr, "%s: ARRAY(%d)", name, count);
- ndr->depth++;
- for (i=0;i<count;i++) {
- char *idx=NULL;
- if (asprintf(&idx, "[%d]", i) != -1) {
- ndr_print_uint8(ndr, idx, data[i]);
- free(idx);
- }
- }
- ndr->depth--;
-}
-
-_PUBLIC_ void ndr_print_DATA_BLOB(struct ndr_print *ndr, const char *name, DATA_BLOB r)
-{
- ndr->print(ndr, "%-25s: DATA_BLOB length=%u", name, (unsigned)r.length);
- if (r.length) {
- dump_data(10, r.data, r.length);
- }
-}
-
-
-/*
- push a DATA_BLOB onto the wire.
-*/
-_PUBLIC_ enum ndr_err_code ndr_push_DATA_BLOB(struct ndr_push *ndr, int ndr_flags, DATA_BLOB blob)
-{
- if (ndr->flags & LIBNDR_ALIGN_FLAGS) {
- if (ndr->flags & LIBNDR_FLAG_ALIGN2) {
- blob.length = NDR_ALIGN(ndr, 2);
- } else if (ndr->flags & LIBNDR_FLAG_ALIGN4) {
- blob.length = NDR_ALIGN(ndr, 4);
- } else if (ndr->flags & LIBNDR_FLAG_ALIGN8) {
- blob.length = NDR_ALIGN(ndr, 8);
- }
- NDR_PUSH_ALLOC_SIZE(ndr, blob.data, blob.length);
- data_blob_clear(&blob);
- } else if (!(ndr->flags & LIBNDR_FLAG_REMAINING)) {
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, blob.length));
- }
- NDR_CHECK(ndr_push_bytes(ndr, blob.data, blob.length));
- return NDR_ERR_SUCCESS;
-}
-
-/*
- pull a DATA_BLOB from the wire.
-*/
-_PUBLIC_ enum ndr_err_code ndr_pull_DATA_BLOB(struct ndr_pull *ndr, int ndr_flags, DATA_BLOB *blob)
-{
- uint32_t length = 0;
-
- if (ndr->flags & LIBNDR_ALIGN_FLAGS) {
- if (ndr->flags & LIBNDR_FLAG_ALIGN2) {
- length = NDR_ALIGN(ndr, 2);
- } else if (ndr->flags & LIBNDR_FLAG_ALIGN4) {
- length = NDR_ALIGN(ndr, 4);
- } else if (ndr->flags & LIBNDR_FLAG_ALIGN8) {
- length = NDR_ALIGN(ndr, 8);
- }
- if (ndr->data_size - ndr->offset < length) {
- length = ndr->data_size - ndr->offset;
- }
- } else if (ndr->flags & LIBNDR_FLAG_REMAINING) {
- length = ndr->data_size - ndr->offset;
- } else {
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &length));
- }
- NDR_PULL_NEED_BYTES(ndr, length);
- *blob = data_blob_talloc(ndr->current_mem_ctx, ndr->data+ndr->offset, length);
- ndr->offset += length;
- return NDR_ERR_SUCCESS;
-}
-
-_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));
-}
diff --git a/source3/librpc/ndr/ndr_compression.c b/source3/librpc/ndr/ndr_compression.c
deleted file mode 100644
index 9da0773f28..0000000000
--- a/source3/librpc/ndr/ndr_compression.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- libndr compression support
-
- Copyright (C) Stefan Metzmacher 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"
-#include "lib/compression/mszip.h"
-#include "librpc/ndr/libndr.h"
-#include "librpc/ndr/ndr_compression.h"
-
-static enum ndr_err_code ndr_pull_compression_mszip_chunk(struct ndr_pull *ndrpull,
- struct ndr_push *ndrpush,
- struct decomp_state *decomp_state,
- bool *last)
-{
- DATA_BLOB comp_chunk;
- uint32_t comp_chunk_offset;
- uint32_t comp_chunk_size;
- DATA_BLOB plain_chunk;
- uint32_t plain_chunk_offset;
- uint32_t plain_chunk_size;
- int ret;
-
- NDR_CHECK(ndr_pull_uint32(ndrpull, NDR_SCALARS, &plain_chunk_size));
- if (plain_chunk_size > 0x00008000) {
- return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION, "Bad MSZIP plain chunk size %08X > 0x00008000 (PULL)",
- plain_chunk_size);
- }
-
- NDR_CHECK(ndr_pull_uint32(ndrpull, NDR_SCALARS, &comp_chunk_size));
-
- DEBUG(10,("MSZIP plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n",
- plain_chunk_size, plain_chunk_size, comp_chunk_size, comp_chunk_size));
-
- comp_chunk_offset = ndrpull->offset;
- NDR_CHECK(ndr_pull_advance(ndrpull, comp_chunk_size));
- comp_chunk.length = comp_chunk_size;
- comp_chunk.data = ndrpull->data + comp_chunk_offset;
-
- plain_chunk_offset = ndrpush->offset;
- NDR_CHECK(ndr_push_zero(ndrpush, plain_chunk_size));
- plain_chunk.length = plain_chunk_size;
- plain_chunk.data = ndrpush->data + plain_chunk_offset;
-
- ret = ZIPdecompress(decomp_state, &comp_chunk, &plain_chunk);
- if (ret != DECR_OK) {
- return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION, "Bad ZIPdecompress() error %d (PULL)",
- ret);
- }
-
- if ((plain_chunk_size < 0x00008000) || (ndrpull->offset+4 >= ndrpull->data_size)) {
- /* this is the last chunk */
- *last = true;
- }
-
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_compression_mszip(struct ndr_pull *subndr,
- struct ndr_pull **_comndr,
- ssize_t decompressed_len)
-{
- struct ndr_push *ndrpush;
- struct ndr_pull *comndr;
- DATA_BLOB uncompressed;
- uint32_t payload_header[4];
- uint32_t payload_size;
- uint32_t payload_offset;
- uint8_t *payload;
- struct decomp_state *decomp_state;
- bool last = false;
-
- ndrpush = ndr_push_init_ctx(subndr);
- NDR_ERR_HAVE_NO_MEMORY(ndrpush);
-
- decomp_state = ZIPdecomp_state(subndr);
- NDR_ERR_HAVE_NO_MEMORY(decomp_state);
-
- while (!last) {
- NDR_CHECK(ndr_pull_compression_mszip_chunk(subndr, ndrpush, decomp_state, &last));
- }
-
- uncompressed = ndr_push_blob(ndrpush);
-
- if (uncompressed.length != decompressed_len) {
- return ndr_pull_error(subndr, NDR_ERR_COMPRESSION, "Bad MSZIP uncompressed_len [%u] != [%d] (PULL)",
- (int)uncompressed.length, (int)decompressed_len);
- }
-
- comndr = talloc_zero(subndr, struct ndr_pull);
- NDR_ERR_HAVE_NO_MEMORY(comndr);
- comndr->flags = subndr->flags;
- comndr->current_mem_ctx = subndr->current_mem_ctx;
-
- comndr->data = uncompressed.data;
- comndr->data_size = uncompressed.length;
- comndr->offset = 0;
-
- NDR_CHECK(ndr_pull_uint32(comndr, NDR_SCALARS, &payload_header[0]));
- NDR_CHECK(ndr_pull_uint32(comndr, NDR_SCALARS, &payload_header[1]));
- NDR_CHECK(ndr_pull_uint32(comndr, NDR_SCALARS, &payload_header[2]));
- NDR_CHECK(ndr_pull_uint32(comndr, NDR_SCALARS, &payload_header[3]));
-
- if (payload_header[0] != 0x00081001) {
- return ndr_pull_error(subndr, NDR_ERR_COMPRESSION, "Bad MSZIP payload_header[0] [0x%08X] != [0x00081001] (PULL)",
- payload_header[0]);
- }
- if (payload_header[1] != 0xCCCCCCCC) {
- return ndr_pull_error(subndr, NDR_ERR_COMPRESSION, "Bad MSZIP payload_header[1] [0x%08X] != [0xCCCCCCCC] (PULL)",
- payload_header[1]);
- }
-
- payload_size = payload_header[2];
-
- if (payload_header[3] != 0x00000000) {
- return ndr_pull_error(subndr, NDR_ERR_COMPRESSION, "Bad MSZIP payload_header[3] [0x%08X] != [0x00000000] (PULL)",
- payload_header[3]);
- }
-
- payload_offset = comndr->offset;
- NDR_CHECK(ndr_pull_advance(comndr, payload_size));
- payload = comndr->data + payload_offset;
-
- comndr->data = payload;
- comndr->data_size = payload_size;
- comndr->offset = 0;
-
- *_comndr = comndr;
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_push_compression_mszip(struct ndr_push *subndr,
- struct ndr_push *comndr)
-{
- return ndr_push_error(subndr, NDR_ERR_COMPRESSION, "Sorry MSZIP compression is not supported yet (PUSH)");
-}
-
-static enum ndr_err_code ndr_pull_compression_xpress_chunk(struct ndr_pull *ndrpull,
- struct ndr_push *ndrpush,
- bool *last)
-{
- DATA_BLOB comp_chunk;
- uint32_t comp_chunk_offset;
- uint32_t comp_chunk_size;
- uint32_t plain_chunk_size;
-
- comp_chunk_offset = ndrpull->offset;
-
- NDR_CHECK(ndr_pull_uint32(ndrpull, NDR_SCALARS, &plain_chunk_size));
- if (plain_chunk_size > 0x00010000) {
- return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION, "Bad XPRESS plain chunk size %08X > 0x00010000 (PULL)",
- plain_chunk_size);
- }
-
- NDR_CHECK(ndr_pull_uint32(ndrpull, NDR_SCALARS, &comp_chunk_size));
-
- NDR_CHECK(ndr_pull_advance(ndrpull, comp_chunk_size));
- comp_chunk.length = comp_chunk_size + 8;
- comp_chunk.data = ndrpull->data + comp_chunk_offset;
-
- DEBUG(10,("XPRESS plain_chunk_size: %08X (%u) comp_chunk_size: %08X (%u)\n",
- plain_chunk_size, plain_chunk_size, comp_chunk_size, comp_chunk_size));
-
- /* For now, we just copy over the compressed blob */
- NDR_CHECK(ndr_push_bytes(ndrpush, comp_chunk.data, comp_chunk.length));
-
- if ((plain_chunk_size < 0x00010000) || (ndrpull->offset+4 >= ndrpull->data_size)) {
- /* this is the last chunk */
- *last = true;
- }
-
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_pull_compression_xpress(struct ndr_pull *subndr,
- struct ndr_pull **_comndr,
- ssize_t decompressed_len)
-{
- struct ndr_push *ndrpush;
- struct ndr_pull *comndr;
- DATA_BLOB uncompressed;
- bool last = false;
-
- ndrpush = ndr_push_init_ctx(subndr);
- NDR_ERR_HAVE_NO_MEMORY(ndrpush);
-
- while (!last) {
- NDR_CHECK(ndr_pull_compression_xpress_chunk(subndr, ndrpush, &last));
- }
-
- uncompressed = ndr_push_blob(ndrpush);
-
- comndr = talloc_zero(subndr, struct ndr_pull);
- NDR_ERR_HAVE_NO_MEMORY(comndr);
- comndr->flags = subndr->flags;
- comndr->current_mem_ctx = subndr->current_mem_ctx;
-
- comndr->data = uncompressed.data;
- comndr->data_size = uncompressed.length;
- comndr->offset = 0;
-
- *_comndr = comndr;
- return NDR_ERR_SUCCESS;
-}
-
-static enum ndr_err_code ndr_push_compression_xpress(struct ndr_push *subndr,
- struct ndr_push *comndr)
-{
- return ndr_push_error(subndr, NDR_ERR_COMPRESSION, "XPRESS compression is not supported yet (PUSH)");
-}
-
-/*
- handle compressed subcontext buffers, which in midl land are user-marshalled, but
- we use magic in pidl to make them easier to cope with
-*/
-enum ndr_err_code ndr_pull_compression_start(struct ndr_pull *subndr,
- struct ndr_pull **_comndr,
- enum ndr_compression_alg compression_alg,
- ssize_t decompressed_len)
-{
- switch (compression_alg) {
- case NDR_COMPRESSION_MSZIP:
- return ndr_pull_compression_mszip(subndr, _comndr, decompressed_len);
- case NDR_COMPRESSION_XPRESS:
- return ndr_pull_compression_xpress(subndr, _comndr, decompressed_len);
- default:
- return ndr_pull_error(subndr, NDR_ERR_COMPRESSION, "Bad compression algorithm %d (PULL)",
- compression_alg);
- }
- return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_compression_end(struct ndr_pull *subndr,
- struct ndr_pull *comndr,
- enum ndr_compression_alg compression_alg,
- ssize_t decompressed_len)
-{
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push a compressed subcontext
-*/
-enum ndr_err_code ndr_push_compression_start(struct ndr_push *subndr,
- struct ndr_push **_comndr,
- enum ndr_compression_alg compression_alg,
- ssize_t decompressed_len)
-{
- struct ndr_push *comndr;
-
- comndr = ndr_push_init_ctx(subndr);
- NDR_ERR_HAVE_NO_MEMORY(comndr);
- comndr->flags = subndr->flags;
-
- *_comndr = comndr;
- return NDR_ERR_SUCCESS;
-}
-
-/*
- push a compressed subcontext
-*/
-enum ndr_err_code ndr_push_compression_end(struct ndr_push *subndr,
- struct ndr_push *comndr,
- enum ndr_compression_alg compression_alg,
- ssize_t decompressed_len)
-{
- switch (compression_alg) {
- case NDR_COMPRESSION_MSZIP:
- return ndr_push_compression_mszip(subndr, comndr);
- case NDR_COMPRESSION_XPRESS:
- return ndr_push_compression_xpress(subndr, comndr);
- default:
- return ndr_push_error(subndr, NDR_ERR_COMPRESSION, "Bad compression algorithm %d (PUSH)",
- compression_alg);
- }
- return NDR_ERR_SUCCESS;
-}
diff --git a/source3/librpc/ndr/ndr_compression.h b/source3/librpc/ndr/ndr_compression.h
deleted file mode 100644
index 4cebbe190c..0000000000
--- a/source3/librpc/ndr/ndr_compression.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef __LIBRPC_NDR_NDR_COMPRESSION_H__
-#define __LIBRPC_NDR_NDR_COMPRESSION_H__
-
-#undef _PRINTF_ATTRIBUTE
-#define _PRINTF_ATTRIBUTE(a1, a2) PRINTF_ATTRIBUTE(a1, a2)
-/* This file was automatically generated by mkproto.pl. DO NOT EDIT */
-
-#ifndef _PUBLIC_
-#define _PUBLIC_
-#endif
-
-#ifndef _PURE_
-#define _PURE_
-#endif
-
-#ifndef _NORETURN_
-#define _NORETURN_
-#endif
-
-#ifndef _DEPRECATED_
-#define _DEPRECATED_
-#endif
-
-#ifndef _WARN_UNUSED_RESULT_
-#define _WARN_UNUSED_RESULT_
-#endif
-
-
-/* The following definitions come from librpc/ndr/ndr_compression.c */
-
-enum ndr_err_code ndr_pull_compression_start(struct ndr_pull *subndr,
- struct ndr_pull **_comndr,
- enum ndr_compression_alg compression_alg,
- ssize_t decompressed_len);
-enum ndr_err_code ndr_pull_compression_end(struct ndr_pull *subndr,
- struct ndr_pull *comndr,
- enum ndr_compression_alg compression_alg,
- ssize_t decompressed_len);
-enum ndr_err_code ndr_push_compression_start(struct ndr_push *subndr,
- struct ndr_push **_comndr,
- enum ndr_compression_alg compression_alg,
- ssize_t decompressed_len);
-enum ndr_err_code ndr_push_compression_end(struct ndr_push *subndr,
- struct ndr_push *comndr,
- enum ndr_compression_alg compression_alg,
- ssize_t decompressed_len);
-#undef _PRINTF_ATTRIBUTE
-#define _PRINTF_ATTRIBUTE(a1, a2)
-
-#endif /* __LIBRPC_NDR_NDR_COMPRESSION_H__ */
-
diff --git a/source3/librpc/ndr/ndr_drsuapi.c b/source3/librpc/ndr/ndr_drsuapi.c
deleted file mode 100644
index aeb81c87bd..0000000000
--- a/source3/librpc/ndr/ndr_drsuapi.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- routines for printing some linked list structs in DRSUAPI
-
- Copyright (C) Stefan (metze) Metzmacher 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"
-#include "librpc/gen_ndr/ndr_drsuapi.h"
-#include "librpc/gen_ndr/ndr_misc.h"
-
-void ndr_print_drsuapi_DsReplicaObjectListItem(struct ndr_print *ndr, const char *name,
- const struct drsuapi_DsReplicaObjectListItem *r)
-{
- ndr_print_struct(ndr, name, "drsuapi_DsReplicaObjectListItem");
- ndr->depth++;
- ndr_print_ptr(ndr, "next_object", r->next_object);
- ndr_print_drsuapi_DsReplicaObject(ndr, "object", &r->object);
- ndr->depth--;
- if (r->next_object) {
- ndr_print_drsuapi_DsReplicaObjectListItem(ndr, "next_object", r->next_object);
- }
-}
-
-void ndr_print_drsuapi_DsReplicaObjectListItemEx(struct ndr_print *ndr, const char *name, const struct drsuapi_DsReplicaObjectListItemEx *r)
-{
- ndr_print_struct(ndr, name, "drsuapi_DsReplicaObjectListItemEx");
- ndr->depth++;
- ndr_print_ptr(ndr, "next_object", r->next_object);
- ndr_print_drsuapi_DsReplicaObject(ndr, "object", &r->object);
- ndr_print_uint32(ndr, "is_nc_prefix", r->is_nc_prefix);
- ndr_print_ptr(ndr, "parent_object_guid", r->parent_object_guid);
- ndr->depth++;
- if (r->parent_object_guid) {
- ndr_print_GUID(ndr, "parent_object_guid", r->parent_object_guid);
- }
- ndr->depth--;
- ndr_print_ptr(ndr, "meta_data_ctr", r->meta_data_ctr);
- ndr->depth++;
- if (r->meta_data_ctr) {
- ndr_print_drsuapi_DsReplicaMetaDataCtr(ndr, "meta_data_ctr", r->meta_data_ctr);
- }
- ndr->depth--;
- ndr->depth--;
- if (r->next_object) {
- ndr_print_drsuapi_DsReplicaObjectListItemEx(ndr, "next_object", r->next_object);
- }
-}
-
-#define _OID_PUSH_CHECK(call) do { \
- bool _status; \
- _status = call; \
- if (_status != true) { \
- return ndr_push_error(ndr, NDR_ERR_SUBCONTEXT, "OID Conversion Error: %s\n", __location__); \
- } \
-} while (0)
-
-#define _OID_PULL_CHECK(call) do { \
- bool _status; \
- _status = call; \
- if (_status != true) { \
- return ndr_pull_error(ndr, NDR_ERR_SUBCONTEXT, "OID Conversion Error: %s\n", __location__); \
- } \
-} while (0)
-
-enum ndr_err_code ndr_push_drsuapi_DsReplicaOID(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsReplicaOID *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_size_drsuapi_DsReplicaOID_oid(r->oid, 0)));
- NDR_CHECK(ndr_push_unique_ptr(ndr, r->oid));
- }
- if (ndr_flags & NDR_BUFFERS) {
- if (r->oid) {
- DATA_BLOB blob;
-
- if (StrnCaseCmp("ff", r->oid, 2) == 0) {
- blob = strhex_to_data_blob(NULL, r->oid);
- if (!blob.data) {
- return ndr_push_error(ndr, NDR_ERR_SUBCONTEXT,
- "HEX String Conversion Error: %s\n",
- __location__);
- }
- } else {
- _OID_PUSH_CHECK(ber_write_OID_String(&blob, r->oid));
- }
- talloc_steal(ndr, blob.data);
-
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, blob.length));
- NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, blob.data, blob.length));
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_drsuapi_DsReplicaOID(struct ndr_pull *ndr, int ndr_flags, struct drsuapi_DsReplicaOID *r)
-{
- uint32_t _ptr_oid;
- TALLOC_CTX *_mem_save_oid_0;
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->__ndr_size));
- if (r->__ndr_size < 0 || r->__ndr_size > 10000) {
- return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
- }
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_oid));
- if (_ptr_oid) {
- NDR_PULL_ALLOC(ndr, r->oid);
- } else {
- r->oid = NULL;
- }
- }
- if (ndr_flags & NDR_BUFFERS) {
- if (r->oid) {
- DATA_BLOB _oid_array;
- const char *_oid;
-
- _mem_save_oid_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, ndr, 0);
- NDR_CHECK(ndr_pull_array_size(ndr, &r->oid));
- _oid_array.length = ndr_get_array_size(ndr, &r->oid);
- NDR_PULL_ALLOC_N(ndr, _oid_array.data, _oid_array.length);
- NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, _oid_array.data, _oid_array.length));
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_oid_0, 0);
-
- if (_oid_array.length && _oid_array.data[0] == 0xFF) {
- _oid = data_blob_hex_string(ndr, &_oid_array);
- NDR_ERR_HAVE_NO_MEMORY(_oid);
- } else {
- _OID_PULL_CHECK(ber_read_OID_String(ndr, _oid_array, &_oid));
- }
- TALLOC_FREE(_oid_array.data);
- talloc_steal(r->oid, _oid);
- r->oid = _oid;
- }
- if (r->oid) {
- NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->oid, r->__ndr_size));
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
-size_t ndr_size_drsuapi_DsReplicaOID_oid(const char *oid, int flags)
-{
- DATA_BLOB _blob;
- size_t ret = 0;
-
- if (!oid) return 0;
-
- if (StrnCaseCmp("ff", oid, 2) == 0) {
- _blob = strhex_to_data_blob(NULL, oid);
- if (_blob.data) {
- ret = _blob.length;
- }
- } else {
- if (ber_write_OID_String(&_blob, oid)) {
- ret = _blob.length;
- }
- }
- data_blob_free(&_blob);
- return ret;
-}
diff --git a/source3/librpc/ndr/ndr_drsuapi.h b/source3/librpc/ndr/ndr_drsuapi.h
deleted file mode 100644
index c663eadd7a..0000000000
--- a/source3/librpc/ndr/ndr_drsuapi.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- routines for printing some linked list structs in DRSUAPI
-
- Copyright (C) Stefan (metze) Metzmacher 2005-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 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 _LIBRPC_NDR_NDR_DRSUAPI_H
-#define _LIBRPC_NDR_NDR_DRSUAPI_H
-
-void ndr_print_drsuapi_DsReplicaObjectListItem(struct ndr_print *ndr, const char *name,
- const struct drsuapi_DsReplicaObjectListItem *r);
-
-void ndr_print_drsuapi_DsReplicaObjectListItemEx(struct ndr_print *ndr, const char *name,
- const struct drsuapi_DsReplicaObjectListItemEx *r);
-
-enum ndr_err_code ndr_push_drsuapi_DsReplicaOID(struct ndr_push *ndr, int ndr_flags, const struct drsuapi_DsReplicaOID *r);
-enum ndr_err_code ndr_pull_drsuapi_DsReplicaOID(struct ndr_pull *ndr, int ndr_flags, struct drsuapi_DsReplicaOID *r);
-size_t ndr_size_drsuapi_DsReplicaOID_oid(const char *oid, int flags);
-
-#endif /* _LIBRPC_NDR_NDR_DRSUAPI_H */
diff --git a/source3/librpc/ndr/ndr_krb5pac.c b/source3/librpc/ndr/ndr_krb5pac.c
deleted file mode 100644
index b0eab44012..0000000000
--- a/source3/librpc/ndr/ndr_krb5pac.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- routines for marshalling/unmarshalling spoolss subcontext buffer structures
-
- Copyright (C) Stefan Metzmacher 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"
-
-#include "librpc/gen_ndr/ndr_krb5pac.h"
-
-static size_t _ndr_size_PAC_INFO(const union PAC_INFO *r, uint32_t level, int flags)
-{
- size_t s = ndr_size_PAC_INFO(r, level, flags);
- switch (level) {
- case PAC_TYPE_LOGON_INFO:
- return NDR_ROUND(s,8);
- default:
- return s;
- }
-}
-
-static size_t _subcontext_size_PAC_INFO(const union PAC_INFO *r, uint32_t level, int flags)
-{
- size_t s = ndr_size_PAC_INFO(r, level, flags);
- return NDR_ROUND(s,8);
-}
-
-enum ndr_err_code ndr_push_PAC_BUFFER(struct ndr_push *ndr, int ndr_flags, const struct PAC_BUFFER *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_PAC_TYPE(ndr, NDR_SCALARS, r->type));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, _ndr_size_PAC_INFO(r->info,r->type,0)));
- {
- uint32_t _flags_save_PAC_INFO = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN8);
- NDR_CHECK(ndr_push_relative_ptr1(ndr, r->info));
- ndr->flags = _flags_save_PAC_INFO;
- }
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
- }
- if (ndr_flags & NDR_BUFFERS) {
- {
- uint32_t _flags_save_PAC_INFO = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN8);
- if (r->info) {
- NDR_CHECK(ndr_push_relative_ptr2(ndr, r->info));
- {
- struct ndr_push *_ndr_info;
- NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info, 0, _subcontext_size_PAC_INFO(r->info,r->type,0)));
- NDR_CHECK(ndr_push_set_switch_value(_ndr_info, r->info, r->type));
- NDR_CHECK(ndr_push_PAC_INFO(_ndr_info, NDR_SCALARS|NDR_BUFFERS, r->info));
- NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info, 0, _subcontext_size_PAC_INFO(r->info,r->type,0)));
- }
- }
- ndr->flags = _flags_save_PAC_INFO;
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_PAC_BUFFER(struct ndr_pull *ndr, int ndr_flags, struct PAC_BUFFER *r)
-{
- uint32_t _ptr_info;
- TALLOC_CTX *_mem_save_info_0;
- if (ndr_flags & NDR_SCALARS) {
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_PAC_TYPE(ndr, NDR_SCALARS, &r->type));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->_ndr_size));
- {
- uint32_t _flags_save_PAC_INFO = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN8);
- NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info));
- if (_ptr_info) {
- NDR_PULL_ALLOC(ndr, r->info);
- NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->info, _ptr_info));
- } else {
- r->info = NULL;
- }
- ndr->flags = _flags_save_PAC_INFO;
- }
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->_pad));
- }
- if (ndr_flags & NDR_BUFFERS) {
- {
- uint32_t _flags_save_PAC_INFO = ndr->flags;
- ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN8);
- if (r->info) {
- uint32_t _relative_save_offset;
- _relative_save_offset = ndr->offset;
- NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->info));
- _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
- NDR_PULL_SET_MEM_CTX(ndr, r->info, 0);
- {
- struct ndr_pull *_ndr_info;
- NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_info, 0, r->_ndr_size));
- NDR_CHECK(ndr_pull_set_switch_value(_ndr_info, r->info, r->type));
- NDR_CHECK(ndr_pull_PAC_INFO(_ndr_info, NDR_SCALARS|NDR_BUFFERS, r->info));
- NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_info, 0, r->_ndr_size));
- }
- NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0);
- ndr->offset = _relative_save_offset;
- }
- ndr->flags = _flags_save_PAC_INFO;
- }
- }
- return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_PAC_BUFFER(struct ndr_print *ndr, const char *name, const struct PAC_BUFFER *r)
-{
- ndr_print_struct(ndr, name, "PAC_BUFFER");
- ndr->depth++;
- ndr_print_PAC_TYPE(ndr, "type", r->type);
- ndr_print_uint32(ndr, "_ndr_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?_ndr_size_PAC_INFO(r->info,r->type,0):r->_ndr_size);
- ndr_print_ptr(ndr, "info", r->info);
- ndr->depth++;
- if (r->info) {
- ndr_print_set_switch_value(ndr, r->info, r->type);
- ndr_print_PAC_INFO(ndr, "info", r->info);
- }
- ndr->depth--;
- ndr_print_uint32(ndr, "_pad", r->_pad);
- ndr->depth--;
-}
diff --git a/source3/librpc/ndr/ndr_misc.c b/source3/librpc/ndr/ndr_misc.c
deleted file mode 100644
index e86842527c..0000000000
--- a/source3/librpc/ndr/ndr_misc.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- UUID/GUID/policy_handle functions
-
- Copyright (C) Theodore Ts'o 1996, 1997,
- Copyright (C) Jim McDonough 2002.
- Copyright (C) Andrew Tridgell 2003.
- Copyright (C) Stefan (metze) Metzmacher 2004.
-
- 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"
-
-/**
- * see if a range of memory is all zero. A NULL pointer is considered
- * to be all zero
- */
-bool all_zero(const uint8_t *ptr, size_t size)
-{
- int i;
- if (!ptr) return True;
- for (i=0;i<size;i++) {
- if (ptr[i]) return False;
- }
- return True;
-}
-
-void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid)
-{
- ndr->print(ndr, "%-25s: %s", name, GUID_string(ndr, guid));
-}
-
-bool ndr_syntax_id_equal(const struct ndr_syntax_id *i1,
- const struct ndr_syntax_id *i2)
-{
- return GUID_equal(&i1->uuid, &i2->uuid)
- && (i1->if_version == i2->if_version);
-}
-
-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) {
- NDR_CHECK(ndr_push_align(ndr, 4));
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS,
- (uint32_t)r->pid));
-#ifdef CLUSTER_SUPPORT
- NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS,
- (uint32_t)r->vnn));
-#endif
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-enum ndr_err_code ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_id *r)
-{
- if (ndr_flags & NDR_SCALARS) {
- uint32_t pid;
- NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &pid));
-#ifdef CLUSTER_SUPPORT
- NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->vnn));
-#endif
- r->pid = (pid_t)pid;
- }
- if (ndr_flags & NDR_BUFFERS) {
- }
- return NDR_ERR_SUCCESS;
-}
-
-void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct server_id *r)
-{
- ndr_print_struct(ndr, name, "server_id");
- ndr->depth++;
- ndr_print_uint32(ndr, "id", (uint32_t)r->pid);
-#ifdef CLUSTER_SUPPORT
- ndr_print_uint32(ndr, "vnn", (uint32_t)r->vnn);
-#endif
- ndr->depth--;
-}
diff --git a/source3/librpc/ndr/ndr_string.c b/source3/librpc/ndr/ndr_string.c
index e2c9ed5946..86d7b26586 100644
--- a/source3/librpc/ndr/ndr_string.c
+++ b/source3/librpc/ndr/ndr_string.c
@@ -89,7 +89,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags,
&converted_size, false))
{
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
- "Bad char conversion");
+ "Bad character conversion");
}
}
NDR_CHECK(ndr_pull_advance(ndr, (len2 + c_len_term)*byte_mul));
@@ -127,7 +127,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags,
&converted_size, false))
{
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
- "Bad char conversion");
+ "Bad character conversion");
}
}
NDR_CHECK(ndr_pull_advance(ndr, (len1 + c_len_term)*byte_mul));
@@ -166,7 +166,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags,
&converted_size, false))
{
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
- "Bad char conversion");
+ "Bad character conversion");
}
}
NDR_CHECK(ndr_pull_advance(ndr, (len1 + c_len_term)*byte_mul));
@@ -201,7 +201,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags,
&converted_size, false))
{
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
- "Bad char conversion");
+ "Bad character conversion");
}
}
NDR_CHECK(ndr_pull_advance(ndr, (len3 + c_len_term)*byte_mul));
@@ -233,7 +233,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags,
&converted_size, false))
{
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
- "Bad char conversion");
+ "Bad character conversion");
}
}
NDR_CHECK(ndr_pull_advance(ndr, len3));
@@ -252,28 +252,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags,
&converted_size, false))
{
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
- "Bad char conversion");
+ "Bad character conversion");
}
NDR_CHECK(ndr_pull_advance(ndr, len1));
*s = as;
break;
- case LIBNDR_FLAG_STR_FIXLEN15:
- case LIBNDR_FLAG_STR_FIXLEN32:
- len1 = (flags & LIBNDR_FLAG_STR_FIXLEN32)?32:15;
- NDR_PULL_NEED_BYTES(ndr, len1*byte_mul);
- if (!convert_string_talloc(ndr->current_mem_ctx, chset, CH_UNIX,
- ndr->data+ndr->offset, len1*byte_mul,
- (void **)(void *)&as,
- &converted_size, false))
- {
- return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
- "Bad char conversion");
- }
- NDR_CHECK(ndr_pull_advance(ndr, len1*byte_mul));
- *s = as;
- break;
-
case LIBNDR_FLAG_STR_NOTERM:
if (!(ndr->flags & LIBNDR_FLAG_REMAINING)) {
return ndr_pull_error(ndr, NDR_ERR_STRING, "Bad string flags 0x%x (missing NDR_REMAINING)\n",
@@ -293,7 +277,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string(struct ndr_pull *ndr, int ndr_flags,
&converted_size, false))
{
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
- "Bad char conversion");
+ "Bad character conversion");
}
}
NDR_CHECK(ndr_pull_advance(ndr, len1));
@@ -346,17 +330,14 @@ _PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, int ndr_flags,
flags &= ~LIBNDR_FLAG_STR_CONFORMANT;
- if (!(flags &
- (LIBNDR_FLAG_STR_NOTERM |
- LIBNDR_FLAG_STR_FIXLEN15 |
- LIBNDR_FLAG_STR_FIXLEN32))) {
+ if (!(flags & LIBNDR_FLAG_STR_NOTERM)) {
s_len++;
}
if (!convert_string_talloc(ndr, CH_UNIX, chset, s, s_len,
(void **)(void *)&dest, &d_len, false))
{
return ndr_push_error(ndr, NDR_ERR_CHARCNV,
- "Bad char conversion");
+ "Bad character conversion");
}
if (flags & LIBNDR_FLAG_STR_BYTESIZE) {
@@ -397,21 +378,6 @@ _PUBLIC_ enum ndr_err_code ndr_push_string(struct ndr_push *ndr, int ndr_flags,
NDR_CHECK(ndr_push_bytes(ndr, dest, d_len));
break;
- case LIBNDR_FLAG_STR_FIXLEN15:
- case LIBNDR_FLAG_STR_FIXLEN32: {
- ssize_t fix_len = (flags & LIBNDR_FLAG_STR_FIXLEN32)?32:15;
- uint32_t pad_len = fix_len - d_len;
- if (d_len > fix_len) {
- return ndr_push_error(ndr, NDR_ERR_CHARCNV,
- "Bad char conversion");
- }
- NDR_CHECK(ndr_push_bytes(ndr, dest, d_len));
- if (pad_len != 0) {
- NDR_CHECK(ndr_push_zero(ndr, pad_len));
- }
- break;
- }
-
default:
if (ndr->flags & LIBNDR_FLAG_REMAINING) {
NDR_CHECK(ndr_push_bytes(ndr, dest, d_len));
@@ -437,13 +403,6 @@ _PUBLIC_ size_t ndr_string_array_size(struct ndr_push *ndr, const char *s)
unsigned byte_mul = 2;
unsigned c_len_term = 1;
- if (flags & LIBNDR_FLAG_STR_FIXLEN32) {
- return 32;
- }
- if (flags & LIBNDR_FLAG_STR_FIXLEN15) {
- return 15;
- }
-
c_len = s?strlen_m(s):0;
if (flags & (LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_UTF8)) {
@@ -653,21 +612,21 @@ _PUBLIC_ uint32_t ndr_string_length(const void *_var, uint32_t element_size)
_PUBLIC_ enum ndr_err_code ndr_check_string_terminator(struct ndr_pull *ndr, uint32_t count, uint32_t element_size)
{
uint32_t i;
- struct ndr_pull_save save_offset;
+ uint32_t save_offset;
- ndr_pull_save(ndr, &save_offset);
+ save_offset = ndr->offset;
ndr_pull_advance(ndr, (count - 1) * element_size);
NDR_PULL_NEED_BYTES(ndr, element_size);
for (i = 0; i < element_size; i++) {
if (ndr->data[ndr->offset+i] != 0) {
- ndr_pull_restore(ndr, &save_offset);
+ ndr->offset = save_offset;
return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "String terminator not present or outside string boundaries");
}
}
- ndr_pull_restore(ndr, &save_offset);
+ ndr->offset = save_offset;
return NDR_ERR_SUCCESS;
}
@@ -693,7 +652,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_charset(struct ndr_pull *ndr, int ndr_flags,
&converted_size, false))
{
return ndr_pull_error(ndr, NDR_ERR_CHARCNV,
- "Bad char conversion");
+ "Bad character conversion");
}
NDR_CHECK(ndr_pull_advance(ndr, length*byte_mul));
@@ -716,7 +675,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_charset(struct ndr_push *ndr, int ndr_flags,
ndr->data+ndr->offset, required, false);
if (ret == -1) {
return ndr_push_error(ndr, NDR_ERR_CHARCNV,
- "Bad char conversion");
+ "Bad character conversion");
}
/* Make sure the remaining part of the string is filled with zeroes */
diff --git a/source3/librpc/ndr/util.c b/source3/librpc/ndr/util.c
new file mode 100644
index 0000000000..457615ce22
--- /dev/null
+++ b/source3/librpc/ndr/util.c
@@ -0,0 +1,174 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ libndr interface
+
+ Copyright (C) Andrew Tridgell 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"
+
+NTSTATUS ndr_map_error2ntstatus(enum ndr_err_code ndr_err)
+{
+ switch (ndr_err) {
+ case NDR_ERR_SUCCESS:
+ return NT_STATUS_OK;
+ case NDR_ERR_BUFSIZE:
+ return NT_STATUS_BUFFER_TOO_SMALL;
+ case NDR_ERR_TOKEN:
+ return NT_STATUS_INTERNAL_ERROR;
+ case NDR_ERR_ALLOC:
+ return NT_STATUS_NO_MEMORY;
+ case NDR_ERR_ARRAY_SIZE:
+ return NT_STATUS_ARRAY_BOUNDS_EXCEEDED;
+ case NDR_ERR_INVALID_POINTER:
+ return NT_STATUS_INVALID_PARAMETER_MIX;
+ case NDR_ERR_UNREAD_BYTES:
+ return NT_STATUS_PORT_MESSAGE_TOO_LONG;
+ default:
+ break;
+ }
+
+ /* we should map all error codes to different status codes */
+ return NT_STATUS_INVALID_PARAMETER;
+}
+
+/*
+ * Convert an ndr error to string
+ */
+
+const char *ndr_errstr(enum ndr_err_code err)
+{
+ switch (err) {
+ case NDR_ERR_SUCCESS:
+ return "NDR_ERR_SUCCESS";
+ break;
+ case NDR_ERR_ARRAY_SIZE:
+ return "NDR_ERR_ARRAY_SIZE";
+ break;
+ case NDR_ERR_BAD_SWITCH:
+ return "NDR_ERR_BAD_SWITCH";
+ break;
+ case NDR_ERR_OFFSET:
+ return "NDR_ERR_OFFSET";
+ break;
+ case NDR_ERR_RELATIVE:
+ return "NDR_ERR_RELATIVE";
+ break;
+ case NDR_ERR_CHARCNV:
+ return "NDR_ERR_CHARCNV";
+ break;
+ case NDR_ERR_LENGTH:
+ return "NDR_ERR_LENGTH";
+ break;
+ case NDR_ERR_SUBCONTEXT:
+ return "NDR_ERR_SUBCONTEXT";
+ break;
+ case NDR_ERR_COMPRESSION:
+ return "NDR_ERR_COMPRESSION";
+ break;
+ case NDR_ERR_STRING:
+ return "NDR_ERR_STRING";
+ break;
+ case NDR_ERR_VALIDATE:
+ return "NDR_ERR_VALIDATE";
+ break;
+ case NDR_ERR_BUFSIZE:
+ return "NDR_ERR_BUFSIZE";
+ break;
+ case NDR_ERR_ALLOC:
+ return "NDR_ERR_ALLOC";
+ break;
+ case NDR_ERR_RANGE:
+ return "NDR_ERR_RANGE";
+ break;
+ case NDR_ERR_TOKEN:
+ return "NDR_ERR_TOKEN";
+ break;
+ case NDR_ERR_IPV4ADDRESS:
+ return "NDR_ERR_IPV4ADDRESS";
+ break;
+ case NDR_ERR_INVALID_POINTER:
+ return "NDR_ERR_INVALID_POINTER";
+ break;
+ case NDR_ERR_UNREAD_BYTES:
+ return "NDR_ERR_UNREAD_BYTES";
+ break;
+ }
+
+ return talloc_asprintf(talloc_tos(), "Unknown NDR error: %d", err);
+}
+
+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) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS,
+ (uint32_t)r->pid));
+#ifdef CLUSTER_SUPPORT
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS,
+ (uint32_t)r->vnn));
+#endif
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+enum ndr_err_code ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_id *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ uint32_t pid;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &pid));
+#ifdef CLUSTER_SUPPORT
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->vnn));
+#endif
+ r->pid = (pid_t)pid;
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct server_id *r)
+{
+ ndr_print_struct(ndr, name, "server_id");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "id", (uint32_t)r->pid);
+#ifdef CLUSTER_SUPPORT
+ ndr_print_uint32(ndr, "vnn", (uint32_t)r->vnn);
+#endif
+ ndr->depth--;
+}
+
+_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));
+}
+
+void *global_loadparm;
+void *cmdline_lp_ctx;
+struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx)
+{
+ return NULL;
+}
diff --git a/source3/librpc/ndr/uuid.c b/source3/librpc/ndr/uuid.c
deleted file mode 100644
index e92df22494..0000000000
--- a/source3/librpc/ndr/uuid.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- UUID/GUID functions
-
- Copyright (C) Theodore Ts'o 1996, 1997,
- Copyright (C) Jim McDonough 2002.
- Copyright (C) Andrew Tridgell 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"
-#include "librpc/ndr/libndr.h"
-
-/**
- build a GUID from a string
-*/
-_PUBLIC_ NTSTATUS GUID_from_string(const char *s, struct GUID *guid)
-{
- NTSTATUS status = NT_STATUS_INVALID_PARAMETER;
- uint32_t time_low;
- uint32_t time_mid, time_hi_and_version;
- uint32_t clock_seq[2];
- uint32_t node[6];
- int i;
-
- if (s == NULL) {
- return NT_STATUS_INVALID_PARAMETER;
- }
-
- if (11 == sscanf(s, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
- &time_low, &time_mid, &time_hi_and_version,
- &clock_seq[0], &clock_seq[1],
- &node[0], &node[1], &node[2], &node[3], &node[4], &node[5])) {
- status = NT_STATUS_OK;
- } else if (11 == sscanf(s, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
- &time_low, &time_mid, &time_hi_and_version,
- &clock_seq[0], &clock_seq[1],
- &node[0], &node[1], &node[2], &node[3], &node[4], &node[5])) {
- status = NT_STATUS_OK;
- }
-
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
-
- guid->time_low = time_low;
- guid->time_mid = time_mid;
- guid->time_hi_and_version = time_hi_and_version;
- guid->clock_seq[0] = clock_seq[0];
- guid->clock_seq[1] = clock_seq[1];
- for (i=0;i<6;i++) {
- guid->node[i] = node[i];
- }
-
- return NT_STATUS_OK;
-}
-
-/**
- build a GUID from a string
-*/
-_PUBLIC_ NTSTATUS NS_GUID_from_string(const char *s, struct GUID *guid)
-{
- NTSTATUS status = NT_STATUS_INVALID_PARAMETER;
- uint32_t time_low;
- uint32_t time_mid, time_hi_and_version;
- uint32_t clock_seq[2];
- uint32_t node[6];
- int i;
-
- if (s == NULL) {
- return NT_STATUS_INVALID_PARAMETER;
- }
-
- if (11 == sscanf(s, "%08x-%04x%04x-%02x%02x%02x%02x-%02x%02x%02x%02x",
- &time_low, &time_mid, &time_hi_and_version,
- &clock_seq[0], &clock_seq[1],
- &node[0], &node[1], &node[2], &node[3], &node[4], &node[5])) {
- status = NT_STATUS_OK;
- }
-
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
-
- guid->time_low = time_low;
- guid->time_mid = time_mid;
- guid->time_hi_and_version = time_hi_and_version;
- guid->clock_seq[0] = clock_seq[0];
- guid->clock_seq[1] = clock_seq[1];
- for (i=0;i<6;i++) {
- guid->node[i] = node[i];
- }
-
- return NT_STATUS_OK;
-}
-
-/**
- * generate a random GUID
- */
-struct GUID GUID_random(void)
-{
- struct GUID guid;
-
- generate_random_buffer((uint8_t *)&guid, sizeof(guid));
- guid.clock_seq[0] = (guid.clock_seq[0] & 0x3F) | 0x80;
- guid.time_hi_and_version = (guid.time_hi_and_version & 0x0FFF) | 0x4000;
-
- return guid;
-}
-
-/**
- * generate an empty GUID
- */
-_PUBLIC_ struct GUID GUID_zero(void)
-{
- struct GUID guid;
-
- ZERO_STRUCT(guid);
-
- return guid;
-}
-
-_PUBLIC_ bool GUID_all_zero(const struct GUID *u)
-{
- if (u->time_low != 0 ||
- u->time_mid != 0 ||
- u->time_hi_and_version != 0 ||
- u->clock_seq[0] != 0 ||
- u->clock_seq[1] != 0 ||
- !all_zero(u->node, 6)) {
- return false;
- }
- return true;
-}
-
-_PUBLIC_ bool GUID_equal(const struct GUID *u1, const struct GUID *u2)
-{
- if (u1->time_low != u2->time_low ||
- u1->time_mid != u2->time_mid ||
- u1->time_hi_and_version != u2->time_hi_and_version ||
- u1->clock_seq[0] != u2->clock_seq[0] ||
- u1->clock_seq[1] != u2->clock_seq[1] ||
- memcmp(u1->node, u2->node, 6) != 0) {
- return false;
- }
- return true;
-}
-
-_PUBLIC_ int GUID_compare(const struct GUID *u1, const struct GUID *u2)
-{
- if (u1->time_low != u2->time_low) {
- return u1->time_low - u2->time_low;
- }
-
- if (u1->time_mid != u2->time_mid) {
- return u1->time_mid - u2->time_mid;
- }
-
- if (u1->time_hi_and_version != u2->time_hi_and_version) {
- return u1->time_hi_and_version - u2->time_hi_and_version;
- }
-
- if (u1->clock_seq[0] != u2->clock_seq[0]) {
- return u1->clock_seq[0] - u2->clock_seq[0];
- }
-
- if (u1->clock_seq[1] != u2->clock_seq[1]) {
- return u1->clock_seq[1] - u2->clock_seq[1];
- }
-
- return memcmp(u1->node, u2->node, 6);
-}
-
-/**
- its useful to be able to display these in debugging messages
-*/
-_PUBLIC_ char *GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid)
-{
- return talloc_asprintf(mem_ctx,
- "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
- guid->time_low, guid->time_mid,
- guid->time_hi_and_version,
- guid->clock_seq[0],
- guid->clock_seq[1],
- guid->node[0], guid->node[1],
- guid->node[2], guid->node[3],
- guid->node[4], guid->node[5]);
-}
-
-_PUBLIC_ char *GUID_string2(TALLOC_CTX *mem_ctx, const struct GUID *guid)
-{
- char *ret, *s = GUID_string(mem_ctx, guid);
- ret = talloc_asprintf(mem_ctx, "{%s}", s);
- talloc_free(s);
- return ret;
-}
-
-_PUBLIC_ char *NS_GUID_string(TALLOC_CTX *mem_ctx, const struct GUID *guid)
-{
- return talloc_asprintf(mem_ctx,
- "%08x-%04x%04x-%02x%02x%02x%02x-%02x%02x%02x%02x",
- guid->time_low, guid->time_mid,
- guid->time_hi_and_version,
- guid->clock_seq[0],
- guid->clock_seq[1],
- guid->node[0], guid->node[1],
- guid->node[2], guid->node[3],
- guid->node[4], guid->node[5]);
-}
-
-_PUBLIC_ bool policy_handle_empty(struct policy_handle *h)
-{
- return (h->handle_type == 0 && GUID_all_zero(&h->uuid));
-}
diff --git a/source3/librpc/rpc/binding.c b/source3/librpc/rpc/binding.c
deleted file mode 100644
index 01e3479c23..0000000000
--- a/source3/librpc/rpc/binding.c
+++ /dev/null
@@ -1,709 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- dcerpc utility functions
-
- Copyright (C) Andrew Tridgell 2003
- Copyright (C) Jelmer Vernooij 2004
- Copyright (C) Andrew Bartlett <abartlet@samba.org> 2005
- Copyright (C) Rafal Szczesniak 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 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"
-
-#define MAX_PROTSEQ 10
-
-static const struct {
- const char *name;
- enum dcerpc_transport_t transport;
- int num_protocols;
- enum epm_protocol protseq[MAX_PROTSEQ];
-} transports[] = {
- { "ncacn_np", NCACN_NP, 3,
- { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_SMB, EPM_PROTOCOL_NETBIOS }},
- { "ncacn_ip_tcp", NCACN_IP_TCP, 3,
- { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_TCP, EPM_PROTOCOL_IP } },
- { "ncacn_http", NCACN_HTTP, 3,
- { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_HTTP, EPM_PROTOCOL_IP } },
- { "ncadg_ip_udp", NCACN_IP_UDP, 3,
- { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UDP, EPM_PROTOCOL_IP } },
- { "ncalrpc", NCALRPC, 2,
- { EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_PIPE } },
- { "ncacn_unix_stream", NCACN_UNIX_STREAM, 2,
- { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_UNIX_DS } },
- { "ncadg_unix_dgram", NCADG_UNIX_DGRAM, 2,
- { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UNIX_DS } },
- { "ncacn_at_dsp", NCACN_AT_DSP, 3,
- { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DSP } },
- { "ncadg_at_ddp", NCADG_AT_DDP, 3,
- { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DDP } },
- { "ncacn_vns_ssp", NCACN_VNS_SPP, 3,
- { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_SPP } },
- { "ncacn_vns_ipc", NCACN_VNS_IPC, 3,
- { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_IPC }, },
- { "ncadg_ipx", NCADG_IPX, 2,
- { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_IPX },
- },
- { "ncacn_spx", NCACN_SPX, 3,
- /* I guess some MS programmer confused the identifier for
- * EPM_PROTOCOL_UUID (0x0D or 13) with the one for
- * EPM_PROTOCOL_SPX (0x13) here. -- jelmer*/
- { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_UUID },
- },
-};
-
-static const struct {
- const char *name;
- uint32_t flag;
-} ncacn_options[] = {
- { "", 0 }
-};
-
-const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor)
-{
- struct ndr_syntax_id syntax;
- NTSTATUS status;
-
- switch(epm_floor->lhs.protocol) {
- case EPM_PROTOCOL_UUID:
- status = dcerpc_floor_get_lhs_data(epm_floor, &syntax);
- if (NT_STATUS_IS_OK(status)) {
- /* lhs is used: UUID */
- char *uuidstr;
-
- if (GUID_equal(&syntax.uuid, &ndr_transfer_syntax.uuid)) {
- return "NDR";
- }
-
- if (GUID_equal(&syntax.uuid, &ndr64_transfer_syntax.uuid)) {
- return "NDR64";
- }
-
- uuidstr = GUID_string(mem_ctx, &syntax.uuid);
-
- return talloc_asprintf(mem_ctx, " uuid %s/0x%02x", uuidstr, syntax.if_version);
- } else { /* IPX */
- return NULL;
- }
-
- case EPM_PROTOCOL_NCACN:
- return "RPC-C";
-
- case EPM_PROTOCOL_NCADG:
- return "RPC";
-
- case EPM_PROTOCOL_NCALRPC:
- return "NCALRPC";
-
- case EPM_PROTOCOL_DNET_NSP:
- return "DNET/NSP";
-
- case EPM_PROTOCOL_IP:
- return talloc_asprintf(mem_ctx, "IP:%s", epm_floor->rhs.ip.ipaddr);
-
- case EPM_PROTOCOL_PIPE:
- return talloc_asprintf(mem_ctx, "PIPE:%s", epm_floor->rhs.pipe.path);
-
- case EPM_PROTOCOL_SMB:
- return talloc_asprintf(mem_ctx, "SMB:%s", epm_floor->rhs.smb.unc);
-
- case EPM_PROTOCOL_UNIX_DS:
- return talloc_asprintf(mem_ctx, "Unix:%s", epm_floor->rhs.unix_ds.path);
-
- case EPM_PROTOCOL_NETBIOS:
- return talloc_asprintf(mem_ctx, "NetBIOS:%s", epm_floor->rhs.netbios.name);
-
- case EPM_PROTOCOL_NETBEUI:
- return "NETBeui";
-
- case EPM_PROTOCOL_SPX:
- return "SPX";
-
- case EPM_PROTOCOL_NB_IPX:
- return "NB_IPX";
-
- case EPM_PROTOCOL_HTTP:
- return talloc_asprintf(mem_ctx, "HTTP:%d", epm_floor->rhs.http.port);
-
- case EPM_PROTOCOL_TCP:
- return talloc_asprintf(mem_ctx, "TCP:%d", epm_floor->rhs.tcp.port);
-
- case EPM_PROTOCOL_UDP:
- return talloc_asprintf(mem_ctx, "UDP:%d", epm_floor->rhs.udp.port);
-
- default:
- return talloc_asprintf(mem_ctx, "UNK(%02x):", epm_floor->lhs.protocol);
- }
-}
-
-
-/*
- form a binding string from a binding structure
-*/
-_PUBLIC_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b)
-{
- char *s = talloc_strdup(mem_ctx, "");
- int i;
- const char *t_name = NULL;
-
- if (b->transport != NCA_UNKNOWN) {
- for (i=0;i<ARRAY_SIZE(transports);i++) {
- if (transports[i].transport == b->transport) {
- t_name = transports[i].name;
- }
- }
- if (!t_name) {
- return NULL;
- }
- }
-
- if (!GUID_all_zero(&b->object.uuid)) {
- s = talloc_asprintf(s, "%s@",
- GUID_string(mem_ctx, &b->object.uuid));
- }
-
- if (t_name != NULL) {
- s = talloc_asprintf_append_buffer(s, "%s:", t_name);
- if (s == NULL) {
- return NULL;
- }
- }
-
- if (b->host) {
- s = talloc_asprintf_append_buffer(s, "%s", b->host);
- }
-
- if (!b->endpoint && !b->options && !b->flags) {
- return s;
- }
-
- s = talloc_asprintf_append_buffer(s, "[");
-
- if (b->endpoint) {
- s = talloc_asprintf_append_buffer(s, "%s", b->endpoint);
- }
-
- /* this is a *really* inefficent way of dealing with strings,
- but this is rarely called and the strings are always short,
- so I don't care */
- for (i=0;b->options && b->options[i];i++) {
- s = talloc_asprintf_append_buffer(s, ",%s", b->options[i]);
- if (!s) return NULL;
- }
-
- for (i=0;i<ARRAY_SIZE(ncacn_options);i++) {
- if (b->flags & ncacn_options[i].flag) {
- s = talloc_asprintf_append_buffer(s, ",%s", ncacn_options[i].name);
- if (!s) return NULL;
- }
- }
-
- s = talloc_asprintf_append_buffer(s, "]");
-
- return s;
-}
-
-/*
- parse a binding string into a dcerpc_binding structure
-*/
-_PUBLIC_ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_binding **b_out)
-{
- struct dcerpc_binding *b;
- char *options;
- char *p;
- int i, j, comma_count;
-
- b = talloc(mem_ctx, struct dcerpc_binding);
- if (!b) {
- return NT_STATUS_NO_MEMORY;
- }
-
- p = strchr(s, '@');
-
- if (p && PTR_DIFF(p, s) == 36) { /* 36 is the length of a UUID */
- NTSTATUS status;
-
- status = GUID_from_string(s, &b->object.uuid);
-
- if (NT_STATUS_IS_ERR(status)) {
- DEBUG(0, ("Failed parsing UUID\n"));
- return status;
- }
-
- s = p + 1;
- } else {
- ZERO_STRUCT(b->object);
- }
-
- b->object.if_version = 0;
-
- p = strchr(s, ':');
-
- if (p == NULL) {
- b->transport = NCA_UNKNOWN;
- } else {
- char *type = talloc_strndup(mem_ctx, s, PTR_DIFF(p, s));
- if (!type) {
- return NT_STATUS_NO_MEMORY;
- }
-
- for (i=0;i<ARRAY_SIZE(transports);i++) {
- if (strcmp(type, transports[i].name) == 0) {
- b->transport = transports[i].transport;
- break;
- }
- }
-
- if (i==ARRAY_SIZE(transports)) {
- DEBUG(0,("Unknown dcerpc transport '%s'\n", type));
- return NT_STATUS_INVALID_PARAMETER;
- }
-
- talloc_free(type);
-
- s = p+1;
- }
-
- p = strchr(s, '[');
- if (p) {
- b->host = talloc_strndup(b, s, PTR_DIFF(p, s));
- options = talloc_strdup(mem_ctx, p+1);
- if (options[strlen(options)-1] != ']') {
- return NT_STATUS_INVALID_PARAMETER;
- }
- options[strlen(options)-1] = 0;
- } else {
- b->host = talloc_strdup(b, s);
- options = NULL;
- }
- if (!b->host) {
- return NT_STATUS_NO_MEMORY;
- }
-
- b->target_hostname = b->host;
-
- b->options = NULL;
- b->flags = 0;
- b->assoc_group_id = 0;
- b->endpoint = NULL;
-
- if (!options) {
- *b_out = b;
- return NT_STATUS_OK;
- }
-
- comma_count = count_chars(options, ',');
-
- b->options = talloc_array(b, const char *, comma_count+2);
- if (!b->options) {
- return NT_STATUS_NO_MEMORY;
- }
-
- for (i=0; (p = strchr(options, ',')); i++) {
- b->options[i] = talloc_strndup(b, options, PTR_DIFF(p, options));
- if (!b->options[i]) {
- return NT_STATUS_NO_MEMORY;
- }
- options = p+1;
- }
- b->options[i] = options;
- b->options[i+1] = NULL;
-
- /* some options are pre-parsed for convenience */
- for (i=0;b->options[i];i++) {
- for (j=0;j<ARRAY_SIZE(ncacn_options);j++) {
- if (strcmp(ncacn_options[j].name, b->options[i]) == 0) {
- int k;
- b->flags |= ncacn_options[j].flag;
- for (k=i;b->options[k];k++) {
- b->options[k] = b->options[k+1];
- }
- i--;
- break;
- }
- }
- }
-
- if (b->options[0]) {
- /* Endpoint is first option */
- b->endpoint = b->options[0];
- if (strlen(b->endpoint) == 0) b->endpoint = NULL;
-
- for (i=0;b->options[i];i++) {
- b->options[i] = b->options[i+1];
- }
- }
-
- if (b->options[0] == NULL)
- b->options = NULL;
-
- *b_out = b;
- return NT_STATUS_OK;
-}
-
-_PUBLIC_ NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct ndr_syntax_id *syntax)
-{
- TALLOC_CTX *mem_ctx = talloc_init("floor_get_lhs_data");
- struct ndr_pull *ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx);
- enum ndr_err_code ndr_err;
- uint16_t if_version=0;
-
- ndr->flags |= LIBNDR_FLAG_NOALIGN;
-
- ndr_err = ndr_pull_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- talloc_free(mem_ctx);
- return ndr_map_error2ntstatus(ndr_err);
- }
-
- ndr_err = ndr_pull_uint16(ndr, NDR_SCALARS, &if_version);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- talloc_free(mem_ctx);
- return ndr_map_error2ntstatus(ndr_err);
- }
-
- syntax->if_version = if_version;
-
- talloc_free(mem_ctx);
-
- return NT_STATUS_OK;
-}
-
-static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *syntax)
-{
- struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx);
-
- ndr->flags |= LIBNDR_FLAG_NOALIGN;
-
- ndr_push_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);
- ndr_push_uint16(ndr, NDR_SCALARS, syntax->if_version);
-
- return ndr_push_blob(ndr);
-}
-
-const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor)
-{
- switch (epm_floor->lhs.protocol) {
- case EPM_PROTOCOL_TCP:
- if (epm_floor->rhs.tcp.port == 0) return NULL;
- return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.tcp.port);
-
- case EPM_PROTOCOL_UDP:
- if (epm_floor->rhs.udp.port == 0) return NULL;
- return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.udp.port);
-
- case EPM_PROTOCOL_HTTP:
- if (epm_floor->rhs.http.port == 0) return NULL;
- return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.http.port);
-
- case EPM_PROTOCOL_IP:
- return talloc_strdup(mem_ctx, epm_floor->rhs.ip.ipaddr);
-
- case EPM_PROTOCOL_NCACN:
- return NULL;
-
- case EPM_PROTOCOL_NCADG:
- return NULL;
-
- case EPM_PROTOCOL_SMB:
- if (strlen(epm_floor->rhs.smb.unc) == 0) return NULL;
- return talloc_strdup(mem_ctx, epm_floor->rhs.smb.unc);
-
- case EPM_PROTOCOL_PIPE:
- if (strlen(epm_floor->rhs.pipe.path) == 0) return NULL;
- return talloc_strdup(mem_ctx, epm_floor->rhs.pipe.path);
-
- case EPM_PROTOCOL_NETBIOS:
- if (strlen(epm_floor->rhs.netbios.name) == 0) return NULL;
- return talloc_strdup(mem_ctx, epm_floor->rhs.netbios.name);
-
- case EPM_PROTOCOL_NCALRPC:
- return NULL;
-
- case EPM_PROTOCOL_VINES_SPP:
- return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.vines_spp.port);
-
- case EPM_PROTOCOL_VINES_IPC:
- return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.vines_ipc.port);
-
- case EPM_PROTOCOL_STREETTALK:
- return talloc_strdup(mem_ctx, epm_floor->rhs.streettalk.streettalk);
-
- case EPM_PROTOCOL_UNIX_DS:
- if (strlen(epm_floor->rhs.unix_ds.path) == 0) return NULL;
- return talloc_strdup(mem_ctx, epm_floor->rhs.unix_ds.path);
-
- case EPM_PROTOCOL_NULL:
- return NULL;
-
- default:
- DEBUG(0,("Unsupported lhs protocol %d\n", epm_floor->lhs.protocol));
- break;
- }
-
- return NULL;
-}
-
-static NTSTATUS dcerpc_floor_set_rhs_data(TALLOC_CTX *mem_ctx,
- struct epm_floor *epm_floor,
- const char *data)
-{
- switch (epm_floor->lhs.protocol) {
- case EPM_PROTOCOL_TCP:
- epm_floor->rhs.tcp.port = atoi(data);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_UDP:
- epm_floor->rhs.udp.port = atoi(data);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_HTTP:
- epm_floor->rhs.http.port = atoi(data);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_IP:
- epm_floor->rhs.ip.ipaddr = talloc_strdup(mem_ctx, data);
- NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.ip.ipaddr);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_NCACN:
- epm_floor->rhs.ncacn.minor_version = 0;
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_NCADG:
- epm_floor->rhs.ncadg.minor_version = 0;
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_SMB:
- epm_floor->rhs.smb.unc = talloc_strdup(mem_ctx, data);
- NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.smb.unc);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_PIPE:
- epm_floor->rhs.pipe.path = talloc_strdup(mem_ctx, data);
- NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.pipe.path);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_NETBIOS:
- epm_floor->rhs.netbios.name = talloc_strdup(mem_ctx, data);
- NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.netbios.name);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_NCALRPC:
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_VINES_SPP:
- epm_floor->rhs.vines_spp.port = atoi(data);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_VINES_IPC:
- epm_floor->rhs.vines_ipc.port = atoi(data);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_STREETTALK:
- epm_floor->rhs.streettalk.streettalk = talloc_strdup(mem_ctx, data);
- NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.streettalk.streettalk);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_UNIX_DS:
- epm_floor->rhs.unix_ds.path = talloc_strdup(mem_ctx, data);
- NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.unix_ds.path);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_NULL:
- return NT_STATUS_OK;
-
- default:
- DEBUG(0,("Unsupported lhs protocol %d\n", epm_floor->lhs.protocol));
- break;
- }
-
- return NT_STATUS_NOT_SUPPORTED;
-}
-
-enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot)
-{
- int i;
-
- /* Find a transport that has 'prot' as 4th protocol */
- for (i=0;i<ARRAY_SIZE(transports);i++) {
- if (transports[i].num_protocols >= 2 &&
- transports[i].protseq[1] == prot) {
- return transports[i].transport;
- }
- }
-
- /* Unknown transport */
- return (unsigned int)-1;
-}
-
-_PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_tower(struct epm_tower *tower)
-{
- int i;
-
- /* Find a transport that matches this tower */
- for (i=0;i<ARRAY_SIZE(transports);i++) {
- int j;
- if (transports[i].num_protocols != tower->num_floors - 2) {
- continue;
- }
-
- for (j = 0; j < transports[i].num_protocols; j++) {
- if (transports[i].protseq[j] != tower->floors[j+2].lhs.protocol) {
- break;
- }
- }
-
- if (j == transports[i].num_protocols) {
- return transports[i].transport;
- }
- }
-
- /* Unknown transport */
- return (unsigned int)-1;
-}
-
-_PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx,
- struct epm_tower *tower,
- struct dcerpc_binding **b_out)
-{
- NTSTATUS status;
- struct dcerpc_binding *binding;
-
- binding = talloc(mem_ctx, struct dcerpc_binding);
- NT_STATUS_HAVE_NO_MEMORY(binding);
-
- ZERO_STRUCT(binding->object);
- binding->options = NULL;
- binding->host = NULL;
- binding->target_hostname = NULL;
- binding->flags = 0;
- binding->assoc_group_id = 0;
-
- binding->transport = dcerpc_transport_by_tower(tower);
-
- if (binding->transport == (unsigned int)-1) {
- return NT_STATUS_NOT_SUPPORTED;
- }
-
- if (tower->num_floors < 1) {
- return NT_STATUS_OK;
- }
-
- /* Set object uuid */
- status = dcerpc_floor_get_lhs_data(&tower->floors[0], &binding->object);
-
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(1, ("Error pulling object uuid and version: %s", nt_errstr(status)));
- return status;
- }
-
- /* Ignore floor 1, it contains the NDR version info */
-
- binding->options = NULL;
-
- /* Set endpoint */
- if (tower->num_floors >= 4) {
- binding->endpoint = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[3]);
- } else {
- binding->endpoint = NULL;
- }
-
- /* Set network address */
- if (tower->num_floors >= 5) {
- binding->host = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[4]);
- NT_STATUS_HAVE_NO_MEMORY(binding->host);
- binding->target_hostname = binding->host;
- }
- *b_out = binding;
- return NT_STATUS_OK;
-}
-
-_PUBLIC_ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding, struct epm_tower *tower)
-{
- const enum epm_protocol *protseq = NULL;
- int num_protocols = -1, i;
- NTSTATUS status;
-
- /* Find transport */
- for (i=0;i<ARRAY_SIZE(transports);i++) {
- if (transports[i].transport == binding->transport) {
- protseq = transports[i].protseq;
- num_protocols = transports[i].num_protocols;
- break;
- }
- }
-
- if (num_protocols == -1) {
- DEBUG(0, ("Unable to find transport with id '%d'\n", binding->transport));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- tower->num_floors = 2 + num_protocols;
- tower->floors = talloc_array(mem_ctx, struct epm_floor, tower->num_floors);
-
- /* Floor 0 */
- tower->floors[0].lhs.protocol = EPM_PROTOCOL_UUID;
-
- tower->floors[0].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, &binding->object);
-
- tower->floors[0].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2);
-
- /* Floor 1 */
- tower->floors[1].lhs.protocol = EPM_PROTOCOL_UUID;
-
- tower->floors[1].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx,
- &ndr_transfer_syntax);
-
- tower->floors[1].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2);
-
- /* Floor 2 to num_protocols */
- for (i = 0; i < num_protocols; i++) {
- tower->floors[2 + i].lhs.protocol = protseq[i];
- tower->floors[2 + i].lhs.lhs_data = data_blob_talloc(mem_ctx, NULL, 0);
- ZERO_STRUCT(tower->floors[2 + i].rhs);
- dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[2 + i], "");
- }
-
- /* The 4th floor contains the endpoint */
- if (num_protocols >= 2 && binding->endpoint) {
- status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[3], binding->endpoint);
- if (NT_STATUS_IS_ERR(status)) {
- return status;
- }
- }
-
- /* The 5th contains the network address */
- if (num_protocols >= 3 && binding->host) {
- if (is_ipaddress(binding->host)) {
- status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4],
- binding->host);
- } else {
- /* note that we don't attempt to resolve the
- name here - when we get a hostname here we
- are in the client code, and want to put in
- a wildcard all-zeros IP for the server to
- fill in */
- status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4],
- "0.0.0.0");
- }
- if (NT_STATUS_IS_ERR(status)) {
- return status;
- }
- }
-
- return NT_STATUS_OK;
-}
diff --git a/source3/librpc/rpc/dcerpc.c b/source3/librpc/rpc/dcerpc.c
index 58d676a9d9..77bb7b33a2 100644
--- a/source3/librpc/rpc/dcerpc.c
+++ b/source3/librpc/rpc/dcerpc.c
@@ -43,7 +43,7 @@ struct rpc_request *dcerpc_ndr_request_send(struct dcerpc_pipe *p, const struct
ret->call = call;
ret->r = r;
- push = ndr_push_init_ctx(mem_ctx);
+ push = ndr_push_init_ctx(mem_ctx, NULL);
if (!push) {
return NULL;
}
@@ -100,7 +100,7 @@ NTSTATUS dcerpc_ndr_request_recv(struct rpc_request *req)
prs_mem_free( &r_ps );
- pull = ndr_pull_init_blob(&blob, req);
+ pull = ndr_pull_init_blob(&blob, req, NULL);
if (pull == NULL) {
return NT_STATUS_NO_MEMORY;
}
diff --git a/source3/librpc/rpc/dcerpc.h b/source3/librpc/rpc/dcerpc.h
index 739e60a341..1a1fd83060 100644
--- a/source3/librpc/rpc/dcerpc.h
+++ b/source3/librpc/rpc/dcerpc.h
@@ -72,4 +72,52 @@ struct dcerpc_binding {
uint32_t assoc_group_id;
};
+
+/* dcerpc pipe flags */
+#define DCERPC_DEBUG_PRINT_IN (1<<0)
+#define DCERPC_DEBUG_PRINT_OUT (1<<1)
+#define DCERPC_DEBUG_PRINT_BOTH (DCERPC_DEBUG_PRINT_IN | DCERPC_DEBUG_PRINT_OUT)
+
+#define DCERPC_DEBUG_VALIDATE_IN (1<<2)
+#define DCERPC_DEBUG_VALIDATE_OUT (1<<3)
+#define DCERPC_DEBUG_VALIDATE_BOTH (DCERPC_DEBUG_VALIDATE_IN | DCERPC_DEBUG_VALIDATE_OUT)
+
+#define DCERPC_CONNECT (1<<4)
+#define DCERPC_SIGN (1<<5)
+#define DCERPC_SEAL (1<<6)
+
+#define DCERPC_PUSH_BIGENDIAN (1<<7)
+#define DCERPC_PULL_BIGENDIAN (1<<8)
+
+#define DCERPC_SCHANNEL (1<<9)
+
+/* use a 128 bit session key */
+#define DCERPC_SCHANNEL_128 (1<<12)
+
+/* check incoming pad bytes */
+#define DCERPC_DEBUG_PAD_CHECK (1<<13)
+
+/* set LIBNDR_FLAG_REF_ALLOC flag when decoding NDR */
+#define DCERPC_NDR_REF_ALLOC (1<<14)
+
+#define DCERPC_AUTH_OPTIONS (DCERPC_SEAL|DCERPC_SIGN|DCERPC_SCHANNEL|DCERPC_AUTH_SPNEGO|DCERPC_AUTH_KRB5|DCERPC_AUTH_NTLM)
+
+/* select spnego auth */
+#define DCERPC_AUTH_SPNEGO (1<<15)
+
+/* select krb5 auth */
+#define DCERPC_AUTH_KRB5 (1<<16)
+
+#define DCERPC_SMB2 (1<<17)
+
+/* select NTLM auth */
+#define DCERPC_AUTH_NTLM (1<<18)
+
+/* this triggers the DCERPC_PFC_FLAG_CONC_MPX flag in the bind request */
+#define DCERPC_CONCURRENT_MULTIPLEX (1<<19)
+
+/* this triggers the DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN flag in the bind request */
+#define DCERPC_HEADER_SIGNING (1<<20)
+
+
#endif /* __DCERPC_H__ */
diff --git a/source3/librpc/rpc/dcerpc_util.c b/source3/librpc/rpc/dcerpc_util.c
deleted file mode 100644
index 3b8768ccc2..0000000000
--- a/source3/librpc/rpc/dcerpc_util.c
+++ /dev/null
@@ -1,1438 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- dcerpc utility functions
-
- Copyright (C) Andrew Tridgell 2003
- Copyright (C) Jelmer Vernooij 2004
- Copyright (C) Andrew Bartlett <abartlet@samba.org> 2005
- Copyright (C) Rafal Szczesniak 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 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/events/events.h"
-#include "libcli/composite/composite.h"
-#include "librpc/gen_ndr/ndr_epmapper_c.h"
-#include "librpc/gen_ndr/ndr_dcerpc.h"
-#include "librpc/gen_ndr/ndr_misc.h"
-#include "librpc/rpc/dcerpc_proto.h"
-#include "auth/credentials/credentials.h"
-#include "param/param.h"
-
-/*
- find a dcerpc call on an interface by name
-*/
-const struct ndr_interface_call *dcerpc_iface_find_call(const struct ndr_interface_table *iface,
- const char *name)
-{
- int i;
- for (i=0;i<iface->num_calls;i++) {
- if (strcmp(iface->calls[i].name, name) == 0) {
- return &iface->calls[i];
- }
- }
- return NULL;
-}
-
-/*
- push a ncacn_packet into a blob, potentially with auth info
-*/
-NTSTATUS ncacn_push_auth(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
- struct smb_iconv_convenience *iconv_convenience,
- struct ncacn_packet *pkt,
- struct dcerpc_auth *auth_info)
-{
- struct ndr_push *ndr;
- enum ndr_err_code ndr_err;
-
- ndr = ndr_push_init_ctx(mem_ctx, iconv_convenience);
- if (!ndr) {
- return NT_STATUS_NO_MEMORY;
- }
-
- if (!(pkt->drep[0] & DCERPC_DREP_LE)) {
- ndr->flags |= LIBNDR_FLAG_BIGENDIAN;
- }
-
- if (pkt->pfc_flags & DCERPC_PFC_FLAG_OBJECT_UUID) {
- ndr->flags |= LIBNDR_FLAG_OBJECT_PRESENT;
- }
-
- if (auth_info) {
- pkt->auth_length = auth_info->credentials.length;
- } else {
- pkt->auth_length = 0;
- }
-
- ndr_err = ndr_push_ncacn_packet(ndr, NDR_SCALARS|NDR_BUFFERS, pkt);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- return ndr_map_error2ntstatus(ndr_err);
- }
-
- if (auth_info) {
- ndr_err = ndr_push_dcerpc_auth(ndr, NDR_SCALARS|NDR_BUFFERS, auth_info);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- return ndr_map_error2ntstatus(ndr_err);
- }
- }
-
- *blob = ndr_push_blob(ndr);
-
- /* fill in the frag length */
- dcerpc_set_frag_length(blob, blob->length);
-
- return NT_STATUS_OK;
-}
-
-#define MAX_PROTSEQ 10
-
-static const struct {
- const char *name;
- enum dcerpc_transport_t transport;
- int num_protocols;
- enum epm_protocol protseq[MAX_PROTSEQ];
-} transports[] = {
- { "ncacn_np", NCACN_NP, 3,
- { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_SMB, EPM_PROTOCOL_NETBIOS }},
- { "ncacn_ip_tcp", NCACN_IP_TCP, 3,
- { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_TCP, EPM_PROTOCOL_IP } },
- { "ncacn_http", NCACN_HTTP, 3,
- { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_HTTP, EPM_PROTOCOL_IP } },
- { "ncadg_ip_udp", NCACN_IP_UDP, 3,
- { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UDP, EPM_PROTOCOL_IP } },
- { "ncalrpc", NCALRPC, 2,
- { EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_PIPE } },
- { "ncacn_unix_stream", NCACN_UNIX_STREAM, 2,
- { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_UNIX_DS } },
- { "ncadg_unix_dgram", NCADG_UNIX_DGRAM, 2,
- { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UNIX_DS } },
- { "ncacn_at_dsp", NCACN_AT_DSP, 3,
- { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DSP } },
- { "ncadg_at_ddp", NCADG_AT_DDP, 3,
- { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DDP } },
- { "ncacn_vns_ssp", NCACN_VNS_SPP, 3,
- { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_SPP } },
- { "ncacn_vns_ipc", NCACN_VNS_IPC, 3,
- { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_IPC }, },
- { "ncadg_ipx", NCADG_IPX, 2,
- { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_IPX },
- },
- { "ncacn_spx", NCACN_SPX, 3,
- /* I guess some MS programmer confused the identifier for
- * EPM_PROTOCOL_UUID (0x0D or 13) with the one for
- * EPM_PROTOCOL_SPX (0x13) here. -- jelmer*/
- { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_UUID },
- },
-};
-
-static const struct {
- const char *name;
- uint32_t flag;
-} ncacn_options[] = {
- {"sign", DCERPC_SIGN},
- {"seal", DCERPC_SEAL},
- {"connect", DCERPC_CONNECT},
- {"spnego", DCERPC_AUTH_SPNEGO},
- {"ntlm", DCERPC_AUTH_NTLM},
- {"krb5", DCERPC_AUTH_KRB5},
- {"validate", DCERPC_DEBUG_VALIDATE_BOTH},
- {"print", DCERPC_DEBUG_PRINT_BOTH},
- {"padcheck", DCERPC_DEBUG_PAD_CHECK},
- {"bigendian", DCERPC_PUSH_BIGENDIAN},
- {"smb2", DCERPC_SMB2}
-};
-
-const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor)
-{
- struct ndr_syntax_id syntax;
- NTSTATUS status;
-
- switch(epm_floor->lhs.protocol) {
- case EPM_PROTOCOL_UUID:
- status = dcerpc_floor_get_lhs_data(epm_floor, &syntax);
- if (NT_STATUS_IS_OK(status)) {
- /* lhs is used: UUID */
- char *uuidstr;
-
- if (GUID_equal(&syntax.uuid, &ndr_transfer_syntax.uuid)) {
- return "NDR";
- }
-
- if (GUID_equal(&syntax.uuid, &ndr64_transfer_syntax.uuid)) {
- return "NDR64";
- }
-
- uuidstr = GUID_string(mem_ctx, &syntax.uuid);
-
- return talloc_asprintf(mem_ctx, " uuid %s/0x%02x", uuidstr, syntax.if_version);
- } else { /* IPX */
- return talloc_asprintf(mem_ctx, "IPX:%s",
- data_blob_hex_string(mem_ctx, &epm_floor->rhs.uuid.unknown));
- }
-
- case EPM_PROTOCOL_NCACN:
- return "RPC-C";
-
- case EPM_PROTOCOL_NCADG:
- return "RPC";
-
- case EPM_PROTOCOL_NCALRPC:
- return "NCALRPC";
-
- case EPM_PROTOCOL_DNET_NSP:
- return "DNET/NSP";
-
- case EPM_PROTOCOL_IP:
- return talloc_asprintf(mem_ctx, "IP:%s", epm_floor->rhs.ip.ipaddr);
-
- case EPM_PROTOCOL_PIPE:
- return talloc_asprintf(mem_ctx, "PIPE:%s", epm_floor->rhs.pipe.path);
-
- case EPM_PROTOCOL_SMB:
- return talloc_asprintf(mem_ctx, "SMB:%s", epm_floor->rhs.smb.unc);
-
- case EPM_PROTOCOL_UNIX_DS:
- return talloc_asprintf(mem_ctx, "Unix:%s", epm_floor->rhs.unix_ds.path);
-
- case EPM_PROTOCOL_NETBIOS:
- return talloc_asprintf(mem_ctx, "NetBIOS:%s", epm_floor->rhs.netbios.name);
-
- case EPM_PROTOCOL_NETBEUI:
- return "NETBeui";
-
- case EPM_PROTOCOL_SPX:
- return "SPX";
-
- case EPM_PROTOCOL_NB_IPX:
- return "NB_IPX";
-
- case EPM_PROTOCOL_HTTP:
- return talloc_asprintf(mem_ctx, "HTTP:%d", epm_floor->rhs.http.port);
-
- case EPM_PROTOCOL_TCP:
- return talloc_asprintf(mem_ctx, "TCP:%d", epm_floor->rhs.tcp.port);
-
- case EPM_PROTOCOL_UDP:
- return talloc_asprintf(mem_ctx, "UDP:%d", epm_floor->rhs.udp.port);
-
- default:
- return talloc_asprintf(mem_ctx, "UNK(%02x):", epm_floor->lhs.protocol);
- }
-}
-
-
-/*
- form a binding string from a binding structure
-*/
-_PUBLIC_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b)
-{
- char *s = talloc_strdup(mem_ctx, "");
- int i;
- const char *t_name = NULL;
-
- if (b->transport != NCA_UNKNOWN) {
- for (i=0;i<ARRAY_SIZE(transports);i++) {
- if (transports[i].transport == b->transport) {
- t_name = transports[i].name;
- }
- }
- if (!t_name) {
- return NULL;
- }
- }
-
- if (!GUID_all_zero(&b->object.uuid)) {
- s = talloc_asprintf(s, "%s@",
- GUID_string(mem_ctx, &b->object.uuid));
- }
-
- if (t_name != NULL) {
- s = talloc_asprintf_append_buffer(s, "%s:", t_name);
- if (s == NULL) {
- return NULL;
- }
- }
-
- if (b->host) {
- s = talloc_asprintf_append_buffer(s, "%s", b->host);
- }
-
- if (!b->endpoint && !b->options && !b->flags) {
- return s;
- }
-
- s = talloc_asprintf_append_buffer(s, "[");
-
- if (b->endpoint) {
- s = talloc_asprintf_append_buffer(s, "%s", b->endpoint);
- }
-
- /* this is a *really* inefficent way of dealing with strings,
- but this is rarely called and the strings are always short,
- so I don't care */
- for (i=0;b->options && b->options[i];i++) {
- s = talloc_asprintf_append_buffer(s, ",%s", b->options[i]);
- if (!s) return NULL;
- }
-
- for (i=0;i<ARRAY_SIZE(ncacn_options);i++) {
- if (b->flags & ncacn_options[i].flag) {
- s = talloc_asprintf_append_buffer(s, ",%s", ncacn_options[i].name);
- if (!s) return NULL;
- }
- }
-
- s = talloc_asprintf_append_buffer(s, "]");
-
- return s;
-}
-
-/*
- parse a binding string into a dcerpc_binding structure
-*/
-_PUBLIC_ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_binding **b_out)
-{
- struct dcerpc_binding *b;
- char *options;
- char *p;
- int i, j, comma_count;
-
- b = talloc(mem_ctx, struct dcerpc_binding);
- if (!b) {
- return NT_STATUS_NO_MEMORY;
- }
-
- p = strchr(s, '@');
-
- if (p && PTR_DIFF(p, s) == 36) { /* 36 is the length of a UUID */
- NTSTATUS status;
-
- status = GUID_from_string(s, &b->object.uuid);
-
- if (NT_STATUS_IS_ERR(status)) {
- DEBUG(0, ("Failed parsing UUID\n"));
- return status;
- }
-
- s = p + 1;
- } else {
- ZERO_STRUCT(b->object);
- }
-
- b->object.if_version = 0;
-
- p = strchr(s, ':');
-
- if (p == NULL) {
- b->transport = NCA_UNKNOWN;
- } else {
- char *type = talloc_strndup(mem_ctx, s, PTR_DIFF(p, s));
- if (!type) {
- return NT_STATUS_NO_MEMORY;
- }
-
- for (i=0;i<ARRAY_SIZE(transports);i++) {
- if (strcasecmp(type, transports[i].name) == 0) {
- b->transport = transports[i].transport;
- break;
- }
- }
-
- if (i==ARRAY_SIZE(transports)) {
- DEBUG(0,("Unknown dcerpc transport '%s'\n", type));
- return NT_STATUS_INVALID_PARAMETER;
- }
-
- talloc_free(type);
-
- s = p+1;
- }
-
- p = strchr(s, '[');
- if (p) {
- b->host = talloc_strndup(b, s, PTR_DIFF(p, s));
- options = talloc_strdup(mem_ctx, p+1);
- if (options[strlen(options)-1] != ']') {
- return NT_STATUS_INVALID_PARAMETER;
- }
- options[strlen(options)-1] = 0;
- } else {
- b->host = talloc_strdup(b, s);
- options = NULL;
- }
- if (!b->host) {
- return NT_STATUS_NO_MEMORY;
- }
-
- b->target_hostname = b->host;
-
- b->options = NULL;
- b->flags = 0;
- b->assoc_group_id = 0;
- b->endpoint = NULL;
-
- if (!options) {
- *b_out = b;
- return NT_STATUS_OK;
- }
-
- comma_count = count_chars(options, ',');
-
- b->options = talloc_array(b, const char *, comma_count+2);
- if (!b->options) {
- return NT_STATUS_NO_MEMORY;
- }
-
- for (i=0; (p = strchr(options, ',')); i++) {
- b->options[i] = talloc_strndup(b, options, PTR_DIFF(p, options));
- if (!b->options[i]) {
- return NT_STATUS_NO_MEMORY;
- }
- options = p+1;
- }
- b->options[i] = options;
- b->options[i+1] = NULL;
-
- /* some options are pre-parsed for convenience */
- for (i=0;b->options[i];i++) {
- for (j=0;j<ARRAY_SIZE(ncacn_options);j++) {
- if (strcasecmp(ncacn_options[j].name, b->options[i]) == 0) {
- int k;
- b->flags |= ncacn_options[j].flag;
- for (k=i;b->options[k];k++) {
- b->options[k] = b->options[k+1];
- }
- i--;
- break;
- }
- }
- }
-
- if (b->options[0]) {
- /* Endpoint is first option */
- b->endpoint = b->options[0];
- if (strlen(b->endpoint) == 0) b->endpoint = NULL;
-
- for (i=0;b->options[i];i++) {
- b->options[i] = b->options[i+1];
- }
- }
-
- if (b->options[0] == NULL)
- b->options = NULL;
-
- *b_out = b;
- return NT_STATUS_OK;
-}
-
-_PUBLIC_ NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct ndr_syntax_id *syntax)
-{
- TALLOC_CTX *mem_ctx = talloc_init("floor_get_lhs_data");
- struct ndr_pull *ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx, NULL);
- enum ndr_err_code ndr_err;
- uint16_t if_version=0;
-
- ndr->flags |= LIBNDR_FLAG_NOALIGN;
-
- ndr_err = ndr_pull_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- talloc_free(mem_ctx);
- return ndr_map_error2ntstatus(ndr_err);
- }
-
- ndr_err = ndr_pull_uint16(ndr, NDR_SCALARS, &if_version);
- if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
- talloc_free(mem_ctx);
- return ndr_map_error2ntstatus(ndr_err);
- }
-
- syntax->if_version = if_version;
-
- talloc_free(mem_ctx);
-
- return NT_STATUS_OK;
-}
-
-static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *syntax)
-{
- struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx, NULL);
-
- ndr->flags |= LIBNDR_FLAG_NOALIGN;
-
- ndr_push_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);
- ndr_push_uint16(ndr, NDR_SCALARS, syntax->if_version);
-
- return ndr_push_blob(ndr);
-}
-
-const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor)
-{
- switch (epm_floor->lhs.protocol) {
- case EPM_PROTOCOL_TCP:
- if (epm_floor->rhs.tcp.port == 0) return NULL;
- return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.tcp.port);
-
- case EPM_PROTOCOL_UDP:
- if (epm_floor->rhs.udp.port == 0) return NULL;
- return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.udp.port);
-
- case EPM_PROTOCOL_HTTP:
- if (epm_floor->rhs.http.port == 0) return NULL;
- return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.http.port);
-
- case EPM_PROTOCOL_IP:
- return talloc_strdup(mem_ctx, epm_floor->rhs.ip.ipaddr);
-
- case EPM_PROTOCOL_NCACN:
- return NULL;
-
- case EPM_PROTOCOL_NCADG:
- return NULL;
-
- case EPM_PROTOCOL_SMB:
- if (strlen(epm_floor->rhs.smb.unc) == 0) return NULL;
- return talloc_strdup(mem_ctx, epm_floor->rhs.smb.unc);
-
- case EPM_PROTOCOL_PIPE:
- if (strlen(epm_floor->rhs.pipe.path) == 0) return NULL;
- return talloc_strdup(mem_ctx, epm_floor->rhs.pipe.path);
-
- case EPM_PROTOCOL_NETBIOS:
- if (strlen(epm_floor->rhs.netbios.name) == 0) return NULL;
- return talloc_strdup(mem_ctx, epm_floor->rhs.netbios.name);
-
- case EPM_PROTOCOL_NCALRPC:
- return NULL;
-
- case EPM_PROTOCOL_VINES_SPP:
- return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.vines_spp.port);
-
- case EPM_PROTOCOL_VINES_IPC:
- return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.vines_ipc.port);
-
- case EPM_PROTOCOL_STREETTALK:
- return talloc_strdup(mem_ctx, epm_floor->rhs.streettalk.streettalk);
-
- case EPM_PROTOCOL_UNIX_DS:
- if (strlen(epm_floor->rhs.unix_ds.path) == 0) return NULL;
- return talloc_strdup(mem_ctx, epm_floor->rhs.unix_ds.path);
-
- case EPM_PROTOCOL_NULL:
- return NULL;
-
- default:
- DEBUG(0,("Unsupported lhs protocol %d\n", epm_floor->lhs.protocol));
- break;
- }
-
- return NULL;
-}
-
-static NTSTATUS dcerpc_floor_set_rhs_data(TALLOC_CTX *mem_ctx,
- struct epm_floor *epm_floor,
- const char *data)
-{
- switch (epm_floor->lhs.protocol) {
- case EPM_PROTOCOL_TCP:
- epm_floor->rhs.tcp.port = atoi(data);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_UDP:
- epm_floor->rhs.udp.port = atoi(data);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_HTTP:
- epm_floor->rhs.http.port = atoi(data);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_IP:
- epm_floor->rhs.ip.ipaddr = talloc_strdup(mem_ctx, data);
- NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.ip.ipaddr);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_NCACN:
- epm_floor->rhs.ncacn.minor_version = 0;
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_NCADG:
- epm_floor->rhs.ncadg.minor_version = 0;
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_SMB:
- epm_floor->rhs.smb.unc = talloc_strdup(mem_ctx, data);
- NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.smb.unc);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_PIPE:
- epm_floor->rhs.pipe.path = talloc_strdup(mem_ctx, data);
- NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.pipe.path);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_NETBIOS:
- epm_floor->rhs.netbios.name = talloc_strdup(mem_ctx, data);
- NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.netbios.name);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_NCALRPC:
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_VINES_SPP:
- epm_floor->rhs.vines_spp.port = atoi(data);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_VINES_IPC:
- epm_floor->rhs.vines_ipc.port = atoi(data);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_STREETTALK:
- epm_floor->rhs.streettalk.streettalk = talloc_strdup(mem_ctx, data);
- NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.streettalk.streettalk);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_UNIX_DS:
- epm_floor->rhs.unix_ds.path = talloc_strdup(mem_ctx, data);
- NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.unix_ds.path);
- return NT_STATUS_OK;
-
- case EPM_PROTOCOL_NULL:
- return NT_STATUS_OK;
-
- default:
- DEBUG(0,("Unsupported lhs protocol %d\n", epm_floor->lhs.protocol));
- break;
- }
-
- return NT_STATUS_NOT_SUPPORTED;
-}
-
-enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot)
-{
- int i;
-
- /* Find a transport that has 'prot' as 4th protocol */
- for (i=0;i<ARRAY_SIZE(transports);i++) {
- if (transports[i].num_protocols >= 2 &&
- transports[i].protseq[1] == prot) {
- return transports[i].transport;
- }
- }
-
- /* Unknown transport */
- return (unsigned int)-1;
-}
-
-_PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_tower(struct epm_tower *tower)
-{
- int i;
-
- /* Find a transport that matches this tower */
- for (i=0;i<ARRAY_SIZE(transports);i++) {
- int j;
- if (transports[i].num_protocols != tower->num_floors - 2) {
- continue;
- }
-
- for (j = 0; j < transports[i].num_protocols; j++) {
- if (transports[i].protseq[j] != tower->floors[j+2].lhs.protocol) {
- break;
- }
- }
-
- if (j == transports[i].num_protocols) {
- return transports[i].transport;
- }
- }
-
- /* Unknown transport */
- return (unsigned int)-1;
-}
-
-_PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx,
- struct epm_tower *tower,
- struct dcerpc_binding **b_out)
-{
- NTSTATUS status;
- struct dcerpc_binding *binding;
-
- binding = talloc(mem_ctx, struct dcerpc_binding);
- NT_STATUS_HAVE_NO_MEMORY(binding);
-
- ZERO_STRUCT(binding->object);
- binding->options = NULL;
- binding->host = NULL;
- binding->target_hostname = NULL;
- binding->flags = 0;
- binding->assoc_group_id = 0;
-
- binding->transport = dcerpc_transport_by_tower(tower);
-
- if (binding->transport == (unsigned int)-1) {
- return NT_STATUS_NOT_SUPPORTED;
- }
-
- if (tower->num_floors < 1) {
- return NT_STATUS_OK;
- }
-
- /* Set object uuid */
- status = dcerpc_floor_get_lhs_data(&tower->floors[0], &binding->object);
-
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(1, ("Error pulling object uuid and version: %s", nt_errstr(status)));
- return status;
- }
-
- /* Ignore floor 1, it contains the NDR version info */
-
- binding->options = NULL;
-
- /* Set endpoint */
- if (tower->num_floors >= 4) {
- binding->endpoint = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[3]);
- } else {
- binding->endpoint = NULL;
- }
-
- /* Set network address */
- if (tower->num_floors >= 5) {
- binding->host = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[4]);
- NT_STATUS_HAVE_NO_MEMORY(binding->host);
- binding->target_hostname = binding->host;
- }
- *b_out = binding;
- return NT_STATUS_OK;
-}
-
-_PUBLIC_ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding, struct epm_tower *tower)
-{
- const enum epm_protocol *protseq = NULL;
- int num_protocols = -1, i;
- NTSTATUS status;
-
- /* Find transport */
- for (i=0;i<ARRAY_SIZE(transports);i++) {
- if (transports[i].transport == binding->transport) {
- protseq = transports[i].protseq;
- num_protocols = transports[i].num_protocols;
- break;
- }
- }
-
- if (num_protocols == -1) {
- DEBUG(0, ("Unable to find transport with id '%d'\n", binding->transport));
- return NT_STATUS_UNSUCCESSFUL;
- }
-
- tower->num_floors = 2 + num_protocols;
- tower->floors = talloc_array(mem_ctx, struct epm_floor, tower->num_floors);
-
- /* Floor 0 */
- tower->floors[0].lhs.protocol = EPM_PROTOCOL_UUID;
-
- tower->floors[0].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, &binding->object);
-
- tower->floors[0].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2);
-
- /* Floor 1 */
- tower->floors[1].lhs.protocol = EPM_PROTOCOL_UUID;
-
- tower->floors[1].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx,
- &ndr_transfer_syntax);
-
- tower->floors[1].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2);
-
- /* Floor 2 to num_protocols */
- for (i = 0; i < num_protocols; i++) {
- tower->floors[2 + i].lhs.protocol = protseq[i];
- tower->floors[2 + i].lhs.lhs_data = data_blob_talloc(mem_ctx, NULL, 0);
- ZERO_STRUCT(tower->floors[2 + i].rhs);
- dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[2 + i], "");
- }
-
- /* The 4th floor contains the endpoint */
- if (num_protocols >= 2 && binding->endpoint) {
- status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[3], binding->endpoint);
- if (NT_STATUS_IS_ERR(status)) {
- return status;
- }
- }
-
- /* The 5th contains the network address */
- if (num_protocols >= 3 && binding->host) {
- if (is_ipaddress(binding->host)) {
- status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4],
- binding->host);
- } else {
- /* note that we don't attempt to resolve the
- name here - when we get a hostname here we
- are in the client code, and want to put in
- a wildcard all-zeros IP for the server to
- fill in */
- status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4],
- "0.0.0.0");
- }
- if (NT_STATUS_IS_ERR(status)) {
- return status;
- }
- }
-
- return NT_STATUS_OK;
-}
-
-
-struct epm_map_binding_state {
- struct dcerpc_binding *binding;
- const struct ndr_interface_table *table;
- struct dcerpc_pipe *pipe;
- struct policy_handle handle;
- struct GUID guid;
- struct epm_twr_t twr;
- struct epm_twr_t *twr_r;
- struct epm_Map r;
-};
-
-
-static void continue_epm_recv_binding(struct composite_context *ctx);
-static void continue_epm_map(struct rpc_request *req);
-
-
-/*
- Stage 2 of epm_map_binding: Receive connected rpc pipe and send endpoint
- mapping rpc request
-*/
-static void continue_epm_recv_binding(struct composite_context *ctx)
-{
- struct rpc_request *map_req;
-
- struct composite_context *c = talloc_get_type(ctx->async.private_data,
- struct composite_context);
- struct epm_map_binding_state *s = talloc_get_type(c->private_data,
- struct epm_map_binding_state);
-
- /* receive result of rpc pipe connect request */
- c->status = dcerpc_pipe_connect_b_recv(ctx, c, &s->pipe);
- if (!composite_is_ok(c)) return;
-
- s->pipe->conn->flags |= DCERPC_NDR_REF_ALLOC;
-
- /* prepare requested binding parameters */
- s->binding->object = s->table->syntax_id;
-
- c->status = dcerpc_binding_build_tower(s->pipe, s->binding, &s->twr.tower);
- if (!composite_is_ok(c)) return;
-
- /* with some nice pretty paper around it of course */
- s->r.in.object = &s->guid;
- s->r.in.map_tower = &s->twr;
- s->r.in.entry_handle = &s->handle;
- s->r.in.max_towers = 1;
- s->r.out.entry_handle = &s->handle;
-
- /* send request for an endpoint mapping - a rpc request on connected pipe */
- map_req = dcerpc_epm_Map_send(s->pipe, c, &s->r);
- if (composite_nomem(map_req, c)) return;
-
- composite_continue_rpc(c, map_req, continue_epm_map, c);
-}
-
-
-/*
- Stage 3 of epm_map_binding: Receive endpoint mapping and provide binding details
-*/
-static void continue_epm_map(struct rpc_request *req)
-{
- struct composite_context *c = talloc_get_type(req->async.private_data,
- struct composite_context);
- struct epm_map_binding_state *s = talloc_get_type(c->private_data,
- struct epm_map_binding_state);
-
- /* receive result of a rpc request */
- c->status = dcerpc_ndr_request_recv(req);
- if (!composite_is_ok(c)) return;
-
- /* check the details */
- if (s->r.out.result != 0 || *s->r.out.num_towers != 1) {
- composite_error(c, NT_STATUS_PORT_UNREACHABLE);
- return;
- }
-
- s->twr_r = s->r.out.towers[0].twr;
- if (s->twr_r == NULL) {
- composite_error(c, NT_STATUS_PORT_UNREACHABLE);
- return;
- }
-
- if (s->twr_r->tower.num_floors != s->twr.tower.num_floors ||
- s->twr_r->tower.floors[3].lhs.protocol != s->twr.tower.floors[3].lhs.protocol) {
- composite_error(c, NT_STATUS_PORT_UNREACHABLE);
- return;
- }
-
- /* get received endpoint */
- s->binding->endpoint = talloc_reference(s->binding,
- dcerpc_floor_get_rhs_data(c, &s->twr_r->tower.floors[3]));
- if (composite_nomem(s->binding->endpoint, c)) return;
-
- composite_done(c);
-}
-
-
-/*
- Request for endpoint mapping of dcerpc binding - try to request for endpoint
- unless there is default one.
-*/
-struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx,
- struct dcerpc_binding *binding,
- const struct ndr_interface_table *table,
- struct event_context *ev,
- struct loadparm_context *lp_ctx)
-{
- struct composite_context *c;
- struct epm_map_binding_state *s;
- struct composite_context *pipe_connect_req;
- struct cli_credentials *anon_creds;
- struct event_context *new_ev = NULL;
-
- NTSTATUS status;
- struct dcerpc_binding *epmapper_binding;
- int i;
-
- /* Try to find event context in memory context in case passed
- * event_context (argument) was NULL. If there's none, just
- * create a new one.
- */
- if (ev == NULL) {
- ev = event_context_find(mem_ctx);
- if (ev == NULL) {
- new_ev = event_context_init(mem_ctx);
- if (new_ev == NULL) return NULL;
- ev = new_ev;
- }
- }
-
- /* composite context allocation and setup */
- c = composite_create(mem_ctx, ev);
- if (c == NULL) {
- talloc_free(new_ev);
- return NULL;
- }
- talloc_steal(c, new_ev);
-
- s = talloc_zero(c, struct epm_map_binding_state);
- if (composite_nomem(s, c)) return c;
- c->private_data = s;
-
- s->binding = binding;
- s->table = table;
-
- /* anonymous credentials for rpc connection used to get endpoint mapping */
- anon_creds = cli_credentials_init(mem_ctx);
- cli_credentials_set_event_context(anon_creds, ev);
- cli_credentials_set_anonymous(anon_creds);
-
- /*
- First, check if there is a default endpoint specified in the IDL
- */
- if (table != NULL) {
- struct dcerpc_binding *default_binding;
-
- /* Find one of the default pipes for this interface */
- for (i = 0; i < table->endpoints->count; i++) {
- status = dcerpc_parse_binding(mem_ctx, table->endpoints->names[i], &default_binding);
-
- if (NT_STATUS_IS_OK(status)) {
- if (binding->transport == NCA_UNKNOWN)
- binding->transport = default_binding->transport;
- if (default_binding->transport == binding->transport &&
- default_binding->endpoint) {
- binding->endpoint = talloc_reference(binding, default_binding->endpoint);
- talloc_free(default_binding);
-
- composite_done(c);
- return c;
-
- } else {
- talloc_free(default_binding);
- }
- }
- }
- }
-
- epmapper_binding = talloc_zero(c, struct dcerpc_binding);
- if (composite_nomem(epmapper_binding, c)) return c;
-
- /* basic endpoint mapping data */
- epmapper_binding->transport = binding->transport;
- epmapper_binding->host = talloc_reference(epmapper_binding, binding->host);
- epmapper_binding->target_hostname = epmapper_binding->host;
- epmapper_binding->options = NULL;
- epmapper_binding->flags = 0;
- epmapper_binding->assoc_group_id = 0;
- epmapper_binding->endpoint = NULL;
-
- /* initiate rpc pipe connection */
- pipe_connect_req = dcerpc_pipe_connect_b_send(c, epmapper_binding,
- &ndr_table_epmapper,
- anon_creds, c->event_ctx,
- lp_ctx);
- if (composite_nomem(pipe_connect_req, c)) return c;
-
- composite_continue(c, pipe_connect_req, continue_epm_recv_binding, c);
- return c;
-}
-
-
-/*
- Receive result of endpoint mapping request
- */
-NTSTATUS dcerpc_epm_map_binding_recv(struct composite_context *c)
-{
- NTSTATUS status = composite_wait(c);
-
- talloc_free(c);
- return status;
-}
-
-
-/*
- Get endpoint mapping for rpc connection
-*/
-_PUBLIC_ NTSTATUS dcerpc_epm_map_binding(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding,
- const struct ndr_interface_table *table, struct event_context *ev,
- struct loadparm_context *lp_ctx)
-{
- struct composite_context *c;
-
- c = dcerpc_epm_map_binding_send(mem_ctx, binding, table, ev, lp_ctx);
- return dcerpc_epm_map_binding_recv(c);
-}
-
-
-struct pipe_auth_state {
- struct dcerpc_pipe *pipe;
- struct dcerpc_binding *binding;
- const struct ndr_interface_table *table;
- struct loadparm_context *lp_ctx;
- struct cli_credentials *credentials;
-};
-
-
-static void continue_auth_schannel(struct composite_context *ctx);
-static void continue_auth(struct composite_context *ctx);
-static void continue_auth_none(struct composite_context *ctx);
-static void continue_ntlmssp_connection(struct composite_context *ctx);
-static void continue_spnego_after_wrong_pass(struct composite_context *ctx);
-
-
-/*
- Stage 2 of pipe_auth: Receive result of schannel bind request
-*/
-static void continue_auth_schannel(struct composite_context *ctx)
-{
- struct composite_context *c = talloc_get_type(ctx->async.private_data,
- struct composite_context);
-
- c->status = dcerpc_bind_auth_schannel_recv(ctx);
- if (!composite_is_ok(c)) return;
-
- composite_done(c);
-}
-
-
-/*
- Stage 2 of pipe_auth: Receive result of authenticated bind request
-*/
-static void continue_auth(struct composite_context *ctx)
-{
- struct composite_context *c = talloc_get_type(ctx->async.private_data,
- struct composite_context);
-
- c->status = dcerpc_bind_auth_recv(ctx);
- if (!composite_is_ok(c)) return;
-
- composite_done(c);
-}
-/*
- Stage 2 of pipe_auth: Receive result of authenticated bind request, but handle fallbacks:
- SPNEGO -> NTLMSSP
-*/
-static void continue_auth_auto(struct composite_context *ctx)
-{
- struct composite_context *c = talloc_get_type(ctx->async.private_data,
- struct composite_context);
- struct pipe_auth_state *s = talloc_get_type(c->private_data, struct pipe_auth_state);
- struct composite_context *sec_conn_req;
-
- c->status = dcerpc_bind_auth_recv(ctx);
- if (NT_STATUS_EQUAL(c->status, NT_STATUS_INVALID_PARAMETER)) {
- /*
- * Retry with NTLMSSP auth as fallback
- * send a request for secondary rpc connection
- */
- sec_conn_req = dcerpc_secondary_connection_send(s->pipe,
- s->binding);
- composite_continue(c, sec_conn_req, continue_ntlmssp_connection, c);
- return;
- } else if (NT_STATUS_EQUAL(c->status, NT_STATUS_LOGON_FAILURE)) {
- if (cli_credentials_wrong_password(s->credentials)) {
- /*
- * Retry SPNEGO with a better password
- * send a request for secondary rpc connection
- */
- sec_conn_req = dcerpc_secondary_connection_send(s->pipe,
- s->binding);
- composite_continue(c, sec_conn_req, continue_spnego_after_wrong_pass, c);
- return;
- }
- }
-
- if (!composite_is_ok(c)) return;
-
- composite_done(c);
-}
-
-/*
- Stage 3 of pipe_auth (fallback to NTLMSSP case): Receive secondary
- rpc connection (the first one can't be used any more, due to the
- bind nak) and perform authenticated bind request
-*/
-static void continue_ntlmssp_connection(struct composite_context *ctx)
-{
- struct composite_context *c;
- struct pipe_auth_state *s;
- struct composite_context *auth_req;
- struct dcerpc_pipe *p2;
-
- c = talloc_get_type(ctx->async.private_data, struct composite_context);
- s = talloc_get_type(c->private_data, struct pipe_auth_state);
-
- /* receive secondary rpc connection */
- c->status = dcerpc_secondary_connection_recv(ctx, &p2);
- if (!composite_is_ok(c)) return;
-
- talloc_steal(s, p2);
- talloc_steal(p2, s->pipe);
- s->pipe = p2;
-
- /* initiate a authenticated bind */
- auth_req = dcerpc_bind_auth_send(c, s->pipe, s->table,
- s->credentials, s->lp_ctx,
- DCERPC_AUTH_TYPE_NTLMSSP,
- dcerpc_auth_level(s->pipe->conn),
- s->table->authservices->names[0]);
- composite_continue(c, auth_req, continue_auth, c);
-}
-
-/*
- Stage 3 of pipe_auth (retry on wrong password): Receive secondary
- rpc connection (the first one can't be used any more, due to the
- bind nak) and perform authenticated bind request
-*/
-static void continue_spnego_after_wrong_pass(struct composite_context *ctx)
-{
- struct composite_context *c;
- struct pipe_auth_state *s;
- struct composite_context *auth_req;
- struct dcerpc_pipe *p2;
-
- c = talloc_get_type(ctx->async.private_data, struct composite_context);
- s = talloc_get_type(c->private_data, struct pipe_auth_state);
-
- /* receive secondary rpc connection */
- c->status = dcerpc_secondary_connection_recv(ctx, &p2);
- if (!composite_is_ok(c)) return;
-
- talloc_steal(s, p2);
- talloc_steal(p2, s->pipe);
- s->pipe = p2;
-
- /* initiate a authenticated bind */
- auth_req = dcerpc_bind_auth_send(c, s->pipe, s->table,
- s->credentials, s->lp_ctx, DCERPC_AUTH_TYPE_SPNEGO,
- dcerpc_auth_level(s->pipe->conn),
- s->table->authservices->names[0]);
- composite_continue(c, auth_req, continue_auth, c);
-}
-
-
-/*
- Stage 2 of pipe_auth: Receive result of non-authenticated bind request
-*/
-static void continue_auth_none(struct composite_context *ctx)
-{
- struct composite_context *c = talloc_get_type(ctx->async.private_data,
- struct composite_context);
-
- c->status = dcerpc_bind_auth_none_recv(ctx);
- if (!composite_is_ok(c)) return;
-
- composite_done(c);
-}
-
-
-/*
- Request to perform an authenticated bind if required. Authentication
- is determined using credentials passed and binding flags.
-*/
-struct composite_context *dcerpc_pipe_auth_send(struct dcerpc_pipe *p,
- struct dcerpc_binding *binding,
- const struct ndr_interface_table *table,
- struct cli_credentials *credentials,
- struct loadparm_context *lp_ctx)
-{
- struct composite_context *c;
- struct pipe_auth_state *s;
- struct composite_context *auth_schannel_req;
- struct composite_context *auth_req;
- struct composite_context *auth_none_req;
- struct dcerpc_connection *conn;
- uint8_t auth_type;
-
- /* composite context allocation and setup */
- c = composite_create(p, p->conn->event_ctx);
- if (c == NULL) return NULL;
-
- s = talloc_zero(c, struct pipe_auth_state);
- if (composite_nomem(s, c)) return c;
- c->private_data = s;
-
- /* store parameters in state structure */
- s->binding = binding;
- s->table = table;
- s->credentials = credentials;
- s->pipe = p;
- s->lp_ctx = lp_ctx;
-
- conn = s->pipe->conn;
- conn->flags = binding->flags;
-
- /* remember the binding string for possible secondary connections */
- conn->binding_string = dcerpc_binding_string(p, binding);
-
- if (cli_credentials_is_anonymous(s->credentials)) {
- auth_none_req = dcerpc_bind_auth_none_send(c, s->pipe, s->table);
- composite_continue(c, auth_none_req, continue_auth_none, c);
- return c;
- }
-
- if ((binding->flags & DCERPC_SCHANNEL) &&
- !cli_credentials_get_netlogon_creds(s->credentials)) {
- /* If we don't already have netlogon credentials for
- * the schannel bind, then we have to get these
- * first */
- auth_schannel_req = dcerpc_bind_auth_schannel_send(c, s->pipe, s->table,
- s->credentials, s->lp_ctx,
- dcerpc_auth_level(conn));
- composite_continue(c, auth_schannel_req, continue_auth_schannel, c);
- return c;
- }
-
- /*
- * we rely on the already authenticated CIFS connection
- * if not doing sign or seal
- */
- if (conn->transport.transport == NCACN_NP &&
- !(s->binding->flags & (DCERPC_SIGN|DCERPC_SEAL))) {
- auth_none_req = dcerpc_bind_auth_none_send(c, s->pipe, s->table);
- composite_continue(c, auth_none_req, continue_auth_none, c);
- return c;
- }
-
-
- /* Perform an authenticated DCE-RPC bind
- */
- if (!(conn->flags & (DCERPC_SIGN|DCERPC_SEAL))) {
- /*
- we are doing an authenticated connection,
- but not using sign or seal. We must force
- the CONNECT dcerpc auth type as a NONE auth
- type doesn't allow authentication
- information to be passed.
- */
- conn->flags |= DCERPC_CONNECT;
- }
-
- if (s->binding->flags & DCERPC_AUTH_SPNEGO) {
- auth_type = DCERPC_AUTH_TYPE_SPNEGO;
-
- } else if (s->binding->flags & DCERPC_AUTH_KRB5) {
- auth_type = DCERPC_AUTH_TYPE_KRB5;
-
- } else if (s->binding->flags & DCERPC_SCHANNEL) {
- auth_type = DCERPC_AUTH_TYPE_SCHANNEL;
-
- } else if (s->binding->flags & DCERPC_AUTH_NTLM) {
- auth_type = DCERPC_AUTH_TYPE_NTLMSSP;
-
- } else {
- /* try SPNEGO with fallback to NTLMSSP */
- auth_req = dcerpc_bind_auth_send(c, s->pipe, s->table,
- s->credentials, s->lp_ctx, DCERPC_AUTH_TYPE_SPNEGO,
- dcerpc_auth_level(conn),
- s->table->authservices->names[0]);
- composite_continue(c, auth_req, continue_auth_auto, c);
- return c;
- }
-
- auth_req = dcerpc_bind_auth_send(c, s->pipe, s->table,
- s->credentials, s->lp_ctx, auth_type,
- dcerpc_auth_level(conn),
- s->table->authservices->names[0]);
- composite_continue(c, auth_req, continue_auth, c);
- return c;
-}
-
-
-/*
- Receive result of authenticated bind request on dcerpc pipe
-
- This returns *p, which may be different to the one originally
- supllied, as it rebinds to a new pipe due to authentication fallback
-
-*/
-NTSTATUS dcerpc_pipe_auth_recv(struct composite_context *c, TALLOC_CTX *mem_ctx,
- struct dcerpc_pipe **p)
-{
- NTSTATUS status;
-
- struct pipe_auth_state *s = talloc_get_type(c->private_data,
- struct pipe_auth_state);
- status = composite_wait(c);
- if (!NT_STATUS_IS_OK(status)) {
- char *uuid_str = GUID_string(s->pipe, &s->table->syntax_id.uuid);
- DEBUG(0, ("Failed to bind to uuid %s - %s\n", uuid_str, nt_errstr(status)));
- talloc_free(uuid_str);
- } else {
- talloc_steal(mem_ctx, s->pipe);
- *p = s->pipe;
- }
-
- talloc_free(c);
- return status;
-}
-
-
-/*
- Perform an authenticated bind if needed - sync version
-
- This may change *p, as it rebinds to a new pipe due to authentication fallback
-*/
-_PUBLIC_ NTSTATUS dcerpc_pipe_auth(TALLOC_CTX *mem_ctx,
- struct dcerpc_pipe **p,
- struct dcerpc_binding *binding,
- const struct ndr_interface_table *table,
- struct cli_credentials *credentials,
- struct loadparm_context *lp_ctx)
-{
- struct composite_context *c;
-
- c = dcerpc_pipe_auth_send(*p, binding, table, credentials, lp_ctx);
- return dcerpc_pipe_auth_recv(c, mem_ctx, p);
-}
-
-
-NTSTATUS dcerpc_generic_session_key(struct dcerpc_connection *c,
- DATA_BLOB *session_key)
-{
- /* this took quite a few CPU cycles to find ... */
- session_key->data = discard_const_p(unsigned char, "SystemLibraryDTC");
- session_key->length = 16;
- return NT_STATUS_OK;
-}
-
-/*
- fetch the user session key - may be default (above) or the SMB session key
-*/
-_PUBLIC_ NTSTATUS dcerpc_fetch_session_key(struct dcerpc_pipe *p,
- DATA_BLOB *session_key)
-{
- return p->conn->security_state.session_key(p->conn, session_key);
-}
-
-
-/*
- log a rpc packet in a format suitable for ndrdump. This is especially useful
- for sealed packets, where ethereal cannot easily see the contents
-
- this triggers on a debug level of >= 10
-*/
-_PUBLIC_ void dcerpc_log_packet(const struct ndr_interface_table *ndr,
- uint32_t opnum, uint32_t flags,
- DATA_BLOB *pkt)
-{
- const int num_examples = 20;
- int i;
-
- if (DEBUGLEVEL < 10) return;
-
- for (i=0;i<num_examples;i++) {
- char *name=NULL;
- asprintf(&name, "%s/rpclog/%s-%u.%d.%s",
- lp_lockdir(global_loadparm), ndr->name, opnum, i,
- (flags&NDR_IN)?"in":"out");
- if (name == NULL) {
- return;
- }
- if (!file_exist(name)) {
- if (file_save(name, pkt->data, pkt->length)) {
- DEBUG(10,("Logged rpc packet to %s\n", name));
- }
- free(name);
- break;
- }
- free(name);
- }
-}
-
-
-
-/*
- create a secondary context from a primary connection
-
- this uses dcerpc_alter_context() to create a new dcerpc context_id
-*/
-_PUBLIC_ NTSTATUS dcerpc_secondary_context(struct dcerpc_pipe *p,
- struct dcerpc_pipe **pp2,
- const struct ndr_interface_table *table)
-{
- NTSTATUS status;
- struct dcerpc_pipe *p2;
-
- p2 = talloc_zero(p, struct dcerpc_pipe);
- if (p2 == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
- p2->conn = talloc_reference(p2, p->conn);
- p2->request_timeout = p->request_timeout;
-
- p2->context_id = ++p->conn->next_context_id;
-
- p2->syntax = table->syntax_id;
-
- p2->transfer_syntax = ndr_transfer_syntax;
-
- p2->binding = talloc_reference(p2, p->binding);
-
- status = dcerpc_alter_context(p2, p2, &p2->syntax, &p2->transfer_syntax);
- if (!NT_STATUS_IS_OK(status)) {
- talloc_free(p2);
- return status;
- }
-
- *pp2 = p2;
-
- return NT_STATUS_OK;
-}
diff --git a/source3/librpc/tools/ndrdump.c b/source3/librpc/tools/ndrdump.c
index dc7f2be32f..5b96e152bb 100644
--- a/source3/librpc/tools/ndrdump.c
+++ b/source3/librpc/tools/ndrdump.c
@@ -281,11 +281,7 @@ static const struct ndr_interface_table *load_iface_from_plugin(const char *plug
exit(1);
}
-#if (_SAMBA_BUILD_ >= 4)
- data = (uint8_t *)file_load(ctx_filename, &size, mem_ctx);
-#else
- data = (uint8_t *)file_load(ctx_filename, &size, 0);
-#endif
+ data = (uint8_t *)file_load(ctx_filename, &size, 0, mem_ctx);
if (!data) {
perror(ctx_filename);
exit(1);
@@ -294,7 +290,7 @@ static const struct ndr_interface_table *load_iface_from_plugin(const char *plug
blob.data = data;
blob.length = size;
- ndr_pull = ndr_pull_init_blob(&blob, mem_ctx);
+ ndr_pull = ndr_pull_init_blob(&blob, mem_ctx, NULL);
ndr_pull->flags |= LIBNDR_FLAG_REF_ALLOC;
ndr_err = f->ndr_pull(ndr_pull, NDR_IN, st);
@@ -312,11 +308,7 @@ static const struct ndr_interface_table *load_iface_from_plugin(const char *plug
}
if (filename)
-#if (_SAMBA_BUILD_ >= 4)
- data = (uint8_t *)file_load(filename, &size, mem_ctx);
-#else
- data = (uint8_t *)file_load(filename, &size, 0);
-#endif
+ data = (uint8_t *)file_load(filename, &size, 0, mem_ctx);
else
data = (uint8_t *)stdin_load(mem_ctx, &size);
@@ -331,7 +323,7 @@ static const struct ndr_interface_table *load_iface_from_plugin(const char *plug
blob.data = data;
blob.length = size;
- ndr_pull = ndr_pull_init_blob(&blob, mem_ctx);
+ ndr_pull = ndr_pull_init_blob(&blob, mem_ctx, NULL);
ndr_pull->flags |= LIBNDR_FLAG_REF_ALLOC;
ndr_err = f->ndr_pull(ndr_pull, flags, st);
@@ -368,7 +360,7 @@ static const struct ndr_interface_table *load_iface_from_plugin(const char *plug
uint8_t byte_a, byte_b;
bool differ;
- ndr_v_push = ndr_push_init_ctx(mem_ctx);
+ ndr_v_push = ndr_push_init_ctx(mem_ctx, NULL);
ndr_err = f->ndr_push(ndr_v_push, flags, st);
status = ndr_map_error2ntstatus(ndr_err);
@@ -385,7 +377,7 @@ static const struct ndr_interface_table *load_iface_from_plugin(const char *plug
dump_data(0, v_blob.data, v_blob.length);
}
- ndr_v_pull = ndr_pull_init_blob(&v_blob, mem_ctx);
+ ndr_v_pull = ndr_pull_init_blob(&v_blob, mem_ctx, NULL);
ndr_v_pull->flags |= LIBNDR_FLAG_REF_ALLOC;
ndr_err = f->ndr_pull(ndr_v_pull, flags, v_st);
diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c
index d5eac07b48..d371e057e3 100644
--- a/source3/libsmb/async_smb.c
+++ b/source3/libsmb/async_smb.c
@@ -924,7 +924,7 @@ static void cli_state_handler(struct event_context *event_ctx,
}
cli->evt_inbuf = tmp;
- res = recv(cli->fd, cli->evt_inbuf + old_size, available, 0);
+ res = sys_recv(cli->fd, cli->evt_inbuf + old_size, available, 0);
if (res == -1) {
DEBUG(10, ("recv failed: %s\n", strerror(errno)));
status = map_nt_error_from_unix(errno);
@@ -970,7 +970,7 @@ static void cli_state_handler(struct event_context *event_ctx,
return;
}
- sent = send(cli->fd, req->outbuf + req->sent,
+ sent = sys_send(cli->fd, req->outbuf + req->sent,
to_send - req->sent, 0);
if (sent < 0) {
diff --git a/source3/libsmb/clidgram.c b/source3/libsmb/clidgram.c
index 8b35a69def..349a8331b4 100644
--- a/source3/libsmb/clidgram.c
+++ b/source3/libsmb/clidgram.c
@@ -136,8 +136,8 @@ bool send_getdc_request(TALLOC_CTX *mem_ctx,
struct in_addr dc_ip;
const char *my_acct_name = NULL;
const char *my_mailslot = NULL;
- struct nbt_ntlogon_packet packet;
- struct nbt_ntlogon_sam_logon *s;
+ struct nbt_netlogon_packet packet;
+ struct NETLOGON_SAM_LOGON_REQUEST *s;
enum ndr_err_code ndr_err;
DATA_BLOB blob;
struct dom_sid my_sid;
@@ -164,7 +164,7 @@ bool send_getdc_request(TALLOC_CTX *mem_ctx,
return false;
}
- packet.command = NTLOGON_SAM_LOGON;
+ packet.command = LOGON_SAM_LOGON_REQUEST;
s = &packet.req.logon;
s->request_count = 0;
@@ -178,11 +178,11 @@ bool send_getdc_request(TALLOC_CTX *mem_ctx,
s->lm20_token = 0xffff;
if (DEBUGLEVEL >= 10) {
- NDR_PRINT_DEBUG(nbt_ntlogon_packet, &packet);
+ NDR_PRINT_DEBUG(nbt_netlogon_packet, &packet);
}
- ndr_err = ndr_push_struct_blob(&blob, mem_ctx, &packet,
- (ndr_push_flags_fn_t)ndr_push_nbt_ntlogon_packet);
+ ndr_err = ndr_push_struct_blob(&blob, mem_ctx, NULL, &packet,
+ (ndr_push_flags_fn_t)ndr_push_nbt_netlogon_packet);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return false;
}
@@ -199,15 +199,16 @@ bool receive_getdc_response(TALLOC_CTX *mem_ctx,
const char *domain_name,
uint32_t *nt_version,
const char **dc_name,
- union nbt_cldap_netlogon **reply)
+ struct netlogon_samlogon_response **_r)
{
struct packet_struct *packet;
const char *my_mailslot = NULL;
struct in_addr dc_ip;
DATA_BLOB blob;
- union nbt_cldap_netlogon r;
+ struct netlogon_samlogon_response r;
union dgram_message_body p;
enum ndr_err_code ndr_err;
+ NTSTATUS status;
const char *returned_dc = NULL;
const char *returned_domain = NULL;
@@ -248,7 +249,7 @@ bool receive_getdc_response(TALLOC_CTX *mem_ctx,
blob.data += 4;
blob.length -= 4;
- ndr_err = ndr_pull_union_blob_all(&blob, mem_ctx, &p, DGRAM_SMB,
+ ndr_err = ndr_pull_union_blob_all(&blob, mem_ctx, NULL, &p, DGRAM_SMB,
(ndr_pull_flags_fn_t)ndr_pull_dgram_smb_packet);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
DEBUG(0,("failed to parse packet\n"));
@@ -266,66 +267,20 @@ bool receive_getdc_response(TALLOC_CTX *mem_ctx,
blob = p.smb.body.trans.data;
- if (!pull_mailslot_cldap_reply(mem_ctx, &blob,
- &r, nt_version))
- {
+ ZERO_STRUCT(r);
+
+ status = pull_netlogon_samlogon_response(&blob, mem_ctx, NULL, &r);
+ if (!NT_STATUS_IS_OK(status)) {
return false;
}
- switch (*nt_version) {
- case 1:
- case 16:
- case 17:
-
- returned_domain = r.logon1.domain_name;
- returned_dc = r.logon1.pdc_name;
- break;
- case 2:
- case 3:
- case 18:
- case 19:
- returned_domain = r.logon3.domain_name;
- returned_dc = r.logon3.pdc_name;
- break;
- case 4:
- case 5:
- case 6:
- case 7:
- returned_domain = r.logon5.domain;
- returned_dc = r.logon5.pdc_name;
- break;
- case 8:
- case 9:
- case 10:
- case 11:
- case 12:
- case 13:
- case 14:
- case 15:
- returned_domain = r.logon13.domain;
- returned_dc = r.logon13.pdc_name;
- break;
- case 20:
- case 21:
- case 22:
- case 23:
- case 24:
- case 25:
- case 26:
- case 27:
- case 28:
- returned_domain = r.logon15.domain;
- returned_dc = r.logon15.pdc_name;
- break;
- case 29:
- case 30:
- case 31:
- returned_domain = r.logon29.domain;
- returned_dc = r.logon29.pdc_name;
- break;
- default:
- return false;
- }
+ map_netlogon_samlogon_response(&r);
+
+ /* do we still need this ? */
+ *nt_version = r.ntver;
+
+ returned_domain = r.data.nt5_ex.domain;
+ returned_dc = r.data.nt5_ex.pdc_name;
if (!strequal(returned_domain, domain_name)) {
DEBUG(3, ("GetDC: Expected domain %s, got %s\n",
@@ -341,10 +296,10 @@ bool receive_getdc_response(TALLOC_CTX *mem_ctx,
if (**dc_name == '\\') *dc_name += 1;
if (**dc_name == '\\') *dc_name += 1;
- if (reply) {
- *reply = (union nbt_cldap_netlogon *)talloc_memdup(
- mem_ctx, &r, sizeof(union nbt_cldap_netlogon));
- if (!*reply) {
+ if (_r) {
+ *_r = (struct netlogon_samlogon_response *)talloc_memdup(
+ mem_ctx, &r, sizeof(struct netlogon_samlogon_response));
+ if (!*_r) {
return false;
}
}
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 9d65fb4e94..8a5aedfde5 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -464,13 +464,11 @@ struct cli_state *cli_initialise(void)
return NULL;
}
- cli = talloc(NULL, struct cli_state);
+ cli = TALLOC_ZERO_P(NULL, struct cli_state);
if (!cli) {
return NULL;
}
- ZERO_STRUCTP(cli);
-
cli->port = 0;
cli->fd = -1;
cli->cnum = -1;
diff --git a/source3/libsmb/clierror.c b/source3/libsmb/clierror.c
index 36746419f7..54f8a7a43c 100644
--- a/source3/libsmb/clierror.c
+++ b/source3/libsmb/clierror.c
@@ -236,142 +236,6 @@ void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *ecode)
*ecode = SVAL(cli->inbuf,smb_err);
}
-/* Return a UNIX errno from a NT status code */
-static const struct {
- NTSTATUS status;
- int error;
-} nt_errno_map[] = {
- {NT_STATUS_ACCESS_VIOLATION, EACCES},
- {NT_STATUS_INVALID_HANDLE, EBADF},
- {NT_STATUS_ACCESS_DENIED, EACCES},
- {NT_STATUS_OBJECT_NAME_NOT_FOUND, ENOENT},
- {NT_STATUS_OBJECT_PATH_NOT_FOUND, ENOENT},
- {NT_STATUS_SHARING_VIOLATION, EBUSY},
- {NT_STATUS_OBJECT_PATH_INVALID, ENOTDIR},
- {NT_STATUS_OBJECT_NAME_COLLISION, EEXIST},
- {NT_STATUS_PATH_NOT_COVERED, ENOENT},
- {NT_STATUS_UNSUCCESSFUL, EINVAL},
- {NT_STATUS_NOT_IMPLEMENTED, ENOSYS},
- {NT_STATUS_IN_PAGE_ERROR, EFAULT},
- {NT_STATUS_BAD_NETWORK_NAME, ENOENT},
-#ifdef EDQUOT
- {NT_STATUS_PAGEFILE_QUOTA, EDQUOT},
- {NT_STATUS_QUOTA_EXCEEDED, EDQUOT},
- {NT_STATUS_REGISTRY_QUOTA_LIMIT, EDQUOT},
- {NT_STATUS_LICENSE_QUOTA_EXCEEDED, EDQUOT},
-#endif
-#ifdef ETIME
- {NT_STATUS_TIMER_NOT_CANCELED, ETIME},
-#endif
- {NT_STATUS_INVALID_PARAMETER, EINVAL},
- {NT_STATUS_NO_SUCH_DEVICE, ENODEV},
- {NT_STATUS_NO_SUCH_FILE, ENOENT},
-#ifdef ENODATA
- {NT_STATUS_END_OF_FILE, ENODATA},
-#endif
-#ifdef ENOMEDIUM
- {NT_STATUS_NO_MEDIA_IN_DEVICE, ENOMEDIUM},
- {NT_STATUS_NO_MEDIA, ENOMEDIUM},
-#endif
- {NT_STATUS_NONEXISTENT_SECTOR, ESPIPE},
- {NT_STATUS_NO_MEMORY, ENOMEM},
- {NT_STATUS_CONFLICTING_ADDRESSES, EADDRINUSE},
- {NT_STATUS_NOT_MAPPED_VIEW, EINVAL},
- {NT_STATUS_UNABLE_TO_FREE_VM, EADDRINUSE},
- {NT_STATUS_ACCESS_DENIED, EACCES},
- {NT_STATUS_BUFFER_TOO_SMALL, ENOBUFS},
- {NT_STATUS_WRONG_PASSWORD, EACCES},
- {NT_STATUS_LOGON_FAILURE, EACCES},
- {NT_STATUS_INVALID_WORKSTATION, EACCES},
- {NT_STATUS_INVALID_LOGON_HOURS, EACCES},
- {NT_STATUS_PASSWORD_EXPIRED, EACCES},
- {NT_STATUS_ACCOUNT_DISABLED, EACCES},
- {NT_STATUS_DISK_FULL, ENOSPC},
- {NT_STATUS_INVALID_PIPE_STATE, EPIPE},
- {NT_STATUS_PIPE_BUSY, EPIPE},
- {NT_STATUS_PIPE_DISCONNECTED, EPIPE},
- {NT_STATUS_PIPE_NOT_AVAILABLE, ENOSYS},
- {NT_STATUS_FILE_IS_A_DIRECTORY, EISDIR},
- {NT_STATUS_NOT_SUPPORTED, ENOSYS},
- {NT_STATUS_NOT_A_DIRECTORY, ENOTDIR},
- {NT_STATUS_DIRECTORY_NOT_EMPTY, ENOTEMPTY},
- {NT_STATUS_NETWORK_UNREACHABLE, ENETUNREACH},
- {NT_STATUS_HOST_UNREACHABLE, EHOSTUNREACH},
- {NT_STATUS_CONNECTION_ABORTED, ECONNABORTED},
- {NT_STATUS_CONNECTION_REFUSED, ECONNREFUSED},
- {NT_STATUS_TOO_MANY_LINKS, EMLINK},
- {NT_STATUS_NETWORK_BUSY, EBUSY},
- {NT_STATUS_DEVICE_DOES_NOT_EXIST, ENODEV},
-#ifdef ELIBACC
- {NT_STATUS_DLL_NOT_FOUND, ELIBACC},
-#endif
- {NT_STATUS_PIPE_BROKEN, EPIPE},
- {NT_STATUS_REMOTE_NOT_LISTENING, ECONNREFUSED},
- {NT_STATUS_NETWORK_ACCESS_DENIED, EACCES},
- {NT_STATUS_TOO_MANY_OPENED_FILES, EMFILE},
-#ifdef EPROTO
- {NT_STATUS_DEVICE_PROTOCOL_ERROR, EPROTO},
-#endif
- {NT_STATUS_FLOAT_OVERFLOW, ERANGE},
- {NT_STATUS_FLOAT_UNDERFLOW, ERANGE},
- {NT_STATUS_INTEGER_OVERFLOW, ERANGE},
- {NT_STATUS_MEDIA_WRITE_PROTECTED, EROFS},
- {NT_STATUS_PIPE_CONNECTED, EISCONN},
- {NT_STATUS_MEMORY_NOT_ALLOCATED, EFAULT},
- {NT_STATUS_FLOAT_INEXACT_RESULT, ERANGE},
- {NT_STATUS_ILL_FORMED_PASSWORD, EACCES},
- {NT_STATUS_PASSWORD_RESTRICTION, EACCES},
- {NT_STATUS_ACCOUNT_RESTRICTION, EACCES},
- {NT_STATUS_PORT_CONNECTION_REFUSED, ECONNREFUSED},
- {NT_STATUS_NAME_TOO_LONG, ENAMETOOLONG},
- {NT_STATUS_REMOTE_DISCONNECT, ESHUTDOWN},
- {NT_STATUS_CONNECTION_DISCONNECTED, ECONNABORTED},
- {NT_STATUS_CONNECTION_RESET, ENETRESET},
-#ifdef ENOTUNIQ
- {NT_STATUS_IP_ADDRESS_CONFLICT1, ENOTUNIQ},
- {NT_STATUS_IP_ADDRESS_CONFLICT2, ENOTUNIQ},
-#endif
- {NT_STATUS_PORT_MESSAGE_TOO_LONG, EMSGSIZE},
- {NT_STATUS_PROTOCOL_UNREACHABLE, ENOPROTOOPT},
- {NT_STATUS_ADDRESS_ALREADY_EXISTS, EADDRINUSE},
- {NT_STATUS_PORT_UNREACHABLE, EHOSTUNREACH},
- {NT_STATUS_IO_TIMEOUT, ETIMEDOUT},
- {NT_STATUS_RETRY, EAGAIN},
-#ifdef ENOTUNIQ
- {NT_STATUS_DUPLICATE_NAME, ENOTUNIQ},
-#endif
-#ifdef ECOMM
- {NT_STATUS_NET_WRITE_FAULT, ECOMM},
-#endif
-#ifdef EXDEV
- {NT_STATUS_NOT_SAME_DEVICE, EXDEV},
-#endif
- {NT_STATUS(0), 0}
-};
-
-/****************************************************************************
- The following mappings need tidying up and moving into libsmb/errormap.c...
-****************************************************************************/
-
-static int cli_errno_from_nt(NTSTATUS status)
-{
- int i;
- DEBUG(10,("cli_errno_from_nt: 32 bit codes: code=%08x\n", NT_STATUS_V(status)));
-
- /* Status codes without this bit set are not errors */
-
- if (!(NT_STATUS_V(status) & 0xc0000000)) {
- return 0;
- }
-
- for (i=0;nt_errno_map[i].error;i++) {
- if (NT_STATUS_V(nt_errno_map[i].status) ==
- NT_STATUS_V(status)) return nt_errno_map[i].error;
- }
-
- /* for all other cases - a default code */
- return EINVAL;
-}
/* Return a UNIX errno appropriate for the error received in the last
packet. */
@@ -382,7 +246,7 @@ int cli_errno(struct cli_state *cli)
if (cli_is_nt_error(cli)) {
status = cli_nt_error(cli);
- return cli_errno_from_nt(status);
+ return map_errno_from_nt_status(status);
}
if (cli_is_dos_error(cli)) {
@@ -391,7 +255,7 @@ int cli_errno(struct cli_state *cli)
cli_dos_error(cli, &eclass, &ecode);
status = dos_to_ntstatus(eclass, ecode);
- return cli_errno_from_nt(status);
+ return map_errno_from_nt_status(status);
}
/*
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index d3819af444..1c525363f7 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -1234,7 +1234,7 @@ bool cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len)
****************************************************************************/
bool cli_lock64(struct cli_state *cli, int fnum,
- SMB_BIG_UINT offset, SMB_BIG_UINT len, int timeout, enum brl_type lock_type)
+ uint64_t offset, uint64_t len, int timeout, enum brl_type lock_type)
{
char *p;
int saved_timeout = cli->timeout;
@@ -1294,7 +1294,7 @@ bool cli_lock64(struct cli_state *cli, int fnum,
Unlock a file with 64 bit offsets.
****************************************************************************/
-bool cli_unlock64(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_UINT len)
+bool cli_unlock64(struct cli_state *cli, int fnum, uint64_t offset, uint64_t len)
{
char *p;
@@ -1341,7 +1341,7 @@ bool cli_unlock64(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_
****************************************************************************/
static bool cli_posix_lock_internal(struct cli_state *cli, int fnum,
- SMB_BIG_UINT offset, SMB_BIG_UINT len, bool wait_lock, enum brl_type lock_type)
+ uint64_t offset, uint64_t len, bool wait_lock, enum brl_type lock_type)
{
unsigned int param_len = 4;
unsigned int data_len = POSIX_LOCK_DATA_SIZE;
@@ -1412,7 +1412,7 @@ static bool cli_posix_lock_internal(struct cli_state *cli, int fnum,
****************************************************************************/
bool cli_posix_lock(struct cli_state *cli, int fnum,
- SMB_BIG_UINT offset, SMB_BIG_UINT len,
+ uint64_t offset, uint64_t len,
bool wait_lock, enum brl_type lock_type)
{
if (lock_type != READ_LOCK && lock_type != WRITE_LOCK) {
@@ -1425,7 +1425,7 @@ bool cli_posix_lock(struct cli_state *cli, int fnum,
POSIX Unlock a file.
****************************************************************************/
-bool cli_posix_unlock(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_BIG_UINT len)
+bool cli_posix_unlock(struct cli_state *cli, int fnum, uint64_t offset, uint64_t len)
{
return cli_posix_lock_internal(cli, fnum, offset, len, False, UNLOCK_LOCK);
}
@@ -1434,7 +1434,7 @@ bool cli_posix_unlock(struct cli_state *cli, int fnum, SMB_BIG_UINT offset, SMB_
POSIX Get any lock covering a file.
****************************************************************************/
-bool cli_posix_getlock(struct cli_state *cli, int fnum, SMB_BIG_UINT *poffset, SMB_BIG_UINT *plen)
+bool cli_posix_getlock(struct cli_state *cli, int fnum, uint64_t *poffset, uint64_t *plen)
{
return True;
}
diff --git a/source3/libsmb/clikrb5.c b/source3/libsmb/clikrb5.c
index b8afb57977..790e8d5369 100644
--- a/source3/libsmb/clikrb5.c
+++ b/source3/libsmb/clikrb5.c
@@ -607,7 +607,7 @@ static bool ads_cleanup_expired_creds(krb5_context context,
DEBUG(3, ("ads_cleanup_expired_creds: Ticket in ccache[%s:%s] expiration %s\n",
cc_type, krb5_cc_get_name(context, ccache),
- http_timestring(credsp->times.endtime)));
+ http_timestring(talloc_tos(), credsp->times.endtime)));
/* we will probably need new tickets if the current ones
will expire within 10 seconds.
@@ -704,7 +704,7 @@ static krb5_error_code ads_krb5_mk_req(krb5_context context,
DEBUG(10,("ads_krb5_mk_req: Ticket (%s) in ccache (%s:%s) is valid until: (%s - %u)\n",
principal, krb5_cc_get_type(context, ccache), krb5_cc_get_name(context, ccache),
- http_timestring((unsigned)credsp->times.endtime),
+ http_timestring(talloc_tos(), (unsigned)credsp->times.endtime),
(unsigned)credsp->times.endtime));
if (expire_time) {
diff --git a/source3/libsmb/cliquota.c b/source3/libsmb/cliquota.c
index f369d28dff..1462aa7a6a 100644
--- a/source3/libsmb/cliquota.c
+++ b/source3/libsmb/cliquota.c
@@ -2,17 +2,17 @@
Unix SMB/CIFS implementation.
client quota functions
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/>.
*/
@@ -25,7 +25,7 @@ bool cli_get_quota_handle(struct cli_state *cli, int *quota_fnum)
0x00000016, DESIRED_ACCESS_PIPE,
0x00000000, FILE_SHARE_READ|FILE_SHARE_WRITE,
FILE_OPEN, 0x00000000, 0x03);
-
+
if (*quota_fnum == (-1)) {
return False;
}
@@ -37,7 +37,7 @@ void free_ntquota_list(SMB_NTQUOTA_LIST **qt_list)
{
if (!qt_list)
return;
-
+
if ((*qt_list)->mem_ctx)
talloc_destroy((*qt_list)->mem_ctx);
@@ -60,7 +60,7 @@ static bool parse_user_quota_record(const char *rdata, unsigned int rdata_count,
if (rdata_count < 40) {
return False;
}
-
+
/* offset to next quota record.
* 4 bytes IVAL(rdata,0)
* unused here...
@@ -78,10 +78,10 @@ static bool parse_user_quota_record(const char *rdata, unsigned int rdata_count,
* maybe its the change time in NTTIME
*/
- /* the used space 8 bytes (SMB_BIG_UINT)*/
- qt.usedspace = (SMB_BIG_UINT)IVAL(rdata,16);
+ /* the used space 8 bytes (uint64_t)*/
+ qt.usedspace = (uint64_t)IVAL(rdata,16);
#ifdef LARGE_SMB_OFF_T
- qt.usedspace |= (((SMB_BIG_UINT)IVAL(rdata,20)) << 32);
+ qt.usedspace |= (((uint64_t)IVAL(rdata,20)) << 32);
#else /* LARGE_SMB_OFF_T */
if ((IVAL(rdata,20) != 0)&&
((qt.usedspace != 0xFFFFFFFF)||
@@ -91,10 +91,10 @@ static bool parse_user_quota_record(const char *rdata, unsigned int rdata_count,
}
#endif /* LARGE_SMB_OFF_T */
- /* the soft quotas 8 bytes (SMB_BIG_UINT)*/
- qt.softlim = (SMB_BIG_UINT)IVAL(rdata,24);
+ /* the soft quotas 8 bytes (uint64_t)*/
+ qt.softlim = (uint64_t)IVAL(rdata,24);
#ifdef LARGE_SMB_OFF_T
- qt.softlim |= (((SMB_BIG_UINT)IVAL(rdata,28)) << 32);
+ qt.softlim |= (((uint64_t)IVAL(rdata,28)) << 32);
#else /* LARGE_SMB_OFF_T */
if ((IVAL(rdata,28) != 0)&&
((qt.softlim != 0xFFFFFFFF)||
@@ -104,10 +104,10 @@ static bool parse_user_quota_record(const char *rdata, unsigned int rdata_count,
}
#endif /* LARGE_SMB_OFF_T */
- /* the hard quotas 8 bytes (SMB_BIG_UINT)*/
- qt.hardlim = (SMB_BIG_UINT)IVAL(rdata,32);
+ /* the hard quotas 8 bytes (uint64_t)*/
+ qt.hardlim = (uint64_t)IVAL(rdata,32);
#ifdef LARGE_SMB_OFF_T
- qt.hardlim |= (((SMB_BIG_UINT)IVAL(rdata,36)) << 32);
+ qt.hardlim |= (((uint64_t)IVAL(rdata,36)) << 32);
#else /* LARGE_SMB_OFF_T */
if ((IVAL(rdata,36) != 0)&&
((qt.hardlim != 0xFFFFFFFF)||
@@ -116,7 +116,7 @@ static bool parse_user_quota_record(const char *rdata, unsigned int rdata_count,
return False;
}
#endif /* LARGE_SMB_OFF_T */
-
+
sid_parse(rdata+40,sid_len,&qt.sid);
qt.qtype = SMB_USER_QUOTA_TYPE;
@@ -149,13 +149,13 @@ bool cli_get_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUC
SIVAL(params, 4,0x00000024);
SIVAL(params, 8,0x00000000);
SIVAL(params,12,0x00000024);
-
+
sid_len = ndr_size_dom_sid(&pqt->sid, 0);
data_len = sid_len+8;
SIVAL(data, 0, 0x00000000);
SIVAL(data, 4, sid_len);
sid_linearize(data+8, sid_len, &pqt->sid);
-
+
if (!cli_send_nt_trans(cli,
NT_TRANSACT_GET_USER_QUOTA,
0,
@@ -204,7 +204,7 @@ bool cli_set_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUC
unsigned int rparam_count=0, rdata_count=0;
unsigned int sid_len;
memset(data,'\0',112);
-
+
if (!cli||!pqt) {
smb_panic("cli_set_user_quota() called with NULL Pointer!");
}
@@ -216,12 +216,12 @@ bool cli_set_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_STRUC
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);
+ SBIG_UINT(data, 8,(uint64_t)0);
SBIG_UINT(data,16,pqt->usedspace);
SBIG_UINT(data,24,pqt->softlim);
SBIG_UINT(data,32,pqt->hardlim);
sid_linearize(data+40, sid_len, &pqt->sid);
-
+
if (!cli_send_nt_trans(cli,
NT_TRANSACT_SET_USER_QUOTA,
0,
@@ -278,7 +278,7 @@ bool cli_list_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_LIST
SIVAL(params, 4,0x00000000);
SIVAL(params, 8,0x00000000);
SIVAL(params,12,0x00000000);
-
+
if (!cli_send_nt_trans(cli,
NT_TRANSACT_GET_USER_QUOTA,
0,
@@ -353,7 +353,7 @@ bool cli_list_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_LIST
DEBUG(1,("Failed to send NT_TRANSACT_GET_USER_QUOTA\n"));
goto cleanup;
}
-
+
SAFE_FREE(rparam);
SAFE_FREE(rdata);
if (!cli_receive_nt_trans(cli,
@@ -369,7 +369,7 @@ bool cli_list_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_LIST
} else {
ret = True;
}
-
+
if (rdata_count == 0) {
break;
}
@@ -389,26 +389,26 @@ bool cli_list_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_LIST
talloc_destroy(mem_ctx);
goto cleanup;
}
-
+
if ((tmp_list_ent->quotas=TALLOC_ZERO_P(mem_ctx,SMB_NTQUOTA_STRUCT))==NULL) {
DEBUG(0,("TALLOC_ZERO() failed\n"));
talloc_destroy(mem_ctx);
goto cleanup;
}
-
+
memcpy(tmp_list_ent->quotas,&qt,sizeof(qt));
tmp_list_ent->mem_ctx = mem_ctx;
-
+
DLIST_ADD((*pqt_list),tmp_list_ent);
}
}
-
+
ret = True;
cleanup:
SAFE_FREE(rparam);
SAFE_FREE(rdata);
-
+
return ret;
}
@@ -427,9 +427,9 @@ bool cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_ST
}
setup = TRANSACT2_QFSINFO;
-
+
SSVAL(param,0,SMB_FS_QUOTA_INFORMATION);
-
+
if (!cli_send_trans(cli, SMBtrans2,
NULL,
0, 0,
@@ -438,7 +438,7 @@ bool cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_ST
NULL, 0, 560)) {
goto cleanup;
}
-
+
if (!cli_receive_trans(cli, SMBtrans2,
&rparam, &rparam_count,
&rdata, &rdata_count)) {
@@ -455,13 +455,13 @@ bool cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_ST
if (rdata_count < 48) {
goto cleanup;
}
-
+
/* unknown_1 24 NULL bytes in pdata*/
- /* the soft quotas 8 bytes (SMB_BIG_UINT)*/
- qt.softlim = (SMB_BIG_UINT)IVAL(rdata,24);
+ /* the soft quotas 8 bytes (uint64_t)*/
+ qt.softlim = (uint64_t)IVAL(rdata,24);
#ifdef LARGE_SMB_OFF_T
- qt.softlim |= (((SMB_BIG_UINT)IVAL(rdata,28)) << 32);
+ qt.softlim |= (((uint64_t)IVAL(rdata,28)) << 32);
#else /* LARGE_SMB_OFF_T */
if ((IVAL(rdata,28) != 0)&&
((qt.softlim != 0xFFFFFFFF)||
@@ -471,10 +471,10 @@ bool cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_ST
}
#endif /* LARGE_SMB_OFF_T */
- /* the hard quotas 8 bytes (SMB_BIG_UINT)*/
- qt.hardlim = (SMB_BIG_UINT)IVAL(rdata,32);
+ /* the hard quotas 8 bytes (uint64_t)*/
+ qt.hardlim = (uint64_t)IVAL(rdata,32);
#ifdef LARGE_SMB_OFF_T
- qt.hardlim |= (((SMB_BIG_UINT)IVAL(rdata,36)) << 32);
+ qt.hardlim |= (((uint64_t)IVAL(rdata,36)) << 32);
#else /* LARGE_SMB_OFF_T */
if ((IVAL(rdata,36) != 0)&&
((qt.hardlim != 0xFFFFFFFF)||
@@ -541,7 +541,7 @@ bool cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_ST
data, 48, 0)) {
goto cleanup;
}
-
+
if (!cli_receive_trans(cli, SMBtrans2,
&rparam, &rparam_count,
&rdata, &rdata_count)) {
@@ -562,18 +562,14 @@ cleanup:
return ret;
}
-static const char *quota_str_static(SMB_BIG_UINT val, bool special, bool _numeric)
+static const char *quota_str_static(uint64_t val, bool special, bool _numeric)
{
const char *result;
if (!_numeric&&special&&(val == SMB_NTQUOTAS_NO_LIMIT)) {
return "NO LIMIT";
}
-#if defined(HAVE_LONGLONG)
- result = talloc_asprintf(talloc_tos(), "%llu", val);
-#else
- result = talloc_asprintf(talloc_tos(), "%lu", val);
-#endif
+ result = talloc_asprintf(talloc_tos(), "%"PRIu64, val);
SMB_ASSERT(result != NULL);
return result;
}
@@ -604,7 +600,7 @@ void dump_ntquota(SMB_NTQUOTA_STRUCT *qt, bool _verbose, bool _numeric, void (*_
case SMB_USER_QUOTA_TYPE:
{
fstring username_str = {0};
-
+
if (_sidtostring) {
_sidtostring(username_str,&qt->sid,_numeric);
} else {
diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c
index ec63281630..cc982683d0 100644
--- a/source3/libsmb/clireadwrite.c
+++ b/source3/libsmb/clireadwrite.c
@@ -70,10 +70,10 @@ struct async_req *cli_read_andx_send(TALLOC_CTX *mem_ctx,
SSVAL(vwv + 8, 0, 0);
SSVAL(vwv + 9, 0, 0);
- if ((SMB_BIG_UINT)offset >> 32) {
+ if ((uint64_t)offset >> 32) {
bigoffset = True;
SIVAL(vwv + 10, 0,
- (((SMB_BIG_UINT)offset)>>32) & 0xffffffff);
+ (((uint64_t)offset)>>32) & 0xffffffff);
wct += 2;
}
@@ -543,7 +543,7 @@ static bool cli_issue_write(struct cli_state *cli,
smb_buf(cli->outbuf) - smb_base(cli->outbuf) + 1);
if (large_writex) {
- SIVAL(cli->outbuf,smb_vwv12,(((SMB_BIG_UINT)offset)>>32) & 0xffffffff);
+ SIVAL(cli->outbuf,smb_vwv12,(((uint64_t)offset)>>32) & 0xffffffff);
}
p = smb_base(cli->outbuf) + SVAL(cli->outbuf,smb_vwv11) -1;
diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c
index 2a445cbd5a..08ab8cad14 100644
--- a/source3/libsmb/dsgetdcname.c
+++ b/source3/libsmb/dsgetdcname.c
@@ -35,8 +35,7 @@ struct ip_service_name {
static NTSTATUS make_dc_info_from_cldap_reply(TALLOC_CTX *mem_ctx,
uint32_t flags,
struct sockaddr_storage *ss,
- uint32_t nt_version,
- union nbt_cldap_netlogon *r,
+ struct NETLOGON_SAM_LOGON_RESPONSE_EX *r,
struct netr_DsRGetDCNameInfo **info);
/****************************************************************
@@ -186,176 +185,51 @@ static NTSTATUS dsgetdcname_cache_store(TALLOC_CTX *mem_ctx,
/****************************************************************
****************************************************************/
-#define SET_STRING(x) \
- talloc_strdup(mem_ctx, x); \
- NT_STATUS_HAVE_NO_MEMORY(x);
-
-static NTSTATUS map_logon29_from_cldap_reply(TALLOC_CTX *mem_ctx,
- uint32_t flags,
- struct sockaddr_storage *ss,
- uint32_t nt_version,
- union nbt_cldap_netlogon *r,
- struct nbt_cldap_netlogon_29 *p)
-{
- char addr[INET6_ADDRSTRLEN];
-
- ZERO_STRUCTP(p);
-
- print_sockaddr(addr, sizeof(addr), ss);
-
- /* FIXME */
- p->dc_sock_addr_size = 0x10; /* the w32 winsock addr size */
- p->dc_sock_addr.family = 2; /* AF_INET */
- p->dc_sock_addr.pdc_ip = talloc_strdup(mem_ctx, addr);
-
- switch (nt_version & 0x0000001f) {
- case 0:
- return NT_STATUS_INVALID_PARAMETER;
- case 1:
- case 16:
- case 17:
- p->pdc_name = SET_STRING(r->logon1.pdc_name);
- p->domain = SET_STRING(r->logon1.domain_name);
-
- if (flags & DS_PDC_REQUIRED) {
- p->server_type = NBT_SERVER_WRITABLE |
- NBT_SERVER_PDC;
- }
- break;
- case 2:
- case 3:
- case 18:
- case 19:
- p->pdc_name = SET_STRING(r->logon3.pdc_name);
- p->domain = SET_STRING(r->logon3.domain_name);
- p->pdc_dns_name = SET_STRING(r->logon3.pdc_dns_name);
- p->dns_domain = SET_STRING(r->logon3.dns_domain);
- p->server_type = r->logon3.server_type;
- p->forest = SET_STRING(r->logon3.forest);
- p->domain_uuid = r->logon3.domain_uuid;
-
- break;
- case 4:
- case 5:
- case 6:
- case 7:
- p->pdc_name = SET_STRING(r->logon5.pdc_name);
- p->domain = SET_STRING(r->logon5.domain);
- p->pdc_dns_name = SET_STRING(r->logon5.pdc_dns_name);
- p->dns_domain = SET_STRING(r->logon5.dns_domain);
- p->server_type = r->logon5.server_type;
- p->forest = SET_STRING(r->logon5.forest);
- p->domain_uuid = r->logon5.domain_uuid;
- p->server_site = SET_STRING(r->logon5.server_site);
- p->client_site = SET_STRING(r->logon5.client_site);
-
- break;
- case 8:
- case 9:
- case 10:
- case 11:
- case 12:
- case 13:
- case 14:
- case 15:
- p->pdc_name = SET_STRING(r->logon13.pdc_name);
- p->domain = SET_STRING(r->logon13.domain);
- p->pdc_dns_name = SET_STRING(r->logon13.pdc_dns_name);
- p->dns_domain = SET_STRING(r->logon13.dns_domain);
- p->server_type = r->logon13.server_type;
- p->forest = SET_STRING(r->logon13.forest);
- p->domain_uuid = r->logon13.domain_uuid;
- p->server_site = SET_STRING(r->logon13.server_site);
- p->client_site = SET_STRING(r->logon13.client_site);
-
- break;
- case 20:
- case 21:
- case 22:
- case 23:
- case 24:
- case 25:
- case 26:
- case 27:
- case 28:
- p->pdc_name = SET_STRING(r->logon15.pdc_name);
- p->domain = SET_STRING(r->logon15.domain);
- p->pdc_dns_name = SET_STRING(r->logon15.pdc_dns_name);
- p->dns_domain = SET_STRING(r->logon15.dns_domain);
- p->server_type = r->logon15.server_type;
- p->forest = SET_STRING(r->logon15.forest);
- p->domain_uuid = r->logon15.domain_uuid;
- p->server_site = SET_STRING(r->logon15.server_site);
- p->client_site = SET_STRING(r->logon15.client_site);
-
- break;
- case 29:
- case 30:
- case 31:
- p->pdc_name = SET_STRING(r->logon29.pdc_name);
- p->domain = SET_STRING(r->logon29.domain);
- p->pdc_dns_name = SET_STRING(r->logon29.pdc_dns_name);
- p->dns_domain = SET_STRING(r->logon29.dns_domain);
- p->server_type = r->logon29.server_type;
- p->forest = SET_STRING(r->logon29.forest);
- p->domain_uuid = r->logon29.domain_uuid;
- p->server_site = SET_STRING(r->logon29.server_site);
- p->client_site = SET_STRING(r->logon29.client_site);
- p->next_closest_site = SET_STRING(r->logon29.next_closest_site);
-
- break;
- default:
- return NT_STATUS_INVALID_PARAMETER;
- }
-
- return NT_STATUS_OK;
-}
-
-/****************************************************************
-****************************************************************/
-
static NTSTATUS store_cldap_reply(TALLOC_CTX *mem_ctx,
uint32_t flags,
struct sockaddr_storage *ss,
uint32_t nt_version,
- union nbt_cldap_netlogon *r)
+ struct NETLOGON_SAM_LOGON_RESPONSE_EX *r)
{
DATA_BLOB blob;
enum ndr_err_code ndr_err;
NTSTATUS status;
- struct nbt_cldap_netlogon_29 logon29;
+ char addr[INET6_ADDRSTRLEN];
- status = map_logon29_from_cldap_reply(mem_ctx, flags, ss,
- nt_version, r, &logon29);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
+ print_sockaddr(addr, sizeof(addr), ss);
+
+ /* FIXME */
+ r->sockaddr_size = 0x10; /* the w32 winsock addr size */
+ r->sockaddr.sockaddr_family = 2; /* AF_INET */
+ r->sockaddr.pdc_ip = talloc_strdup(mem_ctx, addr);
- ndr_err = ndr_push_struct_blob(&blob, mem_ctx, &logon29,
- (ndr_push_flags_fn_t)ndr_push_nbt_cldap_netlogon_29);
+ ndr_err = ndr_push_struct_blob(&blob, mem_ctx, NULL, r,
+ (ndr_push_flags_fn_t)ndr_push_NETLOGON_SAM_LOGON_RESPONSE_EX);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
return ndr_map_error2ntstatus(ndr_err);
}
- if (logon29.domain) {
- status = dsgetdcname_cache_store(mem_ctx, logon29.domain, &blob);
+ if (r->domain) {
+ status = dsgetdcname_cache_store(mem_ctx, r->domain, &blob);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
- if (logon29.client_site) {
- sitename_store(logon29.domain, logon29.client_site);
+ if (r->client_site) {
+ sitename_store(r->domain, r->client_site);
}
}
- if (logon29.dns_domain) {
- status = dsgetdcname_cache_store(mem_ctx, logon29.dns_domain, &blob);
+ if (r->dns_domain) {
+ status = dsgetdcname_cache_store(mem_ctx, r->dns_domain, &blob);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
- if (logon29.client_site) {
- sitename_store(logon29.dns_domain, logon29.client_site);
+ if (r->client_site) {
+ sitename_store(r->dns_domain, r->client_site);
}
}
+ status = NT_STATUS_OK;
+
done:
data_blob_free(&blob);
@@ -387,7 +261,7 @@ static NTSTATUS dsgetdcname_cache_refresh(TALLOC_CTX *mem_ctx,
/****************************************************************
****************************************************************/
-static uint32_t get_cldap_reply_server_flags(union nbt_cldap_netlogon *r,
+static uint32_t get_cldap_reply_server_flags(struct netlogon_samlogon_response *r,
uint32_t nt_version)
{
switch (nt_version & 0x0000001f) {
@@ -400,12 +274,12 @@ static uint32_t get_cldap_reply_server_flags(union nbt_cldap_netlogon *r,
case 3:
case 18:
case 19:
- return r->logon3.server_type;
+ return r->data.nt5.server_type;
case 4:
case 5:
case 6:
case 7:
- return r->logon5.server_type;
+ return r->data.nt5_ex.server_type;
case 8:
case 9:
case 10:
@@ -414,7 +288,7 @@ static uint32_t get_cldap_reply_server_flags(union nbt_cldap_netlogon *r,
case 13:
case 14:
case 15:
- return r->logon13.server_type;
+ return r->data.nt5_ex.server_type;
case 20:
case 21:
case 22:
@@ -424,11 +298,11 @@ static uint32_t get_cldap_reply_server_flags(union nbt_cldap_netlogon *r,
case 26:
case 27:
case 28:
- return r->logon15.server_type;
+ return r->data.nt5_ex.server_type;
case 29:
case 30:
case 31:
- return r->logon29.server_type;
+ return r->data.nt5_ex.server_type;
default:
return 0;
}
@@ -486,8 +360,7 @@ static NTSTATUS dsgetdcname_cache_fetch(TALLOC_CTX *mem_ctx,
DATA_BLOB blob;
enum ndr_err_code ndr_err;
struct netr_DsRGetDCNameInfo *info;
- union nbt_cldap_netlogon p;
- struct nbt_cldap_netlogon_29 r;
+ struct NETLOGON_SAM_LOGON_RESPONSE_EX r;
NTSTATUS status;
if (!gencache_init()) {
@@ -508,8 +381,8 @@ static NTSTATUS dsgetdcname_cache_fetch(TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_MEMORY;
}
- ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, &r,
- (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon_29);
+ ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, NULL, &r,
+ (ndr_pull_flags_fn_t)ndr_pull_NETLOGON_SAM_LOGON_RESPONSE_EX);
data_blob_free(&blob);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -517,11 +390,8 @@ static NTSTATUS dsgetdcname_cache_fetch(TALLOC_CTX *mem_ctx,
return ndr_map_error2ntstatus(ndr_err);
}
- p.logon29 = r;
-
status = make_dc_info_from_cldap_reply(mem_ctx, flags, NULL,
- 29,
- &p, &info);
+ &r, &info);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -916,8 +786,7 @@ static void map_dc_and_domain_names(uint32_t flags,
static NTSTATUS make_dc_info_from_cldap_reply(TALLOC_CTX *mem_ctx,
uint32_t flags,
struct sockaddr_storage *ss,
- uint32_t nt_version,
- union nbt_cldap_netlogon *r,
+ struct NETLOGON_SAM_LOGON_RESPONSE_EX *r,
struct netr_DsRGetDCNameInfo **info)
{
const char *dc_hostname = NULL;
@@ -938,163 +807,28 @@ static NTSTATUS make_dc_info_from_cldap_reply(TALLOC_CTX *mem_ctx,
dc_address_type = DS_ADDRESS_TYPE_INET;
}
- switch (nt_version & 0x0000001f) {
- case 0:
- case 1:
- case 16:
- case 17:
- if (!ss) {
- dc_address = r->logon1.pdc_name;
- dc_address_type = DS_ADDRESS_TYPE_NETBIOS;
- }
-
- map_dc_and_domain_names(flags,
- r->logon1.pdc_name,
- r->logon1.domain_name,
- NULL,
- NULL,
- &dc_flags,
- &dc_hostname,
- &dc_domain_name);
-
- if (flags & DS_PDC_REQUIRED) {
- dc_flags = NBT_SERVER_WRITABLE | NBT_SERVER_PDC;
- }
- break;
- case 2:
- case 3:
- case 18:
- case 19:
- if (!ss) {
- dc_address = r->logon3.pdc_ip;
- dc_address_type = DS_ADDRESS_TYPE_INET;
- }
-
- map_dc_and_domain_names(flags,
- r->logon3.pdc_name,
- r->logon3.domain_name,
- r->logon3.pdc_dns_name,
- r->logon3.dns_domain,
- &dc_flags,
- &dc_hostname,
- &dc_domain_name);
-
- dc_flags |= r->logon3.server_type;
- dc_forest = r->logon3.forest;
- dc_domain_guid = &r->logon3.domain_uuid;
-
- break;
- case 4:
- case 5:
- case 6:
- case 7:
- if (!ss) {
- dc_address = r->logon5.pdc_name;
- dc_address_type = DS_ADDRESS_TYPE_NETBIOS;
- }
-
- map_dc_and_domain_names(flags,
- r->logon5.pdc_name,
- r->logon5.domain,
- r->logon5.pdc_dns_name,
- r->logon5.dns_domain,
- &dc_flags,
- &dc_hostname,
- &dc_domain_name);
-
- dc_flags |= r->logon5.server_type;
- dc_forest = r->logon5.forest;
- dc_domain_guid = &r->logon5.domain_uuid;
- dc_server_site = r->logon5.server_site;
- dc_client_site = r->logon5.client_site;
-
- break;
- case 8:
- case 9:
- case 10:
- case 11:
- case 12:
- case 13:
- case 14:
- case 15:
- if (!ss) {
- dc_address = r->logon13.dc_sock_addr.pdc_ip;
- dc_address_type = DS_ADDRESS_TYPE_INET;
- }
-
- map_dc_and_domain_names(flags,
- r->logon13.pdc_name,
- r->logon13.domain,
- r->logon13.pdc_dns_name,
- r->logon13.dns_domain,
- &dc_flags,
- &dc_hostname,
- &dc_domain_name);
-
- dc_flags |= r->logon13.server_type;
- dc_forest = r->logon13.forest;
- dc_domain_guid = &r->logon13.domain_uuid;
- dc_server_site = r->logon13.server_site;
- dc_client_site = r->logon13.client_site;
-
- break;
- case 20:
- case 21:
- case 22:
- case 23:
- case 24:
- case 25:
- case 26:
- case 27:
- case 28:
- if (!ss) {
- dc_address = r->logon15.pdc_name;
- dc_address_type = DS_ADDRESS_TYPE_NETBIOS;
- }
+ if (!ss && r->sockaddr.pdc_ip) {
+ dc_address = r->sockaddr.pdc_ip;
+ dc_address_type = DS_ADDRESS_TYPE_INET;
+ } else {
+ dc_address = r->pdc_name;
+ dc_address_type = DS_ADDRESS_TYPE_NETBIOS;
+ }
- map_dc_and_domain_names(flags,
- r->logon15.pdc_name,
- r->logon15.domain,
- r->logon15.pdc_dns_name,
- r->logon15.dns_domain,
- &dc_flags,
- &dc_hostname,
- &dc_domain_name);
-
- dc_flags |= r->logon15.server_type;
- dc_forest = r->logon15.forest;
- dc_domain_guid = &r->logon15.domain_uuid;
- dc_server_site = r->logon15.server_site;
- dc_client_site = r->logon15.client_site;
-
- break;
- case 29:
- case 30:
- case 31:
- if (!ss) {
- dc_address = r->logon29.dc_sock_addr.pdc_ip;
- dc_address_type = DS_ADDRESS_TYPE_INET;
- }
+ map_dc_and_domain_names(flags,
+ r->pdc_name,
+ r->domain,
+ r->pdc_dns_name,
+ r->dns_domain,
+ &dc_flags,
+ &dc_hostname,
+ &dc_domain_name);
- map_dc_and_domain_names(flags,
- r->logon29.pdc_name,
- r->logon29.domain,
- r->logon29.pdc_dns_name,
- r->logon29.dns_domain,
- &dc_flags,
- &dc_hostname,
- &dc_domain_name);
-
- dc_flags |= r->logon29.server_type;
- dc_forest = r->logon29.forest;
- dc_domain_guid = &r->logon29.domain_uuid;
- dc_server_site = r->logon29.server_site;
- dc_client_site = r->logon29.client_site;
-
- break;
- default:
- return NT_STATUS_INVALID_PARAMETER;
- }
+ dc_flags |= r->server_type;
+ dc_forest = r->forest;
+ dc_domain_guid = &r->domain_uuid;
+ dc_server_site = r->server_site;
+ dc_client_site = r->client_site;
return make_domain_controller_info(mem_ctx,
dc_hostname,
@@ -1117,19 +851,19 @@ static uint32_t map_ds_flags_to_nt_version(uint32_t flags)
uint32_t nt_version = 0;
if (flags & DS_PDC_REQUIRED) {
- nt_version |= NETLOGON_VERSION_PDC;
+ nt_version |= NETLOGON_NT_VERSION_PDC;
}
if (flags & DS_GC_SERVER_REQUIRED) {
- nt_version |= NETLOGON_VERSION_GC;
+ nt_version |= NETLOGON_NT_VERSION_GC;
}
if (flags & DS_TRY_NEXTCLOSEST_SITE) {
- nt_version |= NETLOGON_VERSION_WITH_CLOSEST_SITE;
+ nt_version |= NETLOGON_NT_VERSION_WITH_CLOSEST_SITE;
}
if (flags & DS_IP_REQUIRED) {
- nt_version |= NETLOGON_VERSION_IP;
+ nt_version |= NETLOGON_NT_VERSION_IP;
}
return nt_version;
@@ -1147,9 +881,9 @@ static NTSTATUS process_dc_dns(TALLOC_CTX *mem_ctx,
{
int i = 0;
bool valid_dc = false;
- union nbt_cldap_netlogon *r = NULL;
- uint32_t nt_version = NETLOGON_VERSION_5 |
- NETLOGON_VERSION_5EX;
+ struct netlogon_samlogon_response *r = NULL;
+ uint32_t nt_version = NETLOGON_NT_VERSION_5 |
+ NETLOGON_NT_VERSION_5EX;
uint32_t ret_flags = 0;
NTSTATUS status;
@@ -1161,9 +895,10 @@ static NTSTATUS process_dc_dns(TALLOC_CTX *mem_ctx,
if (ads_cldap_netlogon(mem_ctx, dclist[i].hostname,
domain_name,
- &nt_version,
+ nt_version,
&r))
{
+ nt_version = r->ntver;
ret_flags = get_cldap_reply_server_flags(r, nt_version);
if (check_cldap_reply_required_flags(ret_flags, flags)) {
@@ -1180,10 +915,10 @@ static NTSTATUS process_dc_dns(TALLOC_CTX *mem_ctx,
}
status = make_dc_info_from_cldap_reply(mem_ctx, flags, &dclist[i].ss,
- nt_version, r, info);
+ &r->data.nt5_ex, info);
if (NT_STATUS_IS_OK(status)) {
return store_cldap_reply(mem_ctx, flags, &dclist[i].ss,
- nt_version, r);
+ nt_version, &r->data.nt5_ex);
}
return status;
@@ -1234,11 +969,11 @@ static NTSTATUS process_dc_netbios(TALLOC_CTX *mem_ctx,
int i;
const char *dc_name = NULL;
fstring tmp_dc_name;
- union nbt_cldap_netlogon *r = NULL;
+ struct netlogon_samlogon_response *r = NULL;
bool store_cache = false;
- uint32_t nt_version = NETLOGON_VERSION_1 |
- NETLOGON_VERSION_5 |
- NETLOGON_VERSION_5EX_WITH_IP;
+ uint32_t nt_version = NETLOGON_NT_VERSION_1 |
+ NETLOGON_NT_VERSION_5 |
+ NETLOGON_NT_VERSION_5EX_WITH_IP;
if (!msg_ctx) {
msg_ctx = msg_context(mem_ctx);
@@ -1288,21 +1023,22 @@ static NTSTATUS process_dc_netbios(TALLOC_CTX *mem_ctx,
&dclist[i].ss,
tmp_dc_name))
{
- struct nbt_cldap_netlogon_1 logon1;
+ struct NETLOGON_SAM_LOGON_RESPONSE_NT40 logon1;
- r = TALLOC_ZERO_P(mem_ctx, union nbt_cldap_netlogon);
+ r = TALLOC_ZERO_P(mem_ctx, struct netlogon_samlogon_response);
NT_STATUS_HAVE_NO_MEMORY(r);
ZERO_STRUCT(logon1);
- nt_version = NETLOGON_VERSION_1;
+ nt_version = NETLOGON_NT_VERSION_1;
logon1.nt_version = nt_version;
- logon1.pdc_name = tmp_dc_name;
- logon1.domain_name = talloc_strdup_upper(mem_ctx, domain_name);
- NT_STATUS_HAVE_NO_MEMORY(logon1.domain_name);
+ logon1.server = tmp_dc_name;
+ logon1.domain = talloc_strdup_upper(mem_ctx, domain_name);
+ NT_STATUS_HAVE_NO_MEMORY(logon1.domain);
- r->logon1 = logon1;
+ r->data.nt4 = logon1;
+ r->ntver = nt_version;
namecache_store(tmp_dc_name, NBT_NAME_SERVER, 1, &ip_list);
@@ -1315,10 +1051,10 @@ static NTSTATUS process_dc_netbios(TALLOC_CTX *mem_ctx,
make_reply:
status = make_dc_info_from_cldap_reply(mem_ctx, flags, &dclist[i].ss,
- nt_version, r, info);
+ &r->data.nt5_ex, info);
if (NT_STATUS_IS_OK(status) && store_cache) {
return store_cldap_reply(mem_ctx, flags, &dclist[i].ss,
- nt_version, r);
+ nt_version, &r->data.nt5_ex);
}
return status;
diff --git a/source3/libsmb/libsmb_xattr.c b/source3/libsmb/libsmb_xattr.c
index f1b3d1415e..ea2c46953c 100644
--- a/source3/libsmb/libsmb_xattr.c
+++ b/source3/libsmb/libsmb_xattr.c
@@ -266,7 +266,7 @@ parse_ace(struct cli_state *ipc_cli,
unsigned int aflags;
unsigned int amask;
DOM_SID sid;
- SEC_ACCESS mask;
+ uint32_t mask;
const struct perm_value *v;
struct perm_value {
const char *perm;
diff --git a/source3/libsmb/ntlmssp_sign.c b/source3/libsmb/ntlmssp_sign.c
index 8413c8066b..d3d358d332 100644
--- a/source3/libsmb/ntlmssp_sign.c
+++ b/source3/libsmb/ntlmssp_sign.c
@@ -35,6 +35,12 @@
*
*/
+static void dump_arc4_state(const char *description,
+ struct arcfour_state *state)
+{
+ dump_data_pw(description, state->sbox, sizeof(state->sbox));
+}
+
static void calc_ntlmv2_key(unsigned char subkey[16],
DATA_BLOB session_key,
const char *constant)
@@ -101,10 +107,10 @@ static NTSTATUS ntlmssp_make_packet_signature(NTLMSSP_STATE *ntlmssp_state,
if (encrypt_sig && (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_KEY_EXCH)) {
switch (direction) {
case NTLMSSP_SEND:
- smb_arc4_crypt(ntlmssp_state->send_seal_arc4_state, digest, 8);
+ arcfour_crypt_sbox(&ntlmssp_state->send_seal_arc4_state, digest, 8);
break;
case NTLMSSP_RECEIVE:
- smb_arc4_crypt(ntlmssp_state->recv_seal_arc4_state, digest, 8);
+ arcfour_crypt_sbox(&ntlmssp_state->recv_seal_arc4_state, digest, 8);
break;
}
}
@@ -117,16 +123,15 @@ static NTSTATUS ntlmssp_make_packet_signature(NTLMSSP_STATE *ntlmssp_state,
} else {
uint32 crc;
- crc = crc32_calc_buffer((const char *)data, length);
+ crc = crc32_calc_buffer(data, length);
if (!msrpc_gen(sig, "dddd", NTLMSSP_SIGN_VERSION, 0, crc, ntlmssp_state->ntlmv1_seq_num)) {
return NT_STATUS_NO_MEMORY;
}
ntlmssp_state->ntlmv1_seq_num++;
- dump_data_pw("ntlmssp hash:\n", ntlmssp_state->ntlmv1_arc4_state,
- sizeof(ntlmssp_state->ntlmv1_arc4_state));
- smb_arc4_crypt(ntlmssp_state->ntlmv1_arc4_state, sig->data+4, sig->length-4);
+ dump_arc4_state("ntlmssp hash: \n", &ntlmssp_state->ntlmv1_arc4_state);
+ arcfour_crypt_sbox(&ntlmssp_state->ntlmv1_arc4_state, sig->data+4, sig->length-4);
}
return NT_STATUS_OK;
}
@@ -259,13 +264,13 @@ NTSTATUS ntlmssp_seal_packet(NTLMSSP_STATE *ntlmssp_state,
return nt_status;
}
- smb_arc4_crypt(ntlmssp_state->send_seal_arc4_state, data, length);
+ arcfour_crypt_sbox(&ntlmssp_state->send_seal_arc4_state, data, length);
if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_KEY_EXCH) {
- smb_arc4_crypt(ntlmssp_state->send_seal_arc4_state, sig->data+4, 8);
+ arcfour_crypt_sbox(&ntlmssp_state->send_seal_arc4_state, sig->data+4, 8);
}
} else {
uint32 crc;
- crc = crc32_calc_buffer((const char *)data, length);
+ crc = crc32_calc_buffer(data, length);
if (!msrpc_gen(sig, "dddd", NTLMSSP_SIGN_VERSION, 0, crc, ntlmssp_state->ntlmv1_seq_num)) {
return NT_STATUS_NO_MEMORY;
}
@@ -274,14 +279,14 @@ NTSTATUS ntlmssp_seal_packet(NTLMSSP_STATE *ntlmssp_state,
then seal the sequence number - this is becouse the ntlmv1_arc4_state is not
constant, but is is rather updated with each iteration */
- dump_data_pw("ntlmv1 arc4 state:\n", ntlmssp_state->ntlmv1_arc4_state,
- sizeof(ntlmssp_state->ntlmv1_arc4_state));
- smb_arc4_crypt(ntlmssp_state->ntlmv1_arc4_state, data, length);
+ dump_arc4_state("ntlmv1 arc4 state:\n",
+ &ntlmssp_state->ntlmv1_arc4_state);
+ arcfour_crypt_sbox(&ntlmssp_state->ntlmv1_arc4_state, data, length);
- dump_data_pw("ntlmv1 arc4 state:\n", ntlmssp_state->ntlmv1_arc4_state,
- sizeof(ntlmssp_state->ntlmv1_arc4_state));
+ dump_arc4_state("ntlmv1 arc4 state:\n",
+ &ntlmssp_state->ntlmv1_arc4_state);
- smb_arc4_crypt(ntlmssp_state->ntlmv1_arc4_state, sig->data+4, sig->length-4);
+ arcfour_crypt_sbox(&ntlmssp_state->ntlmv1_arc4_state, sig->data+4, sig->length-4);
ntlmssp_state->ntlmv1_seq_num++;
}
@@ -311,10 +316,10 @@ NTSTATUS ntlmssp_unseal_packet(NTLMSSP_STATE *ntlmssp_state,
if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_NTLM2) {
/* First unseal the data. */
- smb_arc4_crypt(ntlmssp_state->recv_seal_arc4_state, data, length);
+ arcfour_crypt_sbox(&ntlmssp_state->recv_seal_arc4_state, data, length);
dump_data_pw("ntlmv2 clear data\n", data, length);
} else {
- smb_arc4_crypt(ntlmssp_state->ntlmv1_arc4_state, data, length);
+ arcfour_crypt_sbox(&ntlmssp_state->ntlmv1_arc4_state, data, length);
dump_data_pw("ntlmv1 clear data\n", data, length);
}
return ntlmssp_check_packet(ntlmssp_state, data, length, whole_pdu, pdu_length, sig);
@@ -349,6 +354,7 @@ NTSTATUS ntlmssp_sign_init(NTLMSSP_STATE *ntlmssp_state)
const char *send_seal_const;
const char *recv_sign_const;
const char *recv_seal_const;
+ DATA_BLOB send_seal_key_blob, recv_seal_blob;
switch (ntlmssp_state->role) {
case NTLMSSP_CLIENT:
@@ -397,12 +403,13 @@ NTSTATUS ntlmssp_sign_init(NTLMSSP_STATE *ntlmssp_state)
dump_data_pw("NTLMSSP send seal key:\n",
ntlmssp_state->send_seal_key, 16);
- smb_arc4_init(ntlmssp_state->send_seal_arc4_state,
- ntlmssp_state->send_seal_key, 16);
+ send_seal_key_blob.data = ntlmssp_state->send_seal_key;
+ send_seal_key_blob.length = 16;
+ arcfour_init(&ntlmssp_state->send_seal_arc4_state,
+ &send_seal_key_blob);
- dump_data_pw("NTLMSSP send seal arc4 state:\n",
- ntlmssp_state->send_seal_arc4_state,
- sizeof(ntlmssp_state->send_seal_arc4_state));
+ dump_arc4_state("NTLMSSP send seal arc4 state:\n",
+ &ntlmssp_state->send_seal_arc4_state);
/* RECV: sign key */
calc_ntlmv2_key(ntlmssp_state->recv_sign_key,
@@ -417,12 +424,13 @@ NTSTATUS ntlmssp_sign_init(NTLMSSP_STATE *ntlmssp_state)
dump_data_pw("NTLMSSP recv seal key:\n",
ntlmssp_state->recv_seal_key, 16);
- smb_arc4_init(ntlmssp_state->recv_seal_arc4_state,
- ntlmssp_state->recv_seal_key, 16);
+ recv_seal_blob.data = ntlmssp_state->recv_seal_key;
+ recv_seal_blob.length = 16;
+ arcfour_init(&ntlmssp_state->recv_seal_arc4_state,
+ &recv_seal_blob);
- dump_data_pw("NTLMSSP recv seal arc4 state:\n",
- ntlmssp_state->recv_seal_arc4_state,
- sizeof(ntlmssp_state->recv_seal_arc4_state));
+ dump_arc4_state("NTLMSSP recv seal arc4 state:\n",
+ &ntlmssp_state->recv_seal_arc4_state);
ntlmssp_state->ntlm2_send_seq_num = 0;
ntlmssp_state->ntlm2_recv_seq_num = 0;
@@ -454,11 +462,11 @@ NTSTATUS ntlmssp_sign_init(NTLMSSP_STATE *ntlmssp_state)
DEBUG(5, ("NTLMSSP Sign/Seal - using NTLM1\n"));
- smb_arc4_init(ntlmssp_state->ntlmv1_arc4_state,
- weak_session_key.data, weak_session_key.length);
+ arcfour_init(&ntlmssp_state->ntlmv1_arc4_state,
+ &weak_session_key);
- dump_data_pw("NTLMv1 arc4 state:\n", ntlmssp_state->ntlmv1_arc4_state,
- sizeof(ntlmssp_state->ntlmv1_arc4_state));
+ dump_arc4_state("NTLMv1 arc4 state:\n",
+ &ntlmssp_state->ntlmv1_arc4_state);
ntlmssp_state->ntlmv1_seq_num = 0;
}
diff --git a/source3/libsmb/samlogon_cache.c b/source3/libsmb/samlogon_cache.c
index 4abe5bb6de..7af93cf2e0 100644
--- a/source3/libsmb/samlogon_cache.c
+++ b/source3/libsmb/samlogon_cache.c
@@ -22,6 +22,7 @@
*/
#include "includes.h"
+#include "librpc/gen_ndr/ndr_krb5pac.h"
#define NETSAMLOGON_TDB "netsamlogon_cache.tdb"
@@ -141,7 +142,7 @@ bool netsamlogon_cache_store(const char *username, struct netr_SamInfo3 *info3)
NDR_PRINT_DEBUG(netsamlogoncache_entry, &r);
}
- ndr_err = ndr_push_struct_blob(&blob, mem_ctx, &r,
+ ndr_err = ndr_push_struct_blob(&blob, mem_ctx, NULL, &r,
(ndr_push_flags_fn_t)ndr_push_netsamlogoncache_entry);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
DEBUG(0,("netsamlogon_cache_store: failed to push entry to cache\n"));
@@ -197,7 +198,7 @@ struct netr_SamInfo3 *netsamlogon_cache_get(TALLOC_CTX *mem_ctx, const DOM_SID *
blob = data_blob_const(data.dptr, data.dsize);
- ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, &r,
+ ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, NULL, &r,
(ndr_pull_flags_fn_t)ndr_pull_netsamlogoncache_entry);
if (DEBUGLEVEL >= 10) {
diff --git a/source3/libsmb/smbdes.c b/source3/libsmb/smbdes.c
index 98d5cd05b7..8087d66799 100644
--- a/source3/libsmb/smbdes.c
+++ b/source3/libsmb/smbdes.c
@@ -388,18 +388,19 @@ void des_crypt112_16(unsigned char out[16], unsigned char in[16], const unsigned
void SamOEMhash( unsigned char *data, const unsigned char key[16], size_t len)
{
- unsigned char arc4_state[258];
+ struct arcfour_state arc4_state;
+ const DATA_BLOB keyblob = data_blob_const(key, 16);
- smb_arc4_init(arc4_state, key, 16);
- smb_arc4_crypt(arc4_state, data, len);
+ arcfour_init(&arc4_state, &keyblob);
+ arcfour_crypt_sbox(&arc4_state, data, len);
}
void SamOEMhashBlob( unsigned char *data, size_t len, DATA_BLOB *key)
{
- unsigned char arc4_state[258];
+ struct arcfour_state arc4_state;
- smb_arc4_init(arc4_state, key->data, key->length);
- smb_arc4_crypt(arc4_state, data, len);
+ arcfour_init(&arc4_state, key);
+ arcfour_crypt_sbox(&arc4_state, data, len);
}
/* Decode a sam password hash into a password. The password hash is the
diff --git a/source3/libsmb/smbencrypt.c b/source3/libsmb/smbencrypt.c
index 0742976635..ee162b1b2d 100644
--- a/source3/libsmb/smbencrypt.c
+++ b/source3/libsmb/smbencrypt.c
@@ -22,7 +22,7 @@
*/
#include "includes.h"
-#include "byteorder.h"
+#include "../lib/util/byteorder.h"
void SMBencrypt_hash(const uchar lm_hash[16], const uchar *c8, uchar p24[24])
{
@@ -847,7 +847,7 @@ DATA_BLOB decrypt_drsuapi_blob(TALLOC_CTX *mem_ctx,
* of the remaining bytes
*/
crc32_given = IVAL(dec_buffer.data, 0);
- crc32_calc = crc32_calc_buffer((const char *)dec_buffer.data + 4 , dec_buffer.length - 4);
+ crc32_calc = crc32_calc_buffer(dec_buffer.data + 4 , dec_buffer.length - 4);
if (crc32_given != crc32_calc) {
DEBUG(1,("CRC32: given[0x%08X] calc[0x%08X]\n",
crc32_given, crc32_calc));
diff --git a/source3/libsmb/trusts_util.c b/source3/libsmb/trusts_util.c
index 08a49930b4..f0595695d2 100644
--- a/source3/libsmb/trusts_util.c
+++ b/source3/libsmb/trusts_util.c
@@ -22,104 +22,6 @@
/*********************************************************
Change the domain password on the PDC.
-
- Just changes the password betwen the two values specified.
-
- Caller must have the cli connected to the netlogon pipe
- already.
-**********************************************************/
-
-static NTSTATUS just_change_the_password(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- const unsigned char orig_trust_passwd_hash[16],
- const char *new_trust_pwd_cleartext,
- const unsigned char new_trust_passwd_hash[16],
- uint32 sec_channel_type)
-{
- NTSTATUS result;
- uint32_t neg_flags = NETLOGON_NEG_AUTH2_ADS_FLAGS;
-
- result = rpccli_netlogon_setup_creds(cli,
- cli->desthost, /* server name */
- lp_workgroup(), /* domain */
- global_myname(), /* client name */
- global_myname(), /* machine account name */
- orig_trust_passwd_hash,
- sec_channel_type,
- &neg_flags);
-
- if (!NT_STATUS_IS_OK(result)) {
- DEBUG(3,("just_change_the_password: unable to setup creds (%s)!\n",
- nt_errstr(result)));
- return result;
- }
-
- if (neg_flags & NETLOGON_NEG_PASSWORD_SET2) {
-
- struct netr_Authenticator clnt_creds, srv_cred;
- struct netr_CryptPassword new_password;
- struct samr_CryptPassword password_buf;
-
- netlogon_creds_client_step(cli->dc, &clnt_creds);
-
- encode_pw_buffer(password_buf.data, new_trust_pwd_cleartext, STR_UNICODE);
-
- SamOEMhash(password_buf.data, cli->dc->sess_key, 516);
- memcpy(new_password.data, password_buf.data, 512);
- new_password.length = IVAL(password_buf.data, 512);
-
- result = rpccli_netr_ServerPasswordSet2(cli, mem_ctx,
- cli->dc->remote_machine,
- cli->dc->mach_acct,
- sec_channel_type,
- global_myname(),
- &clnt_creds,
- &srv_cred,
- &new_password);
-
- /* Always check returned credentials. */
- if (!netlogon_creds_client_check(cli->dc, &srv_cred.cred)) {
- DEBUG(0,("rpccli_netr_ServerPasswordSet2: "
- "credentials chain check failed\n"));
- return NT_STATUS_ACCESS_DENIED;
- }
-
- } else {
-
- struct netr_Authenticator clnt_creds, srv_cred;
- struct samr_Password new_password;
-
- netlogon_creds_client_step(cli->dc, &clnt_creds);
-
- cred_hash3(new_password.hash,
- new_trust_passwd_hash,
- cli->dc->sess_key, 1);
-
- result = rpccli_netr_ServerPasswordSet(cli, mem_ctx,
- cli->dc->remote_machine,
- cli->dc->mach_acct,
- sec_channel_type,
- global_myname(),
- &clnt_creds,
- &srv_cred,
- &new_password);
-
- /* Always check returned credentials. */
- if (!netlogon_creds_client_check(cli->dc, &srv_cred.cred)) {
- DEBUG(0,("rpccli_netr_ServerPasswordSet: "
- "credentials chain check failed\n"));
- return NT_STATUS_ACCESS_DENIED;
- }
- }
-
- if (!NT_STATUS_IS_OK(result)) {
- DEBUG(0,("just_change_the_password: unable to change password (%s)!\n",
- nt_errstr(result)));
- }
- return result;
-}
-
-/*********************************************************
- Change the domain password on the PDC.
Store the password ourselves, but use the supplied password
Caller must have already setup the connection to the NETLOGON pipe
**********************************************************/
@@ -131,24 +33,23 @@ NTSTATUS trust_pw_change_and_store_it(struct rpc_pipe_client *cli, TALLOC_CTX *m
{
unsigned char new_trust_passwd_hash[16];
char *new_trust_passwd;
- char *str;
NTSTATUS nt_status;
/* Create a random machine account password */
- str = generate_random_str(DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
+ new_trust_passwd = generate_random_str(mem_ctx, DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
- if ((new_trust_passwd = talloc_strdup(mem_ctx, str)) == NULL) {
+ if (new_trust_passwd == NULL) {
DEBUG(0, ("talloc_strdup failed\n"));
return NT_STATUS_NO_MEMORY;
}
E_md4hash(new_trust_passwd, new_trust_passwd_hash);
- nt_status = just_change_the_password(cli, mem_ctx,
- orig_trust_passwd_hash,
- new_trust_passwd,
- new_trust_passwd_hash,
- sec_channel_type);
+ nt_status = rpccli_netlogon_set_trust_password(cli, mem_ctx,
+ orig_trust_passwd_hash,
+ new_trust_passwd,
+ new_trust_passwd_hash,
+ sec_channel_type);
if (NT_STATUS_IS_OK(nt_status)) {
DEBUG(3,("%s : trust_pw_change_and_store_it: Changed password.\n",
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 368ab1687c..33717f1bb9 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -77,8 +77,8 @@ const char *lock_flav_name(enum brl_flavour lock_flav)
bool is_locked(files_struct *fsp,
uint32 smbpid,
- SMB_BIG_UINT count,
- SMB_BIG_UINT offset,
+ uint64_t count,
+ uint64_t offset,
enum brl_type lock_type)
{
int strict_locking = lp_strict_locking(fsp->conn->params);
@@ -144,8 +144,8 @@ bool is_locked(files_struct *fsp,
NTSTATUS query_lock(files_struct *fsp,
uint32 *psmbpid,
- SMB_BIG_UINT *pcount,
- SMB_BIG_UINT *poffset,
+ uint64_t *pcount,
+ uint64_t *poffset,
enum brl_type *plock_type,
enum brl_flavour lock_flav)
{
@@ -184,8 +184,8 @@ NTSTATUS query_lock(files_struct *fsp,
struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
files_struct *fsp,
uint32 lock_pid,
- SMB_BIG_UINT count,
- SMB_BIG_UINT offset,
+ uint64_t count,
+ uint64_t offset,
enum brl_type lock_type,
enum brl_flavour lock_flav,
bool blocking_lock,
@@ -251,8 +251,8 @@ struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
NTSTATUS do_unlock(struct messaging_context *msg_ctx,
files_struct *fsp,
uint32 lock_pid,
- SMB_BIG_UINT count,
- SMB_BIG_UINT offset,
+ uint64_t count,
+ uint64_t offset,
enum brl_flavour lock_flav)
{
bool ok = False;
@@ -304,8 +304,8 @@ NTSTATUS do_unlock(struct messaging_context *msg_ctx,
NTSTATUS do_lock_cancel(files_struct *fsp,
uint32 lock_pid,
- SMB_BIG_UINT count,
- SMB_BIG_UINT offset,
+ uint64_t count,
+ uint64_t offset,
enum brl_flavour lock_flav)
{
bool ok = False;
diff --git a/source3/locking/posix.c b/source3/locking/posix.c
index 32e1ee9fbf..c036ee597c 100644
--- a/source3/locking/posix.c
+++ b/source3/locking/posix.c
@@ -79,7 +79,7 @@ static const char *posix_lock_type_name(int lock_type)
****************************************************************************/
static bool posix_lock_in_range(SMB_OFF_T *offset_out, SMB_OFF_T *count_out,
- SMB_BIG_UINT u_offset, SMB_BIG_UINT u_count)
+ uint64_t u_offset, uint64_t u_count)
{
SMB_OFF_T offset = (SMB_OFF_T)u_offset;
SMB_OFF_T count = (SMB_OFF_T)u_count;
@@ -132,9 +132,9 @@ static bool posix_lock_in_range(SMB_OFF_T *offset_out, SMB_OFF_T *count_out,
* ignore this lock.
*/
- if (u_offset & ~((SMB_BIG_UINT)max_positive_lock_offset)) {
+ if (u_offset & ~((uint64_t)max_positive_lock_offset)) {
DEBUG(10,("posix_lock_in_range: (offset = %.0f) offset > %.0f and we cannot handle this. Ignoring lock.\n",
- (double)u_offset, (double)((SMB_BIG_UINT)max_positive_lock_offset) ));
+ (double)u_offset, (double)((uint64_t)max_positive_lock_offset) ));
return False;
}
@@ -142,7 +142,7 @@ static bool posix_lock_in_range(SMB_OFF_T *offset_out, SMB_OFF_T *count_out,
* We must truncate the count to less than max_positive_lock_offset.
*/
- if (u_count & ~((SMB_BIG_UINT)max_positive_lock_offset)) {
+ if (u_count & ~((uint64_t)max_positive_lock_offset)) {
count = max_positive_lock_offset;
}
@@ -271,8 +271,8 @@ static bool posix_fcntl_getlock(files_struct *fsp, SMB_OFF_T *poffset, SMB_OFF_T
****************************************************************************/
bool is_posix_locked(files_struct *fsp,
- SMB_BIG_UINT *pu_offset,
- SMB_BIG_UINT *pu_count,
+ uint64_t *pu_offset,
+ uint64_t *pu_count,
enum brl_type *plock_type,
enum brl_flavour lock_flav)
{
@@ -302,8 +302,8 @@ bool is_posix_locked(files_struct *fsp,
if (lock_flav == POSIX_LOCK) {
/* Only POSIX lock queries need to know the details. */
- *pu_offset = (SMB_BIG_UINT)offset;
- *pu_count = (SMB_BIG_UINT)count;
+ *pu_offset = (uint64_t)offset;
+ *pu_count = (uint64_t)count;
*plock_type = (posix_lock_type == F_RDLCK) ? READ_LOCK : WRITE_LOCK;
}
return True;
@@ -929,8 +929,8 @@ lock: start = %.0f, size = %.0f", (double)l_curr->start, (double)l_curr->size, (
****************************************************************************/
bool set_posix_lock_windows_flavour(files_struct *fsp,
- SMB_BIG_UINT u_offset,
- SMB_BIG_UINT u_count,
+ uint64_t u_offset,
+ uint64_t u_count,
enum brl_type lock_type,
const struct lock_context *lock_ctx,
const struct lock_struct *plocks,
@@ -1066,8 +1066,8 @@ bool set_posix_lock_windows_flavour(files_struct *fsp,
****************************************************************************/
bool release_posix_lock_windows_flavour(files_struct *fsp,
- SMB_BIG_UINT u_offset,
- SMB_BIG_UINT u_count,
+ uint64_t u_offset,
+ uint64_t u_count,
enum brl_type deleted_lock_type,
const struct lock_context *lock_ctx,
const struct lock_struct *plocks,
@@ -1189,8 +1189,8 @@ bool release_posix_lock_windows_flavour(files_struct *fsp,
****************************************************************************/
bool set_posix_lock_posix_flavour(files_struct *fsp,
- SMB_BIG_UINT u_offset,
- SMB_BIG_UINT u_count,
+ uint64_t u_offset,
+ uint64_t u_count,
enum brl_type lock_type,
int *errno_ret)
{
@@ -1229,8 +1229,8 @@ bool set_posix_lock_posix_flavour(files_struct *fsp,
****************************************************************************/
bool release_posix_lock_posix_flavour(files_struct *fsp,
- SMB_BIG_UINT u_offset,
- SMB_BIG_UINT u_count,
+ uint64_t u_offset,
+ uint64_t u_count,
const struct lock_context *lock_ctx,
const struct lock_struct *plocks,
int num_locks)
diff --git a/source3/m4/aclocal.m4 b/source3/m4/aclocal.m4
index 9a4213d976..aae729c825 100644
--- a/source3/m4/aclocal.m4
+++ b/source3/m4/aclocal.m4
@@ -886,4 +886,4 @@ int main(void)
])
])
-m4_include(lib/replace/libreplace.m4)
+m4_include(../lib/replace/libreplace.m4)
diff --git a/source3/m4/check_path.m4 b/source3/m4/check_path.m4
index 7aa8c213e0..40a97d3674 100644
--- a/source3/m4/check_path.m4
+++ b/source3/m4/check_path.m4
@@ -18,6 +18,7 @@ AC_PREFIX_DEFAULT(/usr/local/samba)
rootsbindir="\${SBINDIR}"
lockdir="\${VARDIR}/locks"
piddir="\${VARDIR}/locks"
+ncalrpcdir="\${VARDIR}/ncalrpc"
test "${mandir}" || mandir="\${prefix}/man"
logfilebase="\${VARDIR}"
privatedir="\${prefix}/private"
@@ -46,6 +47,7 @@ AC_ARG_WITH(fhs,
codepagedir="\${MODULESDIR}"
statedir="\${VARDIR}/lib/samba"
cachedir="\${VARDIR}/lib/samba"
+ ncalrpcdir="\${VARDIR}/ncalrpc"
AC_DEFINE(FHS_COMPATIBLE, 1, [Whether to use fully FHS-compatible paths])
;;
esac])
@@ -115,6 +117,22 @@ AC_ARG_WITH(piddir,
esac])
#################################################
+# set ncalrpc directory location
+AC_ARG_WITH(ncalprcdir,
+[AS_HELP_STRING([--with-ncalprcdir=DIR], [Where to put ncalrpc sockets ($ac_default_prefix/var/ncalrpc)])],
+[ case "$withval" in
+ yes|no)
+ #
+ # Just in case anybody calls it without argument
+ #
+ AC_MSG_WARN([--with-ncalrpcdir called without argument - will use default])
+ ;;
+ * )
+ ncalrpcdir="$withval"
+ ;;
+ esac])
+
+#################################################
# set SWAT directory location
AC_ARG_WITH(swatdir,
[AS_HELP_STRING([--with-swatdir=DIR], [Where to put SWAT files ($ac_default_prefix/swat)])],
@@ -227,6 +245,7 @@ AC_ARG_WITH(mandir,
AC_SUBST(configdir)
AC_SUBST(lockdir)
AC_SUBST(piddir)
+AC_SUBST(ncalrpcdir)
AC_SUBST(logfilebase)
AC_SUBST(ctdbdir)
AC_SUBST(privatedir)
diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c
index 9e28db8b39..f411176590 100644
--- a/source3/modules/nfs4_acls.c
+++ b/source3/modules/nfs4_acls.c
@@ -44,10 +44,6 @@ typedef struct _SMB_ACL4_INT_T
SMB_ACE4_INT_T *last;
} SMB_ACL4_INT_T;
-extern int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid);
-extern NTSTATUS unpack_nt_owners(int snum, uid_t *puser, gid_t *pgrp,
- uint32 security_info_sent, SEC_DESC *psd);
-
static SMB_ACL4_INT_T *get_validated_aclint(SMB4ACL_T *acl)
{
SMB_ACL4_INT_T *aclint = (SMB_ACL4_INT_T *)acl;
@@ -225,7 +221,7 @@ static bool smbacl4_nfs42win(TALLOC_CTX *mem_ctx, SMB4ACL_T *acl, /* in */
}
for (aceint=aclint->first; aceint!=NULL; aceint=(SMB_ACE4_INT_T *)aceint->next) {
- SEC_ACCESS mask;
+ uint32_t mask;
DOM_SID sid;
SMB_ACE4PROP_T *ace = &aceint->prop;
@@ -260,7 +256,7 @@ static bool smbacl4_nfs42win(TALLOC_CTX *mem_ctx, SMB4ACL_T *acl, /* in */
DEBUG(10, ("mapped %d to %s\n", ace->who.id,
sid_string_dbg(&sid)));
- init_sec_access(&mask, ace->aceMask);
+ mask = ace->aceMask;
init_sec_ace(&nt_ace_list[good_aces++], &sid,
ace->aceType, mask,
ace->aceFlags & 0xf);
@@ -518,7 +514,7 @@ static bool smbacl4_fill_ace4(
smbacl4_vfs_params *params,
uid_t ownerUID,
gid_t ownerGID,
- SEC_ACE *ace_nt, /* input */
+ const SEC_ACE *ace_nt, /* input */
SMB_ACE4PROP_T *ace_v4 /* output */
)
{
@@ -650,7 +646,7 @@ static int smbacl4_MergeIgnoreReject(
static SMB4ACL_T *smbacl4_win2nfs4(
const char *filename,
- SEC_ACL *dacl,
+ const SEC_ACL *dacl,
smbacl4_vfs_params *pparams,
uid_t ownerUID,
gid_t ownerGID
@@ -694,7 +690,7 @@ static SMB4ACL_T *smbacl4_win2nfs4(
NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp,
uint32 security_info_sent,
- SEC_DESC *psd,
+ const SEC_DESC *psd,
set_nfs4acl_native_fn_t set_nfs4_native)
{
smbacl4_vfs_params params;
diff --git a/source3/modules/vfs_acl_xattr.c b/source3/modules/vfs_acl_xattr.c
new file mode 100644
index 0000000000..241751c6a6
--- /dev/null
+++ b/source3/modules/vfs_acl_xattr.c
@@ -0,0 +1,361 @@
+/*
+ * Store Windows ACLs in xattrs.
+ *
+ * Copyright (C) Volker Lendecke, 2008
+ * Copyright (C) Jeremy Allison, 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/>.
+ */
+
+/* NOTE: This is an experimental module, not yet finished. JRA. */
+
+#include "includes.h"
+#include "librpc/gen_ndr/xattr.h"
+#include "librpc/gen_ndr/ndr_xattr.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_VFS
+
+static NTSTATUS parse_acl_blob(const DATA_BLOB *pblob,
+ const struct timespec cts,
+ uint32 security_info,
+ struct security_descriptor **ppdesc)
+{
+ TALLOC_CTX *ctx = talloc_tos();
+ struct xattr_NTACL xacl;
+ enum ndr_err_code ndr_err;
+ size_t sd_size;
+ struct timespec ts;
+
+ ndr_err = ndr_pull_struct_blob(pblob, ctx, NULL, &xacl,
+ (ndr_pull_flags_fn_t)ndr_pull_xattr_NTACL);
+
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ DEBUG(5, ("parse_acl_blob: ndr_pull_xattr_NTACL failed: %s\n",
+ ndr_errstr(ndr_err)));
+ return ndr_map_error2ntstatus(ndr_err);;
+ }
+
+ if (xacl.version != 2) {
+ return NT_STATUS_REVISION_MISMATCH;
+ }
+
+ /*
+ * Check that the ctime timestamp is ealier
+ * than the stored timestamp.
+ */
+
+ ts = nt_time_to_unix_timespec(&xacl.info.sd_ts->last_changed);
+
+ if (timespec_compare(&cts, &ts) > 0) {
+ DEBUG(5, ("parse_acl_blob: stored ACL out of date.\n"));
+ return NT_STATUS_EA_CORRUPT_ERROR;
+ }
+
+ *ppdesc = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE,
+ (security_info & OWNER_SECURITY_INFORMATION)
+ ? xacl.info.sd_ts->sd->owner_sid : NULL,
+ (security_info & GROUP_SECURITY_INFORMATION)
+ ? xacl.info.sd_ts->sd->group_sid : NULL,
+ (security_info & SACL_SECURITY_INFORMATION)
+ ? xacl.info.sd_ts->sd->sacl : NULL,
+ (security_info & DACL_SECURITY_INFORMATION)
+ ? xacl.info.sd_ts->sd->dacl : NULL,
+ &sd_size);
+
+ TALLOC_FREE(xacl.info.sd);
+
+ return (*ppdesc != NULL) ? NT_STATUS_OK : NT_STATUS_NO_MEMORY;
+}
+
+static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
+ vfs_handle_struct *handle,
+ files_struct *fsp,
+ const char *name,
+ DATA_BLOB *pblob)
+{
+ size_t size = 1024;
+ uint8_t *val = NULL;
+ uint8_t *tmp;
+ ssize_t sizeret;
+ int saved_errno = 0;
+
+ ZERO_STRUCTP(pblob);
+
+ again:
+
+ tmp = TALLOC_REALLOC_ARRAY(ctx, val, uint8_t, size);
+ if (tmp == NULL) {
+ TALLOC_FREE(val);
+ return NT_STATUS_NO_MEMORY;
+ }
+ val = tmp;
+
+ become_root();
+ if (fsp && fsp->fh->fd != -1) {
+ sizeret = SMB_VFS_FGETXATTR(fsp, XATTR_NTACL_NAME, val, size);
+ } else {
+ sizeret = SMB_VFS_GETXATTR(handle->conn, name,
+ XATTR_NTACL_NAME, val, size);
+ }
+ if (sizeret == -1) {
+ saved_errno = errno;
+ }
+ unbecome_root();
+
+ /* Max ACL size is 65536 bytes. */
+ if (sizeret == -1) {
+ errno = saved_errno;
+ if ((errno == ERANGE) && (size != 65536)) {
+ /* Too small, try again. */
+ size = 65536;
+ goto again;
+ }
+
+ /* Real error - exit here. */
+ TALLOC_FREE(val);
+ return map_nt_error_from_unix(errno);
+ }
+
+ pblob->data = val;
+ pblob->length = sizeret;
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS get_nt_acl_xattr_internal(vfs_handle_struct *handle,
+ files_struct *fsp,
+ const char *name,
+ uint32 security_info,
+ SEC_DESC **ppdesc)
+{
+ TALLOC_CTX *ctx = talloc_tos();
+ DATA_BLOB blob;
+ SMB_STRUCT_STAT sbuf;
+ NTSTATUS status;
+
+ if (fsp && name == NULL) {
+ name = fsp->fsp_name;
+ }
+
+ DEBUG(10, ("get_nt_acl_xattr_internal: name=%s\n", name));
+
+ status = get_acl_blob(ctx, handle, fsp, name, &blob);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(10, ("get_acl_blob returned %s\n", nt_errstr(status)));
+ return status;
+ }
+
+ if (fsp && fsp->fh->fd != -1) {
+ if (SMB_VFS_FSTAT(fsp, &sbuf) == -1) {
+ return map_nt_error_from_unix(errno);
+ }
+ } else {
+ if (SMB_VFS_STAT(handle->conn, name, &sbuf) == -1) {
+ return map_nt_error_from_unix(errno);
+ }
+ }
+
+ status = parse_acl_blob(&blob, get_ctimespec(&sbuf),
+ security_info, ppdesc);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(10, ("parse_acl_blob returned %s\n",
+ nt_errstr(status)));
+ return status;
+ }
+
+ TALLOC_FREE(blob.data);
+ return status;
+}
+
+static int mkdir_acl_xattr(vfs_handle_struct *handle, const char *path, mode_t mode)
+{
+ return SMB_VFS_NEXT_MKDIR(handle, path, mode);
+}
+
+/*********************************************************************
+ * Currently this only works for existing files. Need to work on
+ * inheritance for new files.
+*********************************************************************/
+
+static int open_acl_xattr(vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode)
+{
+ uint32_t access_granted = 0;
+ SEC_DESC *pdesc = NULL;
+ NTSTATUS status = get_nt_acl_xattr_internal(handle,
+ NULL,
+ fname,
+ (OWNER_SECURITY_INFORMATION |
+ GROUP_SECURITY_INFORMATION |
+ DACL_SECURITY_INFORMATION),
+ &pdesc);
+ if (NT_STATUS_IS_OK(status)) {
+ /* See if we can access it. */
+ if (!se_access_check(pdesc,
+ handle->conn->server_info->ptok,
+ fsp->access_mask,
+ &access_granted,
+ &status)) {
+ errno = map_errno_from_nt_status(status);
+ return -1;
+ }
+ }
+
+ return SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode);
+}
+
+static NTSTATUS fget_nt_acl_xattr(vfs_handle_struct *handle, files_struct *fsp,
+ uint32 security_info, SEC_DESC **ppdesc)
+{
+ NTSTATUS status = get_nt_acl_xattr_internal(handle, fsp,
+ NULL, security_info, ppdesc);
+ if (NT_STATUS_IS_OK(status)) {
+ return NT_STATUS_OK;
+ }
+ return SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp,
+ security_info, ppdesc);
+}
+
+static NTSTATUS get_nt_acl_xattr(vfs_handle_struct *handle,
+ const char *name, uint32 security_info, SEC_DESC **ppdesc)
+{
+ NTSTATUS status = get_nt_acl_xattr_internal(handle, NULL,
+ name, security_info, ppdesc);
+ if (NT_STATUS_IS_OK(status)) {
+ return NT_STATUS_OK;
+ }
+ return SMB_VFS_NEXT_GET_NT_ACL(handle, name,
+ security_info, ppdesc);
+}
+
+static NTSTATUS create_acl_blob(const SEC_DESC *psd, DATA_BLOB *pblob)
+{
+ struct xattr_NTACL xacl;
+ struct security_descriptor_timestamp sd_ts;
+ enum ndr_err_code ndr_err;
+ TALLOC_CTX *ctx = talloc_tos();
+ struct timespec curr = timespec_current();
+
+ ZERO_STRUCT(xacl);
+ ZERO_STRUCT(sd_ts);
+
+ /* Horrid hack as setting an xattr changes the ctime
+ * on Linux. This gives a race of 1 second during
+ * which we would not see a POSIX ACL set.
+ */
+ curr.tv_sec += 1;
+
+ xacl.version = 2;
+ xacl.info.sd_ts = &sd_ts;
+ xacl.info.sd_ts->sd = CONST_DISCARD(SEC_DESC *, psd);
+ unix_timespec_to_nt_time(&xacl.info.sd_ts->last_changed, curr);
+
+ ndr_err = ndr_push_struct_blob(
+ pblob, ctx, NULL, &xacl,
+ (ndr_push_flags_fn_t)ndr_push_xattr_NTACL);
+
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ DEBUG(5, ("create_acl_blob: ndr_push_xattr_NTACL failed: %s\n",
+ ndr_errstr(ndr_err)));
+ return ndr_map_error2ntstatus(ndr_err);;
+ }
+
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS store_acl_blob(files_struct *fsp,
+ DATA_BLOB *pblob)
+{
+ int ret;
+ int saved_errno = 0;
+
+ DEBUG(10,("store_acl_blob: storing blob length %u on file %s\n",
+ (unsigned int)pblob->length, fsp->fsp_name));
+
+ become_root();
+ if (fsp->fh->fd != -1) {
+ ret = SMB_VFS_FSETXATTR(fsp, XATTR_NTACL_NAME,
+ pblob->data, pblob->length, 0);
+ } else {
+ ret = SMB_VFS_SETXATTR(fsp->conn, fsp->fsp_name,
+ XATTR_NTACL_NAME,
+ pblob->data, pblob->length, 0);
+ }
+ if (ret) {
+ saved_errno = errno;
+ }
+ unbecome_root();
+ if (ret) {
+ errno = saved_errno;
+ DEBUG(5, ("store_acl_blob: setting attr failed for file %s"
+ "with error %s\n",
+ fsp->fsp_name,
+ strerror(errno) ));
+ return map_nt_error_from_unix(errno);
+ }
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS fset_nt_acl_xattr(vfs_handle_struct *handle, files_struct *fsp,
+ uint32 security_info_sent, const SEC_DESC *psd)
+{
+ NTSTATUS status;
+ DATA_BLOB blob;
+
+ status = SMB_VFS_NEXT_FSET_NT_ACL(handle, fsp, security_info_sent, psd);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ if ((security_info_sent & DACL_SECURITY_INFORMATION) &&
+ psd->dacl != NULL &&
+ (psd->type & (SE_DESC_DACL_AUTO_INHERITED|
+ SE_DESC_DACL_AUTO_INHERIT_REQ))==
+ (SE_DESC_DACL_AUTO_INHERITED|
+ SE_DESC_DACL_AUTO_INHERIT_REQ) ) {
+ SEC_DESC *new_psd = NULL;
+ status = append_parent_acl(fsp, psd, &new_psd);
+ if (!NT_STATUS_IS_OK(status)) {
+ /* Lower level acl set succeeded,
+ * so still return OK. */
+ return NT_STATUS_OK;
+ }
+ psd = new_psd;
+ }
+
+ create_acl_blob(psd, &blob);
+ store_acl_blob(fsp, &blob);
+
+ return NT_STATUS_OK;
+}
+
+/* VFS operations structure */
+
+static vfs_op_tuple skel_op_tuples[] =
+{
+ {SMB_VFS_OP(mkdir_acl_xattr), SMB_VFS_OP_MKDIR, SMB_VFS_LAYER_TRANSPARENT},
+ {SMB_VFS_OP(open_acl_xattr), SMB_VFS_OP_OPEN, SMB_VFS_LAYER_TRANSPARENT},
+
+ /* NT File ACL operations */
+
+ {SMB_VFS_OP(fget_nt_acl_xattr),SMB_VFS_OP_FGET_NT_ACL,SMB_VFS_LAYER_TRANSPARENT},
+ {SMB_VFS_OP(get_nt_acl_xattr), SMB_VFS_OP_GET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT},
+ {SMB_VFS_OP(fset_nt_acl_xattr),SMB_VFS_OP_FSET_NT_ACL,SMB_VFS_LAYER_TRANSPARENT},
+
+ {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP}
+};
+
+NTSTATUS vfs_acl_xattr_init(void)
+{
+ return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "acl_xattr", skel_op_tuples);
+}
diff --git a/source3/modules/vfs_afsacl.c b/source3/modules/vfs_afsacl.c
index 9409f3fa20..8c89d2fd9f 100644
--- a/source3/modules/vfs_afsacl.c
+++ b/source3/modules/vfs_afsacl.c
@@ -592,7 +592,6 @@ static size_t afs_to_nt_acl_common(struct afs_acl *afs_acl,
{
SEC_ACE *nt_ace_list;
DOM_SID owner_sid, group_sid;
- SEC_ACCESS mask;
SEC_ACL *psa = NULL;
int good_aces;
size_t sd_size;
@@ -616,7 +615,7 @@ static size_t afs_to_nt_acl_common(struct afs_acl *afs_acl,
good_aces = 0;
while (afs_ace != NULL) {
- uint32 nt_rights;
+ uint32_t nt_rights;
uint8 flag = SEC_ACE_FLAG_OBJECT_INHERIT |
SEC_ACE_FLAG_CONTAINER_INHERIT;
@@ -633,9 +632,8 @@ static size_t afs_to_nt_acl_common(struct afs_acl *afs_acl,
else
nt_rights = afs_to_nt_file_rights(afs_ace->rights);
- init_sec_access(&mask, nt_rights);
init_sec_ace(&nt_ace_list[good_aces++], &(afs_ace->sid),
- SEC_ACE_TYPE_ACCESS_ALLOWED, mask, flag);
+ SEC_ACE_TYPE_ACCESS_ALLOWED, nt_rights, flag);
afs_ace = afs_ace->next;
}
@@ -717,12 +715,12 @@ static bool mappable_sid(const DOM_SID *sid)
static bool nt_to_afs_acl(const char *filename,
uint32 security_info_sent,
- struct security_descriptor *psd,
+ const struct security_descriptor *psd,
uint32 (*nt_to_afs_rights)(const char *filename,
const SEC_ACE *ace),
struct afs_acl *afs_acl)
{
- SEC_ACL *dacl;
+ const SEC_ACL *dacl;
int i;
/* Currently we *only* look at the dacl */
@@ -737,7 +735,7 @@ static bool nt_to_afs_acl(const char *filename,
dacl = psd->dacl;
for (i = 0; i < dacl->num_aces; i++) {
- SEC_ACE *ace = &(dacl->aces[i]);
+ const SEC_ACE *ace = &(dacl->aces[i]);
const char *dom_name, *name;
enum lsa_SidType name_type;
char *p;
@@ -887,7 +885,7 @@ static void merge_unknown_aces(struct afs_acl *src, struct afs_acl *dst)
static NTSTATUS afs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
uint32 security_info_sent,
- struct security_descriptor *psd)
+ const struct security_descriptor *psd)
{
struct afs_acl old_afs_acl, new_afs_acl;
struct afs_acl dir_acl, file_acl;
@@ -1040,7 +1038,7 @@ static NTSTATUS afsacl_get_nt_acl(struct vfs_handle_struct *handle,
NTSTATUS afsacl_fset_nt_acl(vfs_handle_struct *handle,
files_struct *fsp,
uint32 security_info_sent,
- SEC_DESC *psd)
+ const SEC_DESC *psd)
{
return afs_set_nt_acl(handle, fsp, security_info_sent, psd);
}
diff --git a/source3/modules/vfs_aixacl2.c b/source3/modules/vfs_aixacl2.c
index 23c4d88134..a078b9f9f6 100644
--- a/source3/modules/vfs_aixacl2.c
+++ b/source3/modules/vfs_aixacl2.c
@@ -371,7 +371,7 @@ static bool aixjfs2_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl)
return True;
}
-static NTSTATUS aixjfs2_set_nt_acl_common(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
+static NTSTATUS aixjfs2_set_nt_acl_common(files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd)
{
acl_type_t acl_type_info;
NTSTATUS result = NT_STATUS_ACCESS_DENIED;
@@ -395,7 +395,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, uint32 security_info_sent, SEC_DESC *psd)
+NTSTATUS aixjfs2_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd)
{
return aixjfs2_set_nt_acl_common(fsp, security_info_sent, psd);
}
diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c
index 79537367d6..6950ab2168 100644
--- a/source3/modules/vfs_cap.c
+++ b/source3/modules/vfs_cap.c
@@ -28,15 +28,15 @@
static char *capencode(TALLOC_CTX *ctx, const char *from);
static char *capdecode(TALLOC_CTX *ctx, const char *from);
-static SMB_BIG_UINT cap_disk_free(vfs_handle_struct *handle, const char *path,
- bool small_query, SMB_BIG_UINT *bsize,
- SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
+static uint64_t cap_disk_free(vfs_handle_struct *handle, const char *path,
+ bool small_query, uint64_t *bsize,
+ uint64_t *dfree, uint64_t *dsize)
{
char *cappath = capencode(talloc_tos(), path);
if (!cappath) {
errno = ENOMEM;
- return (SMB_BIG_UINT)-1;
+ return (uint64_t)-1;
}
return SMB_VFS_NEXT_DISK_FREE(handle, cappath, small_query, bsize,
dfree, dsize);
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 381aa18561..275c2f53c4 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -40,10 +40,10 @@ static void vfswrap_disconnect(vfs_handle_struct *handle)
/* Disk operations */
-static SMB_BIG_UINT vfswrap_disk_free(vfs_handle_struct *handle, const char *path, bool small_query, SMB_BIG_UINT *bsize,
- SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
+static uint64_t vfswrap_disk_free(vfs_handle_struct *handle, const char *path, bool small_query, uint64_t *bsize,
+ uint64_t *dfree, uint64_t *dsize)
{
- SMB_BIG_UINT result;
+ uint64_t result;
result = sys_disk_free(handle->conn, path, small_query, bsize, dfree, dsize);
return result;
@@ -1036,7 +1036,7 @@ static NTSTATUS vfswrap_get_nt_acl(vfs_handle_struct *handle,
return result;
}
-static NTSTATUS vfswrap_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
+static NTSTATUS vfswrap_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd)
{
NTSTATUS result;
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 1224ec3edb..6342c4a14e 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -74,10 +74,10 @@ struct vfs_full_audit_private_data {
static int smb_full_audit_connect(vfs_handle_struct *handle,
const char *svc, const char *user);
static void smb_full_audit_disconnect(vfs_handle_struct *handle);
-static SMB_BIG_UINT smb_full_audit_disk_free(vfs_handle_struct *handle,
+static uint64_t smb_full_audit_disk_free(vfs_handle_struct *handle,
const char *path,
- bool small_query, SMB_BIG_UINT *bsize,
- SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
+ bool small_query, uint64_t *bsize,
+ uint64_t *dfree, uint64_t *dsize);
static int smb_full_audit_get_quota(struct vfs_handle_struct *handle,
enum SMB_QUOTA_TYPE qtype, unid_t id,
SMB_DISK_QUOTA *qt);
@@ -202,7 +202,7 @@ static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle,
SEC_DESC **ppdesc);
static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
uint32 security_info_sent,
- SEC_DESC *psd);
+ const SEC_DESC *psd);
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,
@@ -910,12 +910,12 @@ static void smb_full_audit_disconnect(vfs_handle_struct *handle)
return;
}
-static SMB_BIG_UINT smb_full_audit_disk_free(vfs_handle_struct *handle,
+static uint64_t smb_full_audit_disk_free(vfs_handle_struct *handle,
const char *path,
- bool small_query, SMB_BIG_UINT *bsize,
- SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
+ bool small_query, uint64_t *bsize,
+ uint64_t *dfree, uint64_t *dsize)
{
- SMB_BIG_UINT result;
+ uint64_t result;
result = SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize,
dfree, dsize);
@@ -1582,7 +1582,7 @@ 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,
uint32 security_info_sent,
- SEC_DESC *psd)
+ const SEC_DESC *psd)
{
NTSTATUS result;
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 39d2bb6c38..fa0b4e97a5 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -179,7 +179,7 @@ static int gpfs_get_nfs4_acl(const char *fname, SMB4ACL_T **ppacl)
"who: %d\n", gace->aceType, gace->aceIFlags,
gace->aceFlags, gace->aceMask, gace->aceWho));
- memset(&smbace, 0, sizeof(SMB4ACE_T));
+ ZERO_STRUCT(smbace);
if (gace->aceIFlags & ACE4_IFLAG_SPECIAL_ID) {
smbace.flags |= SMB_ACE4_ID_SPECIAL;
switch (gace->aceWho) {
@@ -365,7 +365,7 @@ static bool gpfsacl_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl)
return True;
}
-static NTSTATUS gpfsacl_set_nt_acl_internal(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
+static NTSTATUS gpfsacl_set_nt_acl_internal(files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd)
{
struct gpfs_acl *acl;
NTSTATUS result = NT_STATUS_ACCESS_DENIED;
@@ -386,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, uint32 security_info_sent, SEC_DESC *psd)
+static NTSTATUS gpfsacl_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd)
{
return gpfsacl_set_nt_acl_internal(fsp, security_info_sent, psd);
}
@@ -739,7 +739,7 @@ static int gpfsacl_emu_chmod(const char *path, mode_t mode)
if (haveAllowEntry[i]==True)
continue;
- memset(&ace, 0, sizeof(SMB_ACE4PROP_T));
+ ZERO_STRUCT(ace);
ace.aceType = SMB_ACE4_ACCESS_ALLOWED_ACE_TYPE;
ace.flags |= SMB_ACE4_ID_SPECIAL;
ace.who.special_id = i;
@@ -761,7 +761,7 @@ static int gpfsacl_emu_chmod(const char *path, mode_t mode)
}
/* don't add complementary DENY ACEs here */
- memset(&fake_fsp, 0, sizeof(struct files_struct));
+ ZERO_STRUCT(fake_fsp);
fake_fsp.fsp_name = (char *)path; /* no file_new is needed here */
/* put the acl */
diff --git a/source3/modules/vfs_smb_traffic_analyzer.c b/source3/modules/vfs_smb_traffic_analyzer.c
new file mode 100644
index 0000000000..9456afb811
--- /dev/null
+++ b/source3/modules/vfs_smb_traffic_analyzer.c
@@ -0,0 +1,427 @@
+/*
+ * traffic-analyzer VFS module. Measure the smb traffic users create
+ * on the net.
+ *
+ * Copyright (C) Holger Hetterich, 2008
+ * Copyright (C) Jeremy Allison, 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"
+
+/* abstraction for the send_over_network function */
+
+enum sock_type {INTERNET_SOCKET = 0, UNIX_DOMAIN_SOCKET};
+
+#define LOCAL_PATHNAME "/var/tmp/stadsocket"
+
+static int vfs_smb_traffic_analyzer_debug_level = DBGC_VFS;
+
+static enum sock_type smb_traffic_analyzer_connMode(vfs_handle_struct *handle)
+{
+ connection_struct *conn = handle->conn;
+ const char *Mode;
+ Mode=lp_parm_const_string(SNUM(conn), "smb_traffic_analyzer","mode", \
+ "internet_socket");
+ if (strstr(Mode,"unix_domain_socket")) {
+ return UNIX_DOMAIN_SOCKET;
+ } else {
+ return INTERNET_SOCKET;
+ }
+}
+
+
+/* Connect to an internet socket */
+
+static int smb_traffic_analyzer_connect_inet_socket(vfs_handle_struct *handle,
+ const char *name, uint16_t port)
+{
+ /* Create a streaming Socket */
+ int sockfd = -1;
+ struct addrinfo hints;
+ struct addrinfo *ailist = NULL;
+ struct addrinfo *res = NULL;
+ int ret;
+
+ ZERO_STRUCT(hints);
+ /* By default make sure it supports TCP. */
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_flags = AI_ADDRCONFIG;
+
+ ret = getaddrinfo(name,
+ NULL,
+ &hints,
+ &ailist);
+
+ if (ret) {
+ DEBUG(3,("smb_traffic_analyzer_connect_inet_socket: "
+ "getaddrinfo failed for name %s [%s]\n",
+ name,
+ gai_strerror(ret) ));
+ return -1;
+ }
+
+ DEBUG(3,("smb_traffic_analyzer: Internet socket mode. Hostname: %s,"
+ "Port: %i\n", name, port));
+
+ for (res = ailist; res; res = res->ai_next) {
+ struct sockaddr_storage ss;
+
+ if (!res->ai_addr || res->ai_addrlen == 0) {
+ continue;
+ }
+
+ ZERO_STRUCT(ss);
+ memcpy(&ss, res->ai_addr, res->ai_addrlen);
+
+ sockfd = open_socket_out(SOCK_STREAM, &ss, port, 10000);
+ if (sockfd != -1) {
+ break;
+ }
+ }
+
+ if (ailist) {
+ freeaddrinfo(ailist);
+ }
+
+ if (sockfd == -1) {
+ DEBUG(1, ("smb_traffic_analyzer: unable to create "
+ "socket, error is %s",
+ strerror(errno)));
+ return -1;
+ }
+
+ return sockfd;
+}
+
+/* Connect to a unix domain socket */
+
+static int smb_traffic_analyzer_connect_unix_socket(vfs_handle_struct *handle,
+ const char *name)
+{
+ /* Create the socket to stad */
+ int len, sock;
+ struct sockaddr_un remote;
+
+ DEBUG(7, ("smb_traffic_analyzer_connect_unix_socket: "
+ "Unix domain socket mode. Using %s\n",
+ name ));
+
+ if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
+ DEBUG(1, ("smb_traffic_analyzer_connect_unix_socket: "
+ "Couldn't create socket, "
+ "make sure stad is running!\n"));
+ }
+ remote.sun_family = AF_UNIX;
+ strlcpy(remote.sun_path, name,
+ sizeof(remote.sun_path));
+ len=strlen(remote.sun_path) + sizeof(remote.sun_family);
+ if (connect(sock, (struct sockaddr *)&remote, len) == -1 ) {
+ DEBUG(1, ("smb_traffic_analyzer_connect_unix_socket: "
+ "Could not connect to "
+ "socket, make sure\nstad is running!\n"));
+ close(sock);
+ return -1;
+ }
+ return sock;
+}
+
+/* Private data allowing shared connection sockets. */
+
+struct refcounted_sock {
+ struct refcounted_sock *next, *prev;
+ char *name;
+ uint16_t port;
+ int sock;
+ unsigned int ref_count;
+};
+
+/* Send data over a socket */
+
+static void smb_traffic_analyzer_send_data(vfs_handle_struct *handle,
+ ssize_t result,
+ const char *file_name,
+ bool Write)
+{
+ struct refcounted_sock *rf_sock = NULL;
+ struct timeval tv;
+ time_t tv_sec;
+ struct tm *tm = NULL;
+ int seconds;
+ char *str = NULL;
+ char *username = NULL;
+ const char *anon_prefix = NULL;
+ size_t len;
+
+ SMB_VFS_HANDLE_GET_DATA(handle, rf_sock, struct refcounted_sock, return);
+
+ if (rf_sock == NULL || rf_sock->sock == -1) {
+ DEBUG(1, ("smb_traffic_analyzer_send_data: socket is "
+ "closed\n"));
+ return;
+ }
+
+ GetTimeOfDay(&tv);
+ tv_sec = convert_timespec_to_time_t(convert_timeval_to_timespec(tv));
+ tm = localtime(&tv_sec);
+ if (!tm) {
+ return;
+ }
+ seconds=(float) (tv.tv_usec / 1000);
+
+ /* check if anonymization is required */
+
+ anon_prefix=lp_parm_const_string(SNUM(handle->conn),"smb_traffic_analyzer",\
+ "anonymize_prefix", NULL );
+ if (anon_prefix!=NULL) {
+ username = talloc_asprintf(talloc_tos(),
+ "%s%i",
+ anon_prefix,
+ str_checksum(
+ handle->conn->server_info->sanitized_username ) );
+ } else {
+ username = handle->conn->server_info->sanitized_username;
+ }
+
+ if (!username) {
+ return;
+ }
+
+ str = talloc_asprintf(talloc_tos(),
+ "V1,%u,\"%s\",\"%s\",\"%c\",\"%s\",\"%s\","
+ "\"%04d-%02d-%02d %02d:%02d:%02d.%03d\"\n",
+ (unsigned int)result,
+ username,
+ pdb_get_domain(handle->conn->server_info->sam_account),
+ Write ? 'W' : 'R',
+ handle->conn->connectpath,
+ file_name,
+ tm->tm_year+1900,
+ tm->tm_mon+1,
+ tm->tm_mday,
+ tm->tm_hour,
+ tm->tm_min,
+ tm->tm_sec,
+ (int)seconds);
+
+ if (!str) {
+ return;
+ }
+
+ len = strlen(str);
+
+ DEBUG(10, ("smb_traffic_analyzer_send_data_socket: sending %s\n",
+ str));
+ if (write_data(rf_sock->sock, str, len) != len) {
+ DEBUG(1, ("smb_traffic_analyzer_send_data_socket: "
+ "error sending data to socket!\n"));
+ return ;
+ }
+}
+
+static struct refcounted_sock *sock_list;
+
+static void smb_traffic_analyzer_free_data(void **pptr)
+{
+ struct refcounted_sock *rf_sock = *(struct refcounted_sock **)pptr;
+ if (rf_sock == NULL) {
+ return;
+ }
+ rf_sock->ref_count--;
+ if (rf_sock->ref_count != 0) {
+ return;
+ }
+ if (rf_sock->sock != -1) {
+ close(rf_sock->sock);
+ }
+ DLIST_REMOVE(sock_list, rf_sock);
+ TALLOC_FREE(rf_sock);
+}
+
+static int smb_traffic_analyzer_connect(struct vfs_handle_struct *handle,
+ const char *service,
+ const char *user)
+{
+ connection_struct *conn = handle->conn;
+ enum sock_type st = smb_traffic_analyzer_connMode(handle);
+ struct refcounted_sock *rf_sock = NULL;
+ const char *name = (st == UNIX_DOMAIN_SOCKET) ? LOCAL_PATHNAME :
+ lp_parm_const_string(SNUM(conn),
+ "smb_traffic_analyzer",
+ "host", "localhost");
+ uint16_t port = (st == UNIX_DOMAIN_SOCKET) ? 0 :
+ atoi( lp_parm_const_string(SNUM(conn),
+ "smb_traffic_analyzer", "port", "9430"));
+
+ /* Are we already connected ? */
+ for (rf_sock = sock_list; rf_sock; rf_sock = rf_sock->next) {
+ if (port == rf_sock->port &&
+ (strcmp(name, rf_sock->name) == 0)) {
+ break;
+ }
+ }
+
+ /* If we're connected already, just increase the
+ * reference count. */
+ if (rf_sock) {
+ rf_sock->ref_count++;
+ } else {
+ /* New connection. */
+ rf_sock = TALLOC_ZERO_P(NULL, struct refcounted_sock);
+ if (rf_sock == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+ rf_sock->name = talloc_strdup(rf_sock, name);
+ if (rf_sock->name == NULL) {
+ TALLOC_FREE(rf_sock);
+ errno = ENOMEM;
+ return -1;
+ }
+ rf_sock->port = port;
+ rf_sock->ref_count = 1;
+
+ if (st == UNIX_DOMAIN_SOCKET) {
+ rf_sock->sock = smb_traffic_analyzer_connect_unix_socket(handle,
+ name);
+ } else {
+
+ rf_sock->sock = smb_traffic_analyzer_connect_inet_socket(handle,
+ name,
+ port);
+ }
+ if (rf_sock->sock == -1) {
+ TALLOC_FREE(rf_sock);
+ return -1;
+ }
+ DLIST_ADD(sock_list, rf_sock);
+ }
+
+ /* Store the private data. */
+ SMB_VFS_HANDLE_SET_DATA(handle, rf_sock, smb_traffic_analyzer_free_data,
+ struct refcounted_sock, return -1);
+ return SMB_VFS_NEXT_CONNECT(handle, service, user);
+}
+
+/* VFS Functions: write, read, pread, pwrite for now */
+
+static ssize_t smb_traffic_analyzer_read(vfs_handle_struct *handle, \
+ files_struct *fsp, void *data, size_t n)
+{
+ ssize_t result;
+
+ result = SMB_VFS_NEXT_READ(handle, fsp, data, n);
+ DEBUG(10, ("smb_traffic_analyzer_read: READ: %s\n", fsp->fsp_name ));
+
+ smb_traffic_analyzer_send_data(handle,
+ result,
+ fsp->fsp_name,
+ false);
+ return result;
+}
+
+
+static ssize_t smb_traffic_analyzer_pread(vfs_handle_struct *handle, \
+ files_struct *fsp, void *data, size_t n, SMB_OFF_T offset)
+{
+ ssize_t result;
+
+ result = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
+
+ DEBUG(10, ("smb_traffic_analyzer_pread: PREAD: %s\n", fsp->fsp_name ));
+
+ smb_traffic_analyzer_send_data(handle,
+ result,
+ fsp->fsp_name,
+ false);
+
+ return result;
+}
+
+static ssize_t smb_traffic_analyzer_write(vfs_handle_struct *handle, \
+ files_struct *fsp, const void *data, size_t n)
+{
+ ssize_t result;
+
+ result = SMB_VFS_NEXT_WRITE(handle, fsp, data, n);
+
+ DEBUG(10, ("smb_traffic_analyzer_write: WRITE: %s\n", fsp->fsp_name ));
+
+ smb_traffic_analyzer_send_data(handle,
+ result,
+ fsp->fsp_name,
+ true);
+ return result;
+}
+
+static ssize_t smb_traffic_analyzer_pwrite(vfs_handle_struct *handle, \
+ files_struct *fsp, const void *data, size_t n, SMB_OFF_T offset)
+{
+ ssize_t result;
+
+ result = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
+
+ DEBUG(10, ("smb_traffic_analyzer_pwrite: PWRITE: %s\n", fsp->fsp_name ));
+
+ smb_traffic_analyzer_send_data(handle,
+ result,
+ fsp->fsp_name,
+ true);
+ return result;
+}
+
+/* VFS operations we use */
+
+static vfs_op_tuple smb_traffic_analyzer_tuples[] = {
+
+ {SMB_VFS_OP(smb_traffic_analyzer_connect), SMB_VFS_OP_CONNECT,
+ SMB_VFS_LAYER_LOGGER},
+ {SMB_VFS_OP(smb_traffic_analyzer_read), SMB_VFS_OP_READ,
+ SMB_VFS_LAYER_LOGGER},
+ {SMB_VFS_OP(smb_traffic_analyzer_pread), SMB_VFS_OP_PREAD,
+ SMB_VFS_LAYER_LOGGER},
+ {SMB_VFS_OP(smb_traffic_analyzer_write), SMB_VFS_OP_WRITE,
+ SMB_VFS_LAYER_LOGGER},
+ {SMB_VFS_OP(smb_traffic_analyzer_pwrite), SMB_VFS_OP_PWRITE,
+ SMB_VFS_LAYER_LOGGER},
+ {SMB_VFS_OP(NULL),SMB_VFS_OP_NOOP,SMB_VFS_LAYER_NOOP}
+};
+
+/* Module initialization */
+
+NTSTATUS vfs_smb_traffic_analyzer_init(void)
+{
+ NTSTATUS ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION, \
+ "smb_traffic_analyzer", smb_traffic_analyzer_tuples);
+
+ if (!NT_STATUS_IS_OK(ret)) {
+ return ret;
+ }
+
+ vfs_smb_traffic_analyzer_debug_level =
+ debug_add_class("smb_traffic_analyzer");
+
+ if (vfs_smb_traffic_analyzer_debug_level == -1) {
+ vfs_smb_traffic_analyzer_debug_level = DBGC_VFS;
+ DEBUG(1, ("smb_traffic_analyzer_init: Couldn't register custom"
+ "debugging class!\n"));
+ } else {
+ DEBUG(3, ("smb_traffic_analyzer_init: Debug class number of"
+ "'smb_traffic_analyzer': %d\n", \
+ vfs_smb_traffic_analyzer_debug_level));
+ }
+
+ return ret;
+}
diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c
index 7b5e510747..8320a5820a 100644
--- a/source3/modules/vfs_xattr_tdb.c
+++ b/source3/modules/vfs_xattr_tdb.c
@@ -48,7 +48,7 @@ static NTSTATUS xattr_tdb_pull_attrs(TALLOC_CTX *mem_ctx,
blob = data_blob_const(data->dptr, data->dsize);
ndr_err = ndr_pull_struct_blob(
- &blob, result, result,
+ &blob, result, NULL, result,
(ndr_pull_flags_fn_t)ndr_pull_tdb_xattrs);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -74,7 +74,7 @@ static NTSTATUS xattr_tdb_push_attrs(TALLOC_CTX *mem_ctx,
enum ndr_err_code ndr_err;
ndr_err = ndr_push_struct_blob(
- &blob, mem_ctx, attribs,
+ &blob, mem_ctx, NULL, attribs,
(ndr_push_flags_fn_t)ndr_push_tdb_xattrs);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -177,25 +177,25 @@ static ssize_t xattr_tdb_getattr(struct db_context *db_ctx,
return -1;
}
- for (i=0; i<attribs->num_xattrs; i++) {
- if (strcmp(attribs->xattrs[i].name, name) == 0) {
+ for (i=0; i<attribs->num_eas; i++) {
+ if (strcmp(attribs->eas[i].name, name) == 0) {
break;
}
}
- if (i == attribs->num_xattrs) {
+ if (i == attribs->num_eas) {
errno = ENOATTR;
goto fail;
}
- if (attribs->xattrs[i].value.length > size) {
+ if (attribs->eas[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;
+ memcpy(value, attribs->eas[i].value.data,
+ attribs->eas[i].value.length);
+ result = attribs->eas[i].value.length;
fail:
TALLOC_FREE(attribs);
@@ -273,8 +273,8 @@ static int xattr_tdb_setattr(struct db_context *db_ctx,
return -1;
}
- for (i=0; i<attribs->num_xattrs; i++) {
- if (strcmp(attribs->xattrs[i].name, name) == 0) {
+ for (i=0; i<attribs->num_eas; i++) {
+ if (strcmp(attribs->eas[i].name, name) == 0) {
if (flags & XATTR_CREATE) {
TALLOC_FREE(rec);
errno = EEXIST;
@@ -284,8 +284,8 @@ static int xattr_tdb_setattr(struct db_context *db_ctx,
}
}
- if (i == attribs->num_xattrs) {
- struct tdb_xattr *tmp;
+ if (i == attribs->num_eas) {
+ struct xattr_EA *tmp;
if (flags & XATTR_REPLACE) {
TALLOC_FREE(rec);
@@ -294,8 +294,8 @@ static int xattr_tdb_setattr(struct db_context *db_ctx,
}
tmp = TALLOC_REALLOC_ARRAY(
- attribs, attribs->xattrs, struct tdb_xattr,
- attribs->num_xattrs + 1);
+ attribs, attribs->eas, struct xattr_EA,
+ attribs->num_eas+ 1);
if (tmp == NULL) {
DEBUG(0, ("TALLOC_REALLOC_ARRAY failed\n"));
@@ -304,13 +304,13 @@ static int xattr_tdb_setattr(struct db_context *db_ctx,
return -1;
}
- attribs->xattrs = tmp;
- attribs->num_xattrs += 1;
+ attribs->eas = tmp;
+ attribs->num_eas += 1;
}
- attribs->xattrs[i].name = name;
- attribs->xattrs[i].value.data = CONST_DISCARD(uint8 *, value);
- attribs->xattrs[i].value.length = size;
+ attribs->eas[i].name = name;
+ attribs->eas[i].value.data = CONST_DISCARD(uint8 *, value);
+ attribs->eas[i].value.length = size;
status = xattr_tdb_save_attrs(rec, attribs);
@@ -386,15 +386,15 @@ static ssize_t xattr_tdb_listattr(struct db_context *db_ctx,
}
DEBUG(10, ("xattr_tdb_listattr: Found %d xattrs\n",
- attribs->num_xattrs));
+ attribs->num_eas));
- for (i=0; i<attribs->num_xattrs; i++) {
+ for (i=0; i<attribs->num_eas; i++) {
size_t tmp;
DEBUG(10, ("xattr_tdb_listattr: xattrs[i].name: %s\n",
- attribs->xattrs[i].name));
+ attribs->eas[i].name));
- tmp = strlen(attribs->xattrs[i].name);
+ tmp = strlen(attribs->eas[i].name);
/*
* Try to protect against overflow
@@ -420,10 +420,10 @@ static ssize_t xattr_tdb_listattr(struct db_context *db_ctx,
len = 0;
- for (i=0; i<attribs->num_xattrs; i++) {
- strlcpy(list+len, attribs->xattrs[i].name,
+ for (i=0; i<attribs->num_eas; i++) {
+ strlcpy(list+len, attribs->eas[i].name,
size-len);
- len += (strlen(attribs->xattrs[i].name) + 1);
+ len += (strlen(attribs->eas[i].name) + 1);
}
TALLOC_FREE(attribs);
@@ -496,23 +496,23 @@ static int xattr_tdb_removeattr(struct db_context *db_ctx,
return -1;
}
- for (i=0; i<attribs->num_xattrs; i++) {
- if (strcmp(attribs->xattrs[i].name, name) == 0) {
+ for (i=0; i<attribs->num_eas; i++) {
+ if (strcmp(attribs->eas[i].name, name) == 0) {
break;
}
}
- if (i == attribs->num_xattrs) {
+ if (i == attribs->num_eas) {
TALLOC_FREE(rec);
errno = ENOATTR;
return -1;
}
- attribs->xattrs[i] =
- attribs->xattrs[attribs->num_xattrs-1];
- attribs->num_xattrs -= 1;
+ attribs->eas[i] =
+ attribs->eas[attribs->num_eas-1];
+ attribs->num_eas -= 1;
- if (attribs->num_xattrs == 0) {
+ if (attribs->num_eas == 0) {
rec->delete_rec(rec);
TALLOC_FREE(rec);
return 0;
diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c
index e933e47317..3688b2386e 100644
--- a/source3/modules/vfs_zfsacl.c
+++ b/source3/modules/vfs_zfsacl.c
@@ -166,7 +166,7 @@ static bool zfs_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl)
*/
static NTSTATUS zfs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
uint32 security_info_sent,
- struct security_descriptor *psd)
+ const struct security_descriptor *psd)
{
return smb_set_nt_acl_nfs4(fsp, security_info_sent, psd,
zfs_process_smbacl);
@@ -207,7 +207,7 @@ static NTSTATUS zfsacl_get_nt_acl(struct vfs_handle_struct *handle,
static NTSTATUS zfsacl_fset_nt_acl(vfs_handle_struct *handle,
files_struct *fsp,
uint32 security_info_sent,
- SEC_DESC *psd)
+ const SEC_DESC *psd)
{
return zfs_set_nt_acl(handle, fsp, security_info_sent, psd);
}
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index d9f2af4c10..28de212d69 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -332,7 +332,7 @@ static bool reload_nmbd_services(bool test)
if ( lp_loaded() ) {
const char *fname = lp_configfile();
- if (file_exist(fname,NULL) && !strcsequal(fname,get_dyn_CONFIGFILE())) {
+ if (file_exist(fname) && !strcsequal(fname,get_dyn_CONFIGFILE())) {
set_dyn_CONFIGFILE(fname);
test = False;
}
@@ -905,7 +905,7 @@ static bool open_sockets(bool isdaemon, int port)
}
#endif
- if (!directory_exist(lp_lockdir(), NULL)) {
+ if (!directory_exist(lp_lockdir())) {
mkdir(lp_lockdir(), 0755);
}
diff --git a/source3/nmbd/nmbd_processlogon.c b/source3/nmbd/nmbd_processlogon.c
index 474ae1ca18..9ee0709cb5 100644
--- a/source3/nmbd/nmbd_processlogon.c
+++ b/source3/nmbd/nmbd_processlogon.c
@@ -178,7 +178,7 @@ logons are not enabled.\n", inet_ntoa(p->ip) ));
break;
}
- case QUERYFORPDC:
+ case LOGON_PRIMARY_QUERY:
{
fstring mach_str, getdc_str;
fstring source_name;
@@ -253,7 +253,7 @@ logons are not enabled.\n", inet_ntoa(p->ip) ));
/* Construct reply. */
q = outbuf;
- SSVAL(q, 0, QUERYFORPDC_R);
+ SSVAL(q, 0, NETLOGON_RESPONSE_FROM_PDC);
q += 2;
fstrcpy(reply_name,my_name);
@@ -292,7 +292,7 @@ logons are not enabled.\n", inet_ntoa(p->ip) ));
DEBUG(5,("process_logon_packet: GETDC request from %s at IP %s, \
reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
mach_str,inet_ntoa(p->ip), reply_name, lp_workgroup(),
- QUERYFORPDC_R, (uint32)ntversion, (uint32)lmnttoken,
+ NETLOGON_RESPONSE_FROM_PDC, (uint32)ntversion, (uint32)lmnttoken,
(uint32)lm20token ));
dump_data(4, (uint8 *)outbuf, PTR_DIFF(q, outbuf));
@@ -309,7 +309,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
return;
}
- case SAMLOGON:
+ case LOGON_SAM_LOGON_REQUEST:
{
fstring getdc_str;
@@ -351,7 +351,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
domainsidsize = IVAL(q, 0);
q += 4;
- DEBUG(5,("process_logon_packet: SAMLOGON sidsize %d, len = %d\n", domainsidsize, len));
+ DEBUG(5,("process_logon_packet: LOGON_SAM_LOGON_REQUEST sidsize %d, len = %d\n", domainsidsize, len));
if (domainsidsize < (len - PTR_DIFF(q, buf)) && (domainsidsize != 0)) {
q += domainsidsize;
@@ -383,7 +383,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
lm20token = SVAL(q, 6);
q += 8;
- DEBUG(3,("process_logon_packet: SAMLOGON sidsize %d ntv %d\n", domainsidsize, ntversion));
+ DEBUG(3,("process_logon_packet: LOGON_SAM_LOGON_REQUEST sidsize %d ntv %d\n", domainsidsize, ntversion));
/*
* we respond regadless of whether the machine is in our password
@@ -392,14 +392,14 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
*/
pull_ucs2_fstring(ascuser, uniuser);
pull_ucs2_fstring(asccomp, unicomp);
- DEBUG(5,("process_logon_packet: SAMLOGON user %s\n", ascuser));
+ DEBUG(5,("process_logon_packet: LOGON_SAM_LOGON_REQUEST user %s\n", ascuser));
fstrcpy(reply_name, "\\\\"); /* Here it wants \\LOGONSERVER. */
fstrcat(reply_name, my_name);
- DEBUG(5,("process_logon_packet: SAMLOGON request from %s(%s) for %s, returning logon svr %s domain %s code %x token=%x\n",
+ DEBUG(5,("process_logon_packet: LOGON_SAM_LOGON_REQUEST request from %s(%s) for %s, returning logon svr %s domain %s code %x token=%x\n",
asccomp,inet_ntoa(p->ip), ascuser, reply_name, lp_workgroup(),
- SAMLOGON_R ,lmnttoken));
+ LOGON_SAM_LOGON_RESPONSE ,lmnttoken));
/* Construct reply. */
@@ -408,9 +408,9 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
/* never, at least for now */
if ((ntversion < 11) || (SEC_ADS != lp_security()) || (ROLE_DOMAIN_PDC != lp_server_role())) {
if (SVAL(uniuser, 0) == 0) {
- SSVAL(q, 0, SAMLOGON_UNK_R); /* user unknown */
+ SSVAL(q, 0, LOGON_SAM_LOGON_USER_UNKNOWN); /* user unknown */
} else {
- SSVAL(q, 0, SAMLOGON_R);
+ SSVAL(q, 0, LOGON_SAM_LOGON_RESPONSE);
}
q += 2;
@@ -442,7 +442,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
("get_mydnsdomname failed.\n"));
return;
}
- hostname = get_myname(talloc_tos());
+ hostname = talloc_get_myname(talloc_tos());
if (!hostname) {
DEBUG(2,
("get_myname failed.\n"));
@@ -453,9 +453,9 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
return;
}
if (SVAL(uniuser, 0) == 0) {
- SIVAL(q, 0, SAMLOGON_AD_UNK_R); /* user unknown */
+ SIVAL(q, 0, LOGON_SAM_LOGON_USER_UNKNOWN_EX); /* user unknown */
} else {
- SIVAL(q, 0, SAMLOGON_AD_R);
+ SIVAL(q, 0, LOGON_SAM_LOGON_RESPONSE_EX);
}
q += 4;
@@ -684,8 +684,8 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
/* Announce change to UAS or SAM. Send by the domain controller when a
replication event is required. */
- case SAM_UAS_CHANGE:
- DEBUG(5, ("Got SAM_UAS_CHANGE\n"));
+ case NETLOGON_ANNOUNCE_UAS:
+ DEBUG(5, ("Got NETLOGON_ANNOUNCE_UAS\n"));
break;
default:
diff --git a/source3/nmbd/nmbd_winsserver.c b/source3/nmbd/nmbd_winsserver.c
index 96938b011a..5ee6e83138 100644
--- a/source3/nmbd/nmbd_winsserver.c
+++ b/source3/nmbd/nmbd_winsserver.c
@@ -124,7 +124,7 @@ static struct name_record *wins_record_to_name_record(TDB_DATA key, TDB_DATA dat
namerec->data.refresh_time = (time_t)refresh_time;
namerec->data.id = id_low;
#if defined(HAVE_LONGLONG)
- namerec->data.id |= ((SMB_BIG_UINT)id_high << 32);
+ namerec->data.id |= ((uint64_t)id_high << 32);
#endif
namerec->data.wins_ip.s_addr = saddr;
namerec->data.wins_flags = wins_flags,
@@ -412,14 +412,14 @@ static void update_wins_flag(struct name_record *namerec, int flags)
Return the general ID value and increase it if requested.
*****************************************************************************/
-static void get_global_id_and_update(SMB_BIG_UINT *current_id, bool update)
+static void get_global_id_and_update(uint64_t *current_id, bool update)
{
/*
* it's kept as a static here, to prevent people from messing
* with the value directly
*/
- static SMB_BIG_UINT general_id = 1;
+ static uint64_t general_id = 1;
DEBUG(5,("get_global_id_and_update: updating version ID: %d\n", (int)general_id));
diff --git a/source3/nsswitch/libwbclient/wbc_guid.c b/source3/nsswitch/libwbclient/wbc_guid.c
new file mode 100644
index 0000000000..0cb33e9868
--- /dev/null
+++ b/source3/nsswitch/libwbclient/wbc_guid.c
@@ -0,0 +1,118 @@
+/*
+ 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 GUID to a character string
+ *
+ * @param guid Binary Guid
+ * @param **guid_string Resulting character string
+ *
+ * @return #wbcErr
+ **/
+
+wbcErr wbcGuidToString(const struct wbcGuid *guid,
+ char **guid_string)
+{
+ wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+
+ if (!guid) {
+ wbc_status = WBC_ERR_INVALID_PARAM;
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+
+ *guid_string = talloc_asprintf(NULL,
+ "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ guid->time_low, guid->time_mid,
+ guid->time_hi_and_version,
+ guid->clock_seq[0],
+ guid->clock_seq[1],
+ guid->node[0], guid->node[1],
+ guid->node[2], guid->node[3],
+ guid->node[4], guid->node[5]);
+ BAIL_ON_PTR_ERROR((*guid_string), wbc_status);
+
+ wbc_status = WBC_ERR_SUCCESS;
+
+done:
+ return wbc_status;
+}
+
+/** @brief Convert a character string to a binary GUID
+ *
+ * @param *str Character string
+ * @param guid Resulting binary GUID
+ *
+ * @return #wbcErr
+ **/
+
+wbcErr wbcStringToGuid(const char *str,
+ struct wbcGuid *guid)
+{
+ uint32_t time_low;
+ uint32_t time_mid, time_hi_and_version;
+ uint32_t clock_seq[2];
+ uint32_t node[6];
+ int i;
+ wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+
+ if (!guid) {
+ wbc_status = WBC_ERR_INVALID_PARAM;
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+
+ if (!str) {
+ wbc_status = WBC_ERR_INVALID_PARAM;
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+
+ if (11 == sscanf(str, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ &time_low, &time_mid, &time_hi_and_version,
+ &clock_seq[0], &clock_seq[1],
+ &node[0], &node[1], &node[2], &node[3], &node[4], &node[5])) {
+ wbc_status = WBC_ERR_SUCCESS;
+ } else if (11 == sscanf(str, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+ &time_low, &time_mid, &time_hi_and_version,
+ &clock_seq[0], &clock_seq[1],
+ &node[0], &node[1], &node[2], &node[3], &node[4], &node[5])) {
+ wbc_status = WBC_ERR_SUCCESS;
+ }
+
+ BAIL_ON_WBC_ERROR(wbc_status);
+
+ guid->time_low = time_low;
+ guid->time_mid = time_mid;
+ guid->time_hi_and_version = time_hi_and_version;
+ guid->clock_seq[0] = clock_seq[0];
+ guid->clock_seq[1] = clock_seq[1];
+
+ for (i=0;i<6;i++) {
+ guid->node[i] = node[i];
+ }
+
+ wbc_status = WBC_ERR_SUCCESS;
+
+done:
+ return wbc_status;
+}
diff --git a/source3/nsswitch/libwbclient/wbc_idmap.c b/source3/nsswitch/libwbclient/wbc_idmap.c
index e32d66cd71..1615fd33ee 100644
--- a/source3/nsswitch/libwbclient/wbc_idmap.c
+++ b/source3/nsswitch/libwbclient/wbc_idmap.c
@@ -394,7 +394,7 @@ wbcErr wbcSetUidHwm(uid_t uid_hwm)
/** @brief Set the highwater mark for allocated gids.
*
- * @param uid_hwm The new gid highwater mark value
+ * @param gid_hwm The new gid highwater mark value
*
* @return #wbcErr
**/
diff --git a/source3/nsswitch/libwbclient/wbc_pam.c b/source3/nsswitch/libwbclient/wbc_pam.c
index 20b42b6efb..713ba2e65b 100644
--- a/source3/nsswitch/libwbclient/wbc_pam.c
+++ b/source3/nsswitch/libwbclient/wbc_pam.c
@@ -4,6 +4,7 @@
Winbind client API
Copyright (C) Gerald (Jerry) Carter 2007
+ Copyright (C) Guenther Deschner 2008
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -260,6 +261,50 @@ done:
return wbc_status;
}
+static wbcErr wbc_create_logon_info(TALLOC_CTX *mem_ctx,
+ const struct winbindd_response *resp,
+ struct wbcLogonUserInfo **_i)
+{
+ wbcErr wbc_status = WBC_ERR_SUCCESS;
+ struct wbcLogonUserInfo *i;
+
+ i = talloc_zero(mem_ctx, struct wbcLogonUserInfo);
+ BAIL_ON_PTR_ERROR(i, wbc_status);
+
+ wbc_status = wbc_create_auth_info(i, resp, &i->info);
+ BAIL_ON_WBC_ERROR(wbc_status);
+
+ if (resp->data.auth.krb5ccname) {
+ wbc_status = wbcAddNamedBlob(&i->num_blobs,
+ &i->blobs,
+ "krb5ccname",
+ 0,
+ (uint8_t *)resp->data.auth.krb5ccname,
+ strlen(resp->data.auth.krb5ccname)+1);
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+
+ if (resp->data.auth.unix_username) {
+ wbc_status = wbcAddNamedBlob(&i->num_blobs,
+ &i->blobs,
+ "unix_username",
+ 0,
+ (uint8_t *)resp->data.auth.unix_username,
+ strlen(resp->data.auth.unix_username)+1);
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+
+ *_i = i;
+ i = NULL;
+done:
+ if (!WBC_ERROR_IS_OK(wbc_status) && i) {
+ wbcFreeMemory(i->blobs);
+ }
+
+ talloc_free(i);
+ return wbc_status;
+}
+
/** @brief Authenticate with more detailed information
*
* @param params Input parameters, WBC_AUTH_USER_LEVEL_HASH
@@ -331,6 +376,7 @@ wbcErr wbcAuthenticateUserEx(const struct wbcAuthUserParams *params,
params->account_name,
sizeof(request.data.auth.user)-1);
}
+
strncpy(request.data.auth.pass,
params->password.plaintext,
sizeof(request.data.auth.pass)-1);
@@ -416,6 +462,10 @@ wbcErr wbcAuthenticateUserEx(const struct wbcAuthUserParams *params,
BAIL_ON_WBC_ERROR(wbc_status);
}
+ if (params->flags) {
+ request.flags |= params->flags;
+ }
+
wbc_status = wbcRequestResponse(cmd,
&request,
&response);
@@ -497,6 +547,101 @@ wbcErr wbcCheckTrustCredentials(const char *domain,
return wbc_status;
}
+/** @brief Trigger an extended logoff notification to Winbind for a specific user
+ *
+ * @param params A wbcLogoffUserParams structure
+ * @param error User output details on error
+ *
+ * @return #wbcErr
+ *
+ **/
+
+wbcErr wbcLogoffUserEx(const struct wbcLogoffUserParams *params,
+ struct wbcAuthErrorInfo **error)
+{
+ struct winbindd_request request;
+ struct winbindd_response response;
+ wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+ int i;
+
+ /* validate input */
+
+ if (!params || !params->username) {
+ wbc_status = WBC_ERR_INVALID_PARAM;
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+
+ if ((params->num_blobs > 0) && (params->blobs == NULL)) {
+ wbc_status = WBC_ERR_INVALID_PARAM;
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+ if ((params->num_blobs == 0) && (params->blobs != NULL)) {
+ wbc_status = WBC_ERR_INVALID_PARAM;
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+
+ ZERO_STRUCT(request);
+ ZERO_STRUCT(response);
+
+ strncpy(request.data.logoff.user, params->username,
+ sizeof(request.data.logoff.user)-1);
+
+ for (i=0; i<params->num_blobs; i++) {
+
+ if (strcasecmp(params->blobs[i].name, "ccfilename") == 0) {
+ if (params->blobs[i].blob.data) {
+ strncpy(request.data.logoff.krb5ccname,
+ (const char *)params->blobs[i].blob.data,
+ sizeof(request.data.logoff.krb5ccname) - 1);
+ }
+ continue;
+ }
+
+ if (strcasecmp(params->blobs[i].name, "user_uid") == 0) {
+ if (params->blobs[i].blob.data) {
+ memcpy(&request.data.logoff.uid,
+ params->blobs[i].blob.data,
+ MIN(params->blobs[i].blob.length,
+ sizeof(request.data.logoff.uid)));
+ }
+ continue;
+ }
+
+ if (strcasecmp(params->blobs[i].name, "flags") == 0) {
+ if (params->blobs[i].blob.data) {
+ memcpy(&request.flags,
+ params->blobs[i].blob.data,
+ MIN(params->blobs[i].blob.length,
+ sizeof(request.flags)));
+ }
+ continue;
+ }
+ }
+
+ /* Send request */
+
+ wbc_status = wbcRequestResponse(WINBINDD_PAM_LOGOFF,
+ &request,
+ &response);
+
+ /* Take the response above and return it to the caller */
+ if (response.data.auth.nt_status != 0) {
+ if (error) {
+ wbc_status = wbc_create_error_info(NULL,
+ &response,
+ error);
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+
+ wbc_status = WBC_ERR_AUTH_ERROR;
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+ BAIL_ON_WBC_ERROR(wbc_status);
+
+ done:
+ return wbc_status;
+}
+
/** @brief Trigger a logoff notification to Winbind for a specific user
*
* @param username Name of user to remove from Winbind's list of
@@ -794,3 +939,159 @@ wbcErr wbcChangeUserPassword(const char *username,
done:
return wbc_status;
}
+
+/** @brief Logon a User
+ *
+ * @param[in] params Pointer to a wbcLogonUserParams structure
+ * @param[out] info Pointer to a pointer to a wbcLogonUserInfo structure
+ * @param[out] error Pointer to a pointer to a wbcAuthErrorInfo structure
+ * @param[out] policy Pointer to a pointer to a wbcUserPasswordPolicyInfo structure
+ *
+ * @return #wbcErr
+ *
+ **/
+
+wbcErr wbcLogonUser(const struct wbcLogonUserParams *params,
+ struct wbcLogonUserInfo **info,
+ struct wbcAuthErrorInfo **error,
+ struct wbcUserPasswordPolicyInfo **policy)
+{
+ wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+ int cmd = 0;
+ struct winbindd_request request;
+ struct winbindd_response response;
+ uint32_t i;
+
+ ZERO_STRUCT(request);
+ ZERO_STRUCT(response);
+
+ if (info) {
+ *info = NULL;
+ }
+ if (error) {
+ *error = NULL;
+ }
+ if (policy) {
+ *policy = NULL;
+ }
+
+ if (!params) {
+ wbc_status = WBC_ERR_INVALID_PARAM;
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+
+ if (!params->username) {
+ wbc_status = WBC_ERR_INVALID_PARAM;
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+
+ if ((params->num_blobs > 0) && (params->blobs == NULL)) {
+ wbc_status = WBC_ERR_INVALID_PARAM;
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+ if ((params->num_blobs == 0) && (params->blobs != NULL)) {
+ wbc_status = WBC_ERR_INVALID_PARAM;
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+
+ /* Initialize request */
+
+ cmd = WINBINDD_PAM_AUTH;
+ request.flags = WBFLAG_PAM_INFO3_TEXT |
+ WBFLAG_PAM_USER_SESSION_KEY |
+ WBFLAG_PAM_LMKEY;
+
+ if (!params->password) {
+ wbc_status = WBC_ERR_INVALID_PARAM;
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+
+ strncpy(request.data.auth.user,
+ params->username,
+ sizeof(request.data.auth.user)-1);
+
+ strncpy(request.data.auth.pass,
+ params->password,
+ sizeof(request.data.auth.pass)-1);
+
+ for (i=0; i<params->num_blobs; i++) {
+
+ if (strcasecmp(params->blobs[i].name, "krb5_cc_type") == 0) {
+ if (params->blobs[i].blob.data) {
+ strncpy(request.data.auth.krb5_cc_type,
+ (const char *)params->blobs[i].blob.data,
+ sizeof(request.data.auth.krb5_cc_type) - 1);
+ }
+ continue;
+ }
+
+ if (strcasecmp(params->blobs[i].name, "user_uid") == 0) {
+ if (params->blobs[i].blob.data) {
+ memcpy(&request.data.auth.uid,
+ params->blobs[i].blob.data,
+ MIN(sizeof(request.data.auth.uid),
+ params->blobs[i].blob.length));
+ }
+ continue;
+ }
+
+ if (strcasecmp(params->blobs[i].name, "flags") == 0) {
+ if (params->blobs[i].blob.data) {
+ uint32_t flags;
+ memcpy(&flags,
+ params->blobs[i].blob.data,
+ MIN(sizeof(flags),
+ params->blobs[i].blob.length));
+ request.flags |= flags;
+ }
+ continue;
+ }
+
+ if (strcasecmp(params->blobs[i].name, "membership_of") == 0) {
+ if (params->blobs[i].blob.data &&
+ params->blobs[i].blob.data[0] > 0) {
+ strncpy(request.data.auth.require_membership_of_sid,
+ (const char *)params->blobs[i].blob.data,
+ sizeof(request.data.auth.require_membership_of_sid) - 1);
+ }
+ continue;
+ }
+ }
+
+ wbc_status = wbcRequestResponse(cmd,
+ &request,
+ &response);
+
+ if (response.data.auth.nt_status != 0) {
+ if (error) {
+ wbc_status = wbc_create_error_info(NULL,
+ &response,
+ error);
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+
+ wbc_status = WBC_ERR_AUTH_ERROR;
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+ BAIL_ON_WBC_ERROR(wbc_status);
+
+ if (info) {
+ wbc_status = wbc_create_logon_info(NULL,
+ &response,
+ info);
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+
+ if (policy) {
+ wbc_status = wbc_create_password_policy_info(NULL,
+ &response,
+ policy);
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+
+done:
+ if (response.extra_data.data)
+ free(response.extra_data.data);
+
+ return wbc_status;
+}
diff --git a/source3/nsswitch/libwbclient/wbc_pwd.c b/source3/nsswitch/libwbclient/wbc_pwd.c
index b5f167369c..0d17b312ef 100644
--- a/source3/nsswitch/libwbclient/wbc_pwd.c
+++ b/source3/nsswitch/libwbclient/wbc_pwd.c
@@ -380,7 +380,7 @@ wbcErr wbcGetgrent(struct group **grp)
*
* @param *account The given user name
* @param *num_groups Number of elements returned in the groups array
- * @param **groups Pointer to resulting gid_t array.
+ * @param **_groups Pointer to resulting gid_t array.
*
* @return #wbcErr
**/
diff --git a/source3/nsswitch/libwbclient/wbc_sid.c b/source3/nsswitch/libwbclient/wbc_sid.c
index f4ffa4e5ca..4cfdd792b5 100644
--- a/source3/nsswitch/libwbclient/wbc_sid.c
+++ b/source3/nsswitch/libwbclient/wbc_sid.c
@@ -223,9 +223,9 @@ wbcErr wbcLookupName(const char *domain,
/** @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
+ * @param pdomain Resolved Domain name (possibly "")
+ * @param pname Resolved User or group name
+ * @param *pname_type Pointet to the resolved SID type
*
* @return #wbcErr
*
diff --git a/source3/nsswitch/libwbclient/wbc_util.c b/source3/nsswitch/libwbclient/wbc_util.c
index 24568f9101..b4868748ae 100644
--- a/source3/nsswitch/libwbclient/wbc_util.c
+++ b/source3/nsswitch/libwbclient/wbc_util.c
@@ -496,7 +496,7 @@ wbcErr wbcListTrusts(struct wbcDomainInfo **domains, size_t *num_domains)
/** @brief Enumerate the domain trusts known by Winbind
*
* @param domain Name of the domain to query for a DC
- * @flags Bit flags used to control the domain location query
+ * @param flags Bit flags used to control the domain location query
* @param *dc_info Pointer to the returned domain controller information
*
* @return #wbcErr
@@ -550,3 +550,187 @@ done:
return wbc_status;
}
+
+static wbcErr wbc_create_domain_controller_info_ex(TALLOC_CTX *mem_ctx,
+ const struct winbindd_response *resp,
+ struct wbcDomainControllerInfoEx **_i)
+{
+ wbcErr wbc_status = WBC_ERR_SUCCESS;
+ struct wbcDomainControllerInfoEx *i;
+ struct wbcGuid guid;
+
+ i = talloc(mem_ctx, struct wbcDomainControllerInfoEx);
+ BAIL_ON_PTR_ERROR(i, wbc_status);
+
+ i->dc_unc = talloc_strdup(i, resp->data.dsgetdcname.dc_unc);
+ BAIL_ON_PTR_ERROR(i->dc_unc, wbc_status);
+
+ i->dc_address = talloc_strdup(i, resp->data.dsgetdcname.dc_address);
+ BAIL_ON_PTR_ERROR(i->dc_address, wbc_status);
+
+ i->dc_address_type = resp->data.dsgetdcname.dc_address_type;
+
+ wbc_status = wbcStringToGuid(resp->data.dsgetdcname.domain_guid, &guid);
+ if (WBC_ERROR_IS_OK(wbc_status)) {
+ i->domain_guid = talloc(i, struct wbcGuid);
+ BAIL_ON_PTR_ERROR(i->domain_guid, wbc_status);
+
+ *i->domain_guid = guid;
+ } else {
+ i->domain_guid = NULL;
+ }
+
+ i->domain_name = talloc_strdup(i, resp->data.dsgetdcname.domain_name);
+ BAIL_ON_PTR_ERROR(i->domain_name, wbc_status);
+
+ if (resp->data.dsgetdcname.forest_name[0] != '\0') {
+ i->forest_name = talloc_strdup(i,
+ resp->data.dsgetdcname.forest_name);
+ BAIL_ON_PTR_ERROR(i->forest_name, wbc_status);
+ } else {
+ i->forest_name = NULL;
+ }
+
+ i->dc_flags = resp->data.dsgetdcname.dc_flags;
+
+ if (resp->data.dsgetdcname.dc_site_name[0] != '\0') {
+ i->dc_site_name = talloc_strdup(i,
+ resp->data.dsgetdcname.dc_site_name);
+ BAIL_ON_PTR_ERROR(i->dc_site_name, wbc_status);
+ } else {
+ i->dc_site_name = NULL;
+ }
+
+ if (resp->data.dsgetdcname.client_site_name[0] != '\0') {
+ i->client_site_name = talloc_strdup(i,
+ resp->data.dsgetdcname.client_site_name);
+ BAIL_ON_PTR_ERROR(i->client_site_name, wbc_status);
+ } else {
+ i->client_site_name = NULL;
+ }
+
+ *_i = i;
+ i = NULL;
+
+done:
+ talloc_free(i);
+ return wbc_status;
+}
+
+/** @brief Get extended domain controller information
+ *
+ * @param domain Name of the domain to query for a DC
+ * @param guid Guid of the domain to query for a DC
+ * @param site Site of the domain to query for a DC
+ * @param flags Bit flags used to control the domain location query
+ * @param *dc_info Pointer to the returned extended domain controller information
+ *
+ * @return #wbcErr
+ *
+ **/
+
+wbcErr wbcLookupDomainControllerEx(const char *domain,
+ struct wbcGuid *guid,
+ const char *site,
+ uint32_t flags,
+ struct wbcDomainControllerInfoEx **dc_info)
+{
+ wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+ struct winbindd_request request;
+ struct winbindd_response response;
+
+ /* validate input params */
+
+ if (!domain || !dc_info) {
+ wbc_status = WBC_ERR_INVALID_PARAM;
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+
+ ZERO_STRUCT(request);
+ ZERO_STRUCT(response);
+
+ request.data.dsgetdcname.flags = flags;
+
+ strncpy(request.data.dsgetdcname.domain_name, domain,
+ sizeof(request.data.dsgetdcname.domain_name)-1);
+
+ if (site) {
+ strncpy(request.data.dsgetdcname.site_name, site,
+ sizeof(request.data.dsgetdcname.site_name)-1);
+ }
+
+ if (guid) {
+ char *str = NULL;
+
+ wbc_status = wbcGuidToString(guid, &str);
+ BAIL_ON_WBC_ERROR(wbc_status);
+
+ strncpy(request.data.dsgetdcname.domain_guid, str,
+ sizeof(request.data.dsgetdcname.domain_guid)-1);
+
+ wbcFreeMemory(str);
+ }
+
+ /* Send request */
+
+ wbc_status = wbcRequestResponse(WINBINDD_DSGETDCNAME,
+ &request,
+ &response);
+ BAIL_ON_WBC_ERROR(wbc_status);
+
+ if (dc_info) {
+ wbc_status = wbc_create_domain_controller_info_ex(NULL,
+ &response,
+ dc_info);
+ BAIL_ON_WBC_ERROR(wbc_status);
+ }
+
+ wbc_status = WBC_ERR_SUCCESS;
+done:
+ return wbc_status;
+}
+
+/** @brief Initialize a named blob and add to list of blobs
+ *
+ * @param[in,out] num_blobs Pointer to the number of blobs
+ * @param[in,out] blobs Pointer to an array of blobs
+ * @param[in] name Name of the new named blob
+ * @param[in] flags Flags of the new named blob
+ * @param[in] data Blob data of new blob
+ * @param[in] length Blob data length of new blob
+ *
+ * @return #wbcErr
+ *
+ **/
+
+wbcErr wbcAddNamedBlob(size_t *num_blobs,
+ struct wbcNamedBlob **blobs,
+ const char *name,
+ uint32_t flags,
+ uint8_t *data,
+ size_t length)
+{
+ wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+ struct wbcNamedBlob blob;
+
+ *blobs = talloc_realloc(NULL, *blobs, struct wbcNamedBlob,
+ *(num_blobs)+1);
+ BAIL_ON_PTR_ERROR(*blobs, wbc_status);
+
+ blob.name = talloc_strdup(*blobs, name);
+ BAIL_ON_PTR_ERROR(blob.name, wbc_status);
+ blob.flags = flags;
+ blob.blob.length = length;
+ blob.blob.data = (uint8_t *)talloc_memdup(*blobs, data, length);
+ BAIL_ON_PTR_ERROR(blob.blob.data, wbc_status);
+
+ (*(blobs))[*num_blobs] = blob;
+ *(num_blobs) += 1;
+
+ wbc_status = WBC_ERR_SUCCESS;
+done:
+ if (!WBC_ERROR_IS_OK(wbc_status) && blobs) {
+ wbcFreeMemory(*blobs);
+ }
+ return wbc_status;
+}
diff --git a/source3/nsswitch/libwbclient/wbclient.h b/source3/nsswitch/libwbclient/wbclient.h
index cae3feec5b..00a3c98966 100644
--- a/source3/nsswitch/libwbclient/wbclient.h
+++ b/source3/nsswitch/libwbclient/wbclient.h
@@ -137,6 +137,19 @@ struct wbcSidWithAttr {
#define WBC_SID_ATTR_GROUP_LOGON_ID 0xC0000000
/**
+ * @brief Windows GUID
+ *
+ **/
+
+struct wbcGuid {
+ uint32_t time_low;
+ uint16_t time_mid;
+ uint16_t time_hi_and_version;
+ uint8_t clock_seq[2];
+ uint8_t node[6];
+};
+
+/**
* @brief Domain Information
**/
@@ -206,6 +219,36 @@ struct wbcAuthUserParams {
};
/**
+ * @brief Generic Blob
+ **/
+
+struct wbcBlob {
+ uint8_t *data;
+ size_t length;
+};
+
+/**
+ * @brief Named Blob
+ **/
+
+struct wbcNamedBlob {
+ const char *name;
+ uint32_t flags;
+ struct wbcBlob blob;
+};
+
+/**
+ * @brief Logon User Parameters
+ **/
+
+struct wbcLogonUserParams {
+ const char *username;
+ const char *password;
+ size_t num_blobs;
+ struct wbcNamedBlob *blobs;
+};
+
+/**
* @brief ChangePassword Parameters
**/
@@ -297,6 +340,18 @@ struct wbcAuthUserInfo {
struct wbcSidWithAttr *sids;
};
+/**
+ * @brief Logon User Information
+ *
+ * Some of the strings are maybe NULL
+ **/
+
+struct wbcLogonUserInfo {
+ struct wbcAuthUserInfo *info;
+ size_t num_blobs;
+ struct wbcNamedBlob *blobs;
+};
+
/* wbcAuthUserInfo->user_flags */
#define WBC_AUTH_USER_INFO_GUEST 0x00000001
@@ -372,6 +427,16 @@ enum wbcPasswordChangeRejectReason {
WBC_PWD_CHANGE_REJECT_COMPLEXITY=5
};
+/**
+ * @brief Logoff User Parameters
+ **/
+
+struct wbcLogoffUserParams {
+ const char *username;
+ size_t num_blobs;
+ struct wbcNamedBlob *blobs;
+};
+
/*
* DomainControllerInfo struct
*/
@@ -379,7 +444,20 @@ struct wbcDomainControllerInfo {
char *dc_name;
};
-
+/*
+ * DomainControllerInfoEx struct
+ */
+struct wbcDomainControllerInfoEx {
+ const char *dc_unc;
+ const char *dc_address;
+ uint16_t dc_address_type;
+ struct wbcGuid *domain_guid;
+ const char *domain_name;
+ const char *forest_name;
+ uint32_t dc_flags;
+ const char *dc_site_name;
+ const char *client_site_name;
+};
/*
* Memory Management
@@ -398,6 +476,16 @@ wbcErr wbcSidToString(const struct wbcDomainSid *sid,
wbcErr wbcStringToSid(const char *sid_string,
struct wbcDomainSid *sid);
+/*
+ * Utility functions for dealing with GUIDs
+ */
+
+wbcErr wbcGuidToString(const struct wbcGuid *guid,
+ char **guid_string);
+
+wbcErr wbcStringToGuid(const char *guid_string,
+ struct wbcGuid *guid);
+
wbcErr wbcPing(void);
wbcErr wbcLibraryDetails(struct wbcLibraryDetails **details);
@@ -531,6 +619,12 @@ wbcErr wbcLookupDomainController(const char *domain,
uint32_t flags,
struct wbcDomainControllerInfo **dc_info);
+wbcErr wbcLookupDomainControllerEx(const char *domain,
+ struct wbcGuid *guid,
+ const char *site,
+ uint32_t flags,
+ struct wbcDomainControllerInfoEx **dc_info);
+
/*
* Athenticate functions
*/
@@ -542,10 +636,18 @@ wbcErr wbcAuthenticateUserEx(const struct wbcAuthUserParams *params,
struct wbcAuthUserInfo **info,
struct wbcAuthErrorInfo **error);
+wbcErr wbcLogonUser(const struct wbcLogonUserParams *params,
+ struct wbcLogonUserInfo **info,
+ struct wbcAuthErrorInfo **error,
+ struct wbcUserPasswordPolicyInfo **policy);
+
wbcErr wbcLogoffUser(const char *username,
uid_t uid,
const char *ccfilename);
+wbcErr wbcLogoffUserEx(const struct wbcLogoffUserParams *params,
+ struct wbcAuthErrorInfo **error);
+
wbcErr wbcChangeUserPassword(const char *username,
const char *old_password,
const char *new_password);
@@ -566,6 +668,14 @@ wbcErr wbcResolveWinsByIP(const char *ip, char **name);
*/
wbcErr wbcCheckTrustCredentials(const char *domain,
struct wbcAuthErrorInfo **error);
-
+/*
+ * Helper functions
+ */
+wbcErr wbcAddNamedBlob(size_t *num_blobs,
+ struct wbcNamedBlob **blobs,
+ const char *name,
+ uint32_t flags,
+ uint8_t *data,
+ size_t length);
#endif /* _WBCLIENT_H */
diff --git a/source3/nsswitch/pam_winbind.c b/source3/nsswitch/pam_winbind.c
index c28c5d2697..8d8868d0ef 100644
--- a/source3/nsswitch/pam_winbind.c
+++ b/source3/nsswitch/pam_winbind.c
@@ -12,6 +12,42 @@
#include "pam_winbind.h"
+static int wbc_error_to_pam_error(wbcErr status)
+{
+ switch (status) {
+ case WBC_ERR_SUCCESS:
+ return PAM_SUCCESS;
+ case WBC_ERR_NOT_IMPLEMENTED:
+ return PAM_SERVICE_ERR;
+ case WBC_ERR_UNKNOWN_FAILURE:
+ break;
+ case WBC_ERR_NO_MEMORY:
+ return PAM_BUF_ERR;
+ case WBC_ERR_INVALID_SID:
+ case WBC_ERR_INVALID_PARAM:
+ break;
+ case WBC_ERR_WINBIND_NOT_AVAILABLE:
+ return PAM_AUTHINFO_UNAVAIL;
+ case WBC_ERR_DOMAIN_NOT_FOUND:
+ return PAM_AUTHINFO_UNAVAIL;
+ case WBC_ERR_INVALID_RESPONSE:
+ return PAM_BUF_ERR;
+ case WBC_ERR_NSS_ERROR:
+ return PAM_USER_UNKNOWN;
+ case WBC_ERR_AUTH_ERROR:
+ return PAM_AUTH_ERR;
+ case WBC_ERR_UNKNOWN_USER:
+ return PAM_USER_UNKNOWN;
+ case WBC_ERR_UNKNOWN_GROUP:
+ return PAM_USER_UNKNOWN;
+ case WBC_ERR_PWD_CHANGE_FAILED:
+ break;
+ }
+
+ /* be paranoid */
+ return PAM_AUTH_ERR;
+}
+
static const char *_pam_error_code_str(int err)
{
switch (err) {
@@ -71,14 +107,22 @@ static const char *_pam_error_code_str(int err)
return "PAM_ABORT";
case PAM_AUTHTOK_EXPIRED:
return "PAM_AUTHTOK_EXPIRED";
+#ifdef PAM_MODULE_UNKNOWN
case PAM_MODULE_UNKNOWN:
return "PAM_MODULE_UNKNOWN";
+#endif
+#ifdef PAM_BAD_ITEM
case PAM_BAD_ITEM:
return "PAM_BAD_ITEM";
+#endif
+#ifdef PAM_CONV_AGAIN
case PAM_CONV_AGAIN:
return "PAM_CONV_AGAIN";
+#endif
+#ifdef PAM_INCOMPLETE
case PAM_INCOMPLETE:
return "PAM_INCOMPLETE";
+#endif
default:
return NULL;
}
@@ -393,6 +437,10 @@ static int _pam_parse(const pam_handle_t *pamh,
ctrl |= WINBIND_WARN_PWD_EXPIRE;
}
+ if (iniparser_getboolean(d, "global:mkhomedir", false)) {
+ ctrl |= WINBIND_MKHOMEDIR;
+ }
+
config_from_pam:
/* step through arguments */
for (i=argc,v=argv; i-- > 0; ++v) {
@@ -425,6 +473,8 @@ config_from_pam:
ctrl |= WINBIND_KRB5_CCACHE_TYPE;
else if (!strcasecmp(*v, "cached_login"))
ctrl |= WINBIND_CACHED_LOGIN;
+ else if (!strcasecmp(*v, "mkhomedir"))
+ ctrl |= WINBIND_MKHOMEDIR;
else {
__pam_log(pamh, ctrl, LOG_ERR,
"pam_parse: unknown option: %s", *v);
@@ -444,13 +494,17 @@ config_from_pam:
return ctrl;
};
-static void _pam_winbind_free_context(struct pwb_context *ctx)
+static int _pam_winbind_free_context(struct pwb_context *ctx)
{
+ if (!ctx) {
+ return 0;
+ }
+
if (ctx->dict) {
iniparser_freedict(ctx->dict);
}
- SAFE_FREE(ctx);
+ return 0;
}
static int _pam_winbind_init_context(pam_handle_t *pamh,
@@ -461,12 +515,12 @@ static int _pam_winbind_init_context(pam_handle_t *pamh,
{
struct pwb_context *r = NULL;
- r = (struct pwb_context *)malloc(sizeof(struct pwb_context));
+ r = TALLOC_ZERO_P(NULL, struct pwb_context);
if (!r) {
return PAM_BUF_ERR;
}
- ZERO_STRUCTP(r);
+ talloc_set_destructor(r, _pam_winbind_free_context);
r->pamh = pamh;
r->flags = flags;
@@ -474,7 +528,7 @@ static int _pam_winbind_init_context(pam_handle_t *pamh,
r->argv = argv;
r->ctrl = _pam_parse(pamh, flags, argc, argv, &r->dict);
if (r->ctrl == -1) {
- _pam_winbind_free_context(r);
+ TALLOC_FREE(r);
return PAM_SYSTEM_ERR;
}
@@ -494,7 +548,7 @@ static void _pam_winbind_cleanup_func(pam_handle_t *pamh,
"(error_status = %d)", pamh, data,
error_status);
}
- SAFE_FREE(data);
+ TALLOC_FREE(data);
}
@@ -636,80 +690,11 @@ static int _make_remark_format(struct pwb_context *ctx, int type, const char *fo
return ret;
}
-static int pam_winbind_request(struct pwb_context *ctx,
- enum winbindd_cmd req_type,
- struct winbindd_request *request,
- struct winbindd_response *response)
-{
- /* Fill in request and send down pipe */
- winbindd_init_request(request, req_type);
-
- if (winbind_write_sock(request, sizeof(*request), 0, 0) == -1) {
- _pam_log(ctx, LOG_ERR,
- "pam_winbind_request: write to socket failed!");
- winbind_close_sock();
- return PAM_SERVICE_ERR;
- }
-
- /* Wait for reply */
- if (winbindd_read_reply(response) == -1) {
- _pam_log(ctx, LOG_ERR,
- "pam_winbind_request: read from socket failed!");
- winbind_close_sock();
- return PAM_SERVICE_ERR;
- }
-
- /* We are done with the socket - close it and avoid mischeif */
- winbind_close_sock();
-
- /* Copy reply data from socket */
- if (response->result == WINBINDD_OK) {
- return PAM_SUCCESS;
- }
-
- /* no need to check for pam_error codes for getpwnam() */
- switch (req_type) {
-
- case WINBINDD_GETPWNAM:
- case WINBINDD_LOOKUPNAME:
- if (strlen(response->data.auth.nt_status_string) > 0) {
- _pam_log(ctx, LOG_ERR,
- "request failed, NT error was %s",
- response->data.auth.nt_status_string);
- } else {
- _pam_log(ctx, LOG_ERR, "request failed");
- }
- return PAM_USER_UNKNOWN;
- default:
- break;
- }
-
- if (response->data.auth.pam_error != PAM_SUCCESS) {
- _pam_log(ctx, LOG_ERR,
- "request failed: %s, "
- "PAM error was %s (%d), NT error was %s",
- response->data.auth.error_string,
- pam_strerror(ctx->pamh, response->data.auth.pam_error),
- response->data.auth.pam_error,
- response->data.auth.nt_status_string);
- return response->data.auth.pam_error;
- }
-
- _pam_log(ctx, LOG_ERR, "request failed, but PAM error 0!");
-
- return PAM_SERVICE_ERR;
-}
-
static int pam_winbind_request_log(struct pwb_context *ctx,
- enum winbindd_cmd req_type,
- struct winbindd_request *request,
- struct winbindd_response *response,
- const char *user)
+ int retval,
+ const char *user,
+ const char *fn)
{
- int retval;
-
- retval = pam_winbind_request(ctx, req_type, request, response);
-
switch (retval) {
case PAM_AUTH_ERR:
/* incorrect password */
@@ -741,33 +726,65 @@ static int pam_winbind_request_log(struct pwb_context *ctx,
return retval;
case PAM_SUCCESS:
/* Otherwise, the authentication looked good */
- switch (req_type) {
- case WINBINDD_INFO:
- break;
- case WINBINDD_PAM_AUTH:
- _pam_log(ctx, LOG_NOTICE,
- "user '%s' granted access", user);
- break;
- case WINBINDD_PAM_CHAUTHTOK:
- _pam_log(ctx, LOG_NOTICE,
- "user '%s' password changed", user);
- break;
- default:
- _pam_log(ctx, LOG_NOTICE,
- "user '%s' OK", user);
- break;
+ if (strcmp(fn, "wbcLogonUser") == 0) {
+ _pam_log(ctx, LOG_NOTICE,
+ "user '%s' granted access", user);
+ } else {
+ _pam_log(ctx, LOG_NOTICE,
+ "user '%s' OK", user);
}
-
return retval;
default:
/* we don't know anything about this return value */
_pam_log(ctx, LOG_ERR,
- "internal module error (retval = %d, user = '%s')",
- retval, user);
+ "internal module error (retval = %s(%d), user = '%s')",
+ _pam_error_code_str(retval), retval, user);
return retval;
}
}
+static int wbc_auth_error_to_pam_error(struct pwb_context *ctx,
+ struct wbcAuthErrorInfo *e,
+ wbcErr status,
+ const char *username,
+ const char *fn)
+{
+ int ret = PAM_AUTH_ERR;
+
+ if (WBC_ERROR_IS_OK(status)) {
+ _pam_log_debug(ctx, LOG_DEBUG, "request %s succeeded",
+ fn);
+ ret = PAM_SUCCESS;
+ return pam_winbind_request_log(ctx, ret, username, fn);
+ }
+
+ if (e) {
+ if (e->pam_error != PAM_SUCCESS) {
+ _pam_log(ctx, LOG_ERR,
+ "request %s failed: %s, "
+ "PAM error: %s (%d), NTSTATUS: %s, "
+ "Error message was: %s",
+ fn,
+ wbcErrorString(status),
+ _pam_error_code_str(e->pam_error),
+ e->pam_error,
+ e->nt_string,
+ e->display_string);
+ ret = e->pam_error;
+ return pam_winbind_request_log(ctx, ret, username, fn);
+ }
+
+ _pam_log(ctx, LOG_ERR, "request %s failed, but PAM error 0!", fn);
+
+ ret = PAM_SERVICE_ERR;
+ return pam_winbind_request_log(ctx, ret, username, fn);
+ }
+
+ ret = wbc_error_to_pam_error(status);
+ return pam_winbind_request_log(ctx, ret, username, fn);
+}
+
+
/**
* send a password expiry message if required
*
@@ -840,29 +857,34 @@ static bool _pam_send_password_expiry_message(struct pwb_context *ctx,
*/
static void _pam_warn_password_expiry(struct pwb_context *ctx,
- const struct winbindd_response *response,
+ const struct wbcAuthUserInfo *info,
+ const struct wbcUserPasswordPolicyInfo *policy,
int warn_pwd_expire,
bool *already_expired)
{
time_t now = time(NULL);
time_t next_change = 0;
+ if (!info || !policy) {
+ return;
+ }
+
if (already_expired) {
*already_expired = false;
}
- /* accounts with ACB_PWNOEXP set never receive a warning */
- if (response->data.auth.info3.acct_flags & ACB_PWNOEXP) {
+ /* accounts with WBC_ACB_PWNOEXP set never receive a warning */
+ if (info->acct_flags & WBC_ACB_PWNOEXP) {
return;
}
/* no point in sending a warning if this is a grace logon */
- if (PAM_WB_GRACE_LOGON(response->data.auth.info3.user_flgs)) {
+ if (PAM_WB_GRACE_LOGON(info->user_flags)) {
return;
}
/* check if the info3 must change timestamp has been set */
- next_change = response->data.auth.info3.pass_must_change_time;
+ next_change = info->pass_must_change_time;
if (_pam_send_password_expiry_message(ctx, next_change, now,
warn_pwd_expire,
@@ -873,12 +895,11 @@ static void _pam_warn_password_expiry(struct pwb_context *ctx,
/* now check for the global password policy */
/* good catch from Ralf Haferkamp: an expiry of "never" is translated
* to -1 */
- if (response->data.auth.policy.expire <= 0) {
+ if (policy->expire <= 0) {
return;
}
- next_change = response->data.auth.info3.pass_last_set_time +
- response->data.auth.policy.expire;
+ next_change = info->pass_last_set_time + policy->expire;
if (_pam_send_password_expiry_message(ctx, next_change, now,
warn_pwd_expire,
@@ -936,33 +957,33 @@ static bool winbind_name_to_sid_string(struct pwb_context *ctx,
int sid_list_buffer_size)
{
const char* sid_string;
- struct winbindd_response sid_response;
/* lookup name? */
if (IS_SID_STRING(name)) {
sid_string = name;
} else {
- struct winbindd_request sid_request;
-
- ZERO_STRUCT(sid_request);
- ZERO_STRUCT(sid_response);
+ wbcErr wbc_status;
+ struct wbcDomainSid sid;
+ enum wbcSidType type;
+ char *sid_str;
_pam_log_debug(ctx, LOG_DEBUG,
"no sid given, looking up: %s\n", name);
- /* fortunatly winbindd can handle non-separated names */
- strncpy(sid_request.data.name.name, name,
- sizeof(sid_request.data.name.name) - 1);
-
- if (pam_winbind_request_log(ctx, WINBINDD_LOOKUPNAME,
- &sid_request, &sid_response,
- user)) {
+ wbc_status = wbcLookupName("", name, &sid, &type);
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
_pam_log(ctx, LOG_INFO,
"could not lookup name: %s\n", name);
return false;
}
- sid_string = sid_response.data.sid.sid;
+ wbc_status = wbcSidToString(&sid, &sid_str);
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
+ return false;
+ }
+
+ wbcFreeMemory(sid_str);
+ sid_string = sid_str;
}
if (!safe_append_string(sid_list_buffer, sid_string,
@@ -1047,15 +1068,28 @@ out:
*/
static void _pam_setup_krb5_env(struct pwb_context *ctx,
- const char *krb5ccname)
+ struct wbcLogonUserInfo *info)
{
char var[PATH_MAX];
int ret;
+ uint32_t i;
+ const char *krb5ccname = NULL;
if (off(ctx->ctrl, WINBIND_KRB5_AUTH)) {
return;
}
+ if (!info) {
+ return;
+ }
+
+ for (i=0; i < info->num_blobs; i++) {
+ if (strcasecmp(info->blobs[i].name, "krb5ccname") == 0) {
+ krb5ccname = (const char *)info->blobs[i].blob.data;
+ break;
+ }
+ }
+
if (!krb5ccname || (strlen(krb5ccname) == 0)) {
return;
}
@@ -1076,6 +1110,41 @@ static void _pam_setup_krb5_env(struct pwb_context *ctx,
}
/**
+ * Copy unix username if available (further processed in PAM).
+ *
+ * @param ctx PAM winbind context
+ * @param user_ret A pointer that holds a pointer to a string
+ * @param unix_username A username
+ *
+ * @return void.
+ */
+
+static void _pam_setup_unix_username(struct pwb_context *ctx,
+ char **user_ret,
+ struct wbcLogonUserInfo *info)
+{
+ const char *unix_username = NULL;
+ uint32_t i;
+
+ if (!user_ret || !info) {
+ return;
+ }
+
+ for (i=0; i < info->num_blobs; i++) {
+ if (strcasecmp(info->blobs[i].name, "unix_username") == 0) {
+ unix_username = (const char *)info->blobs[i].blob.data;
+ break;
+ }
+ }
+
+ if (!unix_username || !unix_username[0]) {
+ return;
+ }
+
+ *user_ret = strdup(unix_username);
+}
+
+/**
* Set string into the PAM stack.
*
* @param ctx PAM winbind context.
@@ -1096,14 +1165,13 @@ static void _pam_set_data_string(struct pwb_context *ctx,
return;
}
- ret = pam_set_data(ctx->pamh, data_name, (void *)strdup(value),
+ ret = pam_set_data(ctx->pamh, data_name, talloc_strdup(NULL, value),
_pam_winbind_cleanup_func);
if (ret) {
_pam_log_debug(ctx, LOG_DEBUG,
"Could not set data %s: %s\n",
data_name, pam_strerror(ctx->pamh, ret));
}
-
}
/**
@@ -1117,16 +1185,16 @@ static void _pam_set_data_string(struct pwb_context *ctx,
*/
static void _pam_set_data_info3(struct pwb_context *ctx,
- struct winbindd_response *response)
+ const struct wbcAuthUserInfo *info)
{
_pam_set_data_string(ctx, PAM_WINBIND_HOMEDIR,
- response->data.auth.info3.home_dir);
+ info->home_directory);
_pam_set_data_string(ctx, PAM_WINBIND_LOGONSCRIPT,
- response->data.auth.info3.logon_script);
+ info->logon_script);
_pam_set_data_string(ctx, PAM_WINBIND_LOGONSERVER,
- response->data.auth.info3.logon_srv);
+ info->logon_server);
_pam_set_data_string(ctx, PAM_WINBIND_PROFILEPATH,
- response->data.auth.info3.profile_path);
+ info->profile_path);
}
/**
@@ -1208,80 +1276,235 @@ static void _pam_warn_krb5_failure(struct pwb_context *ctx,
}
}
+static bool _pam_check_remark_auth_err(struct pwb_context *ctx,
+ const struct wbcAuthErrorInfo *e,
+ const char *nt_status_string,
+ int *pam_error)
+{
+ const char *ntstatus = NULL;
+ const char *error_string = NULL;
+
+ if (!e || !pam_error) {
+ return false;
+ }
+
+ ntstatus = e->nt_string;
+ if (!ntstatus) {
+ return false;
+ }
+
+ if (strcasecmp(ntstatus, nt_status_string) == 0) {
+
+ error_string = _get_ntstatus_error_string(nt_status_string);
+ if (error_string) {
+ _make_remark(ctx, PAM_ERROR_MSG, error_string);
+ *pam_error = e->pam_error;
+ return true;
+ }
+
+ if (e->display_string) {
+ _make_remark(ctx, PAM_ERROR_MSG, e->display_string);
+ *pam_error = e->pam_error;
+ return true;
+ }
+
+ _make_remark(ctx, PAM_ERROR_MSG, nt_status_string);
+ *pam_error = e->pam_error;
+
+ return true;
+ }
+
+ return false;
+};
+
/**
* Compose Password Restriction String for a PAM_ERROR_MSG conversation.
*
- * @param response The struct winbindd_response.
+ * @param i The wbcUserPasswordPolicyInfo struct.
*
- * @return string (caller needs to free).
+ * @return string (caller needs to talloc_free).
*/
-static char *_pam_compose_pwd_restriction_string(struct winbindd_response *response)
+static char *_pam_compose_pwd_restriction_string(struct pwb_context *ctx,
+ struct wbcUserPasswordPolicyInfo *i)
{
char *str = NULL;
- size_t offset = 0, ret = 0, str_size = 1024;
- str = (char *)malloc(str_size);
- if (!str) {
- return NULL;
+ if (!i) {
+ goto failed;
}
- memset(str, '\0', str_size);
-
- offset = snprintf(str, str_size, "Your password ");
- if (offset == -1) {
+ str = talloc_asprintf(ctx, "Your password ");
+ if (!str) {
goto failed;
}
- if (response->data.auth.policy.min_length_password > 0) {
- ret = snprintf(str+offset, str_size-offset,
+ if (i->min_length_password > 0) {
+ str = talloc_asprintf_append(str,
"must be at least %d characters; ",
- response->data.auth.policy.min_length_password);
- if (ret == -1) {
+ i->min_length_password);
+ if (!str) {
goto failed;
}
- offset += ret;
}
- if (response->data.auth.policy.password_history > 0) {
- ret = snprintf(str+offset, str_size-offset,
+ if (i->password_history > 0) {
+ str = talloc_asprintf_append(str,
"cannot repeat any of your previous %d "
"passwords; ",
- response->data.auth.policy.password_history);
- if (ret == -1) {
+ i->password_history);
+ if (!str) {
goto failed;
}
- offset += ret;
}
- if (response->data.auth.policy.password_properties &
- DOMAIN_PASSWORD_COMPLEX) {
- ret = snprintf(str+offset, str_size-offset,
+ if (i->password_properties & WBC_DOMAIN_PASSWORD_COMPLEX) {
+ str = talloc_asprintf_append(str,
"must contain capitals, numerals "
"or punctuation; "
"and cannot contain your account "
"or full name; ");
- if (ret == -1) {
+ if (!str) {
goto failed;
}
- offset += ret;
}
- ret = snprintf(str+offset, str_size-offset,
+ str = talloc_asprintf_append(str,
"Please type a different password. "
"Type a password which meets these requirements in "
"both text boxes.");
- if (ret == -1) {
+ if (!str) {
goto failed;
}
return str;
failed:
- SAFE_FREE(str);
+ TALLOC_FREE(str);
return NULL;
}
+static int _pam_create_homedir(struct pwb_context *ctx,
+ const char *dirname,
+ mode_t mode)
+{
+ struct stat sbuf;
+
+ if (stat(dirname, &sbuf) == 0) {
+ return PAM_SUCCESS;
+ }
+
+ if (mkdir(dirname, mode) != 0) {
+
+ _make_remark_format(ctx, PAM_TEXT_INFO,
+ "Creating directory: %s failed: %s",
+ dirname, strerror(errno));
+ _pam_log(ctx, LOG_ERR, "could not create dir: %s (%s)",
+ dirname, strerror(errno));
+ return PAM_PERM_DENIED;
+ }
+
+ return PAM_SUCCESS;
+}
+
+static int _pam_chown_homedir(struct pwb_context *ctx,
+ const char *dirname,
+ uid_t uid,
+ gid_t gid)
+{
+ if (chown(dirname, uid, gid) != 0) {
+ _pam_log(ctx, LOG_ERR, "failed to chown user homedir: %s (%s)",
+ dirname, strerror(errno));
+ return PAM_PERM_DENIED;
+ }
+
+ return PAM_SUCCESS;
+}
+
+static int _pam_mkhomedir(struct pwb_context *ctx)
+{
+ struct passwd *pwd = NULL;
+ char *token = NULL;
+ char *create_dir = NULL;
+ char *user_dir = NULL;
+ int ret;
+ const char *username;
+ mode_t mode = 0700;
+ char *safe_ptr = NULL;
+ char *p = NULL;
+
+ /* Get the username */
+ ret = pam_get_user(ctx->pamh, &username, NULL);
+ if ((ret != PAM_SUCCESS) || (!username)) {
+ _pam_log_debug(ctx, LOG_DEBUG, "can not get the username");
+ return PAM_SERVICE_ERR;
+ }
+
+ pwd = getpwnam(username);
+ if (pwd == NULL) {
+ _pam_log_debug(ctx, LOG_DEBUG, "can not get the username");
+ return PAM_USER_UNKNOWN;
+ }
+ _pam_log_debug(ctx, LOG_DEBUG, "homedir is: %s", pwd->pw_dir);
+
+ ret = _pam_create_homedir(ctx, pwd->pw_dir, 0700);
+ if (ret == PAM_SUCCESS) {
+ ret = _pam_chown_homedir(ctx, pwd->pw_dir,
+ pwd->pw_uid,
+ pwd->pw_gid);
+ }
+
+ if (ret == PAM_SUCCESS) {
+ return ret;
+ }
+
+ /* maybe we need to create parent dirs */
+ create_dir = talloc_strdup(ctx, "/");
+ if (!create_dir) {
+ return PAM_BUF_ERR;
+ }
+
+ /* find final directory */
+ user_dir = strrchr(pwd->pw_dir, '/');
+ if (!user_dir) {
+ return PAM_BUF_ERR;
+ }
+ user_dir++;
+
+ _pam_log(ctx, LOG_DEBUG, "final directory: %s", user_dir);
+
+ p = pwd->pw_dir;
+
+ while ((token = strtok_r(p, "/", &safe_ptr)) != NULL) {
+
+ mode = 0755;
+
+ p = NULL;
+
+ _pam_log_debug(ctx, LOG_DEBUG, "token is %s", token);
+
+ create_dir = talloc_asprintf_append(create_dir, "%s/", token);
+ if (!create_dir) {
+ return PAM_BUF_ERR;
+ }
+ _pam_log_debug(ctx, LOG_DEBUG, "current_dir is %s", create_dir);
+
+ if (strcmp(token, user_dir) == 0) {
+ _pam_log_debug(ctx, LOG_DEBUG, "assuming last directory: %s", token);
+ mode = 0700;
+ }
+
+ ret = _pam_create_homedir(ctx, create_dir, mode);
+ if (ret) {
+ return ret;
+ }
+ }
+
+ return _pam_chown_homedir(ctx, create_dir,
+ pwd->pw_uid,
+ pwd->pw_gid);
+}
+
/* talk to winbindd */
static int winbind_auth_request(struct pwb_context *ctx,
const char *user,
@@ -1289,37 +1512,52 @@ static int winbind_auth_request(struct pwb_context *ctx,
const char *member,
const char *cctype,
const int warn_pwd_expire,
- struct winbindd_response *p_response,
+ struct wbcAuthErrorInfo **p_error,
+ struct wbcLogonUserInfo **p_info,
+ struct wbcUserPasswordPolicyInfo **p_policy,
time_t *pwd_last_set,
char **user_ret)
{
- struct winbindd_request request;
- struct winbindd_response response;
- int ret;
- bool already_expired = false;
+ wbcErr wbc_status;
+
+ struct wbcLogonUserParams logon;
+ char membership_of[1024];
+ uid_t user_uid = -1;
+ uint32_t flags = WBFLAG_PAM_INFO3_TEXT |
+ WBFLAG_PAM_GET_PWD_POLICY;
+
+ struct wbcLogonUserInfo *info = NULL;
+ struct wbcAuthUserInfo *user_info = NULL;
+ struct wbcAuthErrorInfo *error = NULL;
+ struct wbcUserPasswordPolicyInfo *policy = NULL;
- ZERO_STRUCT(request);
- ZERO_STRUCT(response);
+ int ret = PAM_AUTH_ERR;
+ int i;
+ const char *codes[] = {
+ "NT_STATUS_PASSWORD_EXPIRED",
+ "NT_STATUS_PASSWORD_MUST_CHANGE",
+ "NT_STATUS_INVALID_WORKSTATION",
+ "NT_STATUS_INVALID_LOGON_HOURS",
+ "NT_STATUS_ACCOUNT_EXPIRED",
+ "NT_STATUS_ACCOUNT_DISABLED",
+ "NT_STATUS_ACCOUNT_LOCKED_OUT",
+ "NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT",
+ "NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT",
+ "NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT",
+ "NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND",
+ "NT_STATUS_NO_LOGON_SERVERS",
+ "NT_STATUS_WRONG_PASSWORD",
+ "NT_STATUS_ACCESS_DENIED"
+ };
if (pwd_last_set) {
*pwd_last_set = 0;
}
- strncpy(request.data.auth.user, user,
- sizeof(request.data.auth.user)-1);
-
- strncpy(request.data.auth.pass, pass,
- sizeof(request.data.auth.pass)-1);
-
- request.data.auth.krb5_cc_type[0] = '\0';
- request.data.auth.uid = -1;
-
- request.flags = WBFLAG_PAM_INFO3_TEXT | WBFLAG_PAM_GET_PWD_POLICY;
-
/* Krb5 auth always has to go against the KDC of the user's realm */
if (ctx->ctrl & WINBIND_KRB5_AUTH) {
- request.flags |= WBFLAG_PAM_CONTACT_TRUSTDOM;
+ flags |= WBFLAG_PAM_CONTACT_TRUSTDOM;
}
if (ctx->ctrl & (WINBIND_KRB5_AUTH|WINBIND_CACHED_LOGIN)) {
@@ -1329,7 +1567,7 @@ static int winbind_auth_request(struct pwb_context *ctx,
if (pwd == NULL) {
return PAM_USER_UNKNOWN;
}
- request.data.auth.uid = pwd->pw_uid;
+ user_uid = pwd->pw_uid;
}
if (ctx->ctrl & WINBIND_KRB5_AUTH) {
@@ -1337,38 +1575,34 @@ static int winbind_auth_request(struct pwb_context *ctx,
_pam_log_debug(ctx, LOG_DEBUG,
"enabling krb5 login flag\n");
- request.flags |= WBFLAG_PAM_KRB5 |
- WBFLAG_PAM_FALLBACK_AFTER_KRB5;
+ flags |= WBFLAG_PAM_KRB5 |
+ WBFLAG_PAM_FALLBACK_AFTER_KRB5;
}
if (ctx->ctrl & WINBIND_CACHED_LOGIN) {
_pam_log_debug(ctx, LOG_DEBUG,
"enabling cached login flag\n");
- request.flags |= WBFLAG_PAM_CACHED_LOGIN;
+ flags |= WBFLAG_PAM_CACHED_LOGIN;
}
if (user_ret) {
*user_ret = NULL;
- request.flags |= WBFLAG_PAM_UNIX_NAME;
+ flags |= WBFLAG_PAM_UNIX_NAME;
}
if (cctype != NULL) {
- strncpy(request.data.auth.krb5_cc_type, cctype,
- sizeof(request.data.auth.krb5_cc_type) - 1);
_pam_log_debug(ctx, LOG_DEBUG,
"enabling request for a %s krb5 ccache\n",
cctype);
}
- request.data.auth.require_membership_of_sid[0] = '\0';
-
if (member != NULL) {
- if (!winbind_name_list_to_sid_string_list(ctx, user,
- member,
- request.data.auth.require_membership_of_sid,
- sizeof(request.data.auth.require_membership_of_sid))) {
+ ZERO_STRUCT(membership_of);
+ if (!winbind_name_list_to_sid_string_list(ctx, user, member,
+ membership_of,
+ sizeof(membership_of))) {
_pam_log_debug(ctx, LOG_ERR,
"failed to serialize membership of sid "
"\"%s\"\n", member);
@@ -1376,60 +1610,100 @@ static int winbind_auth_request(struct pwb_context *ctx,
}
}
- ret = pam_winbind_request_log(ctx, WINBINDD_PAM_AUTH,
- &request, &response, user);
+ ZERO_STRUCT(logon);
- if (pwd_last_set) {
- *pwd_last_set = response.data.auth.info3.pass_last_set_time;
+ logon.username = user;
+ logon.password = pass;
+
+ wbc_status = wbcAddNamedBlob(&logon.num_blobs,
+ &logon.blobs,
+ "krb5_cc_type",
+ 0,
+ (uint8_t *)cctype,
+ strlen(cctype)+1);
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
+ goto done;
+ }
+
+ wbc_status = wbcAddNamedBlob(&logon.num_blobs,
+ &logon.blobs,
+ "flags",
+ 0,
+ (uint8_t *)&flags,
+ sizeof(flags));
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
+ goto done;
}
- if (p_response) {
- /* We want to process the response in the caller. */
- *p_response = response;
+ wbc_status = wbcAddNamedBlob(&logon.num_blobs,
+ &logon.blobs,
+ "user_uid",
+ 0,
+ (uint8_t *)&user_uid,
+ sizeof(user_uid));
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
+ goto done;
+ }
+
+ wbc_status = wbcAddNamedBlob(&logon.num_blobs,
+ &logon.blobs,
+ "membership_of",
+ 0,
+ (uint8_t *)membership_of,
+ sizeof(membership_of));
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
+ goto done;
+ }
+
+ wbc_status = wbcLogonUser(&logon, &info, &error, &policy);
+ ret = wbc_auth_error_to_pam_error(ctx, error, wbc_status,
+ user, "wbcLogonUser");
+ wbcFreeMemory(logon.blobs);
+ logon.blobs = NULL;
+
+ if (info && info->info) {
+ user_info = info->info;
+ }
+
+ if (pwd_last_set && user_info) {
+ *pwd_last_set = user_info->pass_last_set_time;
+ }
+
+ if (p_info && info) {
+ *p_info = info;
+ }
+
+ if (p_policy && policy) {
+ *p_policy = policy;
+ }
+
+ if (p_error && error) {
+ /* We want to process the error in the caller. */
+ *p_error = error;
return ret;
}
- if (ret) {
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_PASSWORD_EXPIRED");
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_PASSWORD_MUST_CHANGE");
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_INVALID_WORKSTATION");
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_INVALID_LOGON_HOURS");
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_ACCOUNT_EXPIRED");
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_ACCOUNT_DISABLED");
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_ACCOUNT_LOCKED_OUT");
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT");
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT");
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT");
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND");
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_NO_LOGON_SERVERS");
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_WRONG_PASSWORD");
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_ACCESS_DENIED");
+ for (i=0; i<ARRAY_SIZE(codes); i++) {
+ int _ret = ret;
+ if (_pam_check_remark_auth_err(ctx, error, codes[i], &_ret)) {
+ ret = _ret;
+ goto done;
+ }
}
- if (ret == PAM_SUCCESS) {
+ if ((ret == PAM_SUCCESS) && user_info && policy && info) {
+
+ bool already_expired = false;
/* warn a user if the password is about to expire soon */
- _pam_warn_password_expiry(ctx, &response,
+ _pam_warn_password_expiry(ctx, user_info, policy,
warn_pwd_expire,
&already_expired);
if (already_expired == true) {
- SMB_TIME_T last_set;
- last_set = response.data.auth.info3.pass_last_set_time;
+
+ SMB_TIME_T last_set = user_info->pass_last_set_time;
+
_pam_log_debug(ctx, LOG_DEBUG,
"Password has expired "
"(Password was last set: %lld, "
@@ -1437,33 +1711,44 @@ static int winbind_auth_request(struct pwb_context *ctx,
"%lld (now it's: %lu))\n",
(long long int)last_set,
(long long int)last_set +
- response.data.auth.policy.expire,
+ policy->expire,
time(NULL));
return PAM_AUTHTOK_EXPIRED;
}
/* inform about logon type */
- _pam_warn_logon_type(ctx, user,
- response.data.auth.info3.user_flgs);
+ _pam_warn_logon_type(ctx, user, user_info->user_flags);
/* inform about krb5 failures */
- _pam_warn_krb5_failure(ctx, user,
- response.data.auth.info3.user_flgs);
+ _pam_warn_krb5_failure(ctx, user, user_info->user_flags);
/* set some info3 info for other modules in the stack */
- _pam_set_data_info3(ctx, &response);
+ _pam_set_data_info3(ctx, user_info);
/* put krb5ccname into env */
- _pam_setup_krb5_env(ctx, response.data.auth.krb5ccname);
+ _pam_setup_krb5_env(ctx, info);
/* If winbindd returned a username, return the pointer to it
* here. */
- if (user_ret && response.data.auth.unix_username[0]) {
- /* We have to trust it's a null terminated string. */
- *user_ret = strndup(response.data.auth.unix_username,
- sizeof(response.data.auth.unix_username) - 1);
- }
+ _pam_setup_unix_username(ctx, user_ret, info);
+ }
+
+ done:
+ if (logon.blobs) {
+ wbcFreeMemory(logon.blobs);
+ }
+ if (info && info->blobs) {
+ wbcFreeMemory(info->blobs);
+ }
+ if (error && !p_error) {
+ wbcFreeMemory(error);
+ }
+ if (info && !p_info) {
+ wbcFreeMemory(info);
+ }
+ if (policy && !p_policy) {
+ wbcFreeMemory(policy);
}
return ret;
@@ -1476,99 +1761,95 @@ static int winbind_chauthtok_request(struct pwb_context *ctx,
const char *newpass,
time_t pwd_last_set)
{
- struct winbindd_request request;
- struct winbindd_response response;
- int ret;
+ wbcErr wbc_status;
+ struct wbcChangePasswordParams params;
+ struct wbcAuthErrorInfo *error = NULL;
+ struct wbcUserPasswordPolicyInfo *policy = NULL;
+ enum wbcPasswordChangeRejectReason reject_reason = -1;
+ uint32_t flags = 0;
- ZERO_STRUCT(request);
- ZERO_STRUCT(response);
+ int i;
+ const char *codes[] = {
+ "NT_STATUS_BACKUP_CONTROLLER",
+ "NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND",
+ "NT_STATUS_NO_LOGON_SERVERS",
+ "NT_STATUS_ACCESS_DENIED",
+ "NT_STATUS_PWD_TOO_SHORT", /* TODO: tell the min pwd length ? */
+ "NT_STATUS_PWD_TOO_RECENT", /* TODO: tell the minage ? */
+ "NT_STATUS_PWD_HISTORY_CONFLICT" /* TODO: tell the history length ? */
+ };
+ int ret = PAM_AUTH_ERR;
+
+ ZERO_STRUCT(params);
- if (request.data.chauthtok.user == NULL) {
- return -2;
+ if (ctx->ctrl & WINBIND_KRB5_AUTH) {
+ flags |= WBFLAG_PAM_KRB5 |
+ WBFLAG_PAM_CONTACT_TRUSTDOM;
}
- strncpy(request.data.chauthtok.user, user,
- sizeof(request.data.chauthtok.user) - 1);
-
- if (oldpass != NULL) {
- strncpy(request.data.chauthtok.oldpass, oldpass,
- sizeof(request.data.chauthtok.oldpass) - 1);
- } else {
- request.data.chauthtok.oldpass[0] = '\0';
+ if (ctx->ctrl & WINBIND_CACHED_LOGIN) {
+ flags |= WBFLAG_PAM_CACHED_LOGIN;
}
- if (newpass != NULL) {
- strncpy(request.data.chauthtok.newpass, newpass,
- sizeof(request.data.chauthtok.newpass) - 1);
- } else {
- request.data.chauthtok.newpass[0] = '\0';
- }
+ params.account_name = user;
+ params.level = WBC_AUTH_USER_LEVEL_PLAIN;
+ params.old_password.plaintext = oldpass;
+ params.new_password.plaintext = newpass;
+ params.flags = flags;
- if (ctx->ctrl & WINBIND_KRB5_AUTH) {
- request.flags = WBFLAG_PAM_KRB5 |
- WBFLAG_PAM_CONTACT_TRUSTDOM;
- }
+ wbc_status = wbcChangeUserPasswordEx(&params, &error, &reject_reason, &policy);
+ ret = wbc_auth_error_to_pam_error(ctx, error, wbc_status,
+ user, "wbcChangeUserPasswordEx");
- if (ctx->ctrl & WINBIND_CACHED_LOGIN) {
- request.flags |= WBFLAG_PAM_CACHED_LOGIN;
+ if (WBC_ERROR_IS_OK(wbc_status)) {
+ _pam_log(ctx, LOG_NOTICE,
+ "user '%s' password changed", user);
+ return PAM_SUCCESS;
}
- ret = pam_winbind_request_log(ctx, WINBINDD_PAM_CHAUTHTOK,
- &request, &response, user);
-
- if (ret == PAM_SUCCESS) {
+ if (!error) {
+ wbcFreeMemory(policy);
return ret;
}
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_BACKUP_CONTROLLER");
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND");
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_NO_LOGON_SERVERS");
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_ACCESS_DENIED");
-
- /* TODO: tell the min pwd length ? */
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_PWD_TOO_SHORT");
-
- /* TODO: tell the minage ? */
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_PWD_TOO_RECENT");
-
- /* TODO: tell the history length ? */
- PAM_WB_REMARK_CHECK_RESPONSE_RET(ctx, response,
- "NT_STATUS_PWD_HISTORY_CONFLICT");
+ for (i=0; i<ARRAY_SIZE(codes); i++) {
+ int _ret = ret;
+ if (_pam_check_remark_auth_err(ctx, error, codes[i], &_ret)) {
+ ret = _ret;
+ goto done;
+ }
+ }
- if (!strcasecmp(response.data.auth.nt_status_string,
+ if (!strcasecmp(error->nt_string,
"NT_STATUS_PASSWORD_RESTRICTION")) {
char *pwd_restriction_string = NULL;
- SMB_TIME_T min_pwd_age;
- uint32_t reject_reason = response.data.auth.reject_reason;
- min_pwd_age = response.data.auth.policy.min_passwordage;
+ SMB_TIME_T min_pwd_age = 0;
+
+ if (policy) {
+ min_pwd_age = policy->min_passwordage;
+ }
/* FIXME: avoid to send multiple PAM messages after another */
switch (reject_reason) {
case -1:
break;
- case SAMR_REJECT_OTHER:
+ case WBC_PWD_CHANGE_REJECT_OTHER:
if ((min_pwd_age > 0) &&
(pwd_last_set + min_pwd_age > time(NULL))) {
PAM_WB_REMARK_DIRECT(ctx,
"NT_STATUS_PWD_TOO_RECENT");
}
break;
- case SAMR_REJECT_TOO_SHORT:
+ case WBC_PWD_CHANGE_REJECT_TOO_SHORT:
PAM_WB_REMARK_DIRECT(ctx,
"NT_STATUS_PWD_TOO_SHORT");
break;
- case SAMR_REJECT_IN_HISTORY:
+ case WBC_PWD_CHANGE_REJECT_IN_HISTORY:
PAM_WB_REMARK_DIRECT(ctx,
"NT_STATUS_PWD_HISTORY_CONFLICT");
break;
- case SAMR_REJECT_COMPLEXITY:
+ case WBC_PWD_CHANGE_REJECT_COMPLEXITY:
_make_remark(ctx, PAM_ERROR_MSG,
"Password does not meet "
"complexity requirements");
@@ -1582,13 +1863,16 @@ static int winbind_chauthtok_request(struct pwb_context *ctx,
}
pwd_restriction_string =
- _pam_compose_pwd_restriction_string(&response);
+ _pam_compose_pwd_restriction_string(ctx, policy);
if (pwd_restriction_string) {
_make_remark(ctx, PAM_ERROR_MSG,
pwd_restriction_string);
- SAFE_FREE(pwd_restriction_string);
+ TALLOC_FREE(pwd_restriction_string);
}
}
+ done:
+ wbcFreeMemory(error);
+ wbcFreeMemory(policy);
return ret;
}
@@ -1608,29 +1892,26 @@ static int valid_user(struct pwb_context *ctx,
* sure it's really a winbind user, this is important when stacking PAM
* modules in the 'account' or 'password' facility. */
+ wbcErr wbc_status;
struct passwd *pwd = NULL;
- struct winbindd_request request;
- struct winbindd_response response;
- int ret;
-
- ZERO_STRUCT(request);
- ZERO_STRUCT(response);
+ struct passwd *wb_pwd = NULL;
pwd = getpwnam(user);
if (pwd == NULL) {
return 1;
}
- strncpy(request.data.username, user,
- sizeof(request.data.username) - 1);
-
- ret = pam_winbind_request_log(ctx, WINBINDD_GETPWNAM,
- &request, &response, user);
+ wbc_status = wbcGetpwnam(user, &wb_pwd);
+ wbcFreeMemory(wb_pwd);
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
+ _pam_log(ctx, LOG_DEBUG, "valid_user: wbcGetpwnam gave %s\n",
+ wbcErrorString(wbc_status));
+ }
- switch (ret) {
- case PAM_USER_UNKNOWN:
+ switch (wbc_status) {
+ case WBC_ERR_UNKNOWN_USER:
return 1;
- case PAM_SUCCESS:
+ case WBC_ERR_SUCCESS:
return 0;
default:
break;
@@ -1838,12 +2119,13 @@ static const char *get_conf_item_string(struct pwb_context *ctx,
if (ctx->dict) {
char *key = NULL;
- if (!asprintf(&key, "global:%s", item)) {
+ key = talloc_asprintf(ctx, "global:%s", item);
+ if (!key) {
goto out;
}
parm_opt = iniparser_getstr(ctx->dict, key);
- SAFE_FREE(key);
+ TALLOC_FREE(key);
_pam_log_debug(ctx, LOG_INFO, "CONFIG file: %s '%s'\n",
item, parm_opt);
@@ -1885,12 +2167,13 @@ static int get_config_item_int(struct pwb_context *ctx,
if (ctx->dict) {
char *key = NULL;
- if (!asprintf(&key, "global:%s", item)) {
+ key = talloc_asprintf(ctx, "global:%s", item);
+ if (!key) {
goto out;
}
parm_opt = iniparser_getint(ctx->dict, key, -1);
- SAFE_FREE(key);
+ TALLOC_FREE(key);
_pam_log_debug(ctx, LOG_INFO,
"CONFIG file: %s '%d'\n",
@@ -1940,20 +2223,25 @@ static int get_warn_pwd_expire_from_config(struct pwb_context *ctx)
static char winbind_get_separator(struct pwb_context *ctx)
{
- struct winbindd_request request;
- struct winbindd_response response;
+ wbcErr wbc_status;
+ static struct wbcInterfaceDetails *details = NULL;
- ZERO_STRUCT(request);
- ZERO_STRUCT(response);
+ wbc_status = wbcInterfaceDetails(&details);
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
+ _pam_log(ctx, LOG_ERR,
+ "Could not retrieve winbind interface details: %s",
+ wbcErrorString(wbc_status));
+ return '\0';
+ }
- if (pam_winbind_request_log(ctx, WINBINDD_INFO,
- &request, &response, NULL)) {
+ if (!details) {
return '\0';
}
- return response.data.info.winbind_separator;
+ return details->winbind_separator;
}
+
/**
* Convert a upn to a name.
*
@@ -1966,12 +2254,12 @@ static char winbind_get_separator(struct pwb_context *ctx)
static char* winbind_upn_to_username(struct pwb_context *ctx,
const char *upn)
{
- struct winbindd_request req;
- struct winbindd_response resp;
- int retval;
- char *account_name;
- int account_name_len;
char sep;
+ wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+ struct wbcDomainSid sid;
+ enum wbcSidType type;
+ char *domain;
+ char *name;
/* This cannot work when the winbind separator = @ */
@@ -1982,35 +2270,19 @@ static char* winbind_upn_to_username(struct pwb_context *ctx,
/* Convert the UPN to a SID */
- ZERO_STRUCT(req);
- ZERO_STRUCT(resp);
-
- strncpy(req.data.name.dom_name, "",
- sizeof(req.data.name.dom_name) - 1);
- strncpy(req.data.name.name, upn,
- sizeof(req.data.name.name) - 1);
- retval = pam_winbind_request_log(ctx, WINBINDD_LOOKUPNAME,
- &req, &resp, upn);
- if (retval != PAM_SUCCESS) {
+ wbc_status = wbcLookupName("", upn, &sid, &type);
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
return NULL;
}
/* Convert the the SID back to the sAMAccountName */
- ZERO_STRUCT(req);
- strncpy(req.data.sid, resp.data.sid.sid, sizeof(req.data.sid)-1);
- ZERO_STRUCT(resp);
- retval = pam_winbind_request_log(ctx, WINBINDD_LOOKUPSID,
- &req, &resp, upn);
- if (retval != PAM_SUCCESS) {
+ wbc_status = wbcLookupSid(&sid, &domain, &name, &type);
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
return NULL;
}
- account_name_len = asprintf(&account_name, "%s\\%s",
- resp.data.name.dom_name,
- resp.data.name.name);
-
- return account_name;
+ return talloc_asprintf(ctx, "%s\\%s", domain, name);
}
PAM_EXTERN
@@ -2079,7 +2351,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
real_username);
if (samaccountname) {
free(real_username);
- real_username = samaccountname;
+ real_username = strdup(samaccountname);
}
}
@@ -2111,7 +2383,8 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
/* Now use the username to look up password */
retval = winbind_auth_request(ctx, real_username, password,
- member, cctype, warn_pwd_expire, NULL,
+ member, cctype, warn_pwd_expire,
+ NULL, NULL, NULL,
NULL, &username_ret);
if (retval == PAM_NEW_AUTHTOK_REQD ||
@@ -2119,7 +2392,8 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
char *new_authtok_required_during_auth = NULL;
- if (!asprintf(&new_authtok_required, "%d", retval)) {
+ new_authtok_required = talloc_asprintf(NULL, "%d", retval);
+ if (!new_authtok_required) {
retval = PAM_BUF_ERR;
goto out;
}
@@ -2130,7 +2404,8 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
retval = PAM_SUCCESS;
- if (!asprintf(&new_authtok_required_during_auth, "%d", true)) {
+ new_authtok_required_during_auth = talloc_asprintf(NULL, "%d", true);
+ if (!new_authtok_required_during_auth) {
retval = PAM_BUF_ERR;
goto out;
}
@@ -2164,7 +2439,7 @@ out:
_PAM_LOG_FUNCTION_LEAVE("pam_sm_authenticate", ctx, retval);
- _pam_winbind_free_context(ctx);
+ TALLOC_FREE(ctx);
return retval;
}
@@ -2212,7 +2487,7 @@ int pam_sm_setcred(pam_handle_t *pamh, int flags,
_PAM_LOG_FUNCTION_LEAVE("pam_sm_setcred", ctx, ret);
- _pam_winbind_free_context(ctx);
+ TALLOC_FREE(ctx);
return ret;
}
@@ -2313,7 +2588,7 @@ int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags,
_PAM_LOG_FUNCTION_LEAVE("pam_sm_acct_mgmt", ctx, ret);
- _pam_winbind_free_context(ctx);
+ TALLOC_FREE(ctx);
return ret;
}
@@ -2322,7 +2597,7 @@ PAM_EXTERN
int pam_sm_open_session(pam_handle_t *pamh, int flags,
int argc, const char **argv)
{
- int ret = PAM_SYSTEM_ERR;
+ int ret = PAM_SUCCESS;
struct pwb_context *ctx = NULL;
ret = _pam_winbind_init_context(pamh, flags, argc, argv, &ctx);
@@ -2332,12 +2607,14 @@ int pam_sm_open_session(pam_handle_t *pamh, int flags,
_PAM_LOG_FUNCTION_ENTER("pam_sm_open_session", ctx);
- ret = PAM_SUCCESS;
-
+ if (ctx->ctrl & WINBIND_MKHOMEDIR) {
+ /* check and create homedir */
+ ret = _pam_mkhomedir(ctx);
+ }
out:
_PAM_LOG_FUNCTION_LEAVE("pam_sm_open_session", ctx, ret);
- _pam_winbind_free_context(ctx);
+ TALLOC_FREE(ctx);
return ret;
}
@@ -2348,6 +2625,7 @@ int pam_sm_close_session(pam_handle_t *pamh, int flags,
{
int retval = PAM_SUCCESS;
struct pwb_context *ctx = NULL;
+ struct wbcLogoffUserParams logoff;
retval = _pam_winbind_init_context(pamh, flags, argc, argv, &ctx);
if (retval) {
@@ -2364,15 +2642,15 @@ int pam_sm_close_session(pam_handle_t *pamh, int flags,
if (ctx->ctrl & WINBIND_KRB5_AUTH) {
/* destroy the ccache here */
- struct winbindd_request request;
- struct winbindd_response response;
+
+ wbcErr wbc_status;
+ struct wbcAuthErrorInfo *error = NULL;
+
+ uint32_t flags = 0;
const char *user;
const char *ccname = NULL;
struct passwd *pwd = NULL;
- ZERO_STRUCT(request);
- ZERO_STRUCT(response);
-
retval = pam_get_user(pamh, &user, "Username: ");
if (retval) {
_pam_log(ctx, LOG_ERR,
@@ -2396,34 +2674,70 @@ int pam_sm_close_session(pam_handle_t *pamh, int flags,
"user has no KRB5CCNAME environment");
}
- strncpy(request.data.logoff.user, user,
- sizeof(request.data.logoff.user) - 1);
-
- if (ccname) {
- strncpy(request.data.logoff.krb5ccname, ccname,
- sizeof(request.data.logoff.krb5ccname) - 1);
- }
-
pwd = getpwnam(user);
if (pwd == NULL) {
retval = PAM_USER_UNKNOWN;
goto out;
}
- request.data.logoff.uid = pwd->pw_uid;
- request.flags = WBFLAG_PAM_KRB5 |
- WBFLAG_PAM_CONTACT_TRUSTDOM;
+ flags = WBFLAG_PAM_KRB5 |
+ WBFLAG_PAM_CONTACT_TRUSTDOM;
+
+ ZERO_STRUCT(logoff);
+
+ logoff.username = user;
- retval = pam_winbind_request_log(ctx,
- WINBINDD_PAM_LOGOFF,
- &request, &response, user);
+ wbc_status = wbcAddNamedBlob(&logoff.num_blobs,
+ &logoff.blobs,
+ "ccfilename",
+ 0,
+ (uint8_t *)ccname,
+ strlen(ccname)+1);
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
+ goto out;
+ }
+
+ wbc_status = wbcAddNamedBlob(&logoff.num_blobs,
+ &logoff.blobs,
+ "flags",
+ 0,
+ (uint8_t *)&flags,
+ sizeof(flags));
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
+ goto out;
+ }
+
+ wbc_status = wbcAddNamedBlob(&logoff.num_blobs,
+ &logoff.blobs,
+ "user_uid",
+ 0,
+ (uint8_t *)&pwd->pw_uid,
+ sizeof(pwd->pw_uid));
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
+ goto out;
+ }
+
+ wbc_status = wbcLogoffUserEx(&logoff, &error);
+ retval = wbc_auth_error_to_pam_error(ctx, error, wbc_status,
+ user, "wbcLogoffUser");
+ wbcFreeMemory(error);
+ wbcFreeMemory(logoff.blobs);
+
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
+ _pam_log(ctx, LOG_INFO,
+ "failed to logoff user %s: %s\n",
+ user, wbcErrorString(wbc_status));
+ }
}
out:
+ if (logoff.blobs) {
+ wbcFreeMemory(logoff.blobs);
+ }
_PAM_LOG_FUNCTION_LEAVE("pam_sm_close_session", ctx, retval);
- _pam_winbind_free_context(ctx);
+ TALLOC_FREE(ctx);
return retval;
}
@@ -2495,11 +2809,9 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
int retry = 0;
char *username_ret = NULL;
- struct winbindd_response response;
+ struct wbcAuthErrorInfo *error = NULL;
struct pwb_context *ctx = NULL;
- ZERO_STRUCT(response);
-
ret = _pam_winbind_init_context(pamh, flags, argc, argv, &ctx);
if (ret) {
goto out;
@@ -2552,16 +2864,15 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
time_t pwdlastset_prelim = 0;
/* instruct user what is happening */
-#define greeting "Changing password for "
- Announce = (char *) malloc(sizeof(greeting) + strlen(user));
- if (Announce == NULL) {
+
+#define greeting "Changing password for"
+ Announce = talloc_asprintf(ctx, "%s %s", greeting, user);
+ if (!Announce) {
_pam_log(ctx, LOG_CRIT,
"password - out of memory");
ret = PAM_BUF_ERR;
goto out;
}
- (void) strcpy(Announce, greeting);
- (void) strcpy(Announce + sizeof(greeting) - 1, user);
#undef greeting
lctrl = ctx->ctrl | WINBIND__OLD_PASSWORD;
@@ -2570,6 +2881,7 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
"(current) NT password: ",
NULL,
(const char **) &pass_old);
+ TALLOC_FREE(Announce);
if (ret != PAM_SUCCESS) {
_pam_log(ctx, LOG_NOTICE,
"password - (old) token not obtained");
@@ -2579,7 +2891,8 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
/* verify that this is the password for this user */
ret = winbind_auth_request(ctx, user, pass_old,
- NULL, NULL, 0, &response,
+ NULL, NULL, 0,
+ &error, NULL, NULL,
&pwdlastset_prelim, NULL);
if (ret != PAM_ACCT_EXPIRED &&
@@ -2688,6 +3001,8 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
const char *member = NULL;
const char *cctype = NULL;
int warn_pwd_expire;
+ struct wbcLogonUserInfo *info = NULL;
+ struct wbcUserPasswordPolicyInfo *policy = NULL;
member = get_member_from_config(ctx);
cctype = get_krb5_cc_type_from_config(ctx);
@@ -2702,7 +3017,8 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
* */
ret = winbind_auth_request(ctx, user, pass_new,
- member, cctype, 0, &response,
+ member, cctype, 0,
+ &error, &info, &policy,
NULL, &username_ret);
_pam_overwrite(pass_new);
_pam_overwrite(pass_old);
@@ -2710,19 +3026,24 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
if (ret == PAM_SUCCESS) {
+ struct wbcAuthUserInfo *user_info = NULL;
+
+ if (info && info->info) {
+ user_info = info->info;
+ }
+
/* warn a user if the password is about to
* expire soon */
- _pam_warn_password_expiry(ctx, &response,
+ _pam_warn_password_expiry(ctx, user_info, policy,
warn_pwd_expire,
NULL);
/* set some info3 info for other modules in the
* stack */
- _pam_set_data_info3(ctx, &response);
+ _pam_set_data_info3(ctx, user_info);
/* put krb5ccname into env */
- _pam_setup_krb5_env(ctx,
- response.data.auth.krb5ccname);
+ _pam_setup_krb5_env(ctx, info);
if (username_ret) {
pam_set_item(pamh, PAM_USER,
@@ -2732,6 +3053,9 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
username_ret);
free(username_ret);
}
+
+ wbcFreeMemory(info);
+ wbcFreeMemory(policy);
}
goto out;
@@ -2741,18 +3065,28 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags,
}
out:
+ {
+ /* Deal with offline errors. */
+ int i;
+ const char *codes[] = {
+ "NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND",
+ "NT_STATUS_NO_LOGON_SERVERS",
+ "NT_STATUS_ACCESS_DENIED"
+ };
+
+ for (i=0; i<ARRAY_SIZE(codes); i++) {
+ int _ret;
+ if (_pam_check_remark_auth_err(ctx, error, codes[i], &_ret)) {
+ break;
+ }
+ }
+ }
- /* Deal with offline errors. */
- PAM_WB_REMARK_CHECK_RESPONSE(ctx, response,
- "NT_STATUS_NO_LOGON_SERVERS");
- PAM_WB_REMARK_CHECK_RESPONSE(ctx, response,
- "NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND");
- PAM_WB_REMARK_CHECK_RESPONSE(ctx, response,
- "NT_STATUS_ACCESS_DENIED");
+ wbcFreeMemory(error);
_PAM_LOG_FUNCTION_LEAVE("pam_sm_chauthtok", ctx, ret);
- _pam_winbind_free_context(ctx);
+ TALLOC_FREE(ctx);
return ret;
}
diff --git a/source3/nsswitch/pam_winbind.h b/source3/nsswitch/pam_winbind.h
index c8c1910641..cb6f450ccb 100644
--- a/source3/nsswitch/pam_winbind.h
+++ b/source3/nsswitch/pam_winbind.h
@@ -4,9 +4,11 @@
Shirish Kalele 2000
*/
-#include "lib/replace/replace.h"
+#include "../lib/replace/replace.h"
#include "system/syslog.h"
#include "system/time.h"
+#include <talloc.h>
+#include "libwbclient/wbclient.h"
#define MODULE_NAME "pam_winbind"
#define PAM_SM_AUTH
@@ -97,6 +99,7 @@ do { \
#define WINBIND_SILENT 0x00000800
#define WINBIND_DEBUG_STATE 0x00001000
#define WINBIND_WARN_PWD_EXPIRE 0x00002000
+#define WINBIND_MKHOMEDIR 0x00004000
/*
* here is the string to inform the user that the new passwords they
@@ -133,73 +136,11 @@ do { \
};\
};
-#define PAM_WB_REMARK_DIRECT_RET(h,f,x)\
-{\
- const char *error_string = NULL; \
- error_string = _get_ntstatus_error_string(x);\
- if (error_string != NULL) {\
- _make_remark(h, f, PAM_ERROR_MSG, error_string);\
- return ret;\
- };\
- _make_remark(h, f, PAM_ERROR_MSG, x);\
- return ret;\
-};
-
-#define PAM_WB_REMARK_CHECK_RESPONSE(c,x,y)\
-{\
- const char *ntstatus = x.data.auth.nt_status_string; \
- const char *error_string = NULL; \
- if (!strcasecmp(ntstatus,y)) {\
- error_string = _get_ntstatus_error_string(y);\
- if (error_string != NULL) {\
- _make_remark(c, PAM_ERROR_MSG, error_string);\
- };\
- if (x.data.auth.error_string[0] != '\0') {\
- _make_remark(c, PAM_ERROR_MSG, x.data.auth.error_string);\
- };\
- _make_remark(c, PAM_ERROR_MSG, y);\
- };\
-};
-
-#define PAM_WB_REMARK_CHECK_RESPONSE_RET(c,x,y)\
-{\
- const char *ntstatus = x.data.auth.nt_status_string; \
- const char *error_string = NULL; \
- if (!strcasecmp(ntstatus,y)) {\
- error_string = _get_ntstatus_error_string(y);\
- if (error_string != NULL) {\
- _make_remark(c, PAM_ERROR_MSG, error_string);\
- return ret;\
- };\
- if (x.data.auth.error_string[0] != '\0') {\
- _make_remark(c, PAM_ERROR_MSG, x.data.auth.error_string);\
- return ret;\
- };\
- _make_remark(c, PAM_ERROR_MSG, y);\
- return ret;\
- };\
-};
-
-/* from samr.idl */
-#define DOMAIN_PASSWORD_COMPLEX 0x00000001
-
-#define SAMR_REJECT_OTHER 0x00000000
-#define SAMR_REJECT_TOO_SHORT 0x00000001
-#define SAMR_REJECT_IN_HISTORY 0x00000002
-#define SAMR_REJECT_COMPLEXITY 0x00000005
-
-#define ACB_PWNOEXP 0x00000200
-
-/* from netlogon.idl */
-#define NETLOGON_CACHED_ACCOUNT 0x00000004
-#define NETLOGON_GRACE_LOGON 0x01000000
-
-/* from include/rpc_netlogon.h */
#define LOGON_KRB5_FAIL_CLOCK_SKEW 0x02000000
-#define PAM_WB_CACHED_LOGON(x) (x & NETLOGON_CACHED_ACCOUNT)
+#define PAM_WB_CACHED_LOGON(x) (x & WBC_AUTH_USER_INFO_CACHED_ACCOUNT)
#define PAM_WB_KRB5_CLOCK_SKEW(x) (x & LOGON_KRB5_FAIL_CLOCK_SKEW)
-#define PAM_WB_GRACE_LOGON(x) ((NETLOGON_CACHED_ACCOUNT|NETLOGON_GRACE_LOGON) == ( x & (NETLOGON_CACHED_ACCOUNT|NETLOGON_GRACE_LOGON)))
+#define PAM_WB_GRACE_LOGON(x) ((WBC_AUTH_USER_INFO_CACHED_ACCOUNT|WBC_AUTH_USER_INFO_GRACE_LOGON) == ( x & (WBC_AUTH_USER_INFO_CACHED_ACCOUNT|WBC_AUTH_USER_INFO_GRACE_LOGON)))
struct pwb_context {
pam_handle_t *pamh;
@@ -209,3 +150,8 @@ struct pwb_context {
dictionary *dict;
uint32_t ctrl;
};
+
+#define TALLOC_FREE(ctx) do { if ((ctx) != NULL) {talloc_free(ctx); ctx=NULL;} } while(0)
+#define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type)
+#define TALLOC_P(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type)
+
diff --git a/source3/nsswitch/wbinfo.c b/source3/nsswitch/wbinfo.c
index 60524d1d1b..fc49be4314 100644
--- a/source3/nsswitch/wbinfo.c
+++ b/source3/nsswitch/wbinfo.c
@@ -538,8 +538,8 @@ static bool wbinfo_dsgetdcname(const char *domain_name, uint32_t flags)
ZERO_STRUCT(request);
ZERO_STRUCT(response);
- fstrcpy(request.domain_name, domain_name);
- request.flags = flags;
+ fstrcpy(request.data.dsgetdcname.domain_name, domain_name);
+ request.data.dsgetdcname.flags = flags;
request.flags |= DS_DIRECTORY_SERVICE_REQUIRED;
@@ -553,7 +553,15 @@ static bool wbinfo_dsgetdcname(const char *domain_name, uint32_t flags)
/* Display response */
- d_printf("%s\n", response.data.dc_name);
+ d_printf("%s\n", response.data.dsgetdcname.dc_unc);
+ d_printf("%s\n", response.data.dsgetdcname.dc_address);
+ d_printf("%d\n", response.data.dsgetdcname.dc_address_type);
+ d_printf("%s\n", response.data.dsgetdcname.domain_guid);
+ d_printf("%s\n", response.data.dsgetdcname.domain_name);
+ d_printf("%s\n", response.data.dsgetdcname.forest_name);
+ d_printf("0x%08x\n", response.data.dsgetdcname.dc_flags);
+ d_printf("%s\n", response.data.dsgetdcname.dc_site_name);
+ d_printf("%s\n", response.data.dsgetdcname.client_site_name);
return true;
}
diff --git a/source3/nsswitch/winbind_krb5_locator.c b/source3/nsswitch/winbind_krb5_locator.c
index 990c2cae50..b9e35bdec5 100644
--- a/source3/nsswitch/winbind_krb5_locator.c
+++ b/source3/nsswitch/winbind_krb5_locator.c
@@ -1,7 +1,7 @@
/*
Unix SMB/CIFS implementation.
kerberos locator plugin
- 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
@@ -18,6 +18,7 @@
*/
#include "nsswitch/winbind_client.h"
+#include "libwbclient/wbclient.h"
#ifndef DEBUG_KRB5
#undef DEBUG_KRB5
@@ -244,37 +245,50 @@ static void smb_krb5_locator_close(void *private_data)
static bool ask_winbind(const char *realm, char **dcname)
{
- NSS_STATUS status;
- struct winbindd_request request;
- struct winbindd_response response;
+ wbcErr wbc_status;
+ const char *dc = NULL;
+ struct wbcDomainControllerInfoEx *dc_info = NULL;
+ uint32_t flags;
- ZERO_STRUCT(request);
- ZERO_STRUCT(response);
+ flags = WBC_LOOKUP_DC_KDC_REQUIRED |
+ WBC_LOOKUP_DC_IS_DNS_NAME |
+ WBC_LOOKUP_DC_RETURN_DNS_NAME |
+ WBC_LOOKUP_DC_IP_REQUIRED;
- request.flags = 0x40020600;
- /* DS_KDC_REQUIRED |
- DS_IS_DNS_NAME |
- DS_RETURN_DNS_NAME |
- DS_IP_REQUIRED */
+ wbc_status = wbcLookupDomainControllerEx(realm, NULL, NULL, flags, &dc_info);
- strncpy(request.domain_name, realm,
- sizeof(request.domain_name)-1);
-
- status = winbindd_request_response(WINBINDD_DSGETDCNAME,
- &request, &response);
- if (status != NSS_STATUS_SUCCESS) {
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
#ifdef DEBUG_KRB5
fprintf(stderr,"[%5u]: smb_krb5_locator_lookup: failed with: %s\n",
- (unsigned int)getpid(), nss_err_str(status));
+ (unsigned int)getpid(), wbcErrorString(wbc_status));
#endif
return false;
}
- *dcname = strdup(response.data.dc_name);
+ if (dc_info->dc_address) {
+ dc = dc_info->dc_address;
+ if (dc[0] == '\\') dc++;
+ if (dc[0] == '\\') dc++;
+ }
+
+ if (!dc && dc_info->dc_unc) {
+ dc = dc_info->dc_unc;
+ if (dc[0] == '\\') dc++;
+ if (dc[0] == '\\') dc++;
+ }
+
+ if (!dc) {
+ wbcFreeMemory(dc_info);
+ return false;
+ }
+
+ *dcname = strdup(dc);
if (!*dcname) {
+ wbcFreeMemory(dc_info);
return false;
}
+ wbcFreeMemory(dc_info);
return true;
}
diff --git a/source3/nsswitch/winbind_nss_config.h b/source3/nsswitch/winbind_nss_config.h
index 64d52af771..bed507fdeb 100644
--- a/source3/nsswitch/winbind_nss_config.h
+++ b/source3/nsswitch/winbind_nss_config.h
@@ -39,7 +39,7 @@
/* Include header files from data in config.h file */
#ifndef NO_CONFIG_H
-#include "lib/replace/replace.h"
+#include "../replace/replace.h"
#endif
#include "system/filesys.h"
diff --git a/source3/nsswitch/winbind_nss_irix.c b/source3/nsswitch/winbind_nss_irix.c
index 4726c1e13f..5bc0fa54da 100644
--- a/source3/nsswitch/winbind_nss_irix.c
+++ b/source3/nsswitch/winbind_nss_irix.c
@@ -32,7 +32,6 @@ int asprintf(char **,const char *, ...) PRINTF_ATTRIBUTE(2,3);
#endif
#ifdef HAVE_NS_API_H
-#undef VOLATILE
#undef STATIC
#undef DYNAMIC
#include <ns_daemon.h>
diff --git a/source3/nsswitch/winbind_struct_protocol.h b/source3/nsswitch/winbind_struct_protocol.h
index e81813c77b..ff52dbddaf 100644
--- a/source3/nsswitch/winbind_struct_protocol.h
+++ b/source3/nsswitch/winbind_struct_protocol.h
@@ -313,6 +313,12 @@ struct winbindd_request {
uint32_t initial_blob_len; /* blobs in extra_data */
uint32_t challenge_blob_len;
} ccache_ntlm_auth;
+ struct {
+ fstring domain_name;
+ fstring domain_guid;
+ fstring site_name;
+ uint32_t flags;
+ } dsgetdcname;
/* padding -- needed to fix alignment between 32bit and 64bit libs.
The size is the sizeof the union without the padding aligned on
@@ -453,6 +459,17 @@ struct winbindd_response {
struct {
uint32_t auth_blob_len; /* blob in extra_data */
} ccache_ntlm_auth;
+ struct {
+ fstring dc_unc;
+ fstring dc_address;
+ uint32_t dc_address_type;
+ fstring domain_guid;
+ fstring domain_name;
+ fstring forest_name;
+ uint32_t dc_flags;
+ fstring dc_site_name;
+ fstring client_site_name;
+ } dsgetdcname;
} data;
/* Variable length return data */
diff --git a/source3/nsswitch/wins.c b/source3/nsswitch/wins.c
index 7d42381986..2f82997aaf 100644
--- a/source3/nsswitch/wins.c
+++ b/source3/nsswitch/wins.c
@@ -20,7 +20,6 @@
#include "includes.h"
#ifdef HAVE_NS_API_H
-#undef VOLATILE
#include <ns_daemon.h>
#endif
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 60a1fa4858..d91d34d29b 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -52,6 +52,7 @@
*/
#include "includes.h"
+#include "printing.h"
bool bLoaded = False;
@@ -340,6 +341,7 @@ struct global {
int iKeepalive;
int iminreceivefile;
struct param_opt_struct *param_opt;
+ int cups_connection_timeout;
};
static struct global Globals;
@@ -2595,6 +2597,15 @@ static struct parm_struct parm_table[] = {
.flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
},
{
+ .label = "cups connection timeout",
+ .type = P_INTEGER,
+ .p_class = P_GLOBAL,
+ .ptr = &Globals.cups_connection_timeout,
+ .special = NULL,
+ .enum_list = NULL,
+ .flags = FLAG_ADVANCED,
+ },
+ {
.label = "iprint server",
.type = P_STRING,
.p_class = P_GLOBAL,
@@ -4561,6 +4572,54 @@ static void init_printer_values(struct service *pService)
}
}
+/**
+ * Free the allocated data for one parameter for a given share.
+ */
+static void free_parameter(int snum, struct parm_struct parm)
+{
+ void *parm_ptr;
+
+ if (parm.ptr == NULL); {
+ return;
+ }
+
+ if (snum < 0) {
+ parm_ptr = parm.ptr;
+ } else if (parm.p_class != P_LOCAL) {
+ return;
+ } else {
+ parm_ptr = lp_local_ptr(snum, parm.ptr);
+ }
+
+ if ((parm.type == P_STRING) ||
+ (parm.type == P_USTRING))
+ {
+ string_free((char**)parm_ptr);
+ } else if (parm.type == P_LIST) {
+ TALLOC_FREE(*((char***)parm_ptr));
+ }
+}
+
+/**
+ * Free the allocated parameter data for a share.
+ */
+static void free_parameters(int snum)
+{
+ uint32_t i;
+
+ for (i=0; parm_table[i].label; i++) {
+ free_parameter(snum, parm_table[i]);
+ }
+}
+
+/**
+ * Free the allocated global parameters.
+ */
+static void free_global_parameters(void)
+{
+ free_parameters(GLOBAL_SECTION_SNUM);
+}
+
/***************************************************************************
Initialise the global parameter structure.
***************************************************************************/
@@ -4585,14 +4644,7 @@ static void init_globals(bool first_time_only)
}
done_init = True;
} else {
- for (i = 0; parm_table[i].label; i++) {
- if ((parm_table[i].type == P_STRING ||
- parm_table[i].type == P_USTRING) &&
- parm_table[i].ptr)
- {
- string_free((char **)parm_table[i].ptr);
- }
- }
+ free_global_parameters();
}
memset((void *)&Globals, '\0', sizeof(Globals));
@@ -4794,6 +4846,7 @@ static void init_globals(bool first_time_only)
* to never expire, though, when this runs out the afs client will
* forget the token. Set to 0 to get NEVERDATE.*/
Globals.iAfsTokenLifetime = 604800;
+ Globals.cups_connection_timeout = CUPS_DEFAULT_CONNECTION_TIMEOUT;
/* these parameters are set to defaults that are more appropriate
for the increasing samba install base:
@@ -5235,6 +5288,7 @@ FN_GLOBAL_LIST(lp_svcctl_list, &Globals.szServicesList)
FN_LOCAL_STRING(lp_cups_options, szCupsOptions)
FN_GLOBAL_STRING(lp_cups_server, &Globals.szCupsServer)
FN_GLOBAL_STRING(lp_iprint_server, &Globals.szIPrintServer)
+FN_GLOBAL_INTEGER(lp_cups_connection_timeout, &Globals.cups_connection_timeout)
FN_GLOBAL_CONST_STRING(lp_ctdbd_socket, &Globals.ctdbdSocket)
FN_GLOBAL_LIST(lp_cluster_addresses, &Globals.szClusterAddresses)
FN_GLOBAL_BOOL(lp_clustering, &Globals.clustering)
@@ -5377,6 +5431,7 @@ static bool do_section(const char *pszSectionName, void *userdata);
static void init_copymap(struct service *pservice);
static bool hash_a_service(const char *name, int number);
static void free_service_byindex(int iService);
+static void free_param_opts(struct param_opt_struct **popts);
static char * canonicalize_servicename(const char *name);
static void show_parameter(int parmIndex);
static bool is_synonym_of(int parm1, int parm2, bool *inverse);
@@ -5631,14 +5686,42 @@ static void init_service(struct service *pservice)
copy_service(pservice, &sDefault, NULL);
}
+
+/**
+ * free a param_opts structure.
+ * param_opts handling should be moved to talloc;
+ * then this whole functions reduces to a TALLOC_FREE().
+ */
+
+static void free_param_opts(struct param_opt_struct **popts)
+{
+ struct param_opt_struct *opt, *next_opt;
+
+ if (popts == NULL) {
+ return;
+ }
+
+ if (*popts != NULL) {
+ DEBUG(5, ("Freeing parametrics:\n"));
+ }
+ opt = *popts;
+ while (opt != NULL) {
+ string_free(&opt->key);
+ string_free(&opt->value);
+ TALLOC_FREE(opt->list);
+ next_opt = opt->next;
+ SAFE_FREE(opt);
+ opt = next_opt;
+ }
+ *popts = NULL;
+}
+
/***************************************************************************
Free the dynamically allocated parts of a service struct.
***************************************************************************/
static void free_service(struct service *pservice)
{
- int i;
- struct param_opt_struct *data, *pdata;
if (!pservice)
return;
@@ -5646,36 +5729,12 @@ static void free_service(struct service *pservice)
DEBUG(5, ("free_service: Freeing service %s\n",
pservice->szService));
+ free_parameters(getservicebyname(pservice->szService, NULL));
+
string_free(&pservice->szService);
bitmap_free(pservice->copymap);
- for (i = 0; parm_table[i].label; i++) {
- if ((parm_table[i].type == P_STRING ||
- parm_table[i].type == P_USTRING) &&
- parm_table[i].p_class == P_LOCAL)
- string_free((char **)
- (((char *)pservice) +
- PTR_DIFF(parm_table[i].ptr, &sDefault)));
- else if (parm_table[i].type == P_LIST &&
- parm_table[i].p_class == P_LOCAL)
- TALLOC_FREE(*((char ***)
- (((char *)pservice) +
- PTR_DIFF(parm_table[i].ptr,
- &sDefault))));
- }
-
- data = pservice->param_opt;
- if (data)
- DEBUG(5,("Freeing parametrics:\n"));
- while (data) {
- DEBUG(5,("[%s = %s]\n", data->key, data->value));
- string_free(&data->key);
- string_free(&data->value);
- TALLOC_FREE(data->list);
- pdata = data->next;
- SAFE_FREE(data);
- data = pdata;
- }
+ free_param_opts(&pservice->param_opt);
ZERO_STRUCTP(pservice);
}
@@ -5717,7 +5776,6 @@ static int add_a_service(const struct service *pservice, const char *name)
int i;
struct service tservice;
int num_to_alloc = iNumServices + 1;
- struct param_opt_struct *data, *pdata;
tservice = *pservice;
@@ -5727,16 +5785,7 @@ static int add_a_service(const struct service *pservice, const char *name)
if (i >= 0) {
/* Clean all parametric options for service */
/* They will be added during parsing again */
- data = ServicePtrs[i]->param_opt;
- while (data) {
- string_free(&data->key);
- string_free(&data->value);
- TALLOC_FREE(data->list);
- pdata = data->next;
- SAFE_FREE(data);
- data = pdata;
- }
- ServicePtrs[i]->param_opt = NULL;
+ free_param_opts(&ServicePtrs[i]->param_opt);
return (i);
}
}
@@ -6395,13 +6444,51 @@ static int getservicebyname(const char *pszServiceName, struct service *pservice
If pcopymapDest is NULL then copy all fields
***************************************************************************/
+/**
+ * Add a parametric option to a param_opt_struct,
+ * replacing old value, if already present.
+ */
+static void set_param_opt(struct param_opt_struct **opt_list,
+ const char *opt_name,
+ const char *opt_value)
+{
+ struct param_opt_struct *new_opt, *opt;
+ bool not_added;
+
+ if (opt_list == NULL) {
+ return;
+ }
+
+ opt = *opt_list;
+ not_added = true;
+
+ /* Traverse destination */
+ while (opt) {
+ /* If we already have same option, override it */
+ if (strwicmp(opt->key, opt_name) == 0) {
+ string_free(&opt->value);
+ TALLOC_FREE(opt->list);
+ opt->value = SMB_STRDUP(opt_value);
+ not_added = false;
+ break;
+ }
+ opt = opt->next;
+ }
+ if (not_added) {
+ new_opt = SMB_XMALLOC_P(struct param_opt_struct);
+ new_opt->key = SMB_STRDUP(opt_name);
+ new_opt->value = SMB_STRDUP(opt_value);
+ new_opt->list = NULL;
+ DLIST_ADD(*opt_list, new_opt);
+ }
+}
+
static void copy_service(struct service *pserviceDest, struct service *pserviceSource,
struct bitmap *pcopymapDest)
{
int i;
bool bcopyall = (pcopymapDest == NULL);
- struct param_opt_struct *data, *pdata, *paramo;
- bool not_added;
+ struct param_opt_struct *data;
for (i = 0; parm_table[i].label; i++)
if (parm_table[i].ptr && parm_table[i].p_class == P_LOCAL &&
@@ -6442,7 +6529,7 @@ static void copy_service(struct service *pserviceDest, struct service *pserviceS
break;
case P_LIST:
TALLOC_FREE(*((char ***)dest_ptr));
- str_list_copy(NULL, (char ***)dest_ptr,
+ *((char ***)dest_ptr) = str_list_copy(NULL,
*(const char ***)src_ptr);
break;
default:
@@ -6459,27 +6546,7 @@ static void copy_service(struct service *pserviceDest, struct service *pserviceS
data = pserviceSource->param_opt;
while (data) {
- not_added = True;
- pdata = pserviceDest->param_opt;
- /* Traverse destination */
- while (pdata) {
- /* If we already have same option, override it */
- if (strwicmp(pdata->key, data->key) == 0) {
- string_free(&pdata->value);
- TALLOC_FREE(data->list);
- pdata->value = SMB_STRDUP(data->value);
- not_added = False;
- break;
- }
- pdata = pdata->next;
- }
- if (not_added) {
- paramo = SMB_XMALLOC_P(struct param_opt_struct);
- paramo->key = SMB_STRDUP(data->key);
- paramo->value = SMB_STRDUP(data->value);
- paramo->list = NULL;
- DLIST_ADD(pserviceDest->param_opt, paramo);
- }
+ set_param_opt(&pserviceDest->param_opt, data->key, data->value);
data = data->next;
}
}
@@ -6547,7 +6614,7 @@ static struct smbconf_ctx *lp_smbconf_ctx(void)
return conf_ctx;
}
-static bool process_registry_service(struct smbconf_service *service)
+static bool process_smbconf_service(struct smbconf_service *service)
{
uint32_t count;
bool ret;
@@ -6603,7 +6670,7 @@ static bool process_registry_globals(void)
goto done;
}
- ret = process_registry_service(service);
+ ret = process_smbconf_service(service);
if (!ret) {
goto done;
}
@@ -6641,7 +6708,7 @@ static bool process_registry_shares(void)
if (strequal(service[count]->name, GLOBAL_NAME)) {
continue;
}
- ret = process_registry_service(service[count]);
+ ret = process_smbconf_service(service[count]);
if (!ret) {
goto done;
}
@@ -6863,7 +6930,7 @@ static bool handle_include(int snum, const char *pszParmValue, char **ptr)
string_set(ptr, fname);
- if (file_exist(fname, NULL)) {
+ if (file_exist(fname)) {
bool ret = pm_process(fname, do_section, do_parameter, NULL);
SAFE_FREE(fname);
return ret;
@@ -7144,14 +7211,11 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue
int parmnum, i;
void *parm_ptr = NULL; /* where we are going to store the result */
void *def_ptr = NULL;
- struct param_opt_struct *paramo, *data;
- bool not_added;
+ struct param_opt_struct **opt_list;
parmnum = map_parameter(pszParmName);
if (parmnum < 0) {
- TALLOC_CTX *frame;
-
if (strchr(pszParmName, ':') == NULL) {
DEBUG(0, ("Ignoring unknown parameter \"%s\"\n",
pszParmName));
@@ -7162,37 +7226,10 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue
* We've got a parametric option
*/
- frame = talloc_stackframe();
+ opt_list = (snum < 0)
+ ? &Globals.param_opt : &ServicePtrs[snum]->param_opt;
+ set_param_opt(opt_list, pszParmName, pszParmValue);
- not_added = True;
- data = (snum < 0)
- ? Globals.param_opt : ServicePtrs[snum]->param_opt;
- /* Traverse destination */
- while (data) {
- /* If we already have same option, override it */
- if (strwicmp(data->key, pszParmName) == 0) {
- string_free(&data->value);
- TALLOC_FREE(data->list);
- data->value = SMB_STRDUP(pszParmValue);
- not_added = False;
- break;
- }
- data = data->next;
- }
- if (not_added) {
- paramo = SMB_XMALLOC_P(struct param_opt_struct);
- paramo->key = SMB_STRDUP(pszParmName);
- paramo->value = SMB_STRDUP(pszParmValue);
- paramo->list = NULL;
- if (snum < 0) {
- DLIST_ADD(Globals.param_opt, paramo);
- } else {
- DLIST_ADD(ServicePtrs[snum]->param_opt,
- paramo);
- }
- }
-
- TALLOC_FREE(frame);
return (True);
}
@@ -7213,9 +7250,7 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue
pszParmName));
return (True);
}
- parm_ptr =
- ((char *)ServicePtrs[snum]) + PTR_DIFF(def_ptr,
- &sDefault);
+ parm_ptr = lp_local_ptr(snum, def_ptr);
}
if (snum >= 0) {
@@ -7388,7 +7423,7 @@ static bool equal_parameter(parm_type type, void *ptr1, void *ptr2)
return (*((char *)ptr1) == *((char *)ptr2));
case P_LIST:
- return str_list_compare(*(char ***)ptr1, *(char ***)ptr2);
+ return str_list_equal(*(const char ***)ptr1, *(const char ***)ptr2);
case P_STRING:
case P_USTRING:
@@ -7477,8 +7512,8 @@ static bool is_default(int i)
return False;
switch (parm_table[i].type) {
case P_LIST:
- return str_list_compare (parm_table[i].def.lvalue,
- *(char ***)parm_table[i].ptr);
+ return str_list_equal((const char **)parm_table[i].def.lvalue,
+ *(const char ***)parm_table[i].ptr);
case P_STRING:
case P_USTRING:
return strequal(parm_table[i].def.svalue,
@@ -7813,7 +7848,7 @@ static void lp_add_auto_services(char *str)
Auto-load one printer.
***************************************************************************/
-void lp_add_one_printer(char *name, char *comment)
+void lp_add_one_printer(const char *name, const char *comment, void *pdata)
{
int printers = lp_servicenumber(PRINTERS_NAME);
int i;
@@ -7892,9 +7927,8 @@ static void lp_save_defaults(void)
continue;
switch (parm_table[i].type) {
case P_LIST:
- str_list_copy(
- NULL, &(parm_table[i].def.lvalue),
- *(const char ***)parm_table[i].ptr);
+ parm_table[i].def.lvalue = str_list_copy(
+ NULL, *(const char ***)parm_table[i].ptr);
break;
case P_STRING:
case P_USTRING:
@@ -8351,7 +8385,7 @@ static int process_usershare_file(const char *dir_name, const char *file_name, i
return -1;
}
- lines = fd_lines_load(fd, &numlines, MAX_USERSHARE_FILE_SIZE);
+ lines = fd_lines_load(fd, &numlines, MAX_USERSHARE_FILE_SIZE, NULL);
close(fd);
if (lines == NULL) {
@@ -8366,7 +8400,7 @@ static int process_usershare_file(const char *dir_name, const char *file_name, i
/* Should we allow printers to be shared... ? */
ctx = talloc_init("usershare_sd_xctx");
if (!ctx) {
- file_lines_free(lines);
+ TALLOC_FREE(lines);
return 1;
}
@@ -8374,11 +8408,11 @@ static int process_usershare_file(const char *dir_name, const char *file_name, i
iService, lines, numlines, &sharepath,
&comment, &psd, &guest_ok) != USERSHARE_OK) {
talloc_destroy(ctx);
- file_lines_free(lines);
+ TALLOC_FREE(lines);
return -1;
}
- file_lines_free(lines);
+ TALLOC_FREE(lines);
/* Everything ok - add the service possibly using a template. */
if (iService < 0) {
@@ -8721,17 +8755,7 @@ void gfree_loadparm(void)
/* Now release all resources allocated to global
parameters and the default service */
- for (i = 0; parm_table[i].label; i++)
- {
- if ( parm_table[i].type == P_STRING
- || parm_table[i].type == P_USTRING )
- {
- string_free( (char**)parm_table[i].ptr );
- }
- else if (parm_table[i].type == P_LIST) {
- TALLOC_FREE( *((char***)parm_table[i].ptr) );
- }
- }
+ free_global_parameters();
}
@@ -8752,9 +8776,6 @@ bool lp_is_in_client(void)
return in_client;
}
-
-
-
/***************************************************************************
Load the services array from the services file. Return True on success,
False on failure.
@@ -8770,7 +8791,6 @@ bool lp_load_ex(const char *pszFname,
{
char *n2 = NULL;
bool bRetval;
- struct param_opt_struct *data, *pdata;
bRetval = False;
@@ -8788,22 +8808,11 @@ bool lp_load_ex(const char *pszFname,
lp_save_defaults();
}
+ free_param_opts(&Globals.param_opt);
+
/* We get sections first, so have to start 'behind' to make up */
iServiceIndex = -1;
- if (Globals.param_opt != NULL) {
- data = Globals.param_opt;
- while (data) {
- string_free(&data->key);
- string_free(&data->value);
- TALLOC_FREE(data->list);
- pdata = data->next;
- SAFE_FREE(data);
- data = pdata;
- }
- Globals.param_opt = NULL;
- }
-
if (lp_config_backend_is_file()) {
n2 = alloc_sub_basic(get_current_username(),
current_user_info.domain,
diff --git a/source3/param/params.c b/source3/param/params.c
deleted file mode 100644
index 478376c9e9..0000000000
--- a/source3/param/params.c
+++ /dev/null
@@ -1,590 +0,0 @@
-/* -------------------------------------------------------------------------- **
- * Microsoft Network Services for Unix, AKA., Andrew Tridgell's SAMBA.
- *
- * This module Copyright (C) 1990-1998 Karl Auer
- *
- * Rewritten almost completely by Christopher R. Hertel, 1997.
- * This module Copyright (C) 1997-1998 by Christopher R. Hertel
- *
- * -------------------------------------------------------------------------- **
- *
- * 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/>.
- *
- * -------------------------------------------------------------------------- **
- *
- * Module name: params
- *
- * -------------------------------------------------------------------------- **
- *
- * This module performs lexical analysis and initial parsing of a
- * Windows-like parameter file. It recognizes and handles four token
- * types: section-name, parameter-name, parameter-value, and
- * end-of-file. Comments and line continuation are handled
- * internally.
- *
- * The entry point to the module is function pm_process(). This
- * function opens the source file, calls the Parse() function to parse
- * the input, and then closes the file when either the EOF is reached
- * or a fatal error is encountered.
- *
- * A sample parameter file might look like this:
- *
- * [section one]
- * parameter one = value string
- * parameter two = another value
- * [section two]
- * new parameter = some value or t'other
- *
- * The parameter file is divided into sections by section headers:
- * section names enclosed in square brackets (eg. [section one]).
- * Each section contains parameter lines, each of which consist of a
- * parameter name and value delimited by an equal sign. Roughly, the
- * syntax is:
- *
- * <file> :== { <section> } EOF
- *
- * <section> :== <section header> { <parameter line> }
- *
- * <section header> :== '[' NAME ']'
- *
- * <parameter line> :== NAME '=' VALUE '\n'
- *
- * Blank lines and comment lines are ignored. Comment lines are lines
- * beginning with either a semicolon (';') or a pound sign ('#').
- *
- * All whitespace in section names and parameter names is compressed
- * to single spaces. Leading and trailing whitespace is stipped from
- * both names and values.
- *
- * Only the first equals sign in a parameter line is significant.
- * Parameter values may contain equals signs, square brackets and
- * semicolons. Internal whitespace is retained in parameter values,
- * with the exception of the '\r' character, which is stripped for
- * historic reasons. Parameter names may not start with a left square
- * bracket, an equal sign, a pound sign, or a semicolon, because these
- * are used to identify other tokens.
- *
- * -------------------------------------------------------------------------- **
- */
-
-#include "includes.h"
-
-/* -------------------------------------------------------------------------- **
- * Constants...
- */
-
-#define BUFR_INC 1024
-
-
-/* -------------------------------------------------------------------------- **
- * Variables...
- *
- * DEBUGLEVEL - The ubiquitous DEBUGLEVEL. This determines which DEBUG()
- * messages will be produced.
- * bufr - pointer to a global buffer. This is probably a kludge,
- * but it was the nicest kludge I could think of (for now).
- * bSize - The size of the global buffer <bufr>.
- */
-
-/* we can't use FILE* due to the 256 fd limit - use this cheap hack
- instead */
-typedef struct {
- char *buf;
- char *p;
- size_t size;
- char *end_section_p;
-} myFILE;
-
-static int mygetc(myFILE *f)
-{
- if (f->p >= f->buf+f->size)
- return EOF;
- /* be sure to return chars >127 as positive values */
- return (int)( *(f->p++) & 0x00FF );
-}
-
-static void myfile_close(myFILE *f)
-{
- if (!f)
- return;
- SAFE_FREE(f->buf);
- SAFE_FREE(f);
-}
-
-/* Find the end of the section. We must use mb functions for this. */
-static int FindSectionEnd(myFILE *f)
-{
- f->end_section_p = strchr_m(f->p, ']');
- return f->end_section_p ? 1 : 0;
-}
-
-static int AtSectionEnd(myFILE *f)
-{
- if (f->p == f->end_section_p + 1) {
- f->end_section_p = NULL;
- return 1;
- }
- return 0;
-}
-
-/* -------------------------------------------------------------------------- **
- * Functions...
- */
- /* ------------------------------------------------------------------------ **
- * Scan past whitespace (see ctype(3C)) and return the first non-whitespace
- * character, or newline, or EOF.
- *
- * Input: InFile - Input source.
- *
- * Output: The next non-whitespace character in the input stream.
- *
- * Notes: Because the config files use a line-oriented grammar, we
- * explicitly exclude the newline character from the list of
- * whitespace characters.
- * - Note that both EOF (-1) and the nul character ('\0') are
- * considered end-of-file markers.
- *
- * ------------------------------------------------------------------------ **
- */
-
-static int EatWhitespace( myFILE *InFile )
-{
- int c;
-
- for( c = mygetc( InFile ); isspace( c ) && ('\n' != c); c = mygetc( InFile ) )
- ;
- return( c );
-}
-
- /* ------------------------------------------------------------------------ **
- * Scan to the end of a comment.
- *
- * Input: InFile - Input source.
- *
- * Output: The character that marks the end of the comment. Normally,
- * this will be a newline, but it *might* be an EOF.
- *
- * Notes: Because the config files use a line-oriented grammar, we
- * explicitly exclude the newline character from the list of
- * whitespace characters.
- * - Note that both EOF (-1) and the nul character ('\0') are
- * considered end-of-file markers.
- *
- * ------------------------------------------------------------------------ **
- */
-
-static int EatComment( myFILE *InFile )
-{
- int c;
-
- for( c = mygetc( InFile ); ('\n'!=c) && (EOF!=c) && (c>0); c = mygetc( InFile ) )
- ;
- return( c );
-}
-
-/*****************************************************************************
- * Scan backards within a string to discover if the last non-whitespace
- * character is a line-continuation character ('\\').
- *
- * Input: line - A pointer to a buffer containing the string to be
- * scanned.
- * pos - This is taken to be the offset of the end of the
- * string. This position is *not* scanned.
- *
- * Output: The offset of the '\\' character if it was found, or -1 to
- * indicate that it was not.
- *
- *****************************************************************************/
-
-static int Continuation(uint8_t *line, int pos )
-{
- pos--;
- while( (pos >= 0) && isspace((int)line[pos]))
- pos--;
-
- return (((pos >= 0) && ('\\' == line[pos])) ? pos : -1 );
-}
-
-/* ------------------------------------------------------------------------ **
- * Scan a section name, and pass the name to function sfunc().
- *
- * Input: InFile - Input source.
- * sfunc - Pointer to the function to be called if the section
- * name is successfully read.
- *
- * Output: True if the section name was read and True was returned from
- * <sfunc>. False if <sfunc> failed or if a lexical error was
- * encountered.
- *
- * ------------------------------------------------------------------------ **
- */
-
-static bool Section( DATA_BLOB *buf, myFILE *InFile, bool (*sfunc)(const char *, void *), void *userdata )
-{
- int c;
- int i;
- int end;
- const char *func = "params.c:Section() -";
-
- i = 0; /* <i> is the offset of the next free byte in bufr[] and */
- end = 0; /* <end> is the current "end of string" offset. In most */
- /* cases these will be the same, but if the last */
- /* character written to bufr[] is a space, then <end> */
- /* will be one less than <i>. */
-
-
- /* Find the end of the section. We must use mb functions for this. */
- if (!FindSectionEnd(InFile)) {
- DEBUG(0, ("%s No terminating ']' character in section.\n", func) );
- return False;
- }
-
- c = EatWhitespace( InFile ); /* We've already got the '['. Scan */
- /* past initial white space. */
-
- while( (EOF != c) && (c > 0) ) {
- /* Check that the buffer is big enough for the next character. */
- if( i > (buf->length - 2) ) {
- uint8_t *tb = (uint8_t *)SMB_REALLOC_KEEP_OLD_ON_ERROR(buf->data, buf->length+BUFR_INC );
- if(!tb) {
- DEBUG(0, ("%s Memory re-allocation failure.", func) );
- return False;
- }
- buf->data = tb;
- buf->length += BUFR_INC;
- }
-
- /* Handle a single character other than section end. */
- switch( c ) {
- case '\n': /* Got newline before closing ']'. */
- i = Continuation( buf->data, i ); /* Check for line continuation. */
- if( i < 0 ) {
- buf->data[end] = '\0';
- DEBUG(0, ("%s Badly formed line in configuration file: %s\n", func, buf->data ));
- return False;
- }
- end = ( (i > 0) && (' ' == buf->data[i - 1]) ) ? (i - 1) : (i);
- c = mygetc( InFile ); /* Continue with next line. */
- break;
-
- default: /* All else are a valid name chars. */
- if(isspace( c )) {
- /* One space per whitespace region. */
- buf->data[end] = ' ';
- i = end + 1;
- c = EatWhitespace( InFile );
- } else {
- buf->data[i++] = c;
- end = i;
- c = mygetc( InFile );
- }
- }
-
- if (AtSectionEnd(InFile)) {
- /* Got to the closing bracket. */
- buf->data[end] = '\0';
- if( 0 == end ) {
- /* Don't allow an empty name. */
- DEBUG(0, ("%s Empty section name in configuration file.\n", func ));
- return False;
- }
- if( !sfunc((char *)buf->data, userdata) ) /* Got a valid name. Deal with it. */
- return False;
- EatComment( InFile ); /* Finish off the line. */
- return True;
- }
-
- }
-
- /* We arrive here if we've met the EOF before the closing bracket. */
- DEBUG(0, ("%s Unexpected EOF in the configuration file: %s\n", func, buf->data ));
- return False;
-}
-
-/* ------------------------------------------------------------------------ **
- * Scan a parameter name and value, and pass these two fields to pfunc().
- *
- * Input: InFile - The input source.
- * pfunc - A pointer to the function that will be called to
- * process the parameter, once it has been scanned.
- * c - The first character of the parameter name, which
- * would have been read by Parse(). Unlike a comment
- * line or a section header, there is no lead-in
- * character that can be discarded.
- *
- * Output: True if the parameter name and value were scanned and processed
- * successfully, else False.
- *
- * Notes: This function is in two parts. The first loop scans the
- * parameter name. Internal whitespace is compressed, and an
- * equal sign (=) terminates the token. Leading and trailing
- * whitespace is discarded. The second loop scans the parameter
- * value. When both have been successfully identified, they are
- * passed to pfunc() for processing.
- *
- * ------------------------------------------------------------------------ **
- */
-
-static bool Parameter( DATA_BLOB *buf, myFILE *InFile, bool (*pfunc)(const char *, const char *, void *), int c, void *userdata )
-{
- int i = 0; /* Position within bufr. */
- int end = 0; /* bufr[end] is current end-of-string. */
- int vstart = 0; /* Starting position of the parameter value. */
- const char *func = "params.c:Parameter() -";
-
- /* Read the parameter name. */
- while( 0 == vstart ) {
- /* Loop until we've found the start of the value. */
- if( i > (buf->length - 2) ) {
- /* Ensure there's space for next char. */
- uint8_t *tb = (uint8_t *)SMB_REALLOC_KEEP_OLD_ON_ERROR( buf->data, buf->length + BUFR_INC );
- if (!tb) {
- DEBUG(0, ("%s Memory re-allocation failure.", func) );
- return False;
- }
- buf->data = tb;
- buf->length += BUFR_INC;
- }
-
- switch(c) {
- case '=': /* Equal sign marks end of param name. */
- if( 0 == end ) {
- /* Don't allow an empty name. */
- DEBUG(0, ("%s Invalid parameter name in config. file.\n", func ));
- return False;
- }
- buf->data[end++] = '\0'; /* Mark end of string & advance. */
- i = end; /* New string starts here. */
- vstart = end; /* New string is parameter value. */
- buf->data[i] = '\0'; /* New string is nul, for now. */
- break;
-
- case '\n': /* Find continuation char, else error. */
- i = Continuation( buf->data, i );
- if( i < 0 ) {
- buf->data[end] = '\0';
- DEBUG(1,("%s Ignoring badly formed line in configuration file: %s\n", func, buf->data ));
- return True;
- }
- end = ( (i > 0) && (' ' == buf->data[i - 1]) ) ? (i - 1) : (i);
- c = mygetc( InFile ); /* Read past eoln. */
- break;
-
- case '\0': /* Shouldn't have EOF within param name. */
- case EOF:
- buf->data[i] = '\0';
- DEBUG(1,("%s Unexpected end-of-file at: %s\n", func, buf->data ));
- return True;
-
- default:
- if(isspace( c )) {
- /* One ' ' per whitespace region. */
- buf->data[end] = ' ';
- i = end + 1;
- c = EatWhitespace( InFile );
- } else {
- buf->data[i++] = c;
- end = i;
- c = mygetc( InFile );
- }
- }
- }
-
- /* Now parse the value. */
- c = EatWhitespace( InFile ); /* Again, trim leading whitespace. */
- while( (EOF !=c) && (c > 0) ) {
- if( i > (buf->length - 2) ) {
- /* Make sure there's enough room. */
- uint8_t *tb = (uint8_t *)SMB_REALLOC_KEEP_OLD_ON_ERROR( buf->data, buf->length + BUFR_INC );
- if (!tb) {
- DEBUG(0, ("%s Memory re-allocation failure.", func));
- return False;
- }
- buf->data = tb;
- buf->length += BUFR_INC;
- }
-
- switch(c) {
- case '\r': /* Explicitly remove '\r' because the older */
- c = mygetc( InFile ); /* version called fgets_slash() which also */
- break; /* removes them. */
-
- case '\n': /* Marks end of value unless there's a '\'. */
- i = Continuation( buf->data, i );
- if( i < 0 ) {
- c = 0;
- } else {
- for( end = i; (end >= 0) && isspace((int)buf->data[end]); end-- )
- ;
- c = mygetc( InFile );
- }
- break;
-
- default: /* All others verbatim. Note that spaces do not advance <end>. This allows trimming */
- buf->data[i++] = c;
- if( !isspace( c ) ) /* of whitespace at the end of the line. */
- end = i;
- c = mygetc( InFile );
- break;
- }
- }
- buf->data[end] = '\0'; /* End of value. */
-
- return( pfunc( (char *)buf->data, (char *)&buf->data[vstart], userdata ) ); /* Pass name & value to pfunc(). */
-}
-
-/* ------------------------------------------------------------------------ **
- * Scan & parse the input.
- *
- * Input: InFile - Input source.
- * sfunc - Function to be called when a section name is scanned.
- * See Section().
- * pfunc - Function to be called when a parameter is scanned.
- * See Parameter().
- *
- * Output: True if the file was successfully scanned, else False.
- *
- * Notes: The input can be viewed in terms of 'lines'. There are four
- * types of lines:
- * Blank - May contain whitespace, otherwise empty.
- * Comment - First non-whitespace character is a ';' or '#'.
- * The remainder of the line is ignored.
- * Section - First non-whitespace character is a '['.
- * Parameter - The default case.
- *
- * ------------------------------------------------------------------------ **
- */
-
-static bool Parse( DATA_BLOB *buf, myFILE *InFile,
- bool (*sfunc)(const char *, void *),
- bool (*pfunc)(const char *, const char *, void *),
- void *userdata)
-{
- int c;
-
- c = EatWhitespace( InFile );
- while( (EOF != c) && (c > 0) ) {
- switch( c ) {
- case '\n': /* Blank line. */
- c = EatWhitespace( InFile );
- break;
-
- case ';': /* Comment line. */
- case '#':
- c = EatComment( InFile );
- break;
-
- case '[': /* Section Header. */
- if( !Section( buf, InFile, sfunc, userdata ) )
- return False;
- c = EatWhitespace( InFile );
- break;
-
- case '\\': /* Bogus backslash. */
- c = EatWhitespace( InFile );
- break;
-
- default: /* Parameter line. */
- if( !Parameter( buf, InFile, pfunc, c, userdata ) )
- return False;
- c = EatWhitespace( InFile );
- break;
- }
- }
- return True;
-}
-
-/* ------------------------------------------------------------------------ **
- * Open a configuration file.
- *
- * Input: FileName - The pathname of the config file to be opened.
- *
- * Output: A pointer of type (char **) to the lines of the file
- *
- * ------------------------------------------------------------------------ **
- */
-
-static myFILE *OpenConfFile( const char *FileName )
-{
- const char *func = "params.c:OpenConfFile() -";
- int lvl = lp_is_in_client() ? 1 : 0;
- myFILE *ret;
-
- ret = SMB_MALLOC_P(myFILE);
- if (!ret)
- return NULL;
-
- ret->buf = file_load(FileName, &ret->size, 0);
- if( NULL == ret->buf ) {
- DEBUG( lvl, ("%s Unable to open configuration file \"%s\":\n\t%s\n",
- func, FileName, strerror(errno)) );
- SAFE_FREE(ret);
- return NULL;
- }
-
- ret->p = ret->buf;
- ret->end_section_p = NULL;
- return( ret );
-}
-
-/* ------------------------------------------------------------------------ **
- * Process the named parameter file.
- *
- * Input: FileName - The pathname of the parameter file to be opened.
- * sfunc - A pointer to a function that will be called when
- * a section name is discovered.
- * pfunc - A pointer to a function that will be called when
- * a parameter name and value are discovered.
- *
- * Output: TRUE if the file was successfully parsed, else FALSE.
- *
- * ------------------------------------------------------------------------ **
- */
-
-bool pm_process( const char *FileName,
- bool (*sfunc)(const char *, void *),
- bool (*pfunc)(const char *, const char *, void *),
- void *userdata)
-{
- int result;
- myFILE *InFile;
- const char *func = "params.c:pm_process() -";
- DATA_BLOB buf;
-
- InFile = OpenConfFile( FileName ); /* Open the config file. */
- if( NULL == InFile )
- return False;
-
- DEBUG( 3, ("%s Processing configuration file \"%s\"\n", func, FileName) );
-
- buf = data_blob(NULL, 256);
-
- if (buf.data == NULL) {
- DEBUG(0,("%s memory allocation failure.\n", func));
- myfile_close(InFile);
- return False;
- }
-
- result = Parse( &buf, InFile, sfunc, pfunc, userdata );
- data_blob_free(&buf);
-
- myfile_close(InFile);
-
- if( !result ) {
- DEBUG(0,("%s Failed. Error returned from params.c:parse().\n", func));
- return False;
- }
-
- return True;
-}
diff --git a/source3/param/test_lp_load.c b/source3/param/test_lp_load.c
new file mode 100644
index 0000000000..1ec123e70a
--- /dev/null
+++ b/source3/param/test_lp_load.c
@@ -0,0 +1,88 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * Test for lp_load()
+ * 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"
+
+extern bool AllowDebugChange;
+
+int main(int argc, const char **argv)
+{
+ const char *config_file = get_dyn_CONFIGFILE();
+ int ret = 0;
+ poptContext pc;
+ char *count_str = NULL;
+ int i, count = 1;
+
+ struct poptOption long_options[] = {
+ POPT_AUTOHELP
+ {"count", 'c', POPT_ARG_STRING, &count_str, 1,
+ "Load config <count> number of times"},
+ POPT_COMMON_DEBUGLEVEL
+ POPT_TABLEEND
+ };
+
+ TALLOC_CTX *frame = talloc_stackframe();
+
+ load_case_tables();
+ DEBUGLEVEL_CLASS[DBGC_ALL] = 0;
+
+ pc = poptGetContext(NULL, argc, argv, long_options,
+ POPT_CONTEXT_KEEP_FIRST);
+ poptSetOtherOptionHelp(pc, "[OPTION...] <config-file>");
+
+ while(poptGetNextOpt(pc) != -1);
+
+ setup_logging(poptGetArg(pc), True);
+
+ if (poptPeekArg(pc)) {
+ config_file = poptGetArg(pc);
+ }
+
+ poptFreeContext(pc);
+
+ if (count_str != NULL) {
+ count = atoi(count_str);
+ }
+
+ dbf = x_stderr;
+ /* Don't let the debuglevel be changed by smb.conf. */
+ AllowDebugChange = False;
+
+ for (i=0; i < count; i++) {
+ printf("call lp_load() #%d: ", i+1);
+ if (!lp_load_with_registry_shares(config_file,
+ False, /* global only */
+ True, /* save defaults */
+ False, /*add_ipc */
+ True)) /*init globals */
+ {
+ printf("ERROR.\n");
+ ret = 1;
+ goto done;
+ }
+ printf("ok.\n");
+ }
+
+
+done:
+ gfree_loadparm();
+ TALLOC_FREE(frame);
+ return ret;
+}
+
diff --git a/source3/passdb/machine_sid.c b/source3/passdb/machine_sid.c
index ff2c9bcb0d..c7c3cc474b 100644
--- a/source3/passdb/machine_sid.c
+++ b/source3/passdb/machine_sid.c
@@ -41,15 +41,15 @@ static bool read_sid_from_file(const char *fname, DOM_SID *sid)
int numlines;
bool ret;
- lines = file_lines_load(fname, &numlines,0);
+ lines = file_lines_load(fname, &numlines,0, NULL);
if (!lines || numlines < 1) {
- if (lines) file_lines_free(lines);
+ if (lines) TALLOC_FREE(lines);
return False;
}
ret = string_to_sid(sid, lines[0]);
- file_lines_free(lines);
+ TALLOC_FREE(lines);
return ret;
}
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index 4527ae7127..a6adb904e2 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -238,7 +238,7 @@ bool secrets_fetch_domain_guid(const char *domain, struct GUID *guid)
if (!dyn_guid) {
if (lp_server_role() == ROLE_DOMAIN_PDC) {
- smb_uuid_generate_random(&new_guid);
+ new_guid = GUID_random();
if (!secrets_store_domain_guid(domain, &new_guid))
return False;
dyn_guid = (struct GUID *)secrets_fetch(key, &size);
@@ -259,6 +259,31 @@ bool secrets_fetch_domain_guid(const char *domain, struct GUID *guid)
return True;
}
+bool secrets_store_local_schannel_key(uint8_t schannel_key[16])
+{
+ return secrets_store(SECRETS_LOCAL_SCHANNEL_KEY, schannel_key, 16);
+}
+
+bool secrets_fetch_local_schannel_key(uint8_t schannel_key[16])
+{
+ size_t size = 0;
+ uint8_t *key;
+
+ key = (uint8_t *)secrets_fetch(SECRETS_LOCAL_SCHANNEL_KEY, &size);
+ if (key == NULL) {
+ return false;
+ }
+
+ if (size != 16) {
+ SAFE_FREE(key);
+ return false;
+ }
+
+ memcpy(schannel_key, key, 16);
+ SAFE_FREE(key);
+ return true;
+}
+
/**
* Form a key for fetching the machine trust account sec channel type
*
diff --git a/source3/popt/CHANGES b/source3/popt/CHANGES
deleted file mode 100644
index db16a5fdd0..0000000000
--- a/source3/popt/CHANGES
+++ /dev/null
@@ -1,46 +0,0 @@
-1.5 -> 1.6
- - add ability to perform callbacks for every, not just first, match.
-
-1.3 -> 1.5
- - heavy dose of const's
- - poptParseArgvString() now NULL terminates the list
-
-1.2.3 -> 1.3
- - added support for single -
- - misc bug fixes
- - portability improvements
-
-1.2.2 -> 1.2.3
- - fixed memset() in help message generation (Dale Hawkins)
- - added extern "C" stuff to popt.h for C++ compilers (Dale Hawkins)
- - const'ified poptParseArgvString (Jeff Garzik)
-
-1.2.1 -> 1.2.2
- - fixed bug in chaind alias happens which seems to have only
- affected --triggers in rpm
- - added POPT_ARG_VAL
- - popt.3 installed by default
-
-1.2 -> 1.2.1
- - added POPT_ARG_INTL_DOMAIN (Elliot Lee)
- - updated Makefile's to be more GNUish (Elliot Lee)
-
-1.1 -> 1.2
- - added popt.3 man page (Robert Lynch)
- - don't use mmap anymore (its lack of portability isn't worth the
- trouble)
- - added test script
- - added support for exec
- - removed support for *_POPT_ALIASES env variable -- it was a bad
- idea
- - reorganized into multiple source files
- - added automatic help generation, POPT_AUTOHELP
- - added table callbacks
- - added table inclusion
- - updated man page for new features
- - added test scripts
-
-1.0 -> 1.1
- - moved to autoconf (Fred Fish)
- - added STRERROR replacement (Norbert Warmuth)
- - added const keywords (Bruce Perens)
diff --git a/source3/popt/COPYING b/source3/popt/COPYING
deleted file mode 100644
index b4c7ca876c..0000000000
--- a/source3/popt/COPYING
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 1998 Red Hat Software
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the X Consortium shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from the X Consortium.
diff --git a/source3/popt/README b/source3/popt/README
deleted file mode 100644
index 0b5205bfdd..0000000000
--- a/source3/popt/README
+++ /dev/null
@@ -1,18 +0,0 @@
-This is the popt command line option parsing library. While it is similiar
-to getopt(3), it contains a number of enhancements, including:
-
- 1) popt is fully reentrant
- 2) popt can parse arbitrary argv[] style arrays while
- getopt(2) makes this quite difficult
- 3) popt allows users to alias command line arguments
- 4) popt provides convience functions for parsing strings
- into argv[] style arrays
-
-popt is used by rpm, the Red Hat install program, and many other Red Hat
-utilities, all of which provide excellent examples of how to use popt.
-Complete documentation on popt is available in popt.ps (included in this
-tarball), which is excerpted with permission from the book "Linux
-Application Development" by Michael K. Johnson and Erik Troan (availble
-from Addison Wesley in May, 1998).
-
-Comments on popt should be addressed to ewt@redhat.com.
diff --git a/source3/popt/dummy.in b/source3/popt/dummy.in
deleted file mode 100644
index e69de29bb2..0000000000
--- a/source3/popt/dummy.in
+++ /dev/null
diff --git a/source3/popt/findme.c b/source3/popt/findme.c
deleted file mode 100644
index b28981ba1f..0000000000
--- a/source3/popt/findme.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/** \ingroup popt
- * \file popt/findme.c
- */
-
-/* (C) 1998-2002 Red Hat, Inc. -- Licensing details are in the COPYING
- file accompanying popt source distributions, available from
- ftp://ftp.rpm.org/pub/rpm/dist. */
-
-#include "system.h"
-#include "findme.h"
-
-const char * findProgramPath(const char * argv0) {
- char * path = getenv("PATH");
- char * pathbuf;
- char * start, * chptr;
- char * buf;
-
- if (argv0 == NULL) return NULL; /* XXX can't happen */
- /* If there is a / in the argv[0], it has to be an absolute path */
- if (strchr(argv0, '/'))
- return xstrdup(argv0);
-
- if (path == NULL) return NULL;
-
- start = pathbuf = (char *)alloca(strlen(path) + 1);
- buf = (char *)malloc(strlen(path) + strlen(argv0) + sizeof("/"));
- if (buf == NULL) return NULL; /* XXX can't happen */
- strcpy(pathbuf, path);
-
- chptr = NULL;
- /*@-branchstate@*/
- do {
- if ((chptr = strchr(start, ':')))
- *chptr = '\0';
- sprintf(buf, "%s/%s", start, argv0);
-
- if (!access(buf, X_OK))
- return buf;
-
- if (chptr)
- start = chptr + 1;
- else
- start = NULL;
- } while (start && *start);
- /*@=branchstate@*/
-
- free(buf);
-
- return NULL;
-}
diff --git a/source3/popt/findme.h b/source3/popt/findme.h
deleted file mode 100644
index a016b867ea..0000000000
--- a/source3/popt/findme.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/** \ingroup popt
- * \file popt/findme.h
- */
-
-/* (C) 1998-2000 Red Hat, Inc. -- Licensing details are in the COPYING
- file accompanying popt source distributions, available from
- ftp://ftp.rpm.org/pub/rpm/dist. */
-
-#ifndef H_FINDME
-#define H_FINDME
-
-/**
- * Return absolute path to executable by searching PATH.
- * @param argv0 name of executable
- * @return (malloc'd) absolute path to executable (or NULL)
- */
-/*@null@*/ const char * findProgramPath(/*@null@*/ const char * argv0)
- /*@*/;
-
-#endif
diff --git a/source3/popt/popt.c b/source3/popt/popt.c
deleted file mode 100644
index d9e8411b9f..0000000000
--- a/source3/popt/popt.c
+++ /dev/null
@@ -1,1249 +0,0 @@
-/** \ingroup popt
- * \file popt/popt.c
- */
-
-/* (C) 1998-2002 Red Hat, Inc. -- Licensing details are in the COPYING
- file accompanying popt source distributions, available from
- ftp://ftp.rpm.org/pub/rpm/dist */
-
-#undef MYDEBUG
-
-#include "system.h"
-
-#if HAVE_FLOAT_H
-#include <float.h>
-#endif
-#include <math.h>
-
-#include "findme.h"
-#include "poptint.h"
-
-#ifdef MYDEBUG
-/*@unchecked@*/
-int _popt_debug = 0;
-#endif
-
-#ifndef HAVE_STRERROR
-static char * strerror(int errno) {
- extern int sys_nerr;
- extern char * sys_errlist[];
-
- if ((0 <= errno) && (errno < sys_nerr))
- return sys_errlist[errno];
- else
- return POPT_("unknown errno");
-}
-#endif
-
-#ifdef MYDEBUG
-/*@unused@*/ static void prtcon(const char *msg, poptContext con)
-{
- if (msg) fprintf(stderr, "%s", msg);
- fprintf(stderr, "\tcon %p os %p nextCharArg \"%s\" nextArg \"%s\" argv[%d] \"%s\"\n",
- con, con->os,
- (con->os->nextCharArg ? con->os->nextCharArg : ""),
- (con->os->nextArg ? con->os->nextArg : ""),
- con->os->next,
- (con->os->argv && con->os->argv[con->os->next]
- ? con->os->argv[con->os->next] : ""));
-}
-#endif
-
-void poptSetExecPath(poptContext con, const char * path, int allowAbsolute)
-{
- con->execPath = (const char *)_free(con->execPath);
- con->execPath = xstrdup(path);
- con->execAbsolute = allowAbsolute;
- /*@-nullstate@*/ /* LCL: con->execPath can be NULL? */
- return;
- /*@=nullstate@*/
-}
-
-static void invokeCallbacksPRE(poptContext con, const struct poptOption * opt)
- /*@globals internalState@*/
- /*@modifies internalState@*/
-{
- if (opt != NULL)
- for (; opt->longName || opt->shortName || opt->arg; opt++) {
- if (opt->arg == NULL) continue; /* XXX program error. */
- if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
- /* Recurse on included sub-tables. */
- invokeCallbacksPRE(con, (const struct poptOption *)opt->arg);
- } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_CALLBACK &&
- (opt->argInfo & POPT_CBFLAG_PRE))
- { /*@-castfcnptr@*/
- poptCallbackType cb = (poptCallbackType)opt->arg;
- /*@=castfcnptr@*/
- /* Perform callback. */
- /*@-moduncon -noeffectuncon @*/
- cb(con, POPT_CALLBACK_REASON_PRE, NULL, NULL, opt->descrip);
- /*@=moduncon =noeffectuncon @*/
- }
- }
-}
-
-static void invokeCallbacksPOST(poptContext con, const struct poptOption * opt)
- /*@globals internalState@*/
- /*@modifies internalState@*/
-{
- if (opt != NULL)
- for (; opt->longName || opt->shortName || opt->arg; opt++) {
- if (opt->arg == NULL) continue; /* XXX program error. */
- if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
- /* Recurse on included sub-tables. */
- invokeCallbacksPOST(con, (const struct poptOption *)opt->arg);
- } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_CALLBACK &&
- (opt->argInfo & POPT_CBFLAG_POST))
- { /*@-castfcnptr@*/
- poptCallbackType cb = (poptCallbackType)opt->arg;
- /*@=castfcnptr@*/
- /* Perform callback. */
- /*@-moduncon -noeffectuncon @*/
- cb(con, POPT_CALLBACK_REASON_POST, NULL, NULL, opt->descrip);
- /*@=moduncon =noeffectuncon @*/
- }
- }
-}
-
-static void invokeCallbacksOPTION(poptContext con,
- const struct poptOption * opt,
- const struct poptOption * myOpt,
- /*@null@*/ const void * myData, int shorty)
- /*@globals internalState@*/
- /*@modifies internalState@*/
-{
- const struct poptOption * cbopt = NULL;
-
- if (opt != NULL)
- for (; opt->longName || opt->shortName || opt->arg; opt++) {
- if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
- /* Recurse on included sub-tables. */
- if (opt->arg != NULL) /* XXX program error */
- invokeCallbacksOPTION(con, (const struct poptOption *)opt->arg,
- myOpt, myData, shorty);
- } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_CALLBACK &&
- !(opt->argInfo & POPT_CBFLAG_SKIPOPTION)) {
- /* Save callback info. */
- cbopt = opt;
- } else if (cbopt != NULL &&
- ((myOpt->shortName && opt->shortName && shorty &&
- myOpt->shortName == opt->shortName) ||
- (myOpt->longName && opt->longName &&
- /*@-nullpass@*/ /* LCL: opt->longName != NULL */
- !strcmp(myOpt->longName, opt->longName)))
- /*@=nullpass@*/
- )
- { /*@-castfcnptr@*/
- poptCallbackType cb = (poptCallbackType)cbopt->arg;
- /*@=castfcnptr@*/
- const void * cbData = (cbopt->descrip ? cbopt->descrip : myData);
- /* Perform callback. */
- if (cb != NULL) { /* XXX program error */
- /*@-moduncon -noeffectuncon @*/
- cb(con, POPT_CALLBACK_REASON_OPTION, myOpt,
- con->os->nextArg, cbData);
- /*@=moduncon =noeffectuncon @*/
- }
- /* Terminate (unless explcitly continuing). */
- if (!(cbopt->argInfo & POPT_CBFLAG_CONTINUE))
- return;
- }
- }
-}
-
-poptContext poptGetContext(const char * name, int argc, const char ** argv,
- const struct poptOption * options, int flags)
-{
- poptContext con = (poptContext)malloc(sizeof(*con));
-
- if (con == NULL) return NULL; /* XXX can't happen */
- memset(con, 0, sizeof(*con));
-
- con->os = con->optionStack;
- con->os->argc = argc;
- /*@-dependenttrans -assignexpose@*/ /* FIX: W2DO? */
- con->os->argv = argv;
- /*@=dependenttrans =assignexpose@*/
- con->os->argb = NULL;
-
- if (!(flags & POPT_CONTEXT_KEEP_FIRST))
- con->os->next = 1; /* skip argv[0] */
-
- con->leftovers = (const char **)calloc( (argc + 1),
- sizeof(*con->leftovers) );
- /*@-dependenttrans -assignexpose@*/ /* FIX: W2DO? */
- con->options = options;
- /*@=dependenttrans =assignexpose@*/
- con->aliases = NULL;
- con->numAliases = 0;
- con->flags = flags;
- con->execs = NULL;
- con->numExecs = 0;
- con->finalArgvAlloced = argc * 2;
- con->finalArgv = (const char **)calloc( con->finalArgvAlloced,
- sizeof(*con->finalArgv) );
- con->execAbsolute = 1;
- con->arg_strip = NULL;
-
- if (getenv("POSIXLY_CORRECT") || getenv("POSIX_ME_HARDER"))
- con->flags |= POPT_CONTEXT_POSIXMEHARDER;
-
- if (name) {
- char * t = (char *)malloc(strlen(name) + 1);
- if (t) con->appName = strcpy(t, name);
- }
-
- /*@-internalglobs@*/
- invokeCallbacksPRE(con, con->options);
- /*@=internalglobs@*/
-
- return con;
-}
-
-static void cleanOSE(/*@special@*/ struct optionStackEntry *os)
- /*@uses os @*/
- /*@releases os->nextArg, os->argv, os->argb @*/
- /*@modifies os @*/
-{
- os->nextArg = (const char *)_free(os->nextArg);
- os->argv = (const char **)_free(os->argv);
- os->argb = (pbm_set *)PBM_FREE(os->argb);
-}
-
-/*@-boundswrite@*/
-void poptResetContext(poptContext con)
-{
- int i;
-
- if (con == NULL) return;
- while (con->os > con->optionStack) {
- cleanOSE(con->os--);
- }
- con->os->argb = (pbm_set *)PBM_FREE(con->os->argb);
- con->os->currAlias = NULL;
- con->os->nextCharArg = NULL;
- con->os->nextArg = NULL;
- con->os->next = 1; /* skip argv[0] */
-
- con->numLeftovers = 0;
- con->nextLeftover = 0;
- con->restLeftover = 0;
- con->doExec = NULL;
-
- if (con->finalArgv != NULL)
- for (i = 0; i < con->finalArgvCount; i++) {
- /*@-unqualifiedtrans@*/ /* FIX: typedef double indirection. */
- con->finalArgv[i] = (const char *)_free(con->finalArgv[i]);
- /*@=unqualifiedtrans@*/
- }
-
- con->finalArgvCount = 0;
- con->arg_strip = ( pbm_set *)PBM_FREE(con->arg_strip);
- /*@-nullstate@*/ /* FIX: con->finalArgv != NULL */
- return;
- /*@=nullstate@*/
-}
-/*@=boundswrite@*/
-
-/* Only one of longName, shortName should be set, not both. */
-/*@-boundswrite@*/
-static int handleExec(/*@special@*/ poptContext con,
- /*@null@*/ const char * longName, char shortName)
- /*@uses con->execs, con->numExecs, con->flags, con->doExec,
- con->finalArgv, con->finalArgvAlloced, con->finalArgvCount @*/
- /*@modifies con @*/
-{
- poptItem item;
- int i;
-
- if (con->execs == NULL || con->numExecs <= 0) /* XXX can't happen */
- return 0;
-
- for (i = con->numExecs - 1; i >= 0; i--) {
- item = con->execs + i;
- if (longName && !(item->option.longName &&
- !strcmp(longName, item->option.longName)))
- continue;
- else if (shortName != item->option.shortName)
- continue;
- break;
- }
- if (i < 0) return 0;
-
-
- if (con->flags & POPT_CONTEXT_NO_EXEC)
- return 1;
-
- if (con->doExec == NULL) {
- con->doExec = con->execs + i;
- return 1;
- }
-
- /* We already have an exec to do; remember this option for next
- time 'round */
- if ((con->finalArgvCount + 1) >= (con->finalArgvAlloced)) {
- con->finalArgvAlloced += 10;
- con->finalArgv = (const char **)realloc(con->finalArgv,
- sizeof(*con->finalArgv) * con->finalArgvAlloced);
- }
-
- i = con->finalArgvCount++;
- if (con->finalArgv != NULL) /* XXX can't happen */
- { char *s = (char *)malloc((longName ? strlen(longName) : 0) + 3);
- if (s != NULL) { /* XXX can't happen */
- if (longName)
- sprintf(s, "--%s", longName);
- else
- sprintf(s, "-%c", shortName);
- con->finalArgv[i] = s;
- } else
- con->finalArgv[i] = NULL;
- }
-
- /*@-nullstate@*/ /* FIX: con->finalArgv[] == NULL */
- return 1;
- /*@=nullstate@*/
-}
-/*@=boundswrite@*/
-
-/* Only one of longName, shortName may be set at a time */
-static int handleAlias(/*@special@*/ poptContext con,
- /*@null@*/ const char * longName, char shortName,
- /*@exposed@*/ /*@null@*/ const char * nextCharArg)
- /*@uses con->aliases, con->numAliases, con->optionStack, con->os,
- con->os->currAlias, con->os->currAlias->option.longName @*/
- /*@modifies con @*/
-{
- poptItem item = con->os->currAlias;
- int rc;
- int i;
-
- if (item) {
- if (longName && (item->option.longName &&
- !strcmp(longName, item->option.longName)))
- return 0;
- if (shortName && shortName == item->option.shortName)
- return 0;
- }
-
- if (con->aliases == NULL || con->numAliases <= 0) /* XXX can't happen */
- return 0;
-
- for (i = con->numAliases - 1; i >= 0; i--) {
- item = con->aliases + i;
- if (longName && !(item->option.longName &&
- !strcmp(longName, item->option.longName)))
- continue;
- else if (shortName != item->option.shortName)
- continue;
- break;
- }
- if (i < 0) return 0;
-
- if ((con->os - con->optionStack + 1) == POPT_OPTION_DEPTH)
- return POPT_ERROR_OPTSTOODEEP;
-
-/*@-boundsread@*/
- if (nextCharArg && *nextCharArg)
- con->os->nextCharArg = nextCharArg;
-/*@=boundsread@*/
-
- con->os++;
- con->os->next = 0;
- con->os->stuffed = 0;
- con->os->nextArg = NULL;
- con->os->nextCharArg = NULL;
- con->os->currAlias = con->aliases + i;
- rc = poptDupArgv(con->os->currAlias->argc, con->os->currAlias->argv,
- &con->os->argc, &con->os->argv);
- con->os->argb = NULL;
-
- return (rc ? rc : 1);
-}
-
-/*@-bounds -boundswrite @*/
-static int execCommand(poptContext con)
- /*@globals internalState @*/
- /*@modifies internalState @*/
-{
- poptItem item = con->doExec;
- const char ** argv;
- int argc = 0;
- int rc;
-
- if (item == NULL) /*XXX can't happen*/
- return POPT_ERROR_NOARG;
-
- if (item->argv == NULL || item->argc < 1 ||
- (!con->execAbsolute && strchr(item->argv[0], '/')))
- return POPT_ERROR_NOARG;
-
- argv = (const char **)malloc(
- sizeof(*argv) * (6 + item->argc + con->numLeftovers + con->finalArgvCount));
- if (argv == NULL) return POPT_ERROR_MALLOC; /* XXX can't happen */
-
- if (!strchr(item->argv[0], '/') && con->execPath) {
- char *s = (char *)alloca(
- strlen(con->execPath) + strlen(item->argv[0]) + sizeof("/"));
- sprintf(s, "%s/%s", con->execPath, item->argv[0]);
- argv[argc] = s;
- } else {
- argv[argc] = findProgramPath(item->argv[0]);
- }
- if (argv[argc++] == NULL) return POPT_ERROR_NOARG;
-
- if (item->argc > 1) {
- memcpy(argv + argc, item->argv + 1, sizeof(*argv) * (item->argc - 1));
- argc += (item->argc - 1);
- }
-
- if (con->finalArgv != NULL && con->finalArgvCount > 0) {
- memcpy(argv + argc, con->finalArgv,
- sizeof(*argv) * con->finalArgvCount);
- argc += con->finalArgvCount;
- }
-
- if (con->leftovers != NULL && con->numLeftovers > 0) {
-#if 0
- argv[argc++] = "--";
-#endif
- memcpy(argv + argc, con->leftovers, sizeof(*argv) * con->numLeftovers);
- argc += con->numLeftovers;
- }
-
- argv[argc] = NULL;
-
-#ifdef __hpux
- rc = setresuid(getuid(), getuid(),-1);
- if (rc) return POPT_ERROR_ERRNO;
-#else
-/*
- * XXX " ... on BSD systems setuid() should be preferred over setreuid()"
- * XXX sez' Timur Bakeyev <mc@bat.ru>
- * XXX from Norbert Warmuth <nwarmuth@privat.circular.de>
- */
-#if defined(HAVE_SETUID)
- rc = setuid(getuid());
- if (rc) return POPT_ERROR_ERRNO;
-#elif defined (HAVE_SETREUID)
- rc = setreuid(getuid(), getuid()); /*hlauer: not portable to hpux9.01 */
- if (rc) return POPT_ERROR_ERRNO;
-#else
- ; /* Can't drop privileges */
-#endif
-#endif
-
- if (argv[0] == NULL)
- return POPT_ERROR_NOARG;
-
-#ifdef MYDEBUG
-if (_popt_debug)
- { const char ** avp;
- fprintf(stderr, "==> execvp(%s) argv[%d]:", argv[0], argc);
- for (avp = argv; *avp; avp++)
- fprintf(stderr, " '%s'", *avp);
- fprintf(stderr, "\n");
- }
-#endif
-
- rc = execvp(argv[0], (char *const *)argv);
- /* notreached */
- if (rc) {
- return POPT_ERROR_ERRNO;
- }
-
- return 0;
-}
-/*@=bounds =boundswrite @*/
-
-/*@-boundswrite@*/
-/*@observer@*/ /*@null@*/ static const struct poptOption *
-findOption(const struct poptOption * opt, /*@null@*/ const char * longName,
- char shortName,
- /*@null@*/ /*@out@*/ poptCallbackType * callback,
- /*@null@*/ /*@out@*/ const void ** callbackData,
- int singleDash)
- /*@modifies *callback, *callbackData */
-{
- const struct poptOption * cb = NULL;
-
- /* This happens when a single - is given */
- if (singleDash && !shortName && (longName && *longName == '\0'))
- shortName = '-';
-
- for (; opt->longName || opt->shortName || opt->arg; opt++) {
-
- if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
- const struct poptOption * opt2;
-
- /* Recurse on included sub-tables. */
- if (opt->arg == NULL) continue; /* XXX program error */
- opt2 = findOption((const struct poptOption *)opt->arg, longName,
- shortName, callback,
- callbackData, singleDash);
- if (opt2 == NULL) continue;
- /* Sub-table data will be inheirited if no data yet. */
- if (!(callback && *callback)) return opt2;
- if (!(callbackData && *callbackData == NULL)) return opt2;
- /*@-observertrans -dependenttrans @*/
- *callbackData = opt->descrip;
- /*@=observertrans =dependenttrans @*/
- return opt2;
- } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_CALLBACK) {
- cb = opt;
- } else if (longName && opt->longName &&
- (!singleDash || (opt->argInfo & POPT_ARGFLAG_ONEDASH)) &&
- /*@-nullpass@*/ /* LCL: opt->longName != NULL */
- !strcmp(longName, opt->longName))
- /*@=nullpass@*/
- {
- break;
- } else if (shortName && shortName == opt->shortName) {
- break;
- }
- }
-
- if (!opt->longName && !opt->shortName)
- return NULL;
- /*@-modobserver -mods @*/
- if (callback) *callback = NULL;
- if (callbackData) *callbackData = NULL;
- if (cb) {
- if (callback)
- /*@-castfcnptr@*/
- *callback = (poptCallbackType)cb->arg;
- /*@=castfcnptr@*/
- if (!(cb->argInfo & POPT_CBFLAG_INC_DATA)) {
- if (callbackData)
- /*@-observertrans@*/ /* FIX: typedef double indirection. */
- *callbackData = cb->descrip;
- /*@=observertrans@*/
- }
- }
- /*@=modobserver =mods @*/
-
- return opt;
-}
-/*@=boundswrite@*/
-
-static const char * findNextArg(/*@special@*/ poptContext con,
- unsigned argx, int delete_arg)
- /*@uses con->optionStack, con->os,
- con->os->next, con->os->argb, con->os->argc, con->os->argv @*/
- /*@modifies con @*/
-{
- struct optionStackEntry * os = con->os;
- const char * arg;
-
- do {
- int i;
- arg = NULL;
- while (os->next == os->argc && os > con->optionStack) os--;
- if (os->next == os->argc && os == con->optionStack) break;
- if (os->argv != NULL)
- for (i = os->next; i < os->argc; i++) {
- /*@-sizeoftype@*/
- if (os->argb && PBM_ISSET(i, os->argb))
- /*@innercontinue@*/ continue;
- if (*os->argv[i] == '-')
- /*@innercontinue@*/ continue;
- if (--argx > 0)
- /*@innercontinue@*/ continue;
- arg = os->argv[i];
- if (delete_arg) {
- if (os->argb == NULL) os->argb = (pbm_set *)PBM_ALLOC(os->argc);
- if (os->argb != NULL) /* XXX can't happen */
- PBM_SET(i, os->argb);
- }
- /*@innerbreak@*/ break;
- /*@=sizeoftype@*/
- }
- if (os > con->optionStack) os--;
- } while (arg == NULL);
- return arg;
-}
-
-/*@-boundswrite@*/
-static /*@only@*/ /*@null@*/ const char *
-expandNextArg(/*@special@*/ poptContext con, const char * s)
- /*@uses con->optionStack, con->os,
- con->os->next, con->os->argb, con->os->argc, con->os->argv @*/
- /*@modifies con @*/
-{
- const char * a = NULL;
- size_t alen;
- char *t, *te;
- size_t tn = strlen(s) + 1;
- char c;
-
- te = t = (char *)malloc(tn);;
- if (t == NULL) return NULL; /* XXX can't happen */
- while ((c = *s++) != '\0') {
- switch (c) {
-#if 0 /* XXX can't do this */
- case '\\': /* escape */
- c = *s++;
- /*@switchbreak@*/ break;
-#endif
- case '!':
- if (!(s[0] == '#' && s[1] == ':' && s[2] == '+'))
- /*@switchbreak@*/ break;
- /* XXX Make sure that findNextArg deletes only next arg. */
- if (a == NULL) {
- if ((a = findNextArg(con, 1, 1)) == NULL)
- /*@switchbreak@*/ break;
- }
- s += 3;
-
- alen = strlen(a);
- tn += alen;
- *te = '\0';
- t = (char *)realloc(t, tn);
- te = t + strlen(t);
- strncpy(te, a, alen); te += alen;
- continue;
- /*@notreached@*/ /*@switchbreak@*/ break;
- default:
- /*@switchbreak@*/ break;
- }
- *te++ = c;
- }
- *te = '\0';
- t = (char *)realloc(t, strlen(t) + 1); /* XXX memory leak, hard to plug */
- return t;
-}
-/*@=boundswrite@*/
-
-static void poptStripArg(/*@special@*/ poptContext con, int which)
- /*@uses con->arg_strip, con->optionStack @*/
- /*@defines con->arg_strip @*/
- /*@modifies con @*/
-{
- /*@-sizeoftype@*/
- if (con->arg_strip == NULL)
- con->arg_strip = (pbm_set *)PBM_ALLOC(con->optionStack[0].argc);
- if (con->arg_strip != NULL) /* XXX can't happen */
- PBM_SET(which, con->arg_strip);
- /*@=sizeoftype@*/
- /*@-compdef@*/ /* LCL: con->arg_strip udefined? */
- return;
- /*@=compdef@*/
-}
-
-int poptSaveLong(long * arg, int argInfo, long aLong)
-{
- /* XXX Check alignment, may fail on funky platforms. */
- if (arg == NULL || (((unsigned long)arg) & (sizeof(*arg)-1)))
- return POPT_ERROR_NULLARG;
-
- if (argInfo & POPT_ARGFLAG_NOT)
- aLong = ~aLong;
- switch (argInfo & POPT_ARGFLAG_LOGICALOPS) {
- case 0:
- *arg = aLong;
- break;
- case POPT_ARGFLAG_OR:
- *arg |= aLong;
- break;
- case POPT_ARGFLAG_AND:
- *arg &= aLong;
- break;
- case POPT_ARGFLAG_XOR:
- *arg ^= aLong;
- break;
- default:
- return POPT_ERROR_BADOPERATION;
- /*@notreached@*/ break;
- }
- return 0;
-}
-
-int poptSaveInt(/*@null@*/ int * arg, int argInfo, long aLong)
-{
- /* XXX Check alignment, may fail on funky platforms. */
- if (arg == NULL || (((unsigned long)arg) & (sizeof(*arg)-1)))
- return POPT_ERROR_NULLARG;
-
- if (argInfo & POPT_ARGFLAG_NOT)
- aLong = ~aLong;
- switch (argInfo & POPT_ARGFLAG_LOGICALOPS) {
- case 0:
- *arg = aLong;
- break;
- case POPT_ARGFLAG_OR:
- *arg |= aLong;
- break;
- case POPT_ARGFLAG_AND:
- *arg &= aLong;
- break;
- case POPT_ARGFLAG_XOR:
- *arg ^= aLong;
- break;
- default:
- return POPT_ERROR_BADOPERATION;
- /*@notreached@*/ break;
- }
- return 0;
-}
-
-/*@-boundswrite@*/
-/* returns 'val' element, -1 on last item, POPT_ERROR_* on error */
-int poptGetNextOpt(poptContext con)
-{
- const struct poptOption * opt = NULL;
- int done = 0;
-
- if (con == NULL)
- return -1;
- while (!done) {
- const char * origOptString = NULL;
- poptCallbackType cb = NULL;
- const void * cbData = NULL;
- const char * longArg = NULL;
- int canstrip = 0;
- int shorty = 0;
-
- while (!con->os->nextCharArg && con->os->next == con->os->argc
- && con->os > con->optionStack) {
- cleanOSE(con->os--);
- }
- if (!con->os->nextCharArg && con->os->next == con->os->argc) {
- /*@-internalglobs@*/
- invokeCallbacksPOST(con, con->options);
- /*@=internalglobs@*/
- if (con->doExec) return execCommand(con);
- return -1;
- }
-
- /* Process next long option */
- if (!con->os->nextCharArg) {
- char * localOptString, * optString;
- int thisopt;
-
- /*@-sizeoftype@*/
- if (con->os->argb && PBM_ISSET(con->os->next, con->os->argb)) {
- con->os->next++;
- continue;
- }
- /*@=sizeoftype@*/
- thisopt = con->os->next;
- if (con->os->argv != NULL) /* XXX can't happen */
- origOptString = con->os->argv[con->os->next++];
-
- if (origOptString == NULL) /* XXX can't happen */
- return POPT_ERROR_BADOPT;
-
- if (con->restLeftover || *origOptString != '-') {
- if (con->flags & POPT_CONTEXT_POSIXMEHARDER)
- con->restLeftover = 1;
- if (con->flags & POPT_CONTEXT_ARG_OPTS) {
- con->os->nextArg = xstrdup(origOptString);
- return 0;
- }
- if (con->leftovers != NULL) /* XXX can't happen */
- con->leftovers[con->numLeftovers++] = origOptString;
- continue;
- }
-
- /* Make a copy we can hack at */
- localOptString = optString =
- strcpy((char *)alloca(strlen(origOptString) + 1),
- origOptString);
-
- if (optString[0] == '\0')
- return POPT_ERROR_BADOPT;
-
- if (optString[1] == '-' && !optString[2]) {
- con->restLeftover = 1;
- continue;
- } else {
- char *oe;
- int singleDash;
-
- optString++;
- if (*optString == '-')
- singleDash = 0, optString++;
- else
- singleDash = 1;
-
- /* XXX aliases with arg substitution need "--alias=arg" */
- if (handleAlias(con, optString, '\0', NULL))
- continue;
-
- if (handleExec(con, optString, '\0'))
- continue;
-
- /* Check for "--long=arg" option. */
- for (oe = optString; *oe && *oe != '='; oe++)
- {};
- if (*oe == '=') {
- *oe++ = '\0';
- /* XXX longArg is mapped back to persistent storage. */
- longArg = origOptString + (oe - localOptString);
- }
-
- opt = findOption(con->options, optString, '\0', &cb, &cbData,
- singleDash);
- if (!opt && !singleDash)
- return POPT_ERROR_BADOPT;
- }
-
- if (!opt) {
- con->os->nextCharArg = origOptString + 1;
- } else {
- if (con->os == con->optionStack &&
- opt->argInfo & POPT_ARGFLAG_STRIP)
- {
- canstrip = 1;
- poptStripArg(con, thisopt);
- }
- shorty = 0;
- }
- }
-
- /* Process next short option */
- /*@-branchstate@*/ /* FIX: W2DO? */
- if (con->os->nextCharArg) {
- origOptString = con->os->nextCharArg;
-
- con->os->nextCharArg = NULL;
-
- if (handleAlias(con, NULL, *origOptString, origOptString + 1))
- continue;
-
- if (handleExec(con, NULL, *origOptString)) {
- /* Restore rest of short options for further processing */
- origOptString++;
- if (*origOptString != '\0')
- con->os->nextCharArg = origOptString;
- continue;
- }
-
- opt = findOption(con->options, NULL, *origOptString, &cb,
- &cbData, 0);
- if (!opt)
- return POPT_ERROR_BADOPT;
- shorty = 1;
-
- origOptString++;
- if (*origOptString != '\0')
- con->os->nextCharArg = origOptString;
- }
- /*@=branchstate@*/
-
- if (opt == NULL) return POPT_ERROR_BADOPT; /* XXX can't happen */
- if (opt->arg && (opt->argInfo & POPT_ARG_MASK) == POPT_ARG_NONE) {
- if (poptSaveInt((int *)opt->arg, opt->argInfo, 1L))
- return POPT_ERROR_BADOPERATION;
- } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_VAL) {
- if (opt->arg) {
- if (poptSaveInt((int *)opt->arg, opt->argInfo, (long)opt->val))
- return POPT_ERROR_BADOPERATION;
- }
- } else if ((opt->argInfo & POPT_ARG_MASK) != POPT_ARG_NONE) {
- con->os->nextArg = (const char *)_free(con->os->nextArg);
- /*@-usedef@*/ /* FIX: W2DO? */
- if (longArg) {
- /*@=usedef@*/
- longArg = expandNextArg(con, longArg);
- con->os->nextArg = longArg;
- } else if (con->os->nextCharArg) {
- longArg = expandNextArg(con, con->os->nextCharArg);
- con->os->nextArg = longArg;
- con->os->nextCharArg = NULL;
- } else {
- while (con->os->next == con->os->argc &&
- con->os > con->optionStack) {
- cleanOSE(con->os--);
- }
- if (con->os->next == con->os->argc) {
- if (!(opt->argInfo & POPT_ARGFLAG_OPTIONAL))
- /*@-compdef@*/ /* FIX: con->os->argv not defined */
- return POPT_ERROR_NOARG;
- /*@=compdef@*/
- con->os->nextArg = NULL;
- } else {
-
- /*
- * Make sure this isn't part of a short arg or the
- * result of an alias expansion.
- */
- if (con->os == con->optionStack &&
- (opt->argInfo & POPT_ARGFLAG_STRIP) &&
- canstrip) {
- poptStripArg(con, con->os->next);
- }
-
- if (con->os->argv != NULL) { /* XXX can't happen */
- /* XXX watchout: subtle side-effects live here. */
- longArg = con->os->argv[con->os->next++];
- longArg = expandNextArg(con, longArg);
- con->os->nextArg = longArg;
- }
- }
- }
- longArg = NULL;
-
- if (opt->arg) {
- switch (opt->argInfo & POPT_ARG_MASK) {
- case POPT_ARG_STRING:
- /* XXX memory leak, hard to plug */
- *((const char **) opt->arg) = (con->os->nextArg)
- ? xstrdup(con->os->nextArg) : NULL;
- /*@switchbreak@*/ break;
-
- case POPT_ARG_INT:
- case POPT_ARG_LONG:
- { long aLong = 0;
- char *end;
-
- if (con->os->nextArg) {
- aLong = strtol(con->os->nextArg, &end, 0);
- if (!(end && *end == '\0'))
- return POPT_ERROR_BADNUMBER;
- }
-
- if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_LONG) {
- if (aLong == LONG_MIN || aLong == LONG_MAX)
- return POPT_ERROR_OVERFLOW;
- if (poptSaveLong((long *)opt->arg, opt->argInfo, aLong))
- return POPT_ERROR_BADOPERATION;
- } else {
- if (aLong > INT_MAX || aLong < INT_MIN)
- return POPT_ERROR_OVERFLOW;
- if (poptSaveInt((int *)opt->arg, opt->argInfo, aLong))
- return POPT_ERROR_BADOPERATION;
- }
- } /*@switchbreak@*/ break;
-
- case POPT_ARG_FLOAT:
- case POPT_ARG_DOUBLE:
- { double aDouble = 0.0;
- char *end;
-
- if (con->os->nextArg) {
- /*@-mods@*/
- int saveerrno = errno;
- errno = 0;
- aDouble = strtod(con->os->nextArg, &end);
- if (errno == ERANGE)
- return POPT_ERROR_OVERFLOW;
- errno = saveerrno;
- /*@=mods@*/
- if (*end != '\0')
- return POPT_ERROR_BADNUMBER;
- }
-
- if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_DOUBLE) {
- *((double *) opt->arg) = aDouble;
- } else {
-#ifndef _ABS
-#define _ABS(a) ((((a) - 0.0) < DBL_EPSILON) ? -(a) : (a))
-#endif
- if ((_ABS(aDouble) - FLT_MAX) > DBL_EPSILON)
- return POPT_ERROR_OVERFLOW;
- if ((FLT_MIN - _ABS(aDouble)) > DBL_EPSILON)
- return POPT_ERROR_OVERFLOW;
- *((float *) opt->arg) = aDouble;
- }
- } /*@switchbreak@*/ break;
- default:
- fprintf(stdout,
- POPT_("option type (%d) not implemented in popt\n"),
- (opt->argInfo & POPT_ARG_MASK));
- exit(EXIT_FAILURE);
- /*@notreached@*/ /*@switchbreak@*/ break;
- }
- }
- }
-
- if (cb) {
- /*@-internalglobs@*/
- invokeCallbacksOPTION(con, con->options, opt, cbData, shorty);
- /*@=internalglobs@*/
- } else if (opt->val && ((opt->argInfo & POPT_ARG_MASK) != POPT_ARG_VAL))
- done = 1;
-
- if ((con->finalArgvCount + 2) >= (con->finalArgvAlloced)) {
- con->finalArgvAlloced += 10;
- con->finalArgv = (const char **)realloc(con->finalArgv,
- sizeof(*con->finalArgv) * con->finalArgvAlloced);
- }
-
- if (con->finalArgv != NULL)
- { char *s = (char *)malloc(
- (opt->longName ? strlen(opt->longName) : 0) + 3);
- if (s != NULL) { /* XXX can't happen */
- if (opt->longName)
- sprintf(s, "%s%s",
- ((opt->argInfo & POPT_ARGFLAG_ONEDASH) ? "-" : "--"),
- opt->longName);
- else
- sprintf(s, "-%c", opt->shortName);
- con->finalArgv[con->finalArgvCount++] = s;
- } else
- con->finalArgv[con->finalArgvCount++] = NULL;
- }
-
- if (opt->arg && (opt->argInfo & POPT_ARG_MASK) == POPT_ARG_NONE)
- /*@-ifempty@*/ ; /*@=ifempty@*/
- else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_VAL)
- /*@-ifempty@*/ ; /*@=ifempty@*/
- else if ((opt->argInfo & POPT_ARG_MASK) != POPT_ARG_NONE) {
- if (con->finalArgv != NULL && con->os->nextArg)
- con->finalArgv[con->finalArgvCount++] =
- /*@-nullpass@*/ /* LCL: con->os->nextArg != NULL */
- xstrdup(con->os->nextArg);
- /*@=nullpass@*/
- }
- }
-
- return (opt ? opt->val : -1); /* XXX can't happen */
-}
-/*@=boundswrite@*/
-
-const char * poptGetOptArg(poptContext con)
-{
- const char * ret = NULL;
- /*@-branchstate@*/
- if (con) {
- ret = con->os->nextArg;
- con->os->nextArg = NULL;
- }
- /*@=branchstate@*/
- return ret;
-}
-
-const char * poptGetArg(poptContext con)
-{
- const char * ret = NULL;
- if (con && con->leftovers != NULL && con->nextLeftover < con->numLeftovers)
- ret = con->leftovers[con->nextLeftover++];
- return ret;
-}
-
-const char * poptPeekArg(poptContext con)
-{
- const char * ret = NULL;
- if (con && con->leftovers != NULL && con->nextLeftover < con->numLeftovers)
- ret = con->leftovers[con->nextLeftover];
- return ret;
-}
-
-/*@-boundswrite@*/
-const char ** poptGetArgs(poptContext con)
-{
- if (con == NULL ||
- con->leftovers == NULL || con->numLeftovers == con->nextLeftover)
- return NULL;
-
- /* some apps like [like RPM ;-) ] need this NULL terminated */
- con->leftovers[con->numLeftovers] = NULL;
-
- /*@-nullret -nullstate @*/ /* FIX: typedef double indirection. */
- return (con->leftovers + con->nextLeftover);
- /*@=nullret =nullstate @*/
-}
-/*@=boundswrite@*/
-
-poptContext poptFreeContext(poptContext con)
-{
- poptItem item;
- int i;
-
- if (con == NULL) return con;
- poptResetContext(con);
- con->os->argb = (pbm_set *)_free(con->os->argb);
-
- if (con->aliases != NULL)
- for (i = 0; i < con->numAliases; i++) {
- item = con->aliases + i;
- /*@-modobserver -observertrans -dependenttrans@*/
- item->option.longName = (const char *)_free(item->option.longName);
- item->option.descrip = (const char *)_free(item->option.descrip);
- item->option.argDescrip = (const char *)_free(item->option.argDescrip);
- /*@=modobserver =observertrans =dependenttrans@*/
- item->argv = (const char **)_free(item->argv);
- }
- con->aliases = (poptItem)_free(con->aliases);
-
- if (con->execs != NULL)
- for (i = 0; i < con->numExecs; i++) {
- item = con->execs + i;
- /*@-modobserver -observertrans -dependenttrans@*/
- item->option.longName = (const char *)_free(item->option.longName);
- item->option.descrip = (const char *)_free(item->option.descrip);
- item->option.argDescrip = (const char *)_free(item->option.argDescrip);
- /*@=modobserver =observertrans =dependenttrans@*/
- item->argv = (const char **)_free(item->argv);
- }
- con->execs = (poptItem)_free(con->execs);
-
- con->leftovers = (const char **)_free(con->leftovers);
- con->finalArgv = (const char **)_free(con->finalArgv);
- con->appName = (const char *)_free(con->appName);
- con->otherHelp = (const char *)_free(con->otherHelp);
- con->execPath = (const char *)_free(con->execPath);
- con->arg_strip = (pbm_set *)PBM_FREE(con->arg_strip);
-
- con = (poptContext)_free(con);
- return con;
-}
-
-int poptAddAlias(poptContext con, struct poptAlias alias,
- /*@unused@*/ int flags)
-{
- poptItem item = (poptItem)alloca(sizeof(*item));
- memset(item, 0, sizeof(*item));
- item->option.longName = alias.longName;
- item->option.shortName = alias.shortName;
- item->option.argInfo = POPT_ARGFLAG_DOC_HIDDEN;
- item->option.arg = 0;
- item->option.val = 0;
- item->option.descrip = NULL;
- item->option.argDescrip = NULL;
- item->argc = alias.argc;
- item->argv = alias.argv;
- return poptAddItem(con, item, 0);
-}
-
-/*@-boundswrite@*/
-/*@-mustmod@*/ /* LCL: con not modified? */
-int poptAddItem(poptContext con, poptItem newItem, int flags)
-{
- poptItem * items, item;
- int * nitems;
-
- switch (flags) {
- case 1:
- items = &con->execs;
- nitems = &con->numExecs;
- break;
- case 0:
- items = &con->aliases;
- nitems = &con->numAliases;
- break;
- default:
- return 1;
- /*@notreached@*/ break;
- }
-
- *items = (poptItem)realloc((*items), ((*nitems) + 1) * sizeof(**items));
- if ((*items) == NULL)
- return 1;
-
- item = (*items) + (*nitems);
-
- item->option.longName =
- (newItem->option.longName ? xstrdup(newItem->option.longName) : NULL);
- item->option.shortName = newItem->option.shortName;
- item->option.argInfo = newItem->option.argInfo;
- item->option.arg = newItem->option.arg;
- item->option.val = newItem->option.val;
- item->option.descrip =
- (newItem->option.descrip ? xstrdup(newItem->option.descrip) : NULL);
- item->option.argDescrip =
- (newItem->option.argDescrip ? xstrdup(newItem->option.argDescrip) : NULL);
- item->argc = newItem->argc;
- item->argv = newItem->argv;
-
- (*nitems)++;
-
- return 0;
-}
-/*@=mustmod@*/
-/*@=boundswrite@*/
-
-const char * poptBadOption(poptContext con, int flags)
-{
- struct optionStackEntry * os = NULL;
-
- if (con != NULL)
- os = (flags & POPT_BADOPTION_NOALIAS) ? con->optionStack : con->os;
-
- /*@-nullderef@*/ /* LCL: os->argv != NULL */
- return (os && os->argv ? os->argv[os->next - 1] : NULL);
- /*@=nullderef@*/
-}
-
-const char *poptStrerror(const int error)
-{
- switch (error) {
- case POPT_ERROR_NOARG:
- return POPT_("missing argument");
- case POPT_ERROR_BADOPT:
- return POPT_("unknown option");
- case POPT_ERROR_BADOPERATION:
- return POPT_("mutually exclusive logical operations requested");
- case POPT_ERROR_NULLARG:
- return POPT_("opt->arg should not be NULL");
- case POPT_ERROR_OPTSTOODEEP:
- return POPT_("aliases nested too deeply");
- case POPT_ERROR_BADQUOTE:
- return POPT_("error in parameter quoting");
- case POPT_ERROR_BADNUMBER:
- return POPT_("invalid numeric value");
- case POPT_ERROR_OVERFLOW:
- return POPT_("number too large or too small");
- case POPT_ERROR_MALLOC:
- return POPT_("memory allocation failed");
- case POPT_ERROR_ERRNO:
- return strerror(errno);
- default:
- return POPT_("unknown error");
- }
-}
-
-int poptStuffArgs(poptContext con, const char ** argv)
-{
- int argc;
- int rc;
-
- if ((con->os - con->optionStack) == POPT_OPTION_DEPTH)
- return POPT_ERROR_OPTSTOODEEP;
-
- for (argc = 0; argv[argc]; argc++)
- {};
-
- con->os++;
- con->os->next = 0;
- con->os->nextArg = NULL;
- con->os->nextCharArg = NULL;
- con->os->currAlias = NULL;
- rc = poptDupArgv(argc, argv, &con->os->argc, &con->os->argv);
- con->os->argb = NULL;
- con->os->stuffed = 1;
-
- return rc;
-}
-
-const char * poptGetInvocationName(poptContext con)
-{
- return (con->os->argv ? con->os->argv[0] : "");
-}
-
-/*@-boundswrite@*/
-int poptStrippedArgv(poptContext con, int argc, char ** argv)
-{
- int numargs = argc;
- int j = 1;
- int i;
-
- /*@-sizeoftype@*/
- if (con->arg_strip)
- for (i = 1; i < argc; i++) {
- if (PBM_ISSET(i, con->arg_strip))
- numargs--;
- }
-
- for (i = 1; i < argc; i++) {
- if (con->arg_strip && PBM_ISSET(i, con->arg_strip))
- continue;
- argv[j] = (j < numargs) ? argv[i] : NULL;
- j++;
- }
- /*@=sizeoftype@*/
-
- return numargs;
-}
-/*@=boundswrite@*/
diff --git a/source3/popt/popt.h b/source3/popt/popt.h
deleted file mode 100644
index 08701d73b5..0000000000
--- a/source3/popt/popt.h
+++ /dev/null
@@ -1,545 +0,0 @@
-/** \file popt/popt.h
- * \ingroup popt
- */
-
-/* (C) 1998-2000 Red Hat, Inc. -- Licensing details are in the COPYING
- file accompanying popt source distributions, available from
- ftp://ftp.rpm.org/pub/rpm/dist. */
-
-#ifndef H_POPT
-#define H_POPT
-
-#include <stdio.h> /* for FILE * */
-
-#define POPT_OPTION_DEPTH 10
-
-/** \ingroup popt
- * \name Arg type identifiers
- */
-/*@{*/
-#define POPT_ARG_NONE 0 /*!< no arg */
-#define POPT_ARG_STRING 1 /*!< arg will be saved as string */
-#define POPT_ARG_INT 2 /*!< arg will be converted to int */
-#define POPT_ARG_LONG 3 /*!< arg will be converted to long */
-#define POPT_ARG_INCLUDE_TABLE 4 /*!< arg points to table */
-#define POPT_ARG_CALLBACK 5 /*!< table-wide callback... must be
- set first in table; arg points
- to callback, descrip points to
- callback data to pass */
-#define POPT_ARG_INTL_DOMAIN 6 /*!< set the translation domain
- for this table and any
- included tables; arg points
- to the domain string */
-#define POPT_ARG_VAL 7 /*!< arg should take value val */
-#define POPT_ARG_FLOAT 8 /*!< arg will be converted to float */
-#define POPT_ARG_DOUBLE 9 /*!< arg will be converted to double */
-
-#define POPT_ARG_MASK 0x0000FFFF
-/*@}*/
-
-/** \ingroup popt
- * \name Arg modifiers
- */
-/*@{*/
-#define POPT_ARGFLAG_ONEDASH 0x80000000 /*!< allow -longoption */
-#define POPT_ARGFLAG_DOC_HIDDEN 0x40000000 /*!< don't show in help/usage */
-#define POPT_ARGFLAG_STRIP 0x20000000 /*!< strip this arg from argv(only applies to long args) */
-#define POPT_ARGFLAG_OPTIONAL 0x10000000 /*!< arg may be missing */
-
-#define POPT_ARGFLAG_OR 0x08000000 /*!< arg will be or'ed */
-#define POPT_ARGFLAG_NOR 0x09000000 /*!< arg will be nor'ed */
-#define POPT_ARGFLAG_AND 0x04000000 /*!< arg will be and'ed */
-#define POPT_ARGFLAG_NAND 0x05000000 /*!< arg will be nand'ed */
-#define POPT_ARGFLAG_XOR 0x02000000 /*!< arg will be xor'ed */
-#define POPT_ARGFLAG_NOT 0x01000000 /*!< arg will be negated */
-#define POPT_ARGFLAG_LOGICALOPS \
- (POPT_ARGFLAG_OR|POPT_ARGFLAG_AND|POPT_ARGFLAG_XOR)
-
-#define POPT_BIT_SET (POPT_ARG_VAL|POPT_ARGFLAG_OR)
- /*!< set arg bit(s) */
-#define POPT_BIT_CLR (POPT_ARG_VAL|POPT_ARGFLAG_NAND)
- /*!< clear arg bit(s) */
-
-#define POPT_ARGFLAG_SHOW_DEFAULT 0x00800000 /*!< show default value in --help */
-
-/*@}*/
-
-/** \ingroup popt
- * \name Callback modifiers
- */
-/*@{*/
-#define POPT_CBFLAG_PRE 0x80000000 /*!< call the callback before parse */
-#define POPT_CBFLAG_POST 0x40000000 /*!< call the callback after parse */
-#define POPT_CBFLAG_INC_DATA 0x20000000 /*!< use data from the include line,
- not the subtable */
-#define POPT_CBFLAG_SKIPOPTION 0x10000000 /*!< don't callback with option */
-#define POPT_CBFLAG_CONTINUE 0x08000000 /*!< continue callbacks with option */
-/*@}*/
-
-/** \ingroup popt
- * \name Error return values
- */
-/*@{*/
-#define POPT_ERROR_NOARG -10 /*!< missing argument */
-#define POPT_ERROR_BADOPT -11 /*!< unknown option */
-#define POPT_ERROR_OPTSTOODEEP -13 /*!< aliases nested too deeply */
-#define POPT_ERROR_BADQUOTE -15 /*!< error in paramter quoting */
-#define POPT_ERROR_ERRNO -16 /*!< errno set, use strerror(errno) */
-#define POPT_ERROR_BADNUMBER -17 /*!< invalid numeric value */
-#define POPT_ERROR_OVERFLOW -18 /*!< number too large or too small */
-#define POPT_ERROR_BADOPERATION -19 /*!< mutually exclusive logical operations requested */
-#define POPT_ERROR_NULLARG -20 /*!< opt->arg should not be NULL */
-#define POPT_ERROR_MALLOC -21 /*!< memory allocation failed */
-/*@}*/
-
-/** \ingroup popt
- * \name poptBadOption() flags
- */
-/*@{*/
-#define POPT_BADOPTION_NOALIAS (1 << 0) /*!< don't go into an alias */
-/*@}*/
-
-/** \ingroup popt
- * \name poptGetContext() flags
- */
-/*@{*/
-#define POPT_CONTEXT_NO_EXEC (1 << 0) /*!< ignore exec expansions */
-#define POPT_CONTEXT_KEEP_FIRST (1 << 1) /*!< pay attention to argv[0] */
-#define POPT_CONTEXT_POSIXMEHARDER (1 << 2) /*!< options can't follow args */
-#define POPT_CONTEXT_ARG_OPTS (1 << 4) /*!< return args as options with value 0 */
-/*@}*/
-
-/** \ingroup popt
- */
-struct poptOption {
-/*@observer@*/ /*@null@*/
- const char * longName; /*!< may be NULL */
- char shortName; /*!< may be '\0' */
- int argInfo;
-/*@shared@*/ /*@null@*/
- void * arg; /*!< depends on argInfo */
- int val; /*!< 0 means don't return, just update flag */
-/*@observer@*/ /*@null@*/
- const char * descrip; /*!< description for autohelp -- may be NULL */
-/*@observer@*/ /*@null@*/
- const char * argDescrip; /*!< argument description for autohelp */
-};
-
-/** \ingroup popt
- * A popt alias argument for poptAddAlias().
- */
-struct poptAlias {
-/*@owned@*/ /*@null@*/
- const char * longName; /*!< may be NULL */
- char shortName; /*!< may be '\0' */
- int argc;
-/*@owned@*/
- const char ** argv; /*!< must be free()able */
-};
-
-/** \ingroup popt
- * A popt alias or exec argument for poptAddItem().
- */
-/*@-exporttype@*/
-typedef struct poptItem_s {
- struct poptOption option; /*!< alias/exec name(s) and description. */
- int argc; /*!< (alias) no. of args. */
-/*@owned@*/
- const char ** argv; /*!< (alias) args, must be free()able. */
-} * poptItem;
-/*@=exporttype@*/
-
-/** \ingroup popt
- * \name Auto-generated help/usage
- */
-/*@{*/
-
-/**
- * Empty table marker to enable displaying popt alias/exec options.
- */
-/*@-exportvar@*/
-/*@unchecked@*/ /*@observer@*/
-extern struct poptOption poptAliasOptions[];
-/*@=exportvar@*/
-#define POPT_AUTOALIAS { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptAliasOptions, \
- 0, "Options implemented via popt alias/exec:", NULL },
-
-/**
- * Auto help table options.
- */
-/*@-exportvar@*/
-/*@unchecked@*/ /*@observer@*/
-extern struct poptOption poptHelpOptions[];
-/*@=exportvar@*/
-#define POPT_AUTOHELP { NULL, '\0', POPT_ARG_INCLUDE_TABLE, poptHelpOptions, \
- 0, "Help options:", NULL },
-
-#define POPT_TABLEEND { NULL, '\0', 0, 0, 0, NULL, NULL }
-/*@}*/
-
-/** \ingroup popt
- */
-/*@-exporttype@*/
-typedef /*@abstract@*/ struct poptContext_s * poptContext;
-/*@=exporttype@*/
-
-/** \ingroup popt
- */
-#ifndef __cplusplus
-/*@-exporttype -typeuse@*/
-typedef struct poptOption * poptOption;
-/*@=exporttype =typeuse@*/
-#endif
-
-/*@-exportconst@*/
-enum poptCallbackReason {
- POPT_CALLBACK_REASON_PRE = 0,
- POPT_CALLBACK_REASON_POST = 1,
- POPT_CALLBACK_REASON_OPTION = 2
-};
-/*@=exportconst@*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*@-type@*/
-
-/** \ingroup popt
- * Table callback prototype.
- * @param con context
- * @param reason reason for callback
- * @param opt option that triggered callback
- * @param arg @todo Document.
- * @param data @todo Document.
- */
-typedef void (*poptCallbackType) (poptContext con,
- enum poptCallbackReason reason,
- /*@null@*/ const struct poptOption * opt,
- /*@null@*/ const char * arg,
- /*@null@*/ const void * data)
- /*@*/;
-
-/** \ingroup popt
- * Initialize popt context.
- * @param name context name (usually argv[0] program name)
- * @param argc no. of arguments
- * @param argv argument array
- * @param options address of popt option table
- * @param flags or'd POPT_CONTEXT_* bits
- * @return initialized popt context
- */
-/*@only@*/ /*@null@*/ poptContext poptGetContext(
- /*@dependent@*/ /*@keep@*/ const char * name,
- int argc, /*@dependent@*/ /*@keep@*/ const char ** argv,
- /*@dependent@*/ /*@keep@*/ const struct poptOption * options,
- int flags)
- /*@*/;
-
-/** \ingroup popt
- * Reinitialize popt context.
- * @param con context
- */
-/*@unused@*/
-void poptResetContext(/*@null@*/poptContext con)
- /*@modifies con @*/;
-
-/** \ingroup popt
- * Return value of next option found.
- * @param con context
- * @return next option val, -1 on last item, POPT_ERROR_* on error
- */
-int poptGetNextOpt(/*@null@*/poptContext con)
- /*@globals fileSystem, internalState @*/
- /*@modifies con, fileSystem, internalState @*/;
-
-/** \ingroup popt
- * Return next option argument (if any).
- * @param con context
- * @return option argument, NULL if no argument is available
- */
-/*@observer@*/ /*@null@*/ const char * poptGetOptArg(/*@null@*/poptContext con)
- /*@modifies con @*/;
-
-/** \ingroup popt
- * Return next argument.
- * @param con context
- * @return next argument, NULL if no argument is available
- */
-/*@observer@*/ /*@null@*/ const char * poptGetArg(/*@null@*/poptContext con)
- /*@modifies con @*/;
-
-/** \ingroup popt
- * Peek at current argument.
- * @param con context
- * @return current argument, NULL if no argument is available
- */
-/*@observer@*/ /*@null@*/ const char * poptPeekArg(/*@null@*/poptContext con)
- /*@*/;
-
-/** \ingroup popt
- * Return remaining arguments.
- * @param con context
- * @return argument array, NULL terminated
- */
-/*@observer@*/ /*@null@*/ const char ** poptGetArgs(/*@null@*/poptContext con)
- /*@modifies con @*/;
-
-/** \ingroup popt
- * Return the option which caused the most recent error.
- * @param con context
- * @param flags
- * @return offending option
- */
-/*@observer@*/ const char * poptBadOption(/*@null@*/poptContext con, int flags)
- /*@*/;
-
-/** \ingroup popt
- * Destroy context.
- * @param con context
- * @return NULL always
- */
-/*@null@*/ poptContext poptFreeContext( /*@only@*/ /*@null@*/ poptContext con)
- /*@modifies con @*/;
-
-/** \ingroup popt
- * Add arguments to context.
- * @param con context
- * @param argv argument array, NULL terminated
- * @return 0 on success, POPT_ERROR_OPTSTOODEEP on failure
- */
-int poptStuffArgs(poptContext con, /*@keep@*/ const char ** argv)
- /*@modifies con @*/;
-
-/** \ingroup popt
- * Add alias to context.
- * @todo Pass alias by reference, not value.
- * @deprecated Use poptAddItem instead.
- * @param con context
- * @param alias alias to add
- * @param flags (unused)
- * @return 0 on success
- */
-/*@unused@*/
-int poptAddAlias(poptContext con, struct poptAlias alias, int flags)
- /*@modifies con @*/;
-
-/** \ingroup popt
- * Add alias/exec item to context.
- * @param con context
- * @param newItem alias/exec item to add
- * @param flags 0 for alias, 1 for exec
- * @return 0 on success
- */
-int poptAddItem(poptContext con, poptItem newItem, int flags)
- /*@modifies con @*/;
-
-/** \ingroup popt
- * Read configuration file.
- * @param con context
- * @param fn file name to read
- * @return 0 on success, POPT_ERROR_ERRNO on failure
- */
-int poptReadConfigFile(poptContext con, const char * fn)
- /*@globals fileSystem, internalState @*/
- /*@modifies con->execs, con->numExecs,
- fileSystem, internalState @*/;
-
-/** \ingroup popt
- * Read default configuration from /etc/popt and $HOME/.popt.
- * @param con context
- * @param useEnv (unused)
- * @return 0 on success, POPT_ERROR_ERRNO on failure
- */
-int poptReadDefaultConfig(poptContext con, /*@unused@*/ int useEnv)
- /*@globals fileSystem, internalState @*/
- /*@modifies con->execs, con->numExecs,
- fileSystem, internalState @*/;
-
-/** \ingroup popt
- * Duplicate an argument array.
- * @note: The argument array is malloc'd as a single area, so only argv must
- * be free'd.
- *
- * @param argc no. of arguments
- * @param argv argument array
- * @retval argcPtr address of returned no. of arguments
- * @retval argvPtr address of returned argument array
- * @return 0 on success, POPT_ERROR_NOARG on failure
- */
-int poptDupArgv(int argc, /*@null@*/ const char **argv,
- /*@null@*/ /*@out@*/ int * argcPtr,
- /*@null@*/ /*@out@*/ const char *** argvPtr)
- /*@modifies *argcPtr, *argvPtr @*/;
-
-/** \ingroup popt
- * Parse a string into an argument array.
- * The parse allows ', ", and \ quoting, but ' is treated the same as " and
- * both may include \ quotes.
- * @note: The argument array is malloc'd as a single area, so only argv must
- * be free'd.
- *
- * @param s string to parse
- * @retval argcPtr address of returned no. of arguments
- * @retval argvPtr address of returned argument array
- */
-int poptParseArgvString(const char * s,
- /*@out@*/ int * argcPtr, /*@out@*/ const char *** argvPtr)
- /*@modifies *argcPtr, *argvPtr @*/;
-
-/** \ingroup popt
- * Parses an input configuration file and returns an string that is a
- * command line. For use with popt. You must free the return value when done.
- *
- * Given the file:
-\verbatim
-# this line is ignored
- # this one too
-aaa
- bbb
- ccc
-bla=bla
-
-this_is = fdsafdas
- bad_line=
- reall bad line
- reall bad line = again
-5555= 55555
- test = with lots of spaces
-\endverbatim
-*
-* The result is:
-\verbatim
---aaa --bbb --ccc --bla="bla" --this_is="fdsafdas" --5555="55555" --test="with lots of spaces"
-\endverbatim
-*
-* Passing this to poptParseArgvString() yields an argv of:
-\verbatim
-'--aaa'
-'--bbb'
-'--ccc'
-'--bla=bla'
-'--this_is=fdsafdas'
-'--5555=55555'
-'--test=with lots of spaces'
-\endverbatim
- *
- * @bug NULL is returned if file line is too long.
- * @bug Silently ignores invalid lines.
- *
- * @param fp file handle to read
- * @param *argstrp return string of options (malloc'd)
- * @param flags unused
- * @return 0 on success
- * @see poptParseArgvString
- */
-/*@-fcnuse@*/
-int poptConfigFileToString(FILE *fp, /*@out@*/ char ** argstrp, int flags)
- /*@globals fileSystem @*/
- /*@modifies *fp, *argstrp, fileSystem @*/;
-/*@=fcnuse@*/
-
-/** \ingroup popt
- * Return formatted error string for popt failure.
- * @param error popt error
- * @return error string
- */
-/*@observer@*/ const char* poptStrerror(const int error)
- /*@*/;
-
-/** \ingroup popt
- * Limit search for executables.
- * @param con context
- * @param path single path to search for executables
- * @param allowAbsolute absolute paths only?
- */
-void poptSetExecPath(poptContext con, const char * path, int allowAbsolute)
- /*@modifies con @*/;
-
-/** \ingroup popt
- * Print detailed description of options.
- * @param con context
- * @param fp ouput file handle
- * @param flags (unused)
- */
-void poptPrintHelp(poptContext con, FILE * fp, /*@unused@*/ int flags)
- /*@globals fileSystem @*/
- /*@modifies *fp, fileSystem @*/;
-
-/** \ingroup popt
- * Print terse description of options.
- * @param con context
- * @param fp ouput file handle
- * @param flags (unused)
- */
-void poptPrintUsage(poptContext con, FILE * fp, /*@unused@*/ int flags)
- /*@globals fileSystem @*/
- /*@modifies *fp, fileSystem @*/;
-
-/** \ingroup popt
- * Provide text to replace default "[OPTION...]" in help/usage output.
- * @param con context
- * @param text replacement text
- */
-/*@-fcnuse@*/
-void poptSetOtherOptionHelp(poptContext con, const char * text)
- /*@modifies con @*/;
-/*@=fcnuse@*/
-
-/** \ingroup popt
- * Return argv[0] from context.
- * @param con context
- * @return argv[0]
- */
-/*@-fcnuse@*/
-/*@observer@*/ const char * poptGetInvocationName(poptContext con)
- /*@*/;
-/*@=fcnuse@*/
-
-/** \ingroup popt
- * Shuffle argv pointers to remove stripped args, returns new argc.
- * @param con context
- * @param argc no. of args
- * @param argv arg vector
- * @return new argc
- */
-/*@-fcnuse@*/
-int poptStrippedArgv(poptContext con, int argc, char ** argv)
- /*@modifies *argv @*/;
-/*@=fcnuse@*/
-
-/**
- * Save a long, performing logical operation with value.
- * @warning Alignment check may be too strict on certain platorms.
- * @param arg integer pointer, aligned on int boundary.
- * @param argInfo logical operation (see POPT_ARGFLAG_*)
- * @param aLong value to use
- * @return 0 on success, POPT_ERROR_NULLARG/POPT_ERROR_BADOPERATION
- */
-/*@-incondefs@*/
-/*@unused@*/
-int poptSaveLong(/*@null@*/ long * arg, int argInfo, long aLong)
- /*@modifies *arg @*/
- /*@requires maxSet(arg) >= 0 /\ maxRead(arg) == 0 @*/;
-/*@=incondefs@*/
-
-/**
- * Save an integer, performing logical operation with value.
- * @warning Alignment check may be too strict on certain platorms.
- * @param arg integer pointer, aligned on int boundary.
- * @param argInfo logical operation (see POPT_ARGFLAG_*)
- * @param aLong value to use
- * @return 0 on success, POPT_ERROR_NULLARG/POPT_ERROR_BADOPERATION
- */
-/*@-incondefs@*/
-/*@unused@*/
-int poptSaveInt(/*@null@*/ int * arg, int argInfo, long aLong)
- /*@modifies *arg @*/
- /*@requires maxSet(arg) >= 0 /\ maxRead(arg) == 0 @*/;
-/*@=incondefs@*/
-
-/*@=type@*/
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/source3/popt/poptconfig.c b/source3/popt/poptconfig.c
deleted file mode 100644
index 837828ccf9..0000000000
--- a/source3/popt/poptconfig.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/** \ingroup popt
- * \file popt/poptconfig.c
- */
-
-/* (C) 1998-2002 Red Hat, Inc. -- Licensing details are in the COPYING
- file accompanying popt source distributions, available from
- ftp://ftp.rpm.org/pub/rpm/dist. */
-
-#include "system.h"
-#include "poptint.h"
-
-/*@-compmempass@*/ /* FIX: item->option.longName kept, not dependent. */
-static void configLine(poptContext con, char * line)
- /*@modifies con @*/
-{
- /*@-type@*/
- int nameLength = strlen(con->appName);
- /*@=type@*/
- const char * entryType;
- const char * opt;
- poptItem item = (poptItem)alloca(sizeof(*item));
- int i, j;
-
-/*@-boundswrite@*/
- memset(item, 0, sizeof(*item));
-
- /*@-type@*/
- if (strncmp(line, con->appName, nameLength)) return;
- /*@=type@*/
-
- line += nameLength;
- if (*line == '\0' || !isspace(*line)) return;
-
- while (*line != '\0' && isspace(*line)) line++;
- entryType = line;
- while (*line == '\0' || !isspace(*line)) line++;
- *line++ = '\0';
-
- while (*line != '\0' && isspace(*line)) line++;
- if (*line == '\0') return;
- opt = line;
- while (*line == '\0' || !isspace(*line)) line++;
- *line++ = '\0';
-
- while (*line != '\0' && isspace(*line)) line++;
- if (*line == '\0') return;
-
- /*@-temptrans@*/ /* FIX: line alias is saved */
- if (opt[0] == '-' && opt[1] == '-')
- item->option.longName = opt + 2;
- else if (opt[0] == '-' && opt[2] == '\0')
- item->option.shortName = opt[1];
- /*@=temptrans@*/
-
- if (poptParseArgvString(line, &item->argc, &item->argv)) return;
-
- /*@-modobserver@*/
- item->option.argInfo = POPT_ARGFLAG_DOC_HIDDEN;
- for (i = 0, j = 0; i < item->argc; i++, j++) {
- const char * f;
- if (!strncmp(item->argv[i], "--POPTdesc=", sizeof("--POPTdesc=")-1)) {
- f = item->argv[i] + sizeof("--POPTdesc=");
- if (f[0] == '$' && f[1] == '"') f++;
- item->option.descrip = f;
- item->option.argInfo &= ~POPT_ARGFLAG_DOC_HIDDEN;
- j--;
- } else
- if (!strncmp(item->argv[i], "--POPTargs=", sizeof("--POPTargs=")-1)) {
- f = item->argv[i] + sizeof("--POPTargs=");
- if (f[0] == '$' && f[1] == '"') f++;
- item->option.argDescrip = f;
- item->option.argInfo &= ~POPT_ARGFLAG_DOC_HIDDEN;
- item->option.argInfo |= POPT_ARG_STRING;
- j--;
- } else
- if (j != i)
- item->argv[j] = item->argv[i];
- }
- if (j != i) {
- item->argv[j] = NULL;
- item->argc = j;
- }
- /*@=modobserver@*/
-/*@=boundswrite@*/
-
- /*@-nullstate@*/ /* FIX: item->argv[] may be NULL */
- if (!strcmp(entryType, "alias"))
- (void) poptAddItem(con, item, 0);
- else if (!strcmp(entryType, "exec"))
- (void) poptAddItem(con, item, 1);
- /*@=nullstate@*/
-}
-/*@=compmempass@*/
-
-int poptReadConfigFile(poptContext con, const char * fn)
-{
- const char * file, * chptr, * end;
- char * buf;
-/*@dependent@*/ char * dst;
- int fd, rc;
- off_t fileLength;
-
- fd = open(fn, O_RDONLY);
- if (fd < 0)
- return (errno == ENOENT ? 0 : POPT_ERROR_ERRNO);
-
- fileLength = lseek(fd, 0, SEEK_END);
- if (fileLength == -1 || lseek(fd, 0, 0) == -1) {
- rc = errno;
- (void) close(fd);
- /*@-mods@*/
- errno = rc;
- /*@=mods@*/
- return POPT_ERROR_ERRNO;
- }
-
- file = (const char *)alloca(fileLength + 1);
- if (read(fd, (char *)file, fileLength) != fileLength) {
- rc = errno;
- (void) close(fd);
- /*@-mods@*/
- errno = rc;
- /*@=mods@*/
- return POPT_ERROR_ERRNO;
- }
- if (close(fd) == -1)
- return POPT_ERROR_ERRNO;
-
-/*@-boundswrite@*/
- dst = buf = (char *)alloca(fileLength + 1);
-
- chptr = file;
- end = (file + fileLength);
- /*@-infloops@*/ /* LCL: can't detect chptr++ */
- while (chptr < end) {
- switch (*chptr) {
- case '\n':
- *dst = '\0';
- dst = buf;
- while (*dst && isspace(*dst)) dst++;
- if (*dst && *dst != '#')
- configLine(con, dst);
- chptr++;
- /*@switchbreak@*/ break;
- case '\\':
- *dst++ = *chptr++;
- if (chptr < end) {
- if (*chptr == '\n')
- dst--, chptr++;
- /* \ at the end of a line does not insert a \n */
- else
- *dst++ = *chptr++;
- }
- /*@switchbreak@*/ break;
- default:
- *dst++ = *chptr++;
- /*@switchbreak@*/ break;
- }
- }
- /*@=infloops@*/
-/*@=boundswrite@*/
-
- return 0;
-}
-
-int poptReadDefaultConfig(poptContext con, /*@unused@*/ int useEnv)
-{
- char * fn, * home;
- int rc;
-
- /*@-type@*/
- if (!con->appName) return 0;
- /*@=type@*/
-
- rc = poptReadConfigFile(con, "/etc/popt");
- if (rc) return rc;
-#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
- if (getuid() != geteuid()) return 0;
-#endif
-
- if ((home = getenv("HOME"))) {
- fn = (char *)alloca(strlen(home) + 20);
- strcpy(fn, home);
- strcat(fn, "/.popt");
- rc = poptReadConfigFile(con, fn);
- if (rc) return rc;
- }
-
- return 0;
-}
diff --git a/source3/popt/popthelp.c b/source3/popt/popthelp.c
deleted file mode 100644
index e965ff6168..0000000000
--- a/source3/popt/popthelp.c
+++ /dev/null
@@ -1,740 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-
-/*@-type@*/
-/** \ingroup popt
- * \file popt/popthelp.c
- */
-
-/* (C) 1998-2002 Red Hat, Inc. -- Licensing details are in the COPYING
- file accompanying popt source distributions, available from
- ftp://ftp.rpm.org/pub/rpm/dist. */
-
-#include "system.h"
-#include "poptint.h"
-
-/**
- * Display arguments.
- * @param con context
- * @param foo (unused)
- * @param key option(s)
- * @param arg (unused)
- * @param data (unused)
- */
-static void displayArgs(poptContext con,
- /*@unused@*/ enum poptCallbackReason foo,
- struct poptOption * key,
- /*@unused@*/ const char * arg, /*@unused@*/ void * data)
- /*@globals fileSystem@*/
- /*@modifies fileSystem@*/
-{
- if (key->shortName == '?')
- poptPrintHelp(con, stdout, 0);
- else
- poptPrintUsage(con, stdout, 0);
- exit(0);
-}
-
-#ifdef NOTYET
-/*@unchecked@*/
-static int show_option_defaults = 0;
-#endif
-
-/**
- * Empty table marker to enable displaying popt alias/exec options.
- */
-/*@observer@*/ /*@unchecked@*/
-struct poptOption poptAliasOptions[] = {
- POPT_TABLEEND
-};
-
-/**
- * Auto help table options.
- */
-/*@-castfcnptr@*/
-/*@observer@*/ /*@unchecked@*/
-struct poptOption poptHelpOptions[] = {
- { NULL, '\0', POPT_ARG_CALLBACK, (void *)&displayArgs, '\0', NULL, NULL },
- { "help", '?', 0, NULL, '?', N_("Show this help message"), NULL },
- { "usage", '\0', 0, NULL, 'u', N_("Display brief usage message"), NULL },
-#ifdef NOTYET
- { "defaults", '\0', POPT_ARG_NONE, &show_option_defaults, 0,
- N_("Display option defaults in message"), NULL },
-#endif
- POPT_TABLEEND
-} ;
-/*@=castfcnptr@*/
-
-/**
- * @param table option(s)
- */
-/*@observer@*/ /*@null@*/ static const char *
-getTableTranslationDomain(/*@null@*/ const struct poptOption *table)
- /*@*/
-{
- const struct poptOption *opt;
-
- if (table != NULL)
- for (opt = table; opt->longName || opt->shortName || opt->arg; opt++) {
- if (opt->argInfo == POPT_ARG_INTL_DOMAIN)
- return (char *)opt->arg;
- }
- return NULL;
-}
-
-/**
- * @param opt option(s)
- * @param translation_domain translation domain
- */
-/*@observer@*/ /*@null@*/ static const char *
-getArgDescrip(const struct poptOption * opt,
- /*@-paramuse@*/ /* FIX: i18n macros disabled with lclint */
- /*@null@*/ const char * translation_domain)
- /*@=paramuse@*/
- /*@*/
-{
- if (!(opt->argInfo & POPT_ARG_MASK)) return NULL;
-
- if (opt == (poptHelpOptions + 1) || opt == (poptHelpOptions + 2))
- if (opt->argDescrip) return POPT_(opt->argDescrip);
-
- if (opt->argDescrip) return D_(translation_domain, opt->argDescrip);
-
- switch (opt->argInfo & POPT_ARG_MASK) {
- case POPT_ARG_NONE: return POPT_("NONE");
-#ifdef DYING
- case POPT_ARG_VAL: return POPT_("VAL");
-#else
- case POPT_ARG_VAL: return NULL;
-#endif
- case POPT_ARG_INT: return POPT_("INT");
- case POPT_ARG_LONG: return POPT_("LONG");
- case POPT_ARG_STRING: return POPT_("STRING");
- case POPT_ARG_FLOAT: return POPT_("FLOAT");
- case POPT_ARG_DOUBLE: return POPT_("DOUBLE");
- default: return POPT_("ARG");
- }
-}
-
-/**
- * Display default value for an option.
- * @param lineLength
- * @param opt option(s)
- * @param translation_domain translation domain
- * @return
- */
-static /*@only@*/ /*@null@*/ char *
-singleOptionDefaultValue(int lineLength,
- const struct poptOption * opt,
- /*@-paramuse@*/ /* FIX: i18n macros disabled with lclint */
- /*@null@*/ const char * translation_domain)
- /*@=paramuse@*/
- /*@*/
-{
- const char * defstr = D_(translation_domain, "default");
- char * le = (char *)malloc(4*lineLength + 1);
- char * l = le;
-
- if (le == NULL) return NULL; /* XXX can't happen */
-/*@-boundswrite@*/
- *le = '\0';
- *le++ = '(';
- strcpy(le, defstr); le += strlen(le);
- *le++ = ':';
- *le++ = ' ';
- if (opt->arg) /* XXX programmer error */
- switch (opt->argInfo & POPT_ARG_MASK) {
- case POPT_ARG_VAL:
- case POPT_ARG_INT:
- { long aLong = *((int *)opt->arg);
- le += sprintf(le, "%ld", aLong);
- } break;
- case POPT_ARG_LONG:
- { long aLong = *((long *)opt->arg);
- le += sprintf(le, "%ld", aLong);
- } break;
- case POPT_ARG_FLOAT:
- { double aDouble = *((float *)opt->arg);
- le += sprintf(le, "%g", aDouble);
- } break;
- case POPT_ARG_DOUBLE:
- { double aDouble = *((double *)opt->arg);
- le += sprintf(le, "%g", aDouble);
- } break;
- case POPT_ARG_STRING:
- { const char * s = *(const char **)opt->arg;
- if (s == NULL) {
- strcpy(le, "null"); le += strlen(le);
- } else {
- size_t slen = 4*lineLength - (le - l) - sizeof("\"...\")");
- *le++ = '"';
- strncpy(le, s, slen); le[slen] = '\0'; le += strlen(le);
- if (slen < strlen(s)) {
- strcpy(le, "..."); le += strlen(le);
- }
- *le++ = '"';
- }
- } break;
- case POPT_ARG_NONE:
- default:
- l = (char *)_free(l);
- return NULL;
- /*@notreached@*/ break;
- }
- *le++ = ')';
- *le = '\0';
-/*@=boundswrite@*/
-
- return l;
-}
-
-/**
- * Display help text for an option.
- * @param fp output file handle
- * @param maxLeftCol
- * @param opt option(s)
- * @param translation_domain translation domain
- */
-static void singleOptionHelp(FILE * fp, int maxLeftCol,
- const struct poptOption * opt,
- /*@null@*/ const char * translation_domain)
- /*@globals fileSystem @*/
- /*@modifies *fp, fileSystem @*/
-{
- int indentLength = maxLeftCol + 5;
- int lineLength = 79 - indentLength;
- const char * help = D_(translation_domain, opt->descrip);
- const char * argDescrip = getArgDescrip(opt, translation_domain);
- int helpLength;
- char * defs = NULL;
- char * left;
- int nb = maxLeftCol + 1;
-
- /* Make sure there's more than enough room in target buffer. */
- if (opt->longName) nb += strlen(opt->longName);
- if (argDescrip) nb += strlen(argDescrip);
-
-/*@-boundswrite@*/
- left = (char *)malloc(nb);
- if (left == NULL) return; /* XXX can't happen */
- left[0] = '\0';
- left[maxLeftCol] = '\0';
-
- if (opt->longName && opt->shortName)
- sprintf(left, "-%c, %s%s", opt->shortName,
- ((opt->argInfo & POPT_ARGFLAG_ONEDASH) ? "-" : "--"),
- opt->longName);
- else if (opt->shortName != '\0')
- sprintf(left, "-%c", opt->shortName);
- else if (opt->longName)
- sprintf(left, "%s%s",
- ((opt->argInfo & POPT_ARGFLAG_ONEDASH) ? "-" : "--"),
- opt->longName);
- if (!*left) goto out;
-
- if (argDescrip) {
- char * le = left + strlen(left);
-
- if (opt->argInfo & POPT_ARGFLAG_OPTIONAL)
- *le++ = '[';
-
- /* Choose type of output */
- /*@-branchstate@*/
- if (opt->argInfo & POPT_ARGFLAG_SHOW_DEFAULT) {
- defs = singleOptionDefaultValue(lineLength, opt, translation_domain);
- if (defs) {
- char * t = (char *)malloc((help ? strlen(help) : 0) +
- strlen(defs) + sizeof(" "));
- if (t) {
- char * te = t;
- *te = '\0';
- if (help) {
- strcpy(te, help); te += strlen(te);
- }
- *te++ = ' ';
- strcpy(te, defs);
- defs = (char *)_free(defs);
- }
- defs = t;
- }
- }
- /*@=branchstate@*/
-
- if (opt->argDescrip == NULL) {
- switch (opt->argInfo & POPT_ARG_MASK) {
- case POPT_ARG_NONE:
- break;
- case POPT_ARG_VAL:
-#ifdef NOTNOW /* XXX pug ugly nerdy output */
- { long aLong = opt->val;
- int ops = (opt->argInfo & POPT_ARGFLAG_LOGICALOPS);
- int negate = (opt->argInfo & POPT_ARGFLAG_NOT);
-
- /* Don't bother displaying typical values */
- if (!ops && (aLong == 0L || aLong == 1L || aLong == -1L))
- break;
- *le++ = '[';
- switch (ops) {
- case POPT_ARGFLAG_OR:
- *le++ = '|';
- /*@innerbreak@*/ break;
- case POPT_ARGFLAG_AND:
- *le++ = '&';
- /*@innerbreak@*/ break;
- case POPT_ARGFLAG_XOR:
- *le++ = '^';
- /*@innerbreak@*/ break;
- default:
- /*@innerbreak@*/ break;
- }
- *le++ = '=';
- if (negate) *le++ = '~';
- /*@-formatconst@*/
- le += sprintf(le, (ops ? "0x%lx" : "%ld"), aLong);
- /*@=formatconst@*/
- *le++ = ']';
- }
-#endif
- break;
- case POPT_ARG_INT:
- case POPT_ARG_LONG:
- case POPT_ARG_FLOAT:
- case POPT_ARG_DOUBLE:
- case POPT_ARG_STRING:
- *le++ = '=';
- strcpy(le, argDescrip); le += strlen(le);
- break;
- default:
- break;
- }
- } else {
- *le++ = '=';
- strcpy(le, argDescrip); le += strlen(le);
- }
- if (opt->argInfo & POPT_ARGFLAG_OPTIONAL)
- *le++ = ']';
- *le = '\0';
- }
-/*@=boundswrite@*/
-
- if (help)
- fprintf(fp," %-*s ", maxLeftCol, left);
- else {
- fprintf(fp," %s\n", left);
- goto out;
- }
-
- left = (char *)_free(left);
- if (defs) {
- help = defs; defs = NULL;
- }
-
- helpLength = strlen(help);
-/*@-boundsread@*/
- while (helpLength > lineLength) {
- const char * ch;
- char format[16];
-
- ch = help + lineLength - 1;
- while (ch > help && !isspace(*ch)) ch--;
- if (ch == help) break; /* give up */
- while (ch > (help + 1) && isspace(*ch)) ch--;
- ch++;
-
- sprintf(format, "%%.%ds\n%%%ds", (int) (ch - help), indentLength);
- /*@-formatconst@*/
- fprintf(fp, format, help, " ");
- /*@=formatconst@*/
- help = ch;
- while (isspace(*help) && *help) help++;
- helpLength = strlen(help);
- }
-/*@=boundsread@*/
-
- if (helpLength) fprintf(fp, "%s\n", help);
-
-out:
- /*@-dependenttrans@*/
- defs = (char *)_free(defs);
- /*@=dependenttrans@*/
- left = (char *)_free(left);
-}
-
-/**
- * @param opt option(s)
- * @param translation_domain translation domain
- */
-static int maxArgWidth(const struct poptOption * opt,
- /*@null@*/ const char * translation_domain)
- /*@*/
-{
- int max = 0;
- int len = 0;
- const char * s;
-
- if (opt != NULL)
- while (opt->longName || opt->shortName || opt->arg) {
- if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
- if (opt->arg) /* XXX program error */
- len = maxArgWidth((const struct poptOption *)opt->arg, translation_domain);
- if (len > max) max = len;
- } else if (!(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN)) {
- len = sizeof(" ")-1;
- if (opt->shortName != '\0') len += sizeof("-X")-1;
- if (opt->shortName != '\0' && opt->longName) len += sizeof(", ")-1;
- if (opt->longName) {
- len += ((opt->argInfo & POPT_ARGFLAG_ONEDASH)
- ? sizeof("-")-1 : sizeof("--")-1);
- len += strlen(opt->longName);
- }
-
- s = getArgDescrip(opt, translation_domain);
- if (s)
- len += sizeof("=")-1 + strlen(s);
- if (opt->argInfo & POPT_ARGFLAG_OPTIONAL) len += sizeof("[]")-1;
- if (len > max) max = len;
- }
-
- opt++;
- }
-
- return max;
-}
-
-/**
- * Display popt alias and exec help.
- * @param fp output file handle
- * @param items alias/exec array
- * @param nitems no. of alias/exec entries
- * @param left
- * @param translation_domain translation domain
- */
-static void itemHelp(FILE * fp,
- /*@null@*/ poptItem items, int nitems, int left,
- /*@null@*/ const char * translation_domain)
- /*@globals fileSystem @*/
- /*@modifies *fp, fileSystem @*/
-{
- poptItem item;
- int i;
-
- if (items != NULL)
- for (i = 0, item = items; i < nitems; i++, item++) {
- const struct poptOption * opt;
- opt = &item->option;
- if ((opt->longName || opt->shortName) &&
- !(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN))
- singleOptionHelp(fp, left, opt, translation_domain);
- }
-}
-
-/**
- * Display help text for a table of options.
- * @param con context
- * @param fp output file handle
- * @param table option(s)
- * @param left
- * @param translation_domain translation domain
- */
-static void singleTableHelp(poptContext con, FILE * fp,
- /*@null@*/ const struct poptOption * table, int left,
- /*@null@*/ const char * translation_domain)
- /*@globals fileSystem @*/
- /*@modifies *fp, fileSystem @*/
-{
- const struct poptOption * opt;
- const char *sub_transdom;
-
- if (table == poptAliasOptions) {
- itemHelp(fp, con->aliases, con->numAliases, left, NULL);
- itemHelp(fp, con->execs, con->numExecs, left, NULL);
- return;
- }
-
- if (table != NULL)
- for (opt = table; (opt->longName || opt->shortName || opt->arg); opt++) {
- if ((opt->longName || opt->shortName) &&
- !(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN))
- singleOptionHelp(fp, left, opt, translation_domain);
- }
-
- if (table != NULL)
- for (opt = table; (opt->longName || opt->shortName || opt->arg); opt++) {
- if ((opt->argInfo & POPT_ARG_MASK) != POPT_ARG_INCLUDE_TABLE)
- continue;
- sub_transdom = getTableTranslationDomain(
- (const struct poptOption *)opt->arg);
- if (sub_transdom == NULL)
- sub_transdom = translation_domain;
-
- if (opt->descrip)
- fprintf(fp, "\n%s\n", D_(sub_transdom, opt->descrip));
-
- singleTableHelp(con, fp, (const struct poptOption *)opt->arg, left, sub_transdom);
- }
-}
-
-/**
- * @param con context
- * @param fp output file handle
- */
-static int showHelpIntro(poptContext con, FILE * fp)
- /*@globals fileSystem @*/
- /*@modifies *fp, fileSystem @*/
-{
- int len = 6;
- const char * fn;
-
- fprintf(fp, POPT_("Usage:"));
- if (!(con->flags & POPT_CONTEXT_KEEP_FIRST)) {
-/*@-boundsread@*/
- /*@-nullderef@*/ /* LCL: wazzup? */
- fn = con->optionStack->argv[0];
- /*@=nullderef@*/
-/*@=boundsread@*/
- if (fn == NULL) return len;
- if (strchr(fn, '/')) fn = strrchr(fn, '/') + 1;
- fprintf(fp, " %s", fn);
- len += strlen(fn) + 1;
- }
-
- return len;
-}
-
-void poptPrintHelp(poptContext con, FILE * fp, /*@unused@*/ int flags)
-{
- int leftColWidth;
-
- (void) showHelpIntro(con, fp);
- if (con->otherHelp)
- fprintf(fp, " %s\n", con->otherHelp);
- else
- fprintf(fp, " %s\n", POPT_("[OPTION...]"));
-
- leftColWidth = maxArgWidth(con->options, NULL);
- singleTableHelp(con, fp, con->options, leftColWidth, NULL);
-}
-
-/**
- * @param fp output file handle
- * @param cursor
- * @param opt option(s)
- * @param translation_domain translation domain
- */
-static int singleOptionUsage(FILE * fp, int cursor,
- const struct poptOption * opt,
- /*@null@*/ const char *translation_domain)
- /*@globals fileSystem @*/
- /*@modifies *fp, fileSystem @*/
-{
- int len = 4;
- char shortStr[2] = { '\0', '\0' };
- const char * item = shortStr;
- const char * argDescrip = getArgDescrip(opt, translation_domain);
-
- if (opt->shortName != '\0' && opt->longName != NULL) {
- len += 2;
- if (!(opt->argInfo & POPT_ARGFLAG_ONEDASH)) len++;
- len += strlen(opt->longName);
- } else if (opt->shortName != '\0') {
- len++;
- shortStr[0] = opt->shortName;
- shortStr[1] = '\0';
- } else if (opt->longName) {
- len += strlen(opt->longName);
- if (!(opt->argInfo & POPT_ARGFLAG_ONEDASH)) len++;
- item = opt->longName;
- }
-
- if (len == 4) return cursor;
-
- if (argDescrip)
- len += strlen(argDescrip) + 1;
-
- if ((cursor + len) > 79) {
- fprintf(fp, "\n ");
- cursor = 7;
- }
-
- if (opt->longName && opt->shortName) {
- fprintf(fp, " [-%c|-%s%s%s%s]",
- opt->shortName, ((opt->argInfo & POPT_ARGFLAG_ONEDASH) ? "" : "-"),
- opt->longName,
- (argDescrip ? " " : ""),
- (argDescrip ? argDescrip : ""));
- } else {
- fprintf(fp, " [-%s%s%s%s]",
- ((opt->shortName || (opt->argInfo & POPT_ARGFLAG_ONEDASH)) ? "" : "-"),
- item,
- (argDescrip ? (opt->shortName != '\0' ? " " : "=") : ""),
- (argDescrip ? argDescrip : ""));
- }
-
- return cursor + len + 1;
-}
-
-/**
- * Display popt alias and exec usage.
- * @param fp output file handle
- * @param cursor
- * @param item alias/exec array
- * @param nitems no. of ara/exec entries
- * @param translation_domain translation domain
- */
-static int itemUsage(FILE * fp, int cursor, poptItem item, int nitems,
- /*@null@*/ const char * translation_domain)
- /*@globals fileSystem @*/
- /*@modifies *fp, fileSystem @*/
-{
- int i;
-
- /*@-branchstate@*/ /* FIX: W2DO? */
- if (item != NULL)
- for (i = 0; i < nitems; i++, item++) {
- const struct poptOption * opt;
- opt = &item->option;
- if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INTL_DOMAIN) {
- translation_domain = (const char *)opt->arg;
- } else if ((opt->longName || opt->shortName) &&
- !(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN)) {
- cursor = singleOptionUsage(fp, cursor, opt, translation_domain);
- }
- }
- /*@=branchstate@*/
-
- return cursor;
-}
-
-/**
- * Keep track of option tables already processed.
- */
-typedef struct poptDone_s {
- int nopts;
- int maxopts;
- const void ** opts;
-} * poptDone;
-
-/**
- * Display usage text for a table of options.
- * @param con context
- * @param fp output file handle
- * @param cursor
- * @param opt option(s)
- * @param translation_domain translation domain
- * @param done tables already processed
- * @return
- */
-static int singleTableUsage(poptContext con, FILE * fp, int cursor,
- /*@null@*/ const struct poptOption * opt,
- /*@null@*/ const char * translation_domain,
- /*@null@*/ poptDone done)
- /*@globals fileSystem @*/
- /*@modifies *fp, done, fileSystem @*/
-{
- /*@-branchstate@*/ /* FIX: W2DO? */
- if (opt != NULL)
- for (; (opt->longName || opt->shortName || opt->arg) ; opt++) {
- if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INTL_DOMAIN) {
- translation_domain = (const char *)opt->arg;
- } else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE) {
- if (done) {
- int i = 0;
- for (i = 0; i < done->nopts; i++) {
-/*@-boundsread@*/
- const void * that = done->opts[i];
-/*@=boundsread@*/
- if (that == NULL || that != opt->arg)
- /*@innercontinue@*/ continue;
- /*@innerbreak@*/ break;
- }
- /* Skip if this table has already been processed. */
- if (opt->arg == NULL || i < done->nopts)
- continue;
-/*@-boundswrite@*/
- if (done->nopts < done->maxopts)
- done->opts[done->nopts++] = (const void *) opt->arg;
-/*@=boundswrite@*/
- }
- cursor = singleTableUsage(con, fp, cursor, (const struct poptOption *)opt->arg,
- translation_domain, done);
- } else if ((opt->longName || opt->shortName) &&
- !(opt->argInfo & POPT_ARGFLAG_DOC_HIDDEN)) {
- cursor = singleOptionUsage(fp, cursor, opt, translation_domain);
- }
- }
- /*@=branchstate@*/
-
- return cursor;
-}
-
-/**
- * Return concatenated short options for display.
- * @todo Sub-tables should be recursed.
- * @param opt option(s)
- * @param fp output file handle
- * @retval str concatenation of short options
- * @return length of display string
- */
-static int showShortOptions(const struct poptOption * opt, FILE * fp,
- /*@null@*/ char * str)
- /*@globals fileSystem @*/
- /*@modifies *str, *fp, fileSystem @*/
- /*@requires maxRead(str) >= 0 @*/
-{
- /* bufsize larger then the ascii set, lazy alloca on top level call. */
- char * s = (str != NULL ? str : (char *)memset(alloca(300), 0, 300));
- int len = 0;
-
-/*@-boundswrite@*/
- if (opt != NULL)
- for (; (opt->longName || opt->shortName || opt->arg); opt++) {
- if (opt->shortName && !(opt->argInfo & POPT_ARG_MASK))
- s[strlen(s)] = opt->shortName;
- else if ((opt->argInfo & POPT_ARG_MASK) == POPT_ARG_INCLUDE_TABLE)
- if (opt->arg) /* XXX program error */
- len = showShortOptions(
- (const struct poptOption *)opt->arg, fp, s);
- }
-/*@=boundswrite@*/
-
- /* On return to top level, print the short options, return print length. */
- if (s == str && *s != '\0') {
- fprintf(fp, " [-%s]", s);
- len = strlen(s) + sizeof(" [-]")-1;
- }
- return len;
-}
-
-void poptPrintUsage(poptContext con, FILE * fp, /*@unused@*/ int flags)
-{
- poptDone done = (poptDone)memset(alloca(sizeof(*done)), 0, sizeof(*done));
- int cursor;
-
- done->nopts = 0;
- done->maxopts = 64;
- cursor = done->maxopts * sizeof(*done->opts);
-/*@-boundswrite@*/
- done->opts = (const void **)memset(alloca(cursor), 0, cursor);
- done->opts[done->nopts++] = (const void *) con->options;
-/*@=boundswrite@*/
-
- cursor = showHelpIntro(con, fp);
- cursor += showShortOptions(con->options, fp, NULL);
- cursor = singleTableUsage(con, fp, cursor, con->options, NULL, done);
- cursor = itemUsage(fp, cursor, con->aliases, con->numAliases, NULL);
- cursor = itemUsage(fp, cursor, con->execs, con->numExecs, NULL);
-
- if (con->otherHelp) {
- cursor += strlen(con->otherHelp) + 1;
- if (cursor > 79) fprintf(fp, "\n ");
- fprintf(fp, " %s", con->otherHelp);
- }
-
- fprintf(fp, "\n");
-}
-
-void poptSetOtherOptionHelp(poptContext con, const char * text)
-{
- con->otherHelp = (const char *)_free(con->otherHelp);
- con->otherHelp = xstrdup(text);
-}
-/*@=type@*/
diff --git a/source3/popt/poptint.h b/source3/popt/poptint.h
deleted file mode 100644
index 5d308efe96..0000000000
--- a/source3/popt/poptint.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/** \ingroup popt
- * \file popt/poptint.h
- */
-
-/* (C) 1998-2000 Red Hat, Inc. -- Licensing details are in the COPYING
- file accompanying popt source distributions, available from
- ftp://ftp.rpm.org/pub/rpm/dist. */
-
-#ifndef H_POPTINT
-#define H_POPTINT
-
-/**
- * Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
- * @param p memory to free
- * @retval NULL always
- */
-/*@unused@*/ static inline /*@null@*/ void *
-_free(/*@only@*/ /*@null@*/ const void * p)
- /*@modifies p @*/
-{
- if (p != NULL) free((void *)p);
- return NULL;
-}
-
-/* Bit mask macros. */
-/*@-exporttype -redef @*/
-typedef unsigned int __pbm_bits;
-/*@=exporttype =redef @*/
-#define __PBM_NBITS (8 * sizeof (__pbm_bits))
-#define __PBM_IX(d) ((d) / __PBM_NBITS)
-#define __PBM_MASK(d) ((__pbm_bits) 1 << (((unsigned)(d)) % __PBM_NBITS))
-/*@-exporttype -redef @*/
-typedef struct {
- __pbm_bits bits[1];
-} pbm_set;
-/*@=exporttype =redef @*/
-#define __PBM_BITS(set) ((set)->bits)
-
-#define PBM_ALLOC(d) calloc(__PBM_IX (d) + 1, sizeof(__pbm_bits))
-#define PBM_FREE(s) _free(s);
-#define PBM_SET(d, s) (__PBM_BITS (s)[__PBM_IX (d)] |= __PBM_MASK (d))
-#define PBM_CLR(d, s) (__PBM_BITS (s)[__PBM_IX (d)] &= ~__PBM_MASK (d))
-#define PBM_ISSET(d, s) ((__PBM_BITS (s)[__PBM_IX (d)] & __PBM_MASK (d)) != 0)
-
-struct optionStackEntry {
- int argc;
-/*@only@*/ /*@null@*/
- const char ** argv;
-/*@only@*/ /*@null@*/
- pbm_set * argb;
- int next;
-/*@only@*/ /*@null@*/
- const char * nextArg;
-/*@observer@*/ /*@null@*/
- const char * nextCharArg;
-/*@dependent@*/ /*@null@*/
- poptItem currAlias;
- int stuffed;
-};
-
-struct poptContext_s {
- struct optionStackEntry optionStack[POPT_OPTION_DEPTH];
-/*@dependent@*/
- struct optionStackEntry * os;
-/*@owned@*/ /*@null@*/
- const char ** leftovers;
- int numLeftovers;
- int nextLeftover;
-/*@keep@*/
- const struct poptOption * options;
- int restLeftover;
-/*@only@*/ /*@null@*/
- const char * appName;
-/*@only@*/ /*@null@*/
- poptItem aliases;
- int numAliases;
- int flags;
-/*@owned@*/ /*@null@*/
- poptItem execs;
- int numExecs;
-/*@only@*/ /*@null@*/
- const char ** finalArgv;
- int finalArgvCount;
- int finalArgvAlloced;
-/*@dependent@*/ /*@null@*/
- poptItem doExec;
-/*@only@*/
- const char * execPath;
- int execAbsolute;
-/*@only@*/
- const char * otherHelp;
-/*@null@*/
- pbm_set * arg_strip;
-};
-
-#ifdef HAVE_LIBINTL_H
-#include <libintl.h>
-#endif
-
-#if defined(HAVE_GETTEXT) && !defined(__LCLINT__)
-#define _(foo) gettext(foo)
-#else
-#define _(foo) foo
-#endif
-
-#if defined(HAVE_DCGETTEXT) && !defined(__LCLINT__)
-#define D_(dom, str) dgettext(dom, str)
-#define POPT_(foo) D_("popt", foo)
-#else
-#define D_(dom, str) str
-#define POPT_(foo) foo
-#endif
-
-#define N_(foo) foo
-
-#endif
diff --git a/source3/popt/poptparse.c b/source3/popt/poptparse.c
deleted file mode 100644
index b03deef085..0000000000
--- a/source3/popt/poptparse.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/** \ingroup popt
- * \file popt/poptparse.c
- */
-
-/* (C) 1998-2002 Red Hat, Inc. -- Licensing details are in the COPYING
- file accompanying popt source distributions, available from
- ftp://ftp.rpm.org/pub/rpm/dist. */
-
-#include "system.h"
-
-#define POPT_ARGV_ARRAY_GROW_DELTA 5
-
-/*@-boundswrite@*/
-int poptDupArgv(int argc, const char **argv,
- int * argcPtr, const char *** argvPtr)
-{
- size_t nb = (argc + 1) * sizeof(*argv);
- const char ** argv2;
- char * dst;
- int i;
-
- if (argc <= 0 || argv == NULL) /* XXX can't happen */
- return POPT_ERROR_NOARG;
- for (i = 0; i < argc; i++) {
- if (argv[i] == NULL)
- return POPT_ERROR_NOARG;
- nb += strlen(argv[i]) + 1;
- }
-
- dst = (char *)malloc(nb);
- if (dst == NULL) /* XXX can't happen */
- return POPT_ERROR_MALLOC;
- argv2 = (const char **) dst;
- dst += (argc + 1) * sizeof(*argv);
-
- /*@-branchstate@*/
- for (i = 0; i < argc; i++) {
- argv2[i] = dst;
- dst += strlen(strcpy(dst, argv[i])) + 1;
- }
- /*@=branchstate@*/
- argv2[argc] = NULL;
-
- if (argvPtr) {
- *argvPtr = argv2;
- } else {
- free(argv2);
- argv2 = NULL;
- }
- if (argcPtr)
- *argcPtr = argc;
- return 0;
-}
-/*@=boundswrite@*/
-
-/*@-bounds@*/
-int poptParseArgvString(const char * s, int * argcPtr, const char *** argvPtr)
-{
- const char * src;
- char quote = '\0';
- int argvAlloced = POPT_ARGV_ARRAY_GROW_DELTA;
- const char ** argv = (const char **)malloc(sizeof(*argv) * argvAlloced);
- int argc = 0;
- int buflen = strlen(s) + 1;
- char * buf = (char*)memset(alloca(buflen), 0, buflen);
- int rc = POPT_ERROR_MALLOC;
-
- if (argv == NULL) return rc;
- argv[argc] = buf;
-
- for (src = s; *src != '\0'; src++) {
- if (quote == *src) {
- quote = '\0';
- } else if (quote != '\0') {
- if (*src == '\\') {
- src++;
- if (!*src) {
- rc = POPT_ERROR_BADQUOTE;
- goto exit;
- }
- if (*src != quote) *buf++ = '\\';
- }
- *buf++ = *src;
- } else if (isspace(*src)) {
- if (*argv[argc] != '\0') {
- buf++, argc++;
- if (argc == argvAlloced) {
- argvAlloced += POPT_ARGV_ARRAY_GROW_DELTA;
- argv = (const char **)realloc(argv, sizeof(*argv) * argvAlloced);
- if (argv == NULL) goto exit;
- }
- argv[argc] = buf;
- }
- } else switch (*src) {
- case '"':
- case '\'':
- quote = *src;
- /*@switchbreak@*/ break;
- case '\\':
- src++;
- if (!*src) {
- rc = POPT_ERROR_BADQUOTE;
- goto exit;
- }
- /*@fallthrough@*/
- default:
- *buf++ = *src;
- /*@switchbreak@*/ break;
- }
- }
-
- if (strlen(argv[argc])) {
- argc++, buf++;
- }
-
- rc = poptDupArgv(argc, argv, argcPtr, argvPtr);
-
-exit:
- if (argv) free(argv);
- return rc;
-}
-/*@=bounds@*/
-
-/* still in the dev stage.
- * return values, perhaps 1== file erro
- * 2== line to long
- * 3== umm.... more?
- */
-int poptConfigFileToString(FILE *fp, char ** argstrp, /*@unused@*/ int flags)
-{
- char line[999];
- char * argstr;
- char * p;
- char * q;
- char * x;
- int t;
- int argvlen = 0;
- size_t maxlinelen = sizeof(line);
- size_t linelen;
- int maxargvlen = 480;
- int linenum = 0;
-
- *argstrp = NULL;
-
- /* | this_is = our_line
- * p q x
- */
-
- if (fp == NULL)
- return POPT_ERROR_NULLARG;
-
- argstr = (char *)calloc(maxargvlen, sizeof(*argstr));
- if (argstr == NULL) return POPT_ERROR_MALLOC;
-
- while (fgets(line, (int)maxlinelen, fp) != NULL) {
- linenum++;
- p = line;
-
- /* loop until first non-space char or EOL */
- while( *p != '\0' && isspace(*p) )
- p++;
-
- linelen = strlen(p);
- if (linelen >= maxlinelen-1)
- return POPT_ERROR_OVERFLOW; /* XXX line too long */
-
- if (*p == '\0' || *p == '\n') continue; /* line is empty */
- if (*p == '#') continue; /* comment line */
-
- q = p;
-
- while (*q != '\0' && (!isspace(*q)) && *q != '=')
- q++;
-
- if (isspace(*q)) {
- /* a space after the name, find next non space */
- *q++='\0';
- while( *q != '\0' && isspace((int)*q) ) q++;
- }
- if (*q == '\0') {
- /* single command line option (ie, no name=val, just name) */
- q[-1] = '\0'; /* kill off newline from fgets() call */
- argvlen += (t = q - p) + (sizeof(" --")-1);
- if (argvlen >= maxargvlen) {
- maxargvlen = (t > maxargvlen) ? t*2 : maxargvlen*2;
- argstr = (char *)realloc(argstr, maxargvlen);
- if (argstr == NULL) return POPT_ERROR_MALLOC;
- }
- strcat(argstr, " --");
- strcat(argstr, p);
- continue;
- }
- if (*q != '=')
- continue; /* XXX for now, silently ignore bogus line */
-
- /* *q is an equal sign. */
- *q++ = '\0';
-
- /* find next non-space letter of value */
- while (*q != '\0' && isspace(*q))
- q++;
- if (*q == '\0')
- continue; /* XXX silently ignore missing value */
-
- /* now, loop and strip all ending whitespace */
- x = p + linelen;
- while (isspace(*--x))
- *x = 0; /* null out last char if space (including fgets() NL) */
-
- /* rest of line accept */
- t = x - p;
- argvlen += t + (sizeof("' --='")-1);
- if (argvlen >= maxargvlen) {
- maxargvlen = (t > maxargvlen) ? t*2 : maxargvlen*2;
- argstr = (char *)realloc(argstr, maxargvlen);
- if (argstr == NULL) return POPT_ERROR_MALLOC;
- }
- strcat(argstr, " --");
- strcat(argstr, p);
- strcat(argstr, "=\"");
- strcat(argstr, q);
- strcat(argstr, "\"");
- }
-
- *argstrp = argstr;
- return 0;
-}
diff --git a/source3/popt/system.h b/source3/popt/system.h
deleted file mode 100644
index 1d1b9dae88..0000000000
--- a/source3/popt/system.h
+++ /dev/null
@@ -1,76 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#if defined (__GLIBC__) && defined(__LCLINT__)
-/*@-declundef@*/
-/*@unchecked@*/
-extern __const __int32_t *__ctype_tolower;
-/*@unchecked@*/
-extern __const __int32_t *__ctype_toupper;
-/*@=declundef@*/
-#endif
-
-#include <ctype.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-
-#if HAVE_MCHECK_H
-#include <mcheck.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef __NeXT
-/* access macros are not declared in non posix mode in unistd.h -
- don't try to use posix on NeXTstep 3.3 ! */
-#include <libc.h>
-#endif
-
-#if defined(__LCLINT__)
-/*@-declundef -incondefs -redecl@*/ /* LCL: missing annotation */
-/*@only@*/ void * alloca (size_t __size)
- /*@ensures MaxSet(result) == (__size - 1) @*/
- /*@*/;
-/*@=declundef =incondefs =redecl@*/
-#endif
-
-/* AIX requires this to be the first thing in the file. */
-#ifndef __GNUC__
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
-#pragma alloca
-# else
-# ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-# endif
-# endif
-# endif
-#elif defined(__GNUC__) && defined(__STRICT_ANSI__)
-#define alloca __builtin_alloca
-#endif
-
-/*@-redecl -redef@*/
-/*@mayexit@*/ /*@only@*/ char * xstrdup (const char *str)
- /*@*/;
-/*@=redecl =redef@*/
-
-#if HAVE_MCHECK_H && defined(__GNUC__)
-#define vmefail() (fprintf(stderr, "virtual memory exhausted.\n"), exit(EXIT_FAILURE), NULL)
-#define xstrdup(_str) (strcpy((malloc(strlen(_str)+1) ? : vmefail()), (_str)))
-#else
-#define xstrdup(_str) strdup(_str)
-#endif /* HAVE_MCHECK_H && defined(__GNUC__) */
-
-
-#include "popt.h"
diff --git a/source3/printing/load.c b/source3/printing/load.c
index 23144d5a95..fc21f271bd 100644
--- a/source3/printing/load.c
+++ b/source3/printing/load.c
@@ -60,5 +60,5 @@ void load_printers(void)
/* load all printcap printers */
if (lp_load_printers() && lp_servicenumber(PRINTERS_NAME) >= 0)
- pcap_printer_fn(lp_add_one_printer);
+ pcap_printer_fn(lp_add_one_printer, NULL);
}
diff --git a/source3/printing/notify.c b/source3/printing/notify.c
index 23df17c389..f6599c413d 100644
--- a/source3/printing/notify.c
+++ b/source3/printing/notify.c
@@ -34,6 +34,7 @@ static struct notify_queue {
size_t buflen;
} *notify_queue_head = NULL;
+static struct timed_event *notify_event;
static bool create_send_ctx(void)
{
@@ -214,6 +215,22 @@ void print_notify_send_messages(struct messaging_context *msg_ctx,
num_messages = 0;
}
+/*******************************************************************
+ Event handler to send the messages.
+*******************************************************************/
+
+static void print_notify_event_send_messages(struct event_context *event_ctx,
+ struct timed_event *te,
+ const struct timeval *now,
+ void *private_data)
+{
+ /* Remove this timed event handler. */
+ TALLOC_FREE(notify_event);
+
+ change_to_root_user();
+ print_notify_send_messages(smbd_messaging_context(), 0);
+}
+
/**********************************************************************
deep copy a SPOOLSS_NOTIFY_MSG structure using a TALLOC_CTX
*********************************************************************/
@@ -304,6 +321,15 @@ to notify_queue_head\n", msg->type, msg->field, msg->printer));
DLIST_ADD_END(notify_queue_head, pnqueue, struct notify_queue *);
num_messages++;
+
+ if (smbd_event_context()) {
+ /* Add an event for 1 second's time to send this queue. */
+ notify_event = event_add_timed(smbd_event_context(), NULL,
+ timeval_current_ofs(1,0),
+ "print_notify",
+ print_notify_event_send_messages, NULL);
+ }
+
}
static void send_notify_field_values(const char *sharename, uint32 type,
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index ded985c260..1826fa88ed 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -280,7 +280,7 @@ static bool upgrade_to_version_3(void)
DEBUG(0,("upgrade_to_version_3: upgrading print tdb's to version 3\n"));
for (kbuf = tdb_firstkey(tdb_drivers); kbuf.dptr;
- newkey = tdb_nextkey(tdb_drivers, kbuf), safe_free(kbuf.dptr), kbuf=newkey) {
+ newkey = tdb_nextkey(tdb_drivers, kbuf), free(kbuf.dptr), kbuf=newkey) {
dbuf = tdb_fetch(tdb_drivers, kbuf);
@@ -807,7 +807,7 @@ int get_ntforms(nt_forms_struct **list)
for (kbuf = tdb_firstkey(tdb_forms);
kbuf.dptr;
- newkey = tdb_nextkey(tdb_forms, kbuf), safe_free(kbuf.dptr), kbuf=newkey)
+ newkey = tdb_nextkey(tdb_forms, kbuf), free(kbuf.dptr), kbuf=newkey)
{
if (strncmp((const char *)kbuf.dptr, FORMS_PREFIX, strlen(FORMS_PREFIX)) != 0)
continue;
@@ -1024,7 +1024,7 @@ int get_ntdrivers(fstring **list, const char *architecture, uint32 version)
for (kbuf = tdb_firstkey(tdb_drivers);
kbuf.dptr;
- newkey = tdb_nextkey(tdb_drivers, kbuf), safe_free(kbuf.dptr), kbuf=newkey) {
+ newkey = tdb_nextkey(tdb_drivers, kbuf), free(kbuf.dptr), kbuf=newkey) {
if (strncmp((const char *)kbuf.dptr, key, strlen(key)) != 0)
continue;
@@ -1376,7 +1376,8 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
DEBUGADD(6,("file_version_is_newer: mod time = %ld sec\n", old_create_time));
}
}
- close_file(fsp, NORMAL_CLOSE);
+ close_file(NULL, fsp, NORMAL_CLOSE);
+ fsp = NULL;
/* Get file version info (if available) for new file */
filepath = driver_unix_convert(conn,new_file,&stat_buf);
@@ -1416,7 +1417,8 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
DEBUGADD(6,("file_version_is_newer: mod time = %ld sec\n", new_create_time));
}
}
- close_file(fsp, NORMAL_CLOSE);
+ close_file(NULL, fsp, NORMAL_CLOSE);
+ fsp = NULL;
if (use_version && (new_major != old_major || new_minor != old_minor)) {
/* Compare versions and choose the larger version number */
@@ -1445,7 +1447,7 @@ static int file_version_is_newer(connection_struct *conn, fstring new_file, fstr
error_exit:
if(fsp)
- close_file(fsp, NORMAL_CLOSE);
+ close_file(NULL, fsp, NORMAL_CLOSE);
return -1;
}
@@ -1581,7 +1583,7 @@ static uint32 get_correct_cversion(const char *architecture, fstring driverpath_
DEBUG(10,("get_correct_cversion: Driver file [%s] cversion = %d\n",
driverpath, cversion));
- close_file(fsp, NORMAL_CLOSE);
+ close_file(NULL, fsp, NORMAL_CLOSE);
close_cnum(conn, user->vuid);
unbecome_user();
*perr = WERR_OK;
@@ -1591,7 +1593,7 @@ static uint32 get_correct_cversion(const char *architecture, fstring driverpath_
error_exit:
if(fsp)
- close_file(fsp, NORMAL_CLOSE);
+ close_file(NULL, fsp, NORMAL_CLOSE);
close_cnum(conn, user->vuid);
unbecome_user();
@@ -3121,8 +3123,7 @@ static void map_single_multi_sz_into_ctr(REGVAL_CTR *ctr, const char *val_name,
regval_ctr_delvalue(ctr, val_name);
regval_ctr_addvalue(ctr, val_name, REG_MULTI_SZ,
(char *) conv_strs, str_size);
- safe_free(conv_strs);
-
+ SAFE_FREE(conv_strs);
}
/****************************************************************************
@@ -3219,7 +3220,7 @@ static void store_printer_guid(NT_PRINTER_INFO_LEVEL_2 *info2,
ZERO_STRUCT( unistr_guid );
- init_unistr2( &unistr_guid, smb_uuid_string(talloc_tos(), guid),
+ init_unistr2( &unistr_guid, GUID_string(talloc_tos(), &guid),
UNI_STR_TERMINATE );
regval_ctr_addvalue(ctr, "objectGUID", REG_SZ,
@@ -3534,7 +3535,7 @@ bool is_printer_published(Printer_entry *print_hnd, int snum,
case REG_SZ:
rpcstr_pull( guid_str, regval_data_p(guid_val),
sizeof(guid_str)-1, -1, STR_TERMINATE );
- ret = smb_string_to_uuid( guid_str, guid );
+ ret = NT_STATUS_IS_OK(GUID_from_string( guid_str, guid ));
break;
case REG_BINARY:
if ( regval_size(guid_val) != sizeof(struct GUID) ) {
@@ -3839,7 +3840,7 @@ static int unpack_values(NT_PRINTER_DATA *printer_data, const uint8 *buf, int bu
memcpy( &guid, data_p, sizeof(struct GUID) );
init_unistr2( &unistr_guid,
- smb_uuid_string(talloc_tos(), guid),
+ GUID_string(talloc_tos(), &guid),
UNI_STR_TERMINATE );
regval_ctr_addvalue( printer_data->keys[key_index].values,
@@ -3923,10 +3924,10 @@ static void map_to_os2_driver(fstring drivername)
return;
}
- lines = file_lines_load(mapfile, &numlines,0);
+ lines = file_lines_load(mapfile, &numlines,0,NULL);
if (numlines == 0 || lines == NULL) {
DEBUG(0,("No entries in OS/2 driver map %s\n",mapfile));
- SAFE_FREE(lines);
+ TALLOC_FREE(lines);
return;
}
@@ -3970,12 +3971,12 @@ static void map_to_os2_driver(fstring drivername)
DEBUG(3,("Mapped windows driver %s to os2 driver%s\n",drivername,os2_name));
set_last_from_to(drivername,os2_name);
fstrcpy(drivername,os2_name);
- file_lines_free(lines);
+ TALLOC_FREE(lines);
return;
}
}
- file_lines_free(lines);
+ TALLOC_FREE(lines);
}
/****************************************************************************
@@ -5491,7 +5492,7 @@ static SEC_DESC_BUF *construct_default_printer_sdb(TALLOC_CTX *ctx)
{
SEC_ACE ace[5]; /* max number of ace entries */
int i = 0;
- SEC_ACCESS sa;
+ uint32_t sa;
SEC_ACL *psa = NULL;
SEC_DESC_BUF *sdb = NULL;
SEC_DESC *psd = NULL;
@@ -5500,7 +5501,7 @@ static SEC_DESC_BUF *construct_default_printer_sdb(TALLOC_CTX *ctx)
/* Create an ACE where Everyone is allowed to print */
- init_sec_access(&sa, PRINTER_ACE_PRINT);
+ sa = PRINTER_ACE_PRINT;
init_sec_ace(&ace[i++], &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED,
sa, SEC_ACE_FLAG_CONTAINER_INHERIT);
@@ -5512,7 +5513,7 @@ static SEC_DESC_BUF *construct_default_printer_sdb(TALLOC_CTX *ctx)
sid_copy(&domadmins_sid, get_global_sam_sid());
sid_append_rid(&domadmins_sid, DOMAIN_GROUP_RID_ADMINS);
- init_sec_access(&sa, PRINTER_ACE_FULL_CONTROL);
+ sa = PRINTER_ACE_FULL_CONTROL;
init_sec_ace(&ace[i++], &domadmins_sid,
SEC_ACE_TYPE_ACCESS_ALLOWED, sa,
SEC_ACE_FLAG_OBJECT_INHERIT | SEC_ACE_FLAG_INHERIT_ONLY);
@@ -5522,7 +5523,7 @@ static SEC_DESC_BUF *construct_default_printer_sdb(TALLOC_CTX *ctx)
else if (secrets_fetch_domain_sid(lp_workgroup(), &adm_sid)) {
sid_append_rid(&adm_sid, DOMAIN_USER_RID_ADMIN);
- init_sec_access(&sa, PRINTER_ACE_FULL_CONTROL);
+ sa = PRINTER_ACE_FULL_CONTROL;
init_sec_ace(&ace[i++], &adm_sid,
SEC_ACE_TYPE_ACCESS_ALLOWED, sa,
SEC_ACE_FLAG_OBJECT_INHERIT | SEC_ACE_FLAG_INHERIT_ONLY);
@@ -5532,7 +5533,7 @@ static SEC_DESC_BUF *construct_default_printer_sdb(TALLOC_CTX *ctx)
/* add BUILTIN\Administrators as FULL CONTROL */
- init_sec_access(&sa, PRINTER_ACE_FULL_CONTROL);
+ sa = PRINTER_ACE_FULL_CONTROL;
init_sec_ace(&ace[i++], &global_sid_Builtin_Administrators,
SEC_ACE_TYPE_ACCESS_ALLOWED, sa,
SEC_ACE_FLAG_OBJECT_INHERIT | SEC_ACE_FLAG_INHERIT_ONLY);
diff --git a/source3/printing/pcap.c b/source3/printing/pcap.c
index 30cb254a29..a6bf52a0a4 100644
--- a/source3/printing/pcap.c
+++ b/source3/printing/pcap.c
@@ -63,41 +63,51 @@
#include "includes.h"
-typedef struct pcap_cache {
+struct pcap_cache {
char *name;
char *comment;
struct pcap_cache *next;
-} pcap_cache_t;
+};
-static pcap_cache_t *pcap_cache = NULL;
+/* The systemwide printcap cache. */
+static struct pcap_cache *pcap_cache = NULL;
-bool pcap_cache_add(const char *name, const char *comment)
+bool pcap_cache_add_specific(struct pcap_cache **ppcache, const char *name, const char *comment)
{
- pcap_cache_t *p;
+ struct pcap_cache *p;
- if (name == NULL || ((p = SMB_MALLOC_P(pcap_cache_t)) == NULL))
- return False;
+ if (name == NULL || ((p = SMB_MALLOC_P(struct pcap_cache)) == NULL))
+ return false;
p->name = SMB_STRDUP(name);
p->comment = (comment && *comment) ? SMB_STRDUP(comment) : NULL;
- p->next = pcap_cache;
- pcap_cache = p;
+ DEBUG(11,("pcap_cache_add_specific: Adding name %s info %s\n",
+ p->name, p->comment ? p->comment : ""));
+
+ p->next = *ppcache;
+ *ppcache = p;
- return True;
+ return true;
}
-static void pcap_cache_destroy(pcap_cache_t *cache)
+void pcap_cache_destroy_specific(struct pcap_cache **pp_cache)
{
- pcap_cache_t *p, *next;
+ struct pcap_cache *p, *next;
- for (p = cache; p != NULL; p = next) {
+ for (p = *pp_cache; p != NULL; p = next) {
next = p->next;
SAFE_FREE(p->name);
SAFE_FREE(p->comment);
SAFE_FREE(p);
}
+ *pp_cache = NULL;
+}
+
+bool pcap_cache_add(const char *name, const char *comment)
+{
+ return pcap_cache_add_specific(&pcap_cache, name, comment);
}
bool pcap_cache_loaded(void)
@@ -105,11 +115,21 @@ bool pcap_cache_loaded(void)
return (pcap_cache != NULL);
}
+void pcap_cache_replace(const struct pcap_cache *pcache)
+{
+ const struct pcap_cache *p;
+
+ pcap_cache_destroy_specific(&pcap_cache);
+ for (p = pcache; p; p = p->next) {
+ pcap_cache_add(p->name, p->comment);
+ }
+}
+
void pcap_cache_reload(void)
{
const char *pcap_name = lp_printcapname();
bool pcap_reloaded = False;
- pcap_cache_t *tmp_cache = NULL;
+ struct pcap_cache *tmp_cache = NULL;
XFILE *pcap_file;
char *pcap_line;
@@ -159,7 +179,7 @@ void pcap_cache_reload(void)
goto done;
}
- for (; (pcap_line = fgets_slash(NULL, 1024, pcap_file)) != NULL; safe_free(pcap_line)) {
+ for (; (pcap_line = fgets_slash(NULL, 1024, pcap_file)) != NULL; free(pcap_line)) {
char name[MAXPRINTERLEN+1];
char comment[62];
char *p, *q;
@@ -223,9 +243,9 @@ done:
DEBUG(3, ("reload status: %s\n", (pcap_reloaded) ? "ok" : "error"));
if (pcap_reloaded)
- pcap_cache_destroy(tmp_cache);
+ pcap_cache_destroy_specific(&tmp_cache);
else {
- pcap_cache_destroy(pcap_cache);
+ pcap_cache_destroy_specific(&pcap_cache);
pcap_cache = tmp_cache;
}
@@ -235,7 +255,7 @@ done:
bool pcap_printername_ok(const char *printername)
{
- pcap_cache_t *p;
+ struct pcap_cache *p;
for (p = pcap_cache; p != NULL; p = p->next)
if (strequal(p->name, printername))
@@ -245,19 +265,22 @@ bool pcap_printername_ok(const char *printername)
}
/***************************************************************************
-run a function on each printer name in the printcap file. The function is
-passed the primary name and the comment (if possible). Note the fn() takes
-strings in DOS codepage. This means the xxx_printer_fn() calls must be fixed
-to return DOS codepage. FIXME !! JRA.
-
-XXX: I'm not sure if this comment still applies.. Anyone? -Rob
+run a function on each printer name in the printcap file.
***************************************************************************/
-void pcap_printer_fn(void (*fn)(char *, char *))
+
+void pcap_printer_fn_specific(const struct pcap_cache *pc,
+ void (*fn)(const char *, const char *, void *),
+ void *pdata)
{
- pcap_cache_t *p;
+ const struct pcap_cache *p;
- for (p = pcap_cache; p != NULL; p = p->next)
- fn(p->name, p->comment);
+ for (p = pc; p != NULL; p = p->next)
+ fn(p->name, p->comment, pdata);
return;
}
+
+void pcap_printer_fn(void (*fn)(const char *, const char *, void *), void *pdata)
+{
+ pcap_printer_fn_specific(pcap_cache, fn, pdata);
+}
diff --git a/source3/printing/print_aix.c b/source3/printing/print_aix.c
index 57590cc39e..523be77f35 100644
--- a/source3/printing/print_aix.c
+++ b/source3/printing/print_aix.c
@@ -49,7 +49,7 @@ bool aix_cache_reload(void)
iEtat = 0;
/* scan qconfig file for searching <printername>: */
- for (;(line = fgets_slash(NULL, 1024, pfile)); safe_free(line)) {
+ for (;(line = fgets_slash(NULL, 1024, pfile)); free(line)) {
if (*line == '*' || *line == 0)
continue;
@@ -65,7 +65,7 @@ bool aix_cache_reload(void)
if (strcmp(p, "bsh") != 0) {
name = talloc_strdup(ctx, p);
if (!name) {
- safe_free(line);
+ SAFE_FREE(line);
x_fclose(pfile);
TALLOC_FREE(ctx);
return false;
@@ -85,7 +85,7 @@ bool aix_cache_reload(void)
/* probably a good printer ??? */
iEtat = 0;
if (!pcap_cache_add(name, NULL)) {
- safe_free(line);
+ SAFE_FREE(line);
x_fclose(pfile);
TALLOC_FREE(ctx);
return false;
@@ -100,7 +100,7 @@ bool aix_cache_reload(void)
/* it's a good virtual printer */
iEtat = 0;
if (!pcap_cache_add(name, NULL)) {
- safe_free(line);
+ SAFE_FREE(line);
x_fclose(pfile);
TALLOC_FREE(ctx);
return false;
diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c
index 593c5c7a1f..ca3415ca5a 100644
--- a/source3/printing/print_cups.c
+++ b/source3/printing/print_cups.c
@@ -2,21 +2,26 @@
* Support code for the Common UNIX Printing System ("CUPS")
*
* Copyright 1999-2003 by Michael R Sweet.
+ * Copyright 2008 Jeremy Allison.
*
* 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/>.
*/
+/*
+ * JRA. Converted to utf8 pull/push.
+ */
+
#include "includes.h"
#include "printing.h"
@@ -24,6 +29,17 @@
#include <cups/cups.h>
#include <cups/language.h>
+static SIG_ATOMIC_T gotalarm;
+
+/***************************************************************
+ Signal function to tell us we timed out.
+****************************************************************/
+
+static void gotalarm_sig(void)
+{
+ gotalarm = 1;
+}
+
extern userdom_struct current_user_info;
/*
@@ -40,16 +56,23 @@ cups_passwd_cb(const char *prompt) /* I - Prompt */
return (NULL);
}
-static http_t *cups_connect(void)
+static http_t *cups_connect(TALLOC_CTX *frame)
{
- http_t *http;
- char *server, *p;
+ http_t *http = NULL;
+ char *server = NULL, *p = NULL;
int port;
-
+ int timeout = lp_cups_connection_timeout();
+ size_t size;
+
if (lp_cups_server() != NULL && strlen(lp_cups_server()) > 0) {
- server = smb_xstrdup(lp_cups_server());
+ if (!push_utf8_talloc(frame, &server, lp_cups_server(), &size)) {
+ return NULL;
+ }
} else {
- server = smb_xstrdup(cupsServer());
+ server = talloc_strdup(frame,cupsServer());
+ }
+ if (!server) {
+ return NULL;
}
p = strchr(server, ':');
@@ -59,23 +82,70 @@ static http_t *cups_connect(void)
} else {
port = ippPort();
}
-
+
DEBUG(10, ("connecting to cups server %s:%d\n",
server, port));
- if ((http = httpConnect(server, port)) == NULL) {
- DEBUG(0,("Unable to connect to CUPS server %s:%d - %s\n",
+ gotalarm = 0;
+
+ if (timeout) {
+ CatchSignal(SIGALRM, SIGNAL_CAST gotalarm_sig);
+ alarm(timeout);
+ }
+
+ http = httpConnect(server, port);
+
+ CatchSignal(SIGALRM, SIGNAL_CAST SIG_IGN);
+ alarm(0);
+
+ if (http == NULL) {
+ DEBUG(0,("Unable to connect to CUPS server %s:%d - %s\n",
server, port, strerror(errno)));
- SAFE_FREE(server);
- return NULL;
}
- SAFE_FREE(server);
return http;
}
-bool cups_cache_reload(void)
+static void send_pcap_info(const char *name, const char *info, void *pd)
+{
+ int fd = *(int *)pd;
+ size_t namelen = name ? strlen(name)+1 : 0;
+ size_t infolen = info ? strlen(info)+1 : 0;
+
+ DEBUG(11,("send_pcap_info: writing namelen %u\n", (unsigned int)namelen));
+ if (sys_write(fd, &namelen, sizeof(namelen)) != sizeof(namelen)) {
+ DEBUG(10,("send_pcap_info: namelen write failed %s\n",
+ strerror(errno)));
+ return;
+ }
+ DEBUG(11,("send_pcap_info: writing infolen %u\n", (unsigned int)infolen));
+ if (sys_write(fd, &infolen, sizeof(infolen)) != sizeof(infolen)) {
+ DEBUG(10,("send_pcap_info: infolen write failed %s\n",
+ strerror(errno)));
+ return;
+ }
+ if (namelen) {
+ DEBUG(11,("send_pcap_info: writing name %s\n", name));
+ if (sys_write(fd, name, namelen) != namelen) {
+ DEBUG(10,("send_pcap_info: name write failed %s\n",
+ strerror(errno)));
+ return;
+ }
+ }
+ if (infolen) {
+ DEBUG(11,("send_pcap_info: writing info %s\n", info));
+ if (sys_write(fd, info, infolen) != infolen) {
+ DEBUG(10,("send_pcap_info: info write failed %s\n",
+ strerror(errno)));
+ return;
+ }
+ }
+}
+
+static bool cups_cache_reload_async(int fd)
{
+ TALLOC_CTX *frame = talloc_stackframe();
+ struct pcap_cache *tmp_pcap_cache = NULL;
http_t *http = NULL; /* HTTP connection to server */
ipp_t *request = NULL, /* IPP Request */
*response = NULL; /* IPP Response */
@@ -87,8 +157,9 @@ bool cups_cache_reload(void)
{
"printer-name",
"printer-info"
- };
+ };
bool ret = False;
+ size_t size;
DEBUG(5, ("reloading cups printcap cache\n"));
@@ -102,7 +173,7 @@ bool cups_cache_reload(void)
* Try to connect to the server...
*/
- if ((http = cups_connect()) == NULL) {
+ if ((http = cups_connect(frame)) == NULL) {
goto out;
}
@@ -123,7 +194,7 @@ bool cups_cache_reload(void)
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
- "attributes-charset", NULL, cupsLangEncoding(language));
+ "attributes-charset", NULL, "utf-8");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
@@ -163,12 +234,24 @@ bool cups_cache_reload(void)
while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER) {
if (strcmp(attr->name, "printer-name") == 0 &&
- attr->value_tag == IPP_TAG_NAME)
- name = attr->values[0].string.text;
+ attr->value_tag == IPP_TAG_NAME) {
+ if (!pull_utf8_talloc(frame,
+ &name,
+ attr->values[0].string.text,
+ &size)) {
+ goto out;
+ }
+ }
if (strcmp(attr->name, "printer-info") == 0 &&
- attr->value_tag == IPP_TAG_TEXT)
- info = attr->values[0].string.text;
+ attr->value_tag == IPP_TAG_TEXT) {
+ if (!pull_utf8_talloc(frame,
+ &info,
+ attr->values[0].string.text,
+ &size)) {
+ goto out;
+ }
+ }
attr = attr->next;
}
@@ -180,7 +263,7 @@ bool cups_cache_reload(void)
if (name == NULL)
break;
- if (!pcap_cache_add(name, info)) {
+ if (!pcap_cache_add_specific(&tmp_pcap_cache, name, info)) {
goto out;
}
}
@@ -203,7 +286,7 @@ bool cups_cache_reload(void)
request->request.op.request_id = 1;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
- "attributes-charset", NULL, cupsLangEncoding(language));
+ "attributes-charset", NULL, "utf-8");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
@@ -243,12 +326,24 @@ bool cups_cache_reload(void)
while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER) {
if (strcmp(attr->name, "printer-name") == 0 &&
- attr->value_tag == IPP_TAG_NAME)
- name = attr->values[0].string.text;
+ attr->value_tag == IPP_TAG_NAME) {
+ if (!pull_utf8_talloc(frame,
+ &name,
+ attr->values[0].string.text,
+ &size)) {
+ goto out;
+ }
+ }
if (strcmp(attr->name, "printer-info") == 0 &&
- attr->value_tag == IPP_TAG_TEXT)
- info = attr->values[0].string.text;
+ attr->value_tag == IPP_TAG_TEXT) {
+ if (!pull_utf8_talloc(frame,
+ &info,
+ attr->values[0].string.text,
+ &size)) {
+ goto out;
+ }
+ }
attr = attr->next;
}
@@ -260,7 +355,7 @@ bool cups_cache_reload(void)
if (name == NULL)
break;
- if (!pcap_cache_add(name, info)) {
+ if (!pcap_cache_add_specific(&tmp_pcap_cache, name, info)) {
goto out;
}
}
@@ -277,9 +372,229 @@ bool cups_cache_reload(void)
if (http)
httpClose(http);
+ /* Send all the entries up the pipe. */
+ if (tmp_pcap_cache) {
+ pcap_printer_fn_specific(tmp_pcap_cache,
+ send_pcap_info,
+ (void *)&fd);
+
+ pcap_cache_destroy_specific(&tmp_pcap_cache);
+ }
+ TALLOC_FREE(frame);
return ret;
}
+static struct pcap_cache *local_pcap_copy;
+struct fd_event *cache_fd_event;
+
+static bool cups_pcap_load_async(int *pfd)
+{
+ int fds[2];
+ pid_t pid;
+
+ *pfd = -1;
+
+ if (cache_fd_event) {
+ DEBUG(3,("cups_pcap_load_async: already waiting for "
+ "a refresh event\n" ));
+ return false;
+ }
+
+ DEBUG(5,("cups_pcap_load_async: asynchronously loading cups printers\n"));
+
+ if (pipe(fds) == -1) {
+ return false;
+ }
+
+ pid = sys_fork();
+ if (pid == (pid_t)-1) {
+ DEBUG(10,("cups_pcap_load_async: fork failed %s\n",
+ strerror(errno) ));
+ close(fds[0]);
+ close(fds[1]);
+ return false;
+ }
+
+ if (pid) {
+ DEBUG(10,("cups_pcap_load_async: child pid = %u\n",
+ (unsigned int)pid ));
+ /* Parent. */
+ close(fds[1]);
+ *pfd = fds[0];
+ return true;
+ }
+
+ /* Child. */
+ if (!reinit_after_fork(smbd_messaging_context(), true)) {
+ DEBUG(0,("cups_pcap_load_async: reinit_after_fork() failed\n"));
+ smb_panic("cups_pcap_load_async: reinit_after_fork() failed");
+ }
+
+ close(fds[0]);
+ cups_cache_reload_async(fds[1]);
+ close(fds[1]);
+ _exit(0);
+}
+
+static void cups_async_callback(struct event_context *event_ctx,
+ struct fd_event *event,
+ uint16 flags,
+ void *p)
+{
+ TALLOC_CTX *frame = talloc_stackframe();
+ int fd = *(int *)p;
+ struct pcap_cache *tmp_pcap_cache = NULL;
+
+ DEBUG(5,("cups_async_callback: callback received for printer data. "
+ "fd = %d\n", fd));
+
+ while (1) {
+ char *name = NULL, *info = NULL;
+ size_t namelen = 0, infolen = 0;
+ ssize_t ret = -1;
+
+ ret = sys_read(fd, &namelen, sizeof(namelen));
+ if (ret == 0) {
+ /* EOF */
+ break;
+ }
+ if (ret != sizeof(namelen)) {
+ DEBUG(10,("cups_async_callback: namelen read failed %d %s\n",
+ errno, strerror(errno)));
+ break;
+ }
+
+ DEBUG(11,("cups_async_callback: read namelen %u\n",
+ (unsigned int)namelen));
+
+ ret = sys_read(fd, &infolen, sizeof(infolen));
+ if (ret == 0) {
+ /* EOF */
+ break;
+ }
+ if (ret != sizeof(infolen)) {
+ DEBUG(10,("cups_async_callback: infolen read failed %s\n",
+ strerror(errno)));
+ break;
+ }
+
+ DEBUG(11,("cups_async_callback: read infolen %u\n",
+ (unsigned int)infolen));
+
+ if (namelen) {
+ name = TALLOC_ARRAY(frame, char, namelen);
+ if (!name) {
+ break;
+ }
+ ret = sys_read(fd, name, namelen);
+ if (ret == 0) {
+ /* EOF */
+ break;
+ }
+ if (ret != namelen) {
+ DEBUG(10,("cups_async_callback: name read failed %s\n",
+ strerror(errno)));
+ break;
+ }
+ DEBUG(11,("cups_async_callback: read name %s\n",
+ name));
+ } else {
+ name = NULL;
+ }
+ if (infolen) {
+ info = TALLOC_ARRAY(frame, char, infolen);
+ if (!info) {
+ break;
+ }
+ ret = sys_read(fd, info, infolen);
+ if (ret == 0) {
+ /* EOF */
+ break;
+ }
+ if (ret != infolen) {
+ DEBUG(10,("cups_async_callback: info read failed %s\n",
+ strerror(errno)));
+ break;
+ }
+ DEBUG(11,("cups_async_callback: read info %s\n",
+ info));
+ } else {
+ info = NULL;
+ }
+
+ /* Add to our local pcap cache. */
+ pcap_cache_add_specific(&tmp_pcap_cache, name, info);
+ TALLOC_FREE(name);
+ TALLOC_FREE(info);
+ }
+
+ TALLOC_FREE(frame);
+ if (tmp_pcap_cache) {
+ /* We got a namelist, replace our local cache. */
+ pcap_cache_destroy_specific(&local_pcap_copy);
+ local_pcap_copy = tmp_pcap_cache;
+
+ /* And the systemwide pcap cache. */
+ pcap_cache_replace(local_pcap_copy);
+ } else {
+ DEBUG(2,("cups_async_callback: failed to read a new "
+ "printer list\n"));
+ }
+ close(fd);
+ TALLOC_FREE(p);
+ TALLOC_FREE(cache_fd_event);
+}
+
+bool cups_cache_reload(void)
+{
+ int *p_pipe_fd = TALLOC_P(NULL, int);
+
+ if (!p_pipe_fd) {
+ return false;
+ }
+
+ *p_pipe_fd = -1;
+
+ /* Set up an async refresh. */
+ if (!cups_pcap_load_async(p_pipe_fd)) {
+ return false;
+ }
+ if (!local_pcap_copy) {
+ /* We have no local cache, wait directly for
+ * async refresh to complete.
+ */
+ DEBUG(10,("cups_cache_reload: sync read on fd %d\n",
+ *p_pipe_fd ));
+
+ cups_async_callback(smbd_event_context(),
+ NULL,
+ EVENT_FD_READ,
+ (void *)p_pipe_fd);
+ if (!local_pcap_copy) {
+ return false;
+ }
+ } else {
+ /* Replace the system cache with our
+ * local copy. */
+ pcap_cache_replace(local_pcap_copy);
+
+ DEBUG(10,("cups_cache_reload: async read on fd %d\n",
+ *p_pipe_fd ));
+
+ /* Trigger an event when the pipe can be read. */
+ cache_fd_event = event_add_fd(smbd_event_context(),
+ NULL, *p_pipe_fd,
+ EVENT_FD_READ,
+ cups_async_callback,
+ (void *)p_pipe_fd);
+ if (!cache_fd_event) {
+ close(*p_pipe_fd);
+ TALLOC_FREE(p_pipe_fd);
+ return false;
+ }
+ }
+ return true;
+}
/*
* 'cups_job_delete()' - Delete a job.
@@ -287,13 +602,15 @@ bool cups_cache_reload(void)
static int cups_job_delete(const char *sharename, const char *lprm_command, struct printjob *pjob)
{
+ TALLOC_CTX *frame = talloc_stackframe();
int ret = 1; /* Return value */
http_t *http = NULL; /* HTTP connection to server */
ipp_t *request = NULL, /* IPP Request */
*response = NULL; /* IPP Response */
cups_lang_t *language = NULL; /* Default language */
+ char *user = NULL;
char uri[HTTP_MAX_URI]; /* printer-uri attribute */
-
+ size_t size;
DEBUG(5,("cups_job_delete(%s, %p (%d))\n", sharename, pjob, pjob->sysjob));
@@ -307,7 +624,7 @@ static int cups_job_delete(const char *sharename, const char *lprm_command, stru
* Try to connect to the server...
*/
- if ((http = cups_connect()) == NULL) {
+ if ((http = cups_connect(frame)) == NULL) {
goto out;
}
@@ -329,7 +646,7 @@ static int cups_job_delete(const char *sharename, const char *lprm_command, stru
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
- "attributes-charset", NULL, cupsLangEncoding(language));
+ "attributes-charset", NULL, "utf-8");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
@@ -338,8 +655,12 @@ static int cups_job_delete(const char *sharename, const char *lprm_command, stru
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL, uri);
+ if (!push_utf8_talloc(frame, &user, pjob->user, &size)) {
+ goto out;
+ }
+
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
- NULL, pjob->user);
+ NULL, user);
/*
* Do the request and get back a response...
@@ -367,6 +688,7 @@ static int cups_job_delete(const char *sharename, const char *lprm_command, stru
if (http)
httpClose(http);
+ TALLOC_FREE(frame);
return ret;
}
@@ -377,13 +699,15 @@ static int cups_job_delete(const char *sharename, const char *lprm_command, stru
static int cups_job_pause(int snum, struct printjob *pjob)
{
+ TALLOC_CTX *frame = talloc_stackframe();
int ret = 1; /* Return value */
http_t *http = NULL; /* HTTP connection to server */
ipp_t *request = NULL, /* IPP Request */
*response = NULL; /* IPP Response */
cups_lang_t *language = NULL; /* Default language */
+ char *user = NULL;
char uri[HTTP_MAX_URI]; /* printer-uri attribute */
-
+ size_t size;
DEBUG(5,("cups_job_pause(%d, %p (%d))\n", snum, pjob, pjob->sysjob));
@@ -397,7 +721,7 @@ static int cups_job_pause(int snum, struct printjob *pjob)
* Try to connect to the server...
*/
- if ((http = cups_connect()) == NULL) {
+ if ((http = cups_connect(frame)) == NULL) {
goto out;
}
@@ -419,7 +743,7 @@ static int cups_job_pause(int snum, struct printjob *pjob)
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
- "attributes-charset", NULL, cupsLangEncoding(language));
+ "attributes-charset", NULL, "utf-8");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
@@ -428,8 +752,11 @@ static int cups_job_pause(int snum, struct printjob *pjob)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL, uri);
+ if (!push_utf8_talloc(frame, &user, pjob->user, &size)) {
+ goto out;
+ }
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
- NULL, pjob->user);
+ NULL, user);
/*
* Do the request and get back a response...
@@ -457,6 +784,7 @@ static int cups_job_pause(int snum, struct printjob *pjob)
if (http)
httpClose(http);
+ TALLOC_FREE(frame);
return ret;
}
@@ -467,13 +795,15 @@ static int cups_job_pause(int snum, struct printjob *pjob)
static int cups_job_resume(int snum, struct printjob *pjob)
{
+ TALLOC_CTX *frame = talloc_stackframe();
int ret = 1; /* Return value */
http_t *http = NULL; /* HTTP connection to server */
ipp_t *request = NULL, /* IPP Request */
*response = NULL; /* IPP Response */
cups_lang_t *language = NULL; /* Default language */
+ char *user = NULL;
char uri[HTTP_MAX_URI]; /* printer-uri attribute */
-
+ size_t size;
DEBUG(5,("cups_job_resume(%d, %p (%d))\n", snum, pjob, pjob->sysjob));
@@ -487,7 +817,7 @@ static int cups_job_resume(int snum, struct printjob *pjob)
* Try to connect to the server...
*/
- if ((http = cups_connect()) == NULL) {
+ if ((http = cups_connect(frame)) == NULL) {
goto out;
}
@@ -509,7 +839,7 @@ static int cups_job_resume(int snum, struct printjob *pjob)
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
- "attributes-charset", NULL, cupsLangEncoding(language));
+ "attributes-charset", NULL, "utf-8");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
@@ -518,8 +848,11 @@ static int cups_job_resume(int snum, struct printjob *pjob)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL, uri);
+ if (!push_utf8_talloc(frame, &user, pjob->user, &size)) {
+ goto out;
+ }
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
- NULL, pjob->user);
+ NULL, user);
/*
* Do the request and get back a response...
@@ -547,6 +880,7 @@ static int cups_job_resume(int snum, struct printjob *pjob)
if (http)
httpClose(http);
+ TALLOC_FREE(frame);
return ret;
}
@@ -557,6 +891,7 @@ static int cups_job_resume(int snum, struct printjob *pjob)
static int cups_job_submit(int snum, struct printjob *pjob)
{
+ TALLOC_CTX *frame = talloc_stackframe();
int ret = 1; /* Return value */
http_t *http = NULL; /* HTTP connection to server */
ipp_t *request = NULL, /* IPP Request */
@@ -567,6 +902,12 @@ static int cups_job_submit(int snum, struct printjob *pjob)
char *new_jobname = NULL;
int num_options = 0;
cups_option_t *options = NULL;
+ char *printername = NULL;
+ char *user = NULL;
+ char *jobname = NULL;
+ char *cupsoptions = NULL;
+ char *filename = NULL;
+ size_t size;
char addr[INET6_ADDRSTRLEN];
DEBUG(5,("cups_job_submit(%d, %p (%d))\n", snum, pjob, pjob->sysjob));
@@ -581,7 +922,7 @@ static int cups_job_submit(int snum, struct printjob *pjob)
* Try to connect to the server...
*/
- if ((http = cups_connect()) == NULL) {
+ if ((http = cups_connect(frame)) == NULL) {
goto out;
}
@@ -604,19 +945,25 @@ static int cups_job_submit(int snum, struct printjob *pjob)
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
- "attributes-charset", NULL, cupsLangEncoding(language));
+ "attributes-charset", NULL, "utf-8");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
+ if (!push_utf8_talloc(frame, &printername, PRINTERNAME(snum), &size)) {
+ goto out;
+ }
slprintf(uri, sizeof(uri) - 1, "ipp://localhost/printers/%s",
- PRINTERNAME(snum));
+ printername);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri);
+ if (!push_utf8_talloc(frame, &user, pjob->user, &size)) {
+ goto out;
+ }
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
- NULL, pjob->user);
+ NULL, user);
clientname = client_name(get_client_fd());
if (strcmp(clientname, "UNKNOWN") == 0) {
@@ -627,31 +974,43 @@ static int cups_job_submit(int snum, struct printjob *pjob)
"job-originating-host-name", NULL,
clientname);
- if (asprintf(&new_jobname,"%s%.8u %s", PRINT_SPOOL_PREFIX,
- (unsigned int)pjob->smbjob, pjob->jobname) < 0) {
+ if (!push_utf8_talloc(frame, &jobname, pjob->jobname, &size)) {
+ goto out;
+ }
+ new_jobname = talloc_asprintf(frame,
+ "%s%.8u %s", PRINT_SPOOL_PREFIX,
+ (unsigned int)pjob->smbjob,
+ jobname);
+ if (new_jobname == NULL) {
goto out;
}
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL,
new_jobname);
- /*
- * add any options defined in smb.conf
+ /*
+ * add any options defined in smb.conf
*/
+ if (!push_utf8_talloc(frame, &cupsoptions, lp_cups_options(snum), &size)) {
+ goto out;
+ }
num_options = 0;
options = NULL;
- num_options = cupsParseOptions(lp_cups_options(snum), num_options, &options);
+ num_options = cupsParseOptions(cupsoptions, num_options, &options);
if ( num_options )
- cupsEncodeOptions(request, num_options, options);
+ cupsEncodeOptions(request, num_options, options);
/*
* Do the request and get back a response...
*/
- slprintf(uri, sizeof(uri) - 1, "/printers/%s", PRINTERNAME(snum));
+ slprintf(uri, sizeof(uri) - 1, "/printers/%s", printername);
+ if (!push_utf8_talloc(frame, &filename, pjob->filename, &size)) {
+ goto out;
+ }
if ((response = cupsDoFileRequest(http, request, uri, pjob->filename)) != NULL) {
if (response->request.status.status_code >= IPP_OK_CONFLICT) {
DEBUG(0,("Unable to print file to %s - %s\n", PRINTERNAME(snum),
@@ -678,7 +1037,7 @@ static int cups_job_submit(int snum, struct printjob *pjob)
if (http)
httpClose(http);
- SAFE_FREE(new_jobname);
+ TALLOC_FREE(frame);
return ret;
}
@@ -690,10 +1049,11 @@ static int cups_job_submit(int snum, struct printjob *pjob)
static int cups_queue_get(const char *sharename,
enum printing_types printing_type,
char *lpq_command,
- print_queue_struct **q,
+ print_queue_struct **q,
print_status_struct *status)
{
- fstring printername;
+ TALLOC_CTX *frame = talloc_stackframe();
+ char *printername = NULL;
http_t *http = NULL; /* HTTP connection to server */
ipp_t *request = NULL, /* IPP Request */
*response = NULL; /* IPP Response */
@@ -704,13 +1064,14 @@ static int cups_queue_get(const char *sharename,
qalloc = 0; /* Number of queue entries allocated */
print_queue_struct *queue = NULL, /* Queue entries */
*temp; /* Temporary pointer for queue */
- const char *user_name, /* job-originating-user-name attribute */
- *job_name; /* job-name attribute */
+ char *user_name = NULL, /* job-originating-user-name attribute */
+ *job_name = NULL; /* job-name attribute */
int job_id; /* job-id attribute */
int job_k_octets; /* job-k-octets attribute */
time_t job_time; /* time-at-creation attribute */
ipp_jstate_t job_status; /* job-status attribute */
int job_priority; /* job-priority attribute */
+ size_t size;
static const char *jattrs[] = /* Requested job attributes */
{
"job-id",
@@ -729,15 +1090,16 @@ static int cups_queue_get(const char *sharename,
*q = NULL;
- /* HACK ALERT!!! The problem with support the 'printer name'
- option is that we key the tdb off the sharename. So we will
- overload the lpq_command string to pass in the printername
- (which is basically what we do for non-cups printers ... using
+ /* HACK ALERT!!! The problem with support the 'printer name'
+ option is that we key the tdb off the sharename. So we will
+ overload the lpq_command string to pass in the printername
+ (which is basically what we do for non-cups printers ... using
the lpq_command to get the queue listing). */
- fstrcpy( printername, lpq_command );
-
- DEBUG(5,("cups_queue_get(%s, %p, %p)\n", printername, q, status));
+ if (!push_utf8_talloc(frame, &printername, lpq_command, &size)) {
+ goto out;
+ }
+ DEBUG(5,("cups_queue_get(%s, %p, %p)\n", lpq_command, q, status));
/*
* Make sure we don't ask for passwords...
@@ -749,7 +1111,7 @@ static int cups_queue_get(const char *sharename,
* Try to connect to the server...
*/
- if ((http = cups_connect()) == NULL) {
+ if ((http = cups_connect(frame)) == NULL) {
goto out;
}
@@ -777,7 +1139,7 @@ static int cups_queue_get(const char *sharename,
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
- "attributes-charset", NULL, cupsLangEncoding(language));
+ "attributes-charset", NULL, "utf-8");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
@@ -882,12 +1244,24 @@ static int cups_queue_get(const char *sharename,
job_time = attr->values[0].integer;
if (strcmp(attr->name, "job-name") == 0 &&
- attr->value_tag == IPP_TAG_NAME)
- job_name = attr->values[0].string.text;
+ attr->value_tag == IPP_TAG_NAME) {
+ if (!pull_utf8_talloc(frame,
+ &job_name,
+ attr->values[0].string.text,
+ &size)) {
+ goto out;
+ }
+ }
if (strcmp(attr->name, "job-originating-user-name") == 0 &&
- attr->value_tag == IPP_TAG_NAME)
- user_name = attr->values[0].string.text;
+ attr->value_tag == IPP_TAG_NAME) {
+ if (!pull_utf8_talloc(frame,
+ &user_name,
+ attr->values[0].string.text,
+ &size)) {
+ goto out;
+ }
+ }
attr = attr->next;
}
@@ -911,8 +1285,8 @@ static int cups_queue_get(const char *sharename,
LPQ_PRINTING;
temp->priority = job_priority;
temp->time = job_time;
- strncpy(temp->fs_user, user_name, sizeof(temp->fs_user) - 1);
- strncpy(temp->fs_file, job_name, sizeof(temp->fs_file) - 1);
+ strlcpy(temp->fs_user, user_name, sizeof(temp->fs_user));
+ strlcpy(temp->fs_file, job_name, sizeof(temp->fs_file));
qcount ++;
@@ -939,7 +1313,7 @@ static int cups_queue_get(const char *sharename,
request->request.op.request_id = 1;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
- "attributes-charset", NULL, cupsLangEncoding(language));
+ "attributes-charset", NULL, "utf-8");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
@@ -982,8 +1356,15 @@ static int cups_queue_get(const char *sharename,
}
if ((attr = ippFindAttribute(response, "printer-state-message",
- IPP_TAG_TEXT)) != NULL)
- fstrcpy(status->message, attr->values[0].string.text);
+ IPP_TAG_TEXT)) != NULL) {
+ char *msg = NULL;
+ if (!pull_utf8_talloc(frame, &msg,
+ attr->values[0].string.text,
+ &size)) {
+ goto out;
+ }
+ fstrcpy(status->message, msg);
+ }
/*
* Return the job queue...
@@ -1001,6 +1382,7 @@ static int cups_queue_get(const char *sharename,
if (http)
httpClose(http);
+ TALLOC_FREE(frame);
return qcount;
}
@@ -1011,13 +1393,16 @@ static int cups_queue_get(const char *sharename,
static int cups_queue_pause(int snum)
{
+ TALLOC_CTX *frame = talloc_stackframe();
int ret = 1; /* Return value */
http_t *http = NULL; /* HTTP connection to server */
ipp_t *request = NULL, /* IPP Request */
*response = NULL; /* IPP Response */
cups_lang_t *language = NULL; /* Default language */
+ char *printername = NULL;
+ char *username = NULL;
char uri[HTTP_MAX_URI]; /* printer-uri attribute */
-
+ size_t size;
DEBUG(5,("cups_queue_pause(%d)\n", snum));
@@ -1031,7 +1416,7 @@ static int cups_queue_pause(int snum)
* Try to connect to the server...
*/
- if ((http = cups_connect()) == NULL) {
+ if ((http = cups_connect(frame)) == NULL) {
goto out;
}
@@ -1053,18 +1438,24 @@ static int cups_queue_pause(int snum)
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
- "attributes-charset", NULL, cupsLangEncoding(language));
+ "attributes-charset", NULL, "utf-8");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
+ if (!push_utf8_talloc(frame, &printername, PRINTERNAME(snum), &size)) {
+ goto out;
+ }
slprintf(uri, sizeof(uri) - 1, "ipp://localhost/printers/%s",
- PRINTERNAME(snum));
+ printername);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
+ if (!push_utf8_talloc(frame, &username, current_user_info.unix_name, &size)) {
+ goto out;
+ }
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
- NULL, current_user_info.unix_name);
+ NULL, username);
/*
* Do the request and get back a response...
@@ -1092,6 +1483,7 @@ static int cups_queue_pause(int snum)
if (http)
httpClose(http);
+ TALLOC_FREE(frame);
return ret;
}
@@ -1102,13 +1494,16 @@ static int cups_queue_pause(int snum)
static int cups_queue_resume(int snum)
{
+ TALLOC_CTX *frame = talloc_stackframe();
int ret = 1; /* Return value */
http_t *http = NULL; /* HTTP connection to server */
ipp_t *request = NULL, /* IPP Request */
*response = NULL; /* IPP Response */
cups_lang_t *language = NULL; /* Default language */
+ char *printername = NULL;
+ char *username = NULL;
char uri[HTTP_MAX_URI]; /* printer-uri attribute */
-
+ size_t size;
DEBUG(5,("cups_queue_resume(%d)\n", snum));
@@ -1122,7 +1517,7 @@ static int cups_queue_resume(int snum)
* Try to connect to the server...
*/
- if ((http = cups_connect()) == NULL) {
+ if ((http = cups_connect(frame)) == NULL) {
goto out;
}
@@ -1144,18 +1539,24 @@ static int cups_queue_resume(int snum)
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
- "attributes-charset", NULL, cupsLangEncoding(language));
+ "attributes-charset", NULL, "utf-8");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
+ if (!push_utf8_talloc(frame, &printername, PRINTERNAME(snum), &size)) {
+ goto out;
+ }
slprintf(uri, sizeof(uri) - 1, "ipp://localhost/printers/%s",
- PRINTERNAME(snum));
+ printername);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
+ if (!push_utf8_talloc(frame, &username, current_user_info.unix_name, &size)) {
+ goto out;
+ }
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
- NULL, current_user_info.unix_name);
+ NULL, username);
/*
* Do the request and get back a response...
@@ -1183,6 +1584,7 @@ static int cups_queue_resume(int snum)
if (http)
httpClose(http);
+ TALLOC_FREE(frame);
return ret;
}
@@ -1204,15 +1606,16 @@ struct printif cups_printif =
bool cups_pull_comment_location(NT_PRINTER_INFO_LEVEL_2 *printer)
{
+ TALLOC_CTX *frame = talloc_stackframe();
http_t *http = NULL; /* HTTP connection to server */
ipp_t *request = NULL, /* IPP Request */
*response = NULL; /* IPP Response */
ipp_attribute_t *attr; /* Current attribute */
cups_lang_t *language = NULL; /* Default language */
- char *name, /* printer-name attribute */
- *info, /* printer-info attribute */
- *location; /* printer-location attribute */
char uri[HTTP_MAX_URI];
+ char *server = NULL;
+ char *sharename = NULL;
+ char *name = NULL;
static const char *requested[] =/* Requested attributes */
{
"printer-name",
@@ -1220,6 +1623,7 @@ bool cups_pull_comment_location(NT_PRINTER_INFO_LEVEL_2 *printer)
"printer-location"
};
bool ret = False;
+ size_t size;
DEBUG(5, ("pulling %s location\n", printer->sharename));
@@ -1233,7 +1637,7 @@ bool cups_pull_comment_location(NT_PRINTER_INFO_LEVEL_2 *printer)
* Try to connect to the server...
*/
- if ((http = cups_connect()) == NULL) {
+ if ((http = cups_connect(frame)) == NULL) {
goto out;
}
@@ -1245,13 +1649,26 @@ bool cups_pull_comment_location(NT_PRINTER_INFO_LEVEL_2 *printer)
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
- "attributes-charset", NULL, cupsLangEncoding(language));
+ "attributes-charset", NULL, "utf-8");
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
"attributes-natural-language", NULL, language->language);
+ if (lp_cups_server() != NULL && strlen(lp_cups_server()) > 0) {
+ if (!push_utf8_talloc(frame, &server, lp_cups_server(), &size)) {
+ goto out;
+ }
+ } else {
+ server = talloc_strdup(frame,cupsServer());
+ }
+ if (server) {
+ goto out;
+ }
+ if (!push_utf8_talloc(frame, &sharename, printer->sharename, &size)) {
+ goto out;
+ }
slprintf(uri, sizeof(uri) - 1, "ipp://%s/printers/%s",
- lp_cups_server(), printer->sharename);
+ server, sharename);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri);
@@ -1286,43 +1703,64 @@ bool cups_pull_comment_location(NT_PRINTER_INFO_LEVEL_2 *printer)
* Pull the needed attributes from this printer...
*/
- name = NULL;
- info = NULL;
- location = NULL;
-
while ( attr && (attr->group_tag == IPP_TAG_PRINTER) ) {
+ if (strcmp(attr->name, "printer-name") == 0 &&
+ attr->value_tag == IPP_TAG_NAME) {
+ if (!pull_utf8_talloc(frame,
+ &name,
+ attr->values[0].string.text,
+ &size)) {
+ goto out;
+ }
+ }
+
/* Grab the comment if we don't have one */
if ( (strcmp(attr->name, "printer-info") == 0)
&& (attr->value_tag == IPP_TAG_TEXT)
- && !strlen(printer->comment) )
+ && !strlen(printer->comment) )
{
+ char *comment = NULL;
+ if (!pull_utf8_talloc(frame,
+ &comment,
+ attr->values[0].string.text,
+ &size)) {
+ goto out;
+ }
DEBUG(5,("cups_pull_comment_location: Using cups comment: %s\n",
- attr->values[0].string.text));
+ comment));
strlcpy(printer->comment,
- attr->values[0].string.text,
- sizeof(printer->comment));
+ comment,
+ sizeof(printer->comment));
}
- /* Grab the location if we don't have one */
+ /* Grab the location if we don't have one */
if ( (strcmp(attr->name, "printer-location") == 0)
- && (attr->value_tag == IPP_TAG_TEXT)
+ && (attr->value_tag == IPP_TAG_TEXT)
&& !strlen(printer->location) )
{
+ char *location = NULL;
+ if (!pull_utf8_talloc(frame,
+ &location,
+ attr->values[0].string.text,
+ &size)) {
+ goto out;
+ }
DEBUG(5,("cups_pull_comment_location: Using cups location: %s\n",
- attr->values[0].string.text));
- fstrcpy(printer->location,attr->values[0].string.text);
+ location));
+ strlcpy(printer->location,
+ location,
+ sizeof(printer->location));
}
attr = attr->next;
}
/*
- * See if we have everything needed...
+ * We have everything needed...
*/
- if (name == NULL)
+ if (name != NULL)
break;
-
}
ret = True;
@@ -1337,6 +1775,7 @@ bool cups_pull_comment_location(NT_PRINTER_INFO_LEVEL_2 *printer)
if (http)
httpClose(http);
+ TALLOC_FREE(frame);
return ret;
}
diff --git a/source3/printing/print_generic.c b/source3/printing/print_generic.c
index 2a324fdd5c..5806b29206 100644
--- a/source3/printing/print_generic.c
+++ b/source3/printing/print_generic.c
@@ -104,7 +104,7 @@ static int generic_job_delete( const char *sharename, const char *lprm_command,
slprintf(jobstr, sizeof(jobstr)-1, "%d", pjob->sysjob);
return print_run_command( -1, sharename, False, lprm_command, NULL,
"%j", jobstr,
- "%T", http_timestring(pjob->starttime),
+ "%T", http_timestring(talloc_tos(), pjob->starttime),
NULL);
}
@@ -238,7 +238,7 @@ static int generic_queue_get(const char *printer_name,
}
numlines = 0;
- qlines = fd_lines_load(fd, &numlines,0);
+ qlines = fd_lines_load(fd, &numlines,0,NULL);
close(fd);
/* turn the lpq output into a series of job structures */
@@ -247,7 +247,7 @@ static int generic_queue_get(const char *printer_name,
if (numlines && qlines) {
queue = SMB_MALLOC_ARRAY(print_queue_struct, numlines+1);
if (!queue) {
- file_lines_free(qlines);
+ TALLOC_FREE(qlines);
*q = NULL;
return 0;
}
@@ -262,7 +262,7 @@ static int generic_queue_get(const char *printer_name,
}
}
- file_lines_free(qlines);
+ TALLOC_FREE(qlines);
*q = queue;
return qcount;
}
diff --git a/source3/printing/print_svid.c b/source3/printing/print_svid.c
index 7e91d3a677..681b2bf459 100644
--- a/source3/printing/print_svid.c
+++ b/source3/printing/print_svid.c
@@ -59,12 +59,12 @@ bool sysv_cache_reload(void)
scheduler = file_lines_pload("/usr/bin/lpstat -r", NULL);
if(!strcmp(*scheduler,"scheduler is running")){
DEBUG(3,("No Printers found!!!\n"));
- file_lines_free(scheduler);
+ TALLOC_FREE(scheduler);
return True;
}
else{
DEBUG(3,("Scheduler is not running!!!\n"));
- file_lines_free(scheduler);
+ TALLOC_FREE(scheduler);
return False;
}
#else
@@ -111,12 +111,12 @@ bool sysv_cache_reload(void)
/* add it to the cache */
if (!pcap_cache_add(name, NULL)) {
- file_lines_free(lines);
+ TALLOC_FREE(lines);
return False;
}
}
- file_lines_free(lines);
+ TALLOC_FREE(lines);
return True;
}
diff --git a/source3/printing/printfsp.c b/source3/printing/printfsp.c
index c6749226fd..a247cd8427 100644
--- a/source3/printing/printfsp.c
+++ b/source3/printing/printfsp.c
@@ -25,7 +25,8 @@ open a print file and setup a fsp for it. This is a wrapper around
print_job_start().
***************************************************************************/
-NTSTATUS print_fsp_open(connection_struct *conn, const char *fname,
+NTSTATUS print_fsp_open(struct smb_request *req, connection_struct *conn,
+ const char *fname,
uint16_t current_vuid, files_struct **result)
{
int jobid;
@@ -34,7 +35,7 @@ NTSTATUS print_fsp_open(connection_struct *conn, const char *fname,
fstring name;
NTSTATUS status;
- status = file_new(conn, &fsp);
+ status = file_new(req, conn, &fsp);
if(!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -52,7 +53,7 @@ NTSTATUS print_fsp_open(connection_struct *conn, const char *fname,
jobid = print_job_start(conn->server_info, SNUM(conn), name, NULL);
if (jobid == -1) {
status = map_nt_error_from_unix(errno);
- file_free(fsp);
+ file_free(req, fsp);
return status;
}
@@ -61,7 +62,7 @@ NTSTATUS print_fsp_open(connection_struct *conn, const char *fname,
if (fsp->rap_print_jobid == 0) {
/* We need to delete the entry in the tdb. */
pjob_delete(lp_const_servicename(SNUM(conn)), jobid);
- file_free(fsp);
+ file_free(req, fsp);
return NT_STATUS_ACCESS_DENIED; /* No errno around here */
}
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 1016e6183d..3c8c60f0e0 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -2389,9 +2389,9 @@ uint32 print_job_start(struct auth_serversupplied_info *server_info, int snum,
/* see if we have sufficient disk space */
if (lp_minprintspace(snum)) {
- SMB_BIG_UINT dspace, dsize;
+ uint64_t dspace, dsize;
if (sys_fsusage(path, &dspace, &dsize) == 0 &&
- dspace < 2*(SMB_BIG_UINT)lp_minprintspace(snum)) {
+ dspace < 2*(uint64_t)lp_minprintspace(snum)) {
DEBUG(3, ("print_job_start: disk space check failed.\n"));
release_print_db(pdb);
errno = ENOSPC;
diff --git a/source3/printing/tests/README.vlp b/source3/printing/tests/README.vlp
new file mode 100644
index 0000000000..fc0b91ad69
--- /dev/null
+++ b/source3/printing/tests/README.vlp
@@ -0,0 +1,19 @@
+Virtual line printer test program (vlp)
+=======================================
+
+This can be useful for testing/debugging Samba print code. It gives you a
+virtual full-function printer.
+
+Setup
+
+Set up Samba to use vlp.
+ In your smb.conf file under [global], add the following option:
+ printing = vlp
+ and then add any number of print shares, without needing to make them
+ really exist.
+
+ [testprinter]
+ printable = yes
+
+ is all you need for the most basic virtual printer.
+
diff --git a/source3/printing/tests/vlp.c b/source3/printing/tests/vlp.c
new file mode 100644
index 0000000000..15459889e9
--- /dev/null
+++ b/source3/printing/tests/vlp.c
@@ -0,0 +1,431 @@
+/*
+ Unix SMB/Netbios implementation.
+
+ Virtual lp system for printer testing
+
+ Copyright (C) Tim Potter 2000
+
+ 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"
+
+#define PRINT_TDB "/tmp/vlp.tdb"
+#define PRINT_FIRSTJOB "100"
+
+static TDB_CONTEXT *tdb;
+
+struct vlp_job {
+ fstring owner;
+ int jobid;
+ fstring jobname;
+ int size;
+ int status;
+ time_t submit_time;
+ int deleted;
+};
+
+/* Print usage */
+
+static void usage(void)
+{
+ printf("Usage: print-test lpq|lprm|print|queuepause|queueresume|"
+ "lppause|lpresume [args]\n");
+}
+
+/* Return an array of vlp jobs that is the printer queue */
+
+static void get_job_list(char *printer, struct vlp_job **job_list,
+ int *num_jobs)
+{
+ fstring keystr;
+ TDB_DATA data;
+
+ slprintf(keystr, sizeof(keystr) - 1, "LPQ/%s", printer);
+ data = tdb_fetch_bystring(tdb, keystr);
+
+ *job_list = (struct vlp_job *)data.dptr;
+ *num_jobs = data.dsize / sizeof(struct vlp_job);
+}
+
+/* Store an array of vl jobs for the queue */
+
+static void set_job_list(char *printer, struct vlp_job *job_list,
+ int num_jobs)
+{
+ fstring keystr;
+ TDB_DATA data;
+
+ slprintf(keystr, sizeof(keystr) - 1, "LPQ/%s", printer);
+
+ data.dptr = (unsigned char *)job_list;
+ data.dsize = num_jobs * sizeof(struct vlp_job);
+ tdb_store_bystring(tdb, keystr, data, TDB_REPLACE);
+}
+
+/* Return the next job number for a printer */
+
+static int next_jobnum(char *printer)
+{
+ fstring keystr;
+ int jobnum;
+
+ slprintf(keystr, sizeof(keystr) - 1, "JOBNUM/%s", printer);
+
+ tdb_lock_bystring(tdb, keystr);
+
+ jobnum = tdb_fetch_int32(tdb, keystr);
+
+ /* Create next job index if none exists */
+
+ if (jobnum == -1) {
+ jobnum = atoi(PRINT_FIRSTJOB);
+ }
+
+ jobnum++;
+ tdb_store_int32(tdb, keystr, jobnum);
+
+ tdb_unlock_bystring(tdb, keystr);
+
+ return jobnum;
+}
+
+static void set_printer_status(char *printer, int status)
+{
+ fstring keystr;
+ int result;
+
+ slprintf(keystr, sizeof(keystr) - 1, "STATUS/%s", printer);
+ result = tdb_store_int32(tdb, keystr, status);
+}
+
+static int get_printer_status(char *printer)
+{
+ fstring keystr;
+ TDB_DATA data;
+
+ slprintf(keystr, sizeof(keystr) - 1, "STATUS/%s", printer);
+
+ data.dptr = (unsigned char *)keystr;
+ data.dsize = strlen(keystr) + 1;
+
+ if (!tdb_exists(tdb, data)) {
+ set_printer_status(printer, LPSTAT_OK);
+ return LPSTAT_OK;
+ }
+
+ return tdb_fetch_int32(tdb, keystr);
+}
+
+/* Display printer queue */
+
+static int lpq_command(int argc, char **argv)
+{
+ char *printer;
+ struct vlp_job *job_list = NULL;
+ int i, num_jobs, job_count = 0;
+
+ if (argc != 2) {
+ printf("Usage: lpq <printername>\n");
+ return 1;
+ }
+
+ printer = argv[1];
+
+ /* Display printer status */
+
+ switch (get_printer_status(printer)) {
+ case LPSTAT_OK:
+ printf("enabled\n");
+ break;
+ case LPSTAT_STOPPED:
+ printf("disabled\n");
+ break;
+ case LPSTAT_ERROR:
+ default:
+ printf("error\n");
+ break;
+ }
+
+ /* Print queued documents */
+
+ get_job_list(printer, &job_list, &num_jobs);
+
+ for (i = 0; i < num_jobs; i++) {
+ if (job_list[i].deleted) continue;
+ printf("%d\t%d\t%d\t%ld\t%s\t%s\n", job_list[i].jobid,
+ job_list[i].size,
+ (i == 0 && job_list[i].status == LPQ_QUEUED) ?
+ LPQ_SPOOLING : job_list[i].status,
+ job_list[i].submit_time, job_list[i].owner,
+ job_list[i].jobname);
+ job_count++;
+ }
+
+ free(job_list);
+
+ return 0;
+}
+
+/* Remove a job */
+
+static int lprm_command(int argc, char **argv)
+{
+ char *printer;
+ int jobid, num_jobs, i;
+ struct vlp_job *job_list;
+
+ if (argc < 3) {
+ printf("Usage: lprm <printername> <jobid>\n");
+ return 1;
+ }
+
+ printer = argv[1];
+ jobid = atoi(argv[2]);
+
+ get_job_list(printer, &job_list, &num_jobs);
+
+ for (i = 0; i < num_jobs; i++) {
+ if (job_list[i].jobid == jobid) {
+ job_list[i].deleted = 1;
+ set_job_list(printer, job_list, num_jobs);
+ break;
+ }
+ }
+
+ return 0;
+}
+
+/* print command = print-test %p %s */
+
+static int print_command(int argc, char **argv)
+{
+ char *printer;
+ fstring keystr;
+ struct passwd *pw;
+ TDB_DATA value, queue;
+ struct vlp_job job;
+ int i;
+
+ if (argc < 3) {
+ printf("Usage: print <printername> <jobname>\n");
+ return 1;
+ }
+
+ printer = argv[1];
+
+ ZERO_STRUCT(job);
+
+ /* Create a job record */
+
+ for (i = 2; i < argc; i++) {
+ fstrcat(job.jobname, argv[i]);
+ if (i < argc - 1) {
+ fstrcat(job.jobname, " ");
+ }
+ }
+
+ if (!(pw = getpwuid(getuid()))) {
+ return 1;
+ }
+
+ fstrcpy(job.owner, pw->pw_name);
+
+ job.jobid = next_jobnum(printer);
+ job.size = 666;
+ job.submit_time = time(NULL);
+
+ /* Store job entry in queue */
+
+ slprintf(keystr, sizeof(keystr) - 1, "LPQ/%s", printer);
+
+ value = tdb_fetch_bystring(tdb, keystr);
+
+ if (value.dptr) {
+
+ /* Add job to end of queue */
+
+ queue.dptr = (unsigned char *)SMB_MALLOC(value.dsize +
+ sizeof(struct vlp_job));
+ if (!queue.dptr) return 1;
+
+ memcpy(queue.dptr, value.dptr, value.dsize);
+ memcpy(queue.dptr + value.dsize, &job, sizeof(struct vlp_job));
+
+ queue.dsize = value.dsize + sizeof(struct vlp_job);
+
+ tdb_store_bystring(tdb, keystr, queue, TDB_REPLACE);
+
+ free(queue.dptr);
+
+ } else {
+
+ /* Create new queue */
+ queue.dptr = (unsigned char *)&job;
+ queue.dsize = sizeof(struct vlp_job);
+
+ tdb_store_bystring(tdb, keystr, queue, TDB_REPLACE);
+ }
+
+ return 0;
+}
+
+/* Pause the queue */
+
+static int queuepause_command(int argc, char **argv)
+{
+ char *printer;
+
+ if (argc != 2) {
+ printf("Usage: queuepause <printername>\n");
+ return 1;
+ }
+
+ printer = argv[1];
+ set_printer_status(printer, LPSTAT_STOPPED);
+
+ return 0;
+}
+
+/* Resume the queue */
+
+static int queueresume_command(int argc, char **argv)
+{
+ char *printer;
+
+ if (argc != 2) {
+ printf("Usage: queueresume <printername>\n");
+ return 1;
+ }
+
+ printer = argv[1];
+ set_printer_status(printer, LPSTAT_OK);
+
+ return 0;
+}
+
+/* Pause a job */
+
+static int lppause_command(int argc, char **argv)
+{
+ struct vlp_job *job_list;
+ char *printer;
+ int jobid, num_jobs, i;
+
+ if (argc != 3) {
+ printf("Usage: lppause <printername> <jobid>\n");
+ return 1;
+ }
+
+ printer = argv[1];
+ jobid = atoi(argv[2]);
+
+ get_job_list(printer, &job_list, &num_jobs);
+
+ for (i = 0; i < num_jobs; i++) {
+ if (job_list[i].jobid == jobid) {
+ job_list[i].status = LPQ_PAUSED;
+ set_job_list(printer, job_list, num_jobs);
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+/* Resume a job */
+
+static int lpresume_command(int argc, char **argv)
+{
+ struct vlp_job *job_list;
+ char *printer;
+ int jobid, num_jobs, i;
+
+ if (argc != 3) {
+ printf("Usage: lpresume <printername> <jobid>\n");
+ return 1;
+ }
+
+ printer = argv[1];
+ jobid = atoi(argv[2]);
+
+ get_job_list(printer, &job_list, &num_jobs);
+
+ for (i = 0; i < num_jobs; i++) {
+ if (job_list[i].jobid == jobid) {
+ job_list[i].status = LPQ_QUEUED;
+ set_job_list(printer, job_list, num_jobs);
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+int main(int argc, char **argv)
+{
+ /* Parameter check */
+
+ if (argc == 1) {
+ usage();
+ return 1;
+ }
+
+ /* Initialise */
+
+ if (!(tdb = tdb_open(PRINT_TDB, 0, 0, O_RDWR | O_CREAT,
+ 0666))) {
+ printf("%s: unable to open %s\n", argv[0], PRINT_TDB);
+ return 1;
+ }
+
+ /* Ensure we are modes 666 */
+
+ chmod(PRINT_TDB, 0666);
+
+ /* Do commands */
+
+ if (strcmp(argv[1], "lpq") == 0) {
+ return lpq_command(argc - 1, &argv[1]);
+ }
+
+ if (strcmp(argv[1], "lprm") == 0) {
+ return lprm_command(argc - 1, &argv[1]);
+ }
+
+ if (strcmp(argv[1], "print") == 0) {
+ return print_command(argc - 1, &argv[1]);
+ }
+
+ if (strcmp(argv[1], "queuepause") == 0) {
+ return queuepause_command(argc - 1, &argv[1]);
+ }
+
+ if (strcmp(argv[1], "queueresume") == 0) {
+ return queueresume_command(argc - 1, &argv[1]);
+ }
+
+ if (strcmp(argv[1], "lppause") == 0) {
+ return lppause_command(argc - 1, &argv[1]);
+ }
+
+ if (strcmp(argv[1], "lpresume") == 0) {
+ return lpresume_command(argc - 1, &argv[1]);
+ }
+
+ /* Unknown command */
+
+ printf("%s: invalid command %s\n", argv[0], argv[1]);
+ return 1;
+}
diff --git a/source3/registry/reg_dispatcher.c b/source3/registry/reg_dispatcher.c
index c68ecdedeb..d06410a1b3 100644
--- a/source3/registry/reg_dispatcher.c
+++ b/source3/registry/reg_dispatcher.c
@@ -37,7 +37,6 @@ static const struct generic_mapping reg_generic_map =
static WERROR construct_registry_sd(TALLOC_CTX *ctx, SEC_DESC **psd)
{
SEC_ACE ace[3];
- SEC_ACCESS mask;
size_t i = 0;
SEC_DESC *sd;
SEC_ACL *acl;
@@ -45,21 +44,18 @@ static WERROR construct_registry_sd(TALLOC_CTX *ctx, SEC_DESC **psd)
/* 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);
+ REG_KEY_READ, 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);
+ SEC_ACE_TYPE_ACCESS_ALLOWED, REG_KEY_ALL, 0);
/* Full Access 'NT Authority\System' */
- init_sec_access(&mask, REG_KEY_ALL );
init_sec_ace(&ace[i++], &global_sid_System, SEC_ACE_TYPE_ACCESS_ALLOWED,
- mask, 0);
+ REG_KEY_ALL, 0);
/* create the security descriptor */
diff --git a/source3/registry/reg_perfcount.c b/source3/registry/reg_perfcount.c
index e608847048..eda44ace19 100644
--- a/source3/registry/reg_perfcount.c
+++ b/source3/registry/reg_perfcount.c
@@ -63,7 +63,7 @@ void perfcount_init_keys( void )
/* no registry keys; just create the perfmon directory */
- if ( !directory_exist( p, NULL ) )
+ if ( !directory_exist( p ) )
mkdir( p, 0755 );
return;
@@ -450,7 +450,7 @@ static uint32 _reg_perfcount_get_size_field(uint32 CounterType)
/*********************************************************************
*********************************************************************/
-static uint32 _reg_perfcount_compute_scale(SMB_BIG_INT data)
+static uint32 _reg_perfcount_compute_scale(int64_t data)
{
int scale = 0;
if(data == 0)
@@ -482,7 +482,7 @@ static bool _reg_perfcount_get_counter_info(PERF_DATA_BLOCK *block,
char buf[PERFCOUNT_MAX_LEN];
size_t dsize, padding;
long int data32, dbuf[2];
- SMB_BIG_INT data64;
+ int64_t data64;
uint32 counter_size;
obj->counters[obj->NumCounters].DefaultScale = 0;
@@ -521,7 +521,7 @@ static bool _reg_perfcount_get_counter_info(PERF_DATA_BLOCK *block,
memcpy(buf, data.dptr, data.dsize);
data32 = strtol(buf, NULL, 0);
if((obj->counters[obj->NumCounters].CounterType & 0x00000F00) == PERF_TYPE_NUMBER)
- obj->counters[obj->NumCounters].DefaultScale = _reg_perfcount_compute_scale((SMB_BIG_INT)data32);
+ obj->counters[obj->NumCounters].DefaultScale = _reg_perfcount_compute_scale((int64_t)data32);
else
obj->counters[obj->NumCounters].DefaultScale = 0;
dbuf[0] = data32;
@@ -823,7 +823,7 @@ static int _reg_perfcount_assemble_global(PERF_DATA_BLOCK *block,
/*********************************************************************
*********************************************************************/
-static bool _reg_perfcount_get_64(SMB_BIG_UINT *retval,
+static bool _reg_perfcount_get_64(uint64_t *retval,
TDB_CONTEXT *tdb,
int key_part1,
const char *key_part2)
@@ -855,7 +855,7 @@ static bool _reg_perfcount_get_64(SMB_BIG_UINT *retval,
static bool _reg_perfcount_init_data_block_perf(PERF_DATA_BLOCK *block,
TDB_CONTEXT *names)
{
- SMB_BIG_UINT PerfFreq, PerfTime, PerfTime100nSec;
+ uint64_t PerfFreq, PerfTime, PerfTime100nSec;
TDB_CONTEXT *counters;
bool status = False;
const char *fname = counters_directory( DATA_DB );
diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c
index df87ed13d1..5f115e537b 100644
--- a/source3/rpc_client/cli_netlogon.c
+++ b/source3/rpc_client/cli_netlogon.c
@@ -146,7 +146,7 @@ NTSTATUS rpccli_netlogon_sam_logon(struct rpc_pipe_client *cli,
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
struct netr_Authenticator clnt_creds;
struct netr_Authenticator ret_creds;
- union netr_LogonInfo *logon;
+ union netr_LogonLevel *logon;
union netr_Validation validation;
uint8_t authoritative;
int validation_level = 3;
@@ -156,7 +156,7 @@ NTSTATUS rpccli_netlogon_sam_logon(struct rpc_pipe_client *cli,
ZERO_STRUCT(ret_creds);
ZERO_STRUCT(zeros);
- logon = TALLOC_ZERO_P(mem_ctx, union netr_LogonInfo);
+ logon = TALLOC_ZERO_P(mem_ctx, union netr_LogonLevel);
if (!logon) {
return NT_STATUS_NO_MEMORY;
}
@@ -172,7 +172,7 @@ NTSTATUS rpccli_netlogon_sam_logon(struct rpc_pipe_client *cli,
netlogon_creds_client_step(cli->dc, &clnt_creds);
switch (logon_type) {
- case INTERACTIVE_LOGON_TYPE: {
+ case NetlogonInteractiveInformation: {
struct netr_PasswordInfo *password_info;
@@ -231,7 +231,7 @@ NTSTATUS rpccli_netlogon_sam_logon(struct rpc_pipe_client *cli,
break;
}
- case NET_LOGON_TYPE: {
+ case NetlogonNetworkInformation: {
struct netr_NetworkInfo *network_info;
uint8 chal[8];
unsigned char local_lm_response[24];
@@ -327,7 +327,7 @@ NTSTATUS rpccli_netlogon_sam_network_logon(struct rpc_pipe_client *cli,
uint8 zeros[16];
struct netr_Authenticator clnt_creds;
struct netr_Authenticator ret_creds;
- union netr_LogonInfo *logon = NULL;
+ union netr_LogonLevel *logon = NULL;
struct netr_NetworkInfo *network_info;
uint8_t authoritative;
union netr_Validation validation;
@@ -342,7 +342,7 @@ NTSTATUS rpccli_netlogon_sam_network_logon(struct rpc_pipe_client *cli,
ZERO_STRUCT(lm);
ZERO_STRUCT(nt);
- logon = TALLOC_ZERO_P(mem_ctx, union netr_LogonInfo);
+ logon = TALLOC_ZERO_P(mem_ctx, union netr_LogonLevel);
if (!logon) {
return NT_STATUS_NO_MEMORY;
}
@@ -398,7 +398,7 @@ NTSTATUS rpccli_netlogon_sam_network_logon(struct rpc_pipe_client *cli,
global_myname(),
&clnt_creds,
&ret_creds,
- NET_LOGON_TYPE,
+ NetlogonNetworkInformation,
logon,
validation_level,
&validation,
@@ -447,7 +447,7 @@ NTSTATUS rpccli_netlogon_sam_network_logon_ex(struct rpc_pipe_client *cli,
const char *workstation_name_slash;
const char *server_name_slash;
uint8 zeros[16];
- union netr_LogonInfo *logon = NULL;
+ union netr_LogonLevel *logon = NULL;
struct netr_NetworkInfo *network_info;
uint8_t authoritative;
union netr_Validation validation;
@@ -462,7 +462,7 @@ NTSTATUS rpccli_netlogon_sam_network_logon_ex(struct rpc_pipe_client *cli,
ZERO_STRUCT(lm);
ZERO_STRUCT(nt);
- logon = TALLOC_ZERO_P(mem_ctx, union netr_LogonInfo);
+ logon = TALLOC_ZERO_P(mem_ctx, union netr_LogonLevel);
if (!logon) {
return NT_STATUS_NO_MEMORY;
}
@@ -514,7 +514,7 @@ NTSTATUS rpccli_netlogon_sam_network_logon_ex(struct rpc_pipe_client *cli,
result = rpccli_netr_LogonSamLogonEx(cli, mem_ctx,
server_name_slash,
global_myname(),
- NET_LOGON_TYPE,
+ NetlogonNetworkInformation,
logon,
validation_level,
&validation,
@@ -538,3 +538,94 @@ NTSTATUS rpccli_netlogon_sam_network_logon_ex(struct rpc_pipe_client *cli,
return result;
}
+
+/*********************************************************
+ Change the domain password on the PDC.
+
+ Just changes the password betwen the two values specified.
+
+ Caller must have the cli connected to the netlogon pipe
+ already.
+**********************************************************/
+
+NTSTATUS rpccli_netlogon_set_trust_password(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ const unsigned char orig_trust_passwd_hash[16],
+ const char *new_trust_pwd_cleartext,
+ const unsigned char new_trust_passwd_hash[16],
+ uint32_t sec_channel_type)
+{
+ NTSTATUS result;
+ uint32_t neg_flags = NETLOGON_NEG_AUTH2_ADS_FLAGS;
+ struct netr_Authenticator clnt_creds, srv_cred;
+
+ result = rpccli_netlogon_setup_creds(cli,
+ cli->desthost, /* server name */
+ lp_workgroup(), /* domain */
+ global_myname(), /* client name */
+ global_myname(), /* machine account name */
+ orig_trust_passwd_hash,
+ sec_channel_type,
+ &neg_flags);
+
+ if (!NT_STATUS_IS_OK(result)) {
+ DEBUG(3,("rpccli_netlogon_set_trust_password: unable to setup creds (%s)!\n",
+ nt_errstr(result)));
+ return result;
+ }
+
+ netlogon_creds_client_step(cli->dc, &clnt_creds);
+
+ if (neg_flags & NETLOGON_NEG_PASSWORD_SET2) {
+
+ struct netr_CryptPassword new_password;
+
+ init_netr_CryptPassword(new_trust_pwd_cleartext,
+ cli->dc->sess_key,
+ &new_password);
+
+ result = rpccli_netr_ServerPasswordSet2(cli, mem_ctx,
+ cli->dc->remote_machine,
+ cli->dc->mach_acct,
+ sec_channel_type,
+ global_myname(),
+ &clnt_creds,
+ &srv_cred,
+ &new_password);
+ if (!NT_STATUS_IS_OK(result)) {
+ DEBUG(0,("rpccli_netr_ServerPasswordSet2 failed: %s\n",
+ nt_errstr(result)));
+ return result;
+ }
+ } else {
+
+ struct samr_Password new_password;
+
+ cred_hash3(new_password.hash,
+ new_trust_passwd_hash,
+ cli->dc->sess_key, 1);
+
+ result = rpccli_netr_ServerPasswordSet(cli, mem_ctx,
+ cli->dc->remote_machine,
+ cli->dc->mach_acct,
+ sec_channel_type,
+ global_myname(),
+ &clnt_creds,
+ &srv_cred,
+ &new_password);
+ if (!NT_STATUS_IS_OK(result)) {
+ DEBUG(0,("rpccli_netr_ServerPasswordSet failed: %s\n",
+ nt_errstr(result)));
+ return result;
+ }
+ }
+
+ /* Always check returned credentials. */
+ if (!netlogon_creds_client_check(cli->dc, &srv_cred.cred)) {
+ DEBUG(0,("credentials chain check failed\n"));
+ return NT_STATUS_ACCESS_DENIED;
+ }
+
+ return result;
+}
+
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index f32a33fdb6..ca9d3392e7 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -2810,7 +2810,7 @@ NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path,
result->abstract_syntax = *abstract_syntax;
result->transfer_syntax = ndr_transfer_syntax;
- result->desthost = get_myname(result);
+ result->desthost = talloc_get_myname(result);
result->srv_name_slash = talloc_asprintf_strupper_m(
result, "\\\\%s", result->desthost);
if ((result->desthost == NULL) || (result->srv_name_slash == NULL)) {
@@ -2906,7 +2906,7 @@ static NTSTATUS rpc_pipe_open_np(struct cli_state *cli,
fnum = cli_nt_create(cli, result->trans.np.pipe_name,
DESIRED_ACCESS_PIPE);
if (fnum == -1) {
- DEBUG(1,("rpc_pipe_open_np: cli_nt_create failed on pipe %s "
+ DEBUG(3,("rpc_pipe_open_np: cli_nt_create failed on pipe %s "
"to machine %s. Error was %s\n",
result->trans.np.pipe_name, cli->desthost,
cli_errstr(cli)));
diff --git a/source3/rpc_client/cli_svcctl.c b/source3/rpc_client/cli_svcctl.c
index 3c29dcdee8..51678083d3 100644
--- a/source3/rpc_client/cli_svcctl.c
+++ b/source3/rpc_client/cli_svcctl.c
@@ -90,79 +90,3 @@ WERROR rpccli_svcctl_enumerate_services( struct rpc_pipe_client *cli, TALLOC_CTX
return out.status;
}
-
-/*******************************************************************
-*******************************************************************/
-
-WERROR rpccli_svcctl_query_config(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- POLICY_HND *hService, SERVICE_CONFIG *config )
-{
- SVCCTL_Q_QUERY_SERVICE_CONFIG in;
- SVCCTL_R_QUERY_SERVICE_CONFIG out;
- prs_struct qbuf, rbuf;
-
- ZERO_STRUCT(in);
- ZERO_STRUCT(out);
-
- memcpy( &in.handle, hService, sizeof(POLICY_HND) );
- in.buffer_size = 0;
-
-
- CLI_DO_RPC_WERR( cli, mem_ctx, &ndr_table_svcctl.syntax_id,
- SVCCTL_QUERY_SERVICE_CONFIG_W,
- in, out,
- qbuf, rbuf,
- svcctl_io_q_query_service_config,
- svcctl_io_r_query_service_config,
- WERR_GENERAL_FAILURE );
-
- if ( W_ERROR_EQUAL( out.status, WERR_INSUFFICIENT_BUFFER ) ) {
- in.buffer_size = out.needed;
-
- CLI_DO_RPC_WERR( cli, mem_ctx, &ndr_table_svcctl.syntax_id,
- SVCCTL_QUERY_SERVICE_CONFIG_W,
- in, out,
- qbuf, rbuf,
- svcctl_io_q_query_service_config,
- svcctl_io_r_query_service_config,
- WERR_GENERAL_FAILURE );
- }
-
- if ( !W_ERROR_IS_OK( out.status ) )
- return out.status;
-
- memcpy( config, &out.config, sizeof(SERVICE_CONFIG) );
-
- config->executablepath = TALLOC_ZERO_P( mem_ctx, UNISTR2 );
- config->loadordergroup = TALLOC_ZERO_P( mem_ctx, UNISTR2 );
- config->dependencies = TALLOC_ZERO_P( mem_ctx, UNISTR2 );
- config->startname = TALLOC_ZERO_P( mem_ctx, UNISTR2 );
- config->displayname = TALLOC_ZERO_P( mem_ctx, UNISTR2 );
-
- if ( out.config.executablepath ) {
- config->executablepath = TALLOC_ZERO_P( mem_ctx, UNISTR2 );
- copy_unistr2( config->executablepath, out.config.executablepath );
- }
-
- if ( out.config.loadordergroup ) {
- config->loadordergroup = TALLOC_ZERO_P( mem_ctx, UNISTR2 );
- copy_unistr2( config->loadordergroup, out.config.loadordergroup );
- }
-
- if ( out.config.dependencies ) {
- config->dependencies = TALLOC_ZERO_P( mem_ctx, UNISTR2 );
- copy_unistr2( config->dependencies, out.config.dependencies );
- }
-
- if ( out.config.startname ) {
- config->startname = TALLOC_ZERO_P( mem_ctx, UNISTR2 );
- copy_unistr2( config->startname, out.config.startname );
- }
-
- if ( out.config.displayname ) {
- config->displayname = TALLOC_ZERO_P( mem_ctx, UNISTR2 );
- copy_unistr2( config->displayname, out.config.displayname );
- }
-
- return out.status;
-}
diff --git a/source3/rpc_client/init_netlogon.c b/source3/rpc_client/init_netlogon.c
index 61841953fc..e4c39e739e 100644
--- a/source3/rpc_client/init_netlogon.c
+++ b/source3/rpc_client/init_netlogon.c
@@ -391,3 +391,20 @@ void init_netr_PasswordInfo(struct netr_PasswordInfo *r,
r->lmpassword = lmpassword;
r->ntpassword = ntpassword;
}
+
+/*************************************************************************
+ inits a netr_CryptPassword structure
+ *************************************************************************/
+
+void init_netr_CryptPassword(const char *pwd,
+ unsigned char session_key[16],
+ struct netr_CryptPassword *pwd_buf)
+{
+ struct samr_CryptPassword password_buf;
+
+ encode_pw_buffer(password_buf.data, pwd, STR_UNICODE);
+
+ SamOEMhash(password_buf.data, session_key, 516);
+ memcpy(pwd_buf->data, password_buf.data, 512);
+ pwd_buf->length = IVAL(password_buf.data, 512);
+}
diff --git a/source3/rpc_client/init_samr.c b/source3/rpc_client/init_samr.c
index 2e757531ce..283be0d98b 100644
--- a/source3/rpc_client/init_samr.c
+++ b/source3/rpc_client/init_samr.c
@@ -41,21 +41,21 @@ void init_samr_DomInfo1(struct samr_DomInfo1 *r,
inits a structure.
********************************************************************/
-void init_samr_DomInfo2(struct samr_DomInfo2 *r,
- NTTIME force_logoff_time,
- const char *comment,
- const char *domain_name,
- const char *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)
+void init_samr_DomGeneralInformation(struct samr_DomGeneralInformation *r,
+ NTTIME force_logoff_time,
+ const char *oem_information,
+ const char *domain_name,
+ const char *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)
{
r->force_logoff_time = force_logoff_time;
- init_lsa_String(&r->comment, comment);
+ init_lsa_String(&r->oem_information, oem_information);
init_lsa_String(&r->domain_name, domain_name);
init_lsa_String(&r->primary, primary);
r->sequence_num = sequence_num;
@@ -81,10 +81,10 @@ void init_samr_DomInfo3(struct samr_DomInfo3 *r,
inits a structure.
********************************************************************/
-void init_samr_DomInfo4(struct samr_DomInfo4 *r,
- const char *comment)
+void init_samr_DomOEMInformation(struct samr_DomOEMInformation *r,
+ const char *oem_information)
{
- init_lsa_String(&r->comment, comment);
+ init_lsa_String(&r->oem_information, oem_information);
}
/*******************************************************************
diff --git a/source3/rpc_client/ndr.c b/source3/rpc_client/ndr.c
index 72a33137a6..9ada47a3f5 100644
--- a/source3/rpc_client/ndr.c
+++ b/source3/rpc_client/ndr.c
@@ -41,7 +41,7 @@ NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli,
call = &table->calls[opnum];
- push = ndr_push_init_ctx(mem_ctx);
+ push = ndr_push_init_ctx(mem_ctx, NULL);
if (!push) {
return NT_STATUS_NO_MEMORY;
}
@@ -77,7 +77,7 @@ NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli,
prs_mem_free( &r_ps );
- pull = ndr_pull_init_blob(&blob, mem_ctx);
+ pull = ndr_pull_init_blob(&blob, mem_ctx, NULL);
if (pull == NULL) {
return NT_STATUS_NO_MEMORY;
}
diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c
index c5d93864ba..7d31f4b2f0 100644
--- a/source3/rpc_parse/parse_svcctl.c
+++ b/source3/rpc_parse/parse_svcctl.c
@@ -58,51 +58,6 @@ static bool svcctl_io_service_status( const char *desc, SERVICE_STATUS *status,
/*******************************************************************
********************************************************************/
-static bool svcctl_io_service_config( const char *desc, SERVICE_CONFIG *config, prs_struct *ps, int depth )
-{
-
- prs_debug(ps, depth, desc, "svcctl_io_service_config");
- depth++;
-
- if(!prs_uint32("service_type", ps, depth, &config->service_type))
- return False;
- if(!prs_uint32("start_type", ps, depth, &config->start_type))
- return False;
- if(!prs_uint32("error_control", ps, depth, &config->error_control))
- return False;
-
- if (!prs_io_unistr2_p("", ps, depth, &config->executablepath))
- return False;
- if (!prs_io_unistr2_p("", ps, depth, &config->loadordergroup))
- return False;
-
- if(!prs_uint32("tag_id", ps, depth, &config->tag_id))
- return False;
-
- if (!prs_io_unistr2_p("", ps, depth, &config->dependencies))
- return False;
- if (!prs_io_unistr2_p("", ps, depth, &config->startname))
- return False;
- if (!prs_io_unistr2_p("", ps, depth, &config->displayname))
- return False;
-
- if (!prs_io_unistr2("", ps, depth, config->executablepath))
- return False;
- if (!prs_io_unistr2("", ps, depth, config->loadordergroup))
- return False;
- if (!prs_io_unistr2("", ps, depth, config->dependencies))
- return False;
- if (!prs_io_unistr2("", ps, depth, config->startname))
- return False;
- if (!prs_io_unistr2("", ps, depth, config->displayname))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
bool svcctl_io_enum_services_status( const char *desc, ENUM_SERVICES_STATUS *enum_status, RPC_BUFFER *buffer, int depth )
{
prs_struct *ps=&buffer->prs;
@@ -175,26 +130,6 @@ static uint32 sizeof_unistr2( UNISTR2 *string )
return size;
}
-/********************************************************************
-********************************************************************/
-
-uint32 svcctl_sizeof_service_config( SERVICE_CONFIG *config )
-{
- uint32 size = 0;
-
- size = sizeof(uint32) * 4; /* static uint32 fields */
-
- /* now add the UNISTR2 + pointer sizes */
-
- size += sizeof(uint32) * sizeof_unistr2(config->executablepath);
- size += sizeof(uint32) * sizeof_unistr2(config->loadordergroup);
- size += sizeof(uint32) * sizeof_unistr2(config->dependencies);
- size += sizeof(uint32) * sizeof_unistr2(config->startname);
- size += sizeof(uint32) * sizeof_unistr2(config->displayname);
-
- return size;
-}
-
/*******************************************************************
********************************************************************/
@@ -262,57 +197,6 @@ bool svcctl_io_r_enum_services_status(const char *desc, SVCCTL_R_ENUM_SERVICES_S
/*******************************************************************
********************************************************************/
-bool svcctl_io_q_query_service_config(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG *q_u, prs_struct *ps, int depth)
-{
- if (q_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_q_query_service_config");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!smb_io_pol_hnd("service_pol", &q_u->handle, ps, depth))
- return False;
-
- if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool svcctl_io_r_query_service_config(const char *desc, SVCCTL_R_QUERY_SERVICE_CONFIG *r_u, prs_struct *ps, int depth)
-{
- if (r_u == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "svcctl_io_r_query_service_config");
- depth++;
-
-
- if(!prs_align(ps))
- return False;
-
- if(!svcctl_io_service_config("config", &r_u->config, ps, depth))
- return False;
-
- if(!prs_uint32("needed", ps, depth, &r_u->needed))
- return False;
-
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
bool svcctl_io_q_query_service_config2(const char *desc, SVCCTL_Q_QUERY_SERVICE_CONFIG2 *q_u, prs_struct *ps, int depth)
{
if (q_u == NULL)
diff --git a/source3/rpc_server/srv_eventlog.c b/source3/rpc_server/srv_eventlog.c
index da761c905e..973be28040 100644
--- a/source3/rpc_server/srv_eventlog.c
+++ b/source3/rpc_server/srv_eventlog.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include "librpc/gen_ndr/srv_eventlog.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
diff --git a/source3/rpc_server/srv_eventlog_lib.c b/source3/rpc_server/srv_eventlog_lib.c
index e232a30078..9215a86d3f 100644
--- a/source3/rpc_server/srv_eventlog_lib.c
+++ b/source3/rpc_server/srv_eventlog_lib.c
@@ -344,7 +344,7 @@ ELOG_TDB *elog_open_tdb( char *logname, bool force_clear )
/* make sure that the eventlog dir exists */
eventlogdir = state_path( "eventlog" );
- if ( !directory_exist( eventlogdir, NULL ) )
+ if ( !directory_exist( eventlogdir ) )
mkdir( eventlogdir, 0755 );
/* get the path on disk */
diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c
index 94517f3478..2fa705daf3 100644
--- a/source3/rpc_server/srv_lsa_nt.c
+++ b/source3/rpc_server/srv_lsa_nt.c
@@ -290,22 +290,18 @@ static NTSTATUS lsa_get_generic_sd(TALLOC_CTX *mem_ctx, SEC_DESC **sd, size_t *s
DOM_SID adm_sid;
SEC_ACE ace[3];
- SEC_ACCESS mask;
SEC_ACL *psa = NULL;
- init_sec_access(&mask, LSA_POLICY_EXECUTE);
- init_sec_ace(&ace[0], &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
+ init_sec_ace(&ace[0], &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, LSA_POLICY_EXECUTE, 0);
sid_copy(&adm_sid, get_global_sam_sid());
sid_append_rid(&adm_sid, DOMAIN_GROUP_RID_ADMINS);
- init_sec_access(&mask, LSA_POLICY_ALL_ACCESS);
- init_sec_ace(&ace[1], &adm_sid, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
+ init_sec_ace(&ace[1], &adm_sid, SEC_ACE_TYPE_ACCESS_ALLOWED, LSA_POLICY_ALL_ACCESS, 0);
sid_copy(&local_adm_sid, &global_sid_Builtin);
sid_append_rid(&local_adm_sid, BUILTIN_ALIAS_RID_ADMINS);
- init_sec_access(&mask, LSA_POLICY_ALL_ACCESS);
- init_sec_ace(&ace[2], &local_adm_sid, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
+ init_sec_ace(&ace[2], &local_adm_sid, SEC_ACE_TYPE_ACCESS_ALLOWED, LSA_POLICY_ALL_ACCESS, 0);
if((psa = make_sec_acl(mem_ctx, NT4_ACL_REVISION, 3, ace)) == NULL)
return NT_STATUS_NO_MEMORY;
@@ -434,7 +430,7 @@ NTSTATUS _lsa_OpenPolicy(pipes_struct *p,
lsa_get_generic_sd(p->mem_ctx, &psd, &sd_size);
if(!se_access_check(psd, p->pipe_user.nt_user_token, des_access, &acc_granted, &status)) {
- if (geteuid() != 0) {
+ if (p->pipe_user.ut.uid != sec_initial_uid()) {
return status;
}
DEBUG(4,("ACCESS should be DENIED (granted: %#010x; required: %#010x)\n",
@@ -1206,8 +1202,8 @@ NTSTATUS _lsa_LookupNames4(pipes_struct *p,
q.in.num_names = r->in.num_names;
q.in.names = r->in.names;
q.in.level = r->in.level;
- q.in.unknown1 = r->in.unknown1;
- q.in.unknown2 = r->in.unknown2;
+ q.in.lookup_options = r->in.lookup_options;
+ q.in.client_revision = r->in.client_revision;
q.in.sids = r->in.sids;
q.in.count = r->in.count;
@@ -1466,6 +1462,16 @@ NTSTATUS _lsa_GetUserName(pipes_struct *p,
struct lsa_String *account_name = NULL;
struct lsa_String *authority_name = NULL;
+ if (r->in.account_name &&
+ *r->in.account_name) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ if (r->in.authority_name &&
+ *r->in.authority_name) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
if (p->server_info->guest) {
/*
* I'm 99% sure this is not the right place to do this,
@@ -1481,21 +1487,24 @@ NTSTATUS _lsa_GetUserName(pipes_struct *p,
domname = pdb_get_domain(p->server_info->sam_account);
}
- account_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_String);
+ account_name = TALLOC_P(p->mem_ctx, struct lsa_String);
if (!account_name) {
return NT_STATUS_NO_MEMORY;
}
+ init_lsa_String(account_name, username);
- authority_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_String);
- if (!authority_name) {
- return NT_STATUS_NO_MEMORY;
+ if (r->out.authority_name) {
+ authority_name = TALLOC_P(p->mem_ctx, struct lsa_String);
+ if (!authority_name) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ init_lsa_String(authority_name, domname);
}
- init_lsa_String(account_name, username);
- init_lsa_String(authority_name, domname);
-
*r->out.account_name = account_name;
- *r->out.authority_name = authority_name;
+ if (r->out.authority_name) {
+ *r->out.authority_name = authority_name;
+ }
return NT_STATUS_OK;
}
@@ -1526,7 +1535,8 @@ NTSTATUS _lsa_CreateAccount(pipes_struct *p,
/* check to see if the pipe_user is a Domain Admin since
account_pol.tdb was already opened as root, this is all we have */
- if ( !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
+ if ( p->pipe_user.ut.uid != sec_initial_uid()
+ && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
return NT_STATUS_ACCESS_DENIED;
if ( is_privileged_sid( r->in.sid ) )
@@ -1612,6 +1622,9 @@ NTSTATUS _lsa_EnumPrivsAccount(pipes_struct *p,
if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
+ if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
+ return NT_STATUS_ACCESS_DENIED;
+
if ( !get_privileges_for_sids( &mask, &info->sid, 1 ) )
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
@@ -1672,6 +1685,9 @@ NTSTATUS _lsa_GetSystemAccessAccount(pipes_struct *p,
if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
+ if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
+ return NT_STATUS_ACCESS_DENIED;
+
if (!lookup_sid(p->mem_ctx, &info->sid, NULL, NULL, NULL))
return NT_STATUS_ACCESS_DENIED;
@@ -1706,7 +1722,8 @@ NTSTATUS _lsa_SetSystemAccessAccount(pipes_struct *p,
/* check to see if the pipe_user is a Domain Admin since
account_pol.tdb was already opened as root, this is all we have */
- if ( !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
+ if ( p->pipe_user.ut.uid != sec_initial_uid()
+ && !nt_token_check_domain_rid( p->pipe_user.nt_user_token, DOMAIN_GROUP_RID_ADMINS ) )
return NT_STATUS_ACCESS_DENIED;
if (!pdb_getgrsid(&map, info->sid))
@@ -1816,7 +1833,6 @@ NTSTATUS _lsa_QuerySecurity(pipes_struct *p,
if (!(handle->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
return NT_STATUS_ACCESS_DENIED;
-
switch (r->in.sec_info) {
case 1:
/* SD contains only the owner */
@@ -2074,6 +2090,9 @@ NTSTATUS _lsa_EnumAccountRights(pipes_struct *p,
if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
+ if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
+ return NT_STATUS_ACCESS_DENIED;
+
/* according to an NT4 PDC, you can add privileges to SIDs even without
call_lsa_create_account() first. And you can use any arbitrary SID. */
@@ -2116,6 +2135,9 @@ NTSTATUS _lsa_LookupPrivValue(pipes_struct *p,
if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
+ if (!(info->access & LSA_POLICY_VIEW_LOCAL_INFORMATION))
+ return NT_STATUS_ACCESS_DENIED;
+
name = r->in.name->string;
DEBUG(10,("_lsa_lookup_priv_value: name = %s\n", name));
diff --git a/source3/rpc_server/srv_netlog_nt.c b/source3/rpc_server/srv_netlog_nt.c
index 4e211cfb81..2dc6cd6393 100644
--- a/source3/rpc_server/srv_netlog_nt.c
+++ b/source3/rpc_server/srv_netlog_nt.c
@@ -756,7 +756,7 @@ NTSTATUS _netr_LogonSamLogon(pipes_struct *p,
{
NTSTATUS status = NT_STATUS_OK;
struct netr_SamInfo3 *sam3 = NULL;
- union netr_LogonInfo *logon = r->in.logon;
+ union netr_LogonLevel *logon = r->in.logon;
fstring nt_username, nt_domain, nt_workstation;
auth_usersupplied_info *user_info = NULL;
auth_serversupplied_info *server_info = NULL;
@@ -838,7 +838,7 @@ NTSTATUS _netr_LogonSamLogon(pipes_struct *p,
}
switch (r->in.logon_level) {
- case INTERACTIVE_LOGON_TYPE:
+ case NetlogonInteractiveInformation:
fstrcpy(nt_username,
logon->password->identity_info.account_name.string);
fstrcpy(nt_domain,
@@ -848,7 +848,7 @@ NTSTATUS _netr_LogonSamLogon(pipes_struct *p,
DEBUG(3,("SAM Logon (Interactive). Domain:[%s]. ", lp_workgroup()));
break;
- case NET_LOGON_TYPE:
+ case NetlogonNetworkInformation:
fstrcpy(nt_username,
logon->network->identity_info.account_name.string);
fstrcpy(nt_domain,
@@ -873,7 +873,7 @@ NTSTATUS _netr_LogonSamLogon(pipes_struct *p,
status = NT_STATUS_OK;
switch (r->in.logon_level) {
- case NET_LOGON_TYPE:
+ case NetlogonNetworkInformation:
{
const char *wksname = nt_workstation;
@@ -902,7 +902,7 @@ NTSTATUS _netr_LogonSamLogon(pipes_struct *p,
}
break;
}
- case INTERACTIVE_LOGON_TYPE:
+ case NetlogonInteractiveInformation:
/* 'Interactive' authentication, supplies the password in its
MD4 form, encrypted with the session key. We will convert
this to challenge/response for the auth subsystem to chew
diff --git a/source3/rpc_server/srv_ntsvcs.c b/source3/rpc_server/srv_ntsvcs.c
index 100d577010..5010990b58 100644
--- a/source3/rpc_server/srv_ntsvcs.c
+++ b/source3/rpc_server/srv_ntsvcs.c
@@ -18,6 +18,7 @@
*/
#include "includes.h"
+#include "librpc/gen_ndr/srv_ntsvcs.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c
index 3968d41168..c8037e6e43 100644
--- a/source3/rpc_server/srv_pipe_hnd.c
+++ b/source3/rpc_server/srv_pipe_hnd.c
@@ -24,30 +24,8 @@
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
-#define PIPE "\\PIPE\\"
-#define PIPELEN strlen(PIPE)
-
-static smb_np_struct *chain_p;
static int pipes_open;
-/*
- * Sometimes I can't decide if I hate Windows printer driver
- * writers more than I hate the Windows spooler service driver
- * writers. This gets around a combination of bugs in the spooler
- * and the HP 8500 PCL driver that causes a spooler spin. JRA.
- *
- * bumped up from 20 -> 64 after viewing traffic from WordPerfect
- * 2002 running on NT 4.- SP6
- * bumped up from 64 -> 256 after viewing traffic from con2prt
- * for lots of printers on a WinNT 4.x SP6 box.
- */
-
-#ifndef MAX_OPEN_SPOOLSS_PIPES
-#define MAX_OPEN_SPOOLSS_PIPES 256
-#endif
-static int current_spoolss_pipes_open;
-
-static smb_np_struct *Pipes;
static pipes_struct *InternalPipes;
static struct bitmap *bmap;
@@ -94,15 +72,6 @@ void set_pipe_handle_offset(int max_open_files)
}
/****************************************************************************
- Reset pipe chain handle number.
-****************************************************************************/
-
-void reset_chain_p(void)
-{
- chain_p = NULL;
-}
-
-/****************************************************************************
Initialise pipe handle states.
****************************************************************************/
@@ -145,132 +114,20 @@ static bool pipe_init_outgoing_data(pipes_struct *p)
}
/****************************************************************************
- Find first available pipe slot.
-****************************************************************************/
-
-smb_np_struct *open_rpc_pipe_p(const char *pipe_name,
- connection_struct *conn, uint16 vuid)
-{
- int i;
- smb_np_struct *p, *p_it;
- static int next_pipe;
- bool is_spoolss_pipe = False;
-
- DEBUG(4,("Open pipe requested %s (pipes_open=%d)\n",
- pipe_name, pipes_open));
-
- if (strstr(pipe_name, "spoolss")) {
- is_spoolss_pipe = True;
- }
-
- if (is_spoolss_pipe && current_spoolss_pipes_open >= MAX_OPEN_SPOOLSS_PIPES) {
- DEBUG(10,("open_rpc_pipe_p: spooler bug workaround. Denying open on pipe %s\n",
- pipe_name ));
- return NULL;
- }
-
- /* not repeating pipe numbers makes it easier to track things in
- log files and prevents client bugs where pipe numbers are reused
- over connection restarts */
-
- if (next_pipe == 0) {
- next_pipe = (sys_getpid() ^ time(NULL)) % MAX_OPEN_PIPES;
- }
-
- i = bitmap_find(bmap, next_pipe);
-
- if (i == -1) {
- DEBUG(0,("ERROR! Out of pipe structures\n"));
- return NULL;
- }
-
- next_pipe = (i+1) % MAX_OPEN_PIPES;
-
- for (p = Pipes; p; p = p->next) {
- DEBUG(5,("open_rpc_pipe_p: name %s pnum=%x\n", p->name, p->pnum));
- }
-
- p = talloc(NULL, smb_np_struct);
- if (!p) {
- DEBUG(0,("ERROR! no memory for smb_np_struct!\n"));
- return NULL;
- }
-
- ZERO_STRUCTP(p);
-
- p->name = talloc_strdup(p, pipe_name);
- if (p->name == NULL) {
- TALLOC_FREE(p);
- DEBUG(0,("ERROR! no memory for pipe name!\n"));
- return NULL;
- }
-
- /* add a dso mechanism instead of this, here */
-
- p->namedpipe_create = make_internal_rpc_pipe_p;
- p->namedpipe_read = read_from_internal_pipe;
- p->namedpipe_write = write_to_internal_pipe;
-
- p->np_state = p->namedpipe_create(pipe_name, conn->client_address,
- conn->server_info, vuid);
-
- if (p->np_state == NULL) {
- DEBUG(0,("open_rpc_pipe_p: make_internal_rpc_pipe_p failed.\n"));
- TALLOC_FREE(p);
- return NULL;
- }
-
- DLIST_ADD(Pipes, p);
-
- /*
- * Initialize the incoming RPC data buffer with one PDU worth of memory.
- * We cheat here and say we're marshalling, as we intend to add incoming
- * data directly into the prs_struct and we want it to auto grow. We will
- * change the type to UNMARSALLING before processing the stream.
- */
-
- bitmap_set(bmap, i);
- i += pipe_handle_offset;
-
- pipes_open++;
-
- p->pnum = i;
-
- p->open = True;
- p->device_state = 0;
- p->priority = 0;
- p->conn = conn;
- p->vuid = vuid;
-
- p->max_trans_reply = 0;
-
- DEBUG(4,("Opened pipe %s with handle %x (pipes_open=%d)\n",
- pipe_name, i, pipes_open));
-
- chain_p = p;
-
- /* Iterate over p_it as a temp variable, to display all open pipes */
- for (p_it = Pipes; p_it; p_it = p_it->next) {
- DEBUG(5,("open pipes: name %s pnum=%x\n", p_it->name, p_it->pnum));
- }
-
- return chain_p;
-}
-
-/****************************************************************************
Make an internal namedpipes structure
****************************************************************************/
-struct pipes_struct *make_internal_rpc_pipe_p(const char *pipe_name,
- const char *client_address,
- struct auth_serversupplied_info *server_info,
- uint16_t vuid)
+static struct pipes_struct *make_internal_rpc_pipe_p(TALLOC_CTX *mem_ctx,
+ const char *pipe_name,
+ const char *client_address,
+ struct auth_serversupplied_info *server_info,
+ uint16_t vuid)
{
pipes_struct *p;
DEBUG(4,("Create pipe requested %s\n", pipe_name));
- p = TALLOC_ZERO_P(NULL, pipes_struct);
+ p = TALLOC_ZERO_P(mem_ctx, struct pipes_struct);
if (!p) {
DEBUG(0,("ERROR! no memory for pipes_struct!\n"));
@@ -903,26 +760,10 @@ incoming data size = %u\n", (unsigned int)p->in_data.pdu_received_len, (unsigned
}
/****************************************************************************
- Accepts incoming data on an rpc pipe.
-****************************************************************************/
-
-ssize_t write_to_pipe(smb_np_struct *p, char *data, size_t n)
-{
- DEBUG(6,("write_to_pipe: %x", p->pnum));
-
- DEBUG(6,(" name: %s open: %s len: %d\n",
- p->name, BOOLSTR(p->open), (int)n));
-
- dump_data(50, (uint8 *)data, n);
-
- return p->namedpipe_write(p->np_state, data, n);
-}
-
-/****************************************************************************
Accepts incoming data on an internal rpc pipe.
****************************************************************************/
-ssize_t write_to_internal_pipe(struct pipes_struct *p, char *data, size_t n)
+static ssize_t write_to_internal_pipe(struct pipes_struct *p, char *data, size_t n)
{
size_t data_left = n;
@@ -957,32 +798,8 @@ ssize_t write_to_internal_pipe(struct pipes_struct *p, char *data, size_t n)
have been prepared into arrays of headers + data stream sections.
****************************************************************************/
-ssize_t read_from_pipe(smb_np_struct *p, char *data, size_t n,
- bool *is_data_outstanding)
-{
- if (!p || !p->open) {
- DEBUG(0,("read_from_pipe: pipe not open\n"));
- return -1;
- }
-
- DEBUG(6,("read_from_pipe: %x", p->pnum));
-
- return p->namedpipe_read(p->np_state, data, n, is_data_outstanding);
-}
-
-/****************************************************************************
- Replies to a request to read data from a pipe.
-
- Headers are interspersed with the data at PDU intervals. By the time
- this function is called, the start of the data could possibly have been
- read by an SMBtrans (file_offset != 0).
-
- Calling create_rpc_reply() here is a hack. The data should already
- have been prepared into arrays of headers + data stream sections.
-****************************************************************************/
-
-ssize_t read_from_internal_pipe(struct pipes_struct *p, char *data, size_t n,
- bool *is_data_outstanding)
+static ssize_t read_from_internal_pipe(struct pipes_struct *p, char *data, size_t n,
+ bool *is_data_outstanding)
{
uint32 pdu_remaining = 0;
ssize_t data_returned = 0;
@@ -1072,106 +889,6 @@ returning %d bytes.\n", p->name, (unsigned int)p->out_data.current_pdu_len,
}
/****************************************************************************
- Wait device state on a pipe. Exactly what this is for is unknown...
-****************************************************************************/
-
-bool wait_rpc_pipe_hnd_state(smb_np_struct *p, uint16 priority)
-{
- if (p == NULL) {
- return False;
- }
-
- if (p->open) {
- DEBUG(3,("wait_rpc_pipe_hnd_state: Setting pipe wait state priority=%x on pipe (name=%s)\n",
- priority, p->name));
-
- p->priority = priority;
-
- return True;
- }
-
- DEBUG(3,("wait_rpc_pipe_hnd_state: Error setting pipe wait state priority=%x (name=%s)\n",
- priority, p->name));
- return False;
-}
-
-
-/****************************************************************************
- Set device state on a pipe. Exactly what this is for is unknown...
-****************************************************************************/
-
-bool set_rpc_pipe_hnd_state(smb_np_struct *p, uint16 device_state)
-{
- if (p == NULL) {
- return False;
- }
-
- if (p->open) {
- DEBUG(3,("set_rpc_pipe_hnd_state: Setting pipe device state=%x on pipe (name=%s)\n",
- device_state, p->name));
-
- p->device_state = device_state;
-
- return True;
- }
-
- DEBUG(3,("set_rpc_pipe_hnd_state: Error setting pipe device state=%x (name=%s)\n",
- device_state, p->name));
- return False;
-}
-
-
-/****************************************************************************
- Close an rpc pipe.
-****************************************************************************/
-
-bool close_rpc_pipe_hnd(smb_np_struct *p)
-{
- if (!p) {
- DEBUG(0,("Invalid pipe in close_rpc_pipe_hnd\n"));
- return False;
- }
-
- TALLOC_FREE(p->np_state);
-
- bitmap_clear(bmap, p->pnum - pipe_handle_offset);
-
- pipes_open--;
-
- DEBUG(4,("closed pipe name %s pnum=%x (pipes_open=%d)\n",
- p->name, p->pnum, pipes_open));
-
- DLIST_REMOVE(Pipes, p);
-
- /* TODO: Remove from pipe open db */
-
- if ( !delete_pipe_opendb( p ) ) {
- DEBUG(3,("close_rpc_pipe_hnd: failed to delete %s "
- "pipe from open db.\n", p->name));
- }
-
- TALLOC_FREE(p);
-
- return True;
-}
-
-/****************************************************************************
- Close all pipes on a connection.
-****************************************************************************/
-
-void pipe_close_conn(connection_struct *conn)
-{
- smb_np_struct *p, *next;
-
- for (p=Pipes;p;p=next) {
- next = p->next;
- if (p->conn == conn) {
- close_rpc_pipe_hnd(p);
- }
- }
-}
-
-/****************************************************************************
Close an rpc pipe.
****************************************************************************/
@@ -1210,40 +927,92 @@ static int close_internal_rpc_pipe_hnd(struct pipes_struct *p)
return True;
}
-/****************************************************************************
- Find an rpc pipe given a pipe handle in a buffer and an offset.
-****************************************************************************/
+bool fsp_is_np(struct files_struct *fsp)
+{
+ return ((fsp != NULL)
+ && (fsp->fake_file_handle != NULL)
+ && (fsp->fake_file_handle->type == FAKE_FILE_TYPE_NAMED_PIPE));
+}
-smb_np_struct *get_rpc_pipe_p(uint16 pnum)
+NTSTATUS np_open(struct smb_request *smb_req, struct connection_struct *conn,
+ const char *name, struct files_struct **pfsp)
{
- if (chain_p) {
- return chain_p;
+ NTSTATUS status;
+ struct files_struct *fsp;
+ struct pipes_struct *p;
+
+ status = file_new(smb_req, conn, &fsp);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0, ("file_new failed: %s\n", nt_errstr(status)));
+ return status;
}
- return get_rpc_pipe(pnum);
-}
+ fsp->conn = conn;
+ fsp->fh->fd = -1;
+ fsp->vuid = smb_req->vuid;
+ fsp->can_lock = false;
+ fsp->access_mask = FILE_READ_DATA | FILE_WRITE_DATA;
+ string_set(&fsp->fsp_name, name);
-/****************************************************************************
- Find an rpc pipe given a pipe handle.
-****************************************************************************/
+ fsp->fake_file_handle = talloc(NULL, struct fake_file_handle);
+ if (fsp->fake_file_handle == NULL) {
+ file_free(smb_req, fsp);
+ return NT_STATUS_NO_MEMORY;
+ }
+ fsp->fake_file_handle->type = FAKE_FILE_TYPE_NAMED_PIPE;
-smb_np_struct *get_rpc_pipe(int pnum)
-{
- smb_np_struct *p;
+ p = make_internal_rpc_pipe_p(fsp->fake_file_handle, name,
+ conn->client_address, conn->server_info,
+ smb_req->vuid);
+ if (p == NULL) {
+ file_free(smb_req, fsp);
+ return NT_STATUS_PIPE_NOT_AVAILABLE;
+ }
+ fsp->fake_file_handle->private_data = p;
+
+ *pfsp = fsp;
- DEBUG(4,("search for pipe pnum=%x\n", pnum));
+ return NT_STATUS_OK;
+}
+
+NTSTATUS np_write(struct files_struct *fsp, uint8_t *data, size_t len,
+ ssize_t *nwritten)
+{
+ struct pipes_struct *p;
- for (p=Pipes;p;p=p->next) {
- DEBUG(5,("pipe name %s pnum=%x (pipes_open=%d)\n",
- p->name, p->pnum, pipes_open));
+ if (!fsp_is_np(fsp)) {
+ return NT_STATUS_INVALID_HANDLE;
}
- for (p=Pipes;p;p=p->next) {
- if (p->pnum == pnum) {
- chain_p = p;
- return p;
- }
+ p = talloc_get_type_abort(
+ fsp->fake_file_handle->private_data, struct pipes_struct);
+
+ DEBUG(6, ("np_write: %x name: %s len: %d\n", (int)fsp->fnum,
+ fsp->fsp_name, (int)len));
+ dump_data(50, data, len);
+
+ *nwritten = write_to_internal_pipe(p, (char *)data, len);
+
+ return ((*nwritten) >= 0)
+ ? NT_STATUS_OK : NT_STATUS_UNEXPECTED_IO_ERROR;
+}
+
+NTSTATUS np_read(struct files_struct *fsp, uint8_t *data, size_t len,
+ ssize_t *nread, bool *is_data_outstanding)
+{
+ struct pipes_struct *p;
+
+ if (!fsp_is_np(fsp)) {
+ return NT_STATUS_INVALID_HANDLE;
}
- return NULL;
+ p = talloc_get_type_abort(
+ fsp->fake_file_handle->private_data, struct pipes_struct);
+
+ *nread = read_from_internal_pipe(p, (char *)data, len,
+ is_data_outstanding);
+
+ return ((*nread) >= 0)
+ ? NT_STATUS_OK : NT_STATUS_UNEXPECTED_IO_ERROR;
+
}
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index 1b1e98c049..261d77ca65 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -113,36 +113,35 @@ static NTSTATUS make_samr_object_sd( TALLOC_CTX *ctx, SEC_DESC **psd, size_t *sd
{
DOM_SID domadmin_sid;
SEC_ACE ace[5]; /* at most 5 entries */
- SEC_ACCESS mask;
size_t i = 0;
SEC_ACL *psa = NULL;
/* basic access for Everyone */
- init_sec_access(&mask, map->generic_execute | map->generic_read );
- init_sec_ace(&ace[i++], &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
+ init_sec_ace(&ace[i++], &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED,
+ map->generic_execute | map->generic_read, 0);
/* add Full Access 'BUILTIN\Administrators' and 'BUILTIN\Account Operators */
- init_sec_access(&mask, map->generic_all);
-
- init_sec_ace(&ace[i++], &global_sid_Builtin_Administrators, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
- init_sec_ace(&ace[i++], &global_sid_Builtin_Account_Operators, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
+ init_sec_ace(&ace[i++], &global_sid_Builtin_Administrators,
+ SEC_ACE_TYPE_ACCESS_ALLOWED, map->generic_all, 0);
+ init_sec_ace(&ace[i++], &global_sid_Builtin_Account_Operators,
+ SEC_ACE_TYPE_ACCESS_ALLOWED, map->generic_all, 0);
/* Add Full Access for Domain Admins if we are a DC */
if ( IS_DC ) {
sid_copy( &domadmin_sid, get_global_sam_sid() );
sid_append_rid( &domadmin_sid, DOMAIN_GROUP_RID_ADMINS );
- init_sec_ace(&ace[i++], &domadmin_sid, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
+ init_sec_ace(&ace[i++], &domadmin_sid,
+ SEC_ACE_TYPE_ACCESS_ALLOWED, map->generic_all, 0);
}
/* if we have a sid, give it some special access */
if ( sid ) {
- init_sec_access( &mask, sid_access );
- init_sec_ace(&ace[i++], sid, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
+ init_sec_ace(&ace[i++], sid, SEC_ACE_TYPE_ACCESS_ALLOWED, sid_access, 0);
}
/* create the security descriptor */
@@ -826,6 +825,13 @@ NTSTATUS _samr_QuerySecurity(pipes_struct *p,
DEBUG(10,("_samr_QuerySecurity: querying security on SID: %s\n",
sid_string_dbg(&pol_sid)));
+ status = access_check_samr_function(acc_granted,
+ STD_RIGHT_READ_CONTROL_ACCESS,
+ "_samr_QuerySecurity");
+ if (NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
/* Check what typ of SID is beeing queried (e.g Domain SID, User SID, Group SID) */
/* To query the security of the SAM it self an invalid SID with S-0-0 is passed to this function */
@@ -1154,6 +1160,9 @@ NTSTATUS _samr_EnumDomainAliases(pipes_struct *p,
if (!find_policy_by_hnd(p, r->in.domain_handle, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
+ DEBUG(5,("_samr_EnumDomainAliases: sid %s\n",
+ sid_string_dbg(&info->sid)));
+
status = access_check_samr_function(info->acc_granted,
SA_RIGHT_DOMAIN_ENUM_ACCOUNTS,
"_samr_EnumDomainAliases");
@@ -1161,9 +1170,6 @@ NTSTATUS _samr_EnumDomainAliases(pipes_struct *p,
return status;
}
- DEBUG(5,("_samr_EnumDomainAliases: sid %s\n",
- sid_string_dbg(&info->sid)));
-
samr_array = TALLOC_ZERO_P(p->mem_ctx, struct samr_SamArray);
if (!samr_array) {
return NT_STATUS_NO_MEMORY;
@@ -1430,6 +1436,13 @@ NTSTATUS _samr_QueryDisplayInfo(pipes_struct *p,
if (!find_policy_by_hnd(p, r->in.domain_handle, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
+ status = access_check_samr_function(info->acc_granted,
+ SA_RIGHT_DOMAIN_ENUM_ACCOUNTS,
+ "_samr_QueryDisplayInfo");
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
/*
* calculate how many entries we will return.
* based on
@@ -2063,6 +2076,13 @@ NTSTATUS _samr_LookupRids(pipes_struct *p,
if (!get_lsa_policy_samr_sid(p, r->in.domain_handle, &pol_sid, &acc_granted, NULL))
return NT_STATUS_INVALID_HANDLE;
+ status = access_check_samr_function(acc_granted,
+ SA_RIGHT_DOMAIN_ENUM_ACCOUNTS,
+ "_samr__LookupRids");
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
if (num_rids > 1000) {
DEBUG(0, ("Got asked for %d rids (more than 1000) -- according "
"to samba4 idl this is not possible\n", num_rids));
@@ -2438,7 +2458,7 @@ static NTSTATUS get_user_info_20(TALLOC_CTX *mem_ctx,
if (munged_dial) {
blob = base64_decode_data_blob(munged_dial);
} else {
- blob = data_blob_string_const("");
+ blob = data_blob_string_const_null("");
}
status = init_samr_parameters_string(mem_ctx, &blob, &parameters);
@@ -2547,7 +2567,7 @@ static NTSTATUS get_user_info_21(TALLOC_CTX *mem_ctx,
if (munged_dial) {
blob = base64_decode_data_blob(munged_dial);
} else {
- blob = data_blob_string_const("");
+ blob = data_blob_string_const_null("");
}
status = init_samr_parameters_string(mem_ctx, &blob, &parameters);
@@ -2633,6 +2653,13 @@ NTSTATUS _samr_QueryUserInfo(pipes_struct *p,
if (!find_policy_by_hnd(p, r->in.user_handle, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
+ status = access_check_samr_function(info->acc_granted,
+ SA_RIGHT_DOMAIN_OPEN_ACCOUNT,
+ "_samr_QueryUserInfo");
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
domain_sid = info->sid;
sid_split_rid(&domain_sid, &rid);
@@ -2881,6 +2908,13 @@ static NTSTATUS samr_QueryDomainInfo_internal(const char *fn_name,
return NT_STATUS_INVALID_HANDLE;
}
+ status = access_check_samr_function(info->acc_granted,
+ SA_RIGHT_SAM_OPEN_DOMAIN,
+ "_samr_QueryDomainInfo_internal" );
+
+ if ( !NT_STATUS_IS_OK(status) )
+ return status;
+
switch (level) {
case 0x01:
@@ -2910,6 +2944,10 @@ static NTSTATUS samr_QueryDomainInfo_internal(const char *fn_name,
unix_to_nt_time_abs(&nt_expire, u_expire);
unix_to_nt_time_abs(&nt_min_age, u_min_age);
+ if (lp_check_password_script() && *lp_check_password_script()) {
+ password_properties |= DOMAIN_PASSWORD_COMPLEX;
+ }
+
init_samr_DomInfo1(&dom_info->info1,
(uint16)min_pass_len,
(uint16)pass_hist,
@@ -2943,18 +2981,18 @@ static NTSTATUS samr_QueryDomainInfo_internal(const char *fn_name,
if (lp_server_role() == ROLE_DOMAIN_BDC)
server_role = ROLE_DOMAIN_BDC;
- init_samr_DomInfo2(&dom_info->info2,
- nt_logout,
- lp_serverstring(),
- lp_workgroup(),
- global_myname(),
- seq_num,
- 1,
- server_role,
- 1,
- num_users,
- num_groups,
- num_aliases);
+ init_samr_DomGeneralInformation(&dom_info->general,
+ nt_logout,
+ lp_serverstring(),
+ lp_workgroup(),
+ global_myname(),
+ seq_num,
+ 1,
+ server_role,
+ 1,
+ num_users,
+ num_groups,
+ num_aliases);
break;
case 0x03:
@@ -2979,8 +3017,8 @@ static NTSTATUS samr_QueryDomainInfo_internal(const char *fn_name,
break;
case 0x04:
- init_samr_DomInfo4(&dom_info->info4,
- lp_serverstring());
+ init_samr_DomOEMInformation(&dom_info->oem,
+ lp_serverstring());
break;
case 0x05:
init_samr_DomInfo5(&dom_info->info5,
@@ -5602,16 +5640,32 @@ NTSTATUS _samr_QueryDomainInfo2(pipes_struct *p,
NTSTATUS _samr_SetDomainInfo(pipes_struct *p,
struct samr_SetDomainInfo *r)
{
+ struct samr_info *info = NULL;
time_t u_expire, u_min_age;
time_t u_logout;
time_t u_lock_duration, u_reset_time;
+ NTSTATUS result;
DEBUG(5,("_samr_SetDomainInfo: %d\n", __LINE__));
/* find the policy handle. open a policy on it. */
- if (!find_policy_by_hnd(p, r->in.domain_handle, NULL))
+ if (!find_policy_by_hnd(p, r->in.domain_handle, (void **)(void *)&info))
return NT_STATUS_INVALID_HANDLE;
+ /* We do have different access bits for info
+ * levels here, but we're really just looking for
+ * GENERIC_RIGHTS_DOMAIN_WRITE access. Unfortunately
+ * this maps to different specific bits. So
+ * assume if we have SA_RIGHT_DOMAIN_SET_INFO_1
+ * set we are ok. */
+
+ result = access_check_samr_function(info->acc_granted,
+ SA_RIGHT_DOMAIN_SET_INFO_1,
+ "_samr_SetDomainInfo");
+
+ if (!NT_STATUS_IS_OK(result))
+ return result;
+
DEBUG(5,("_samr_SetDomainInfo: level: %d\n", r->in.level));
switch (r->in.level) {
@@ -5669,6 +5723,7 @@ NTSTATUS _samr_GetDisplayEnumerationIndex(pipes_struct *p,
int i;
uint32_t num_account = 0;
struct samr_displayentry *entries = NULL;
+ NTSTATUS status;
DEBUG(5,("_samr_GetDisplayEnumerationIndex: %d\n", __LINE__));
@@ -5677,6 +5732,13 @@ NTSTATUS _samr_GetDisplayEnumerationIndex(pipes_struct *p,
return NT_STATUS_INVALID_HANDLE;
}
+ status = access_check_samr_function(info->acc_granted,
+ SA_RIGHT_DOMAIN_ENUM_ACCOUNTS,
+ "_samr_GetDisplayEnumerationIndex");
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
if ((r->in.level < 1) || (r->in.level > 3)) {
DEBUG(0,("_samr_GetDisplayEnumerationIndex: "
"Unknown info level (%u)\n",
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 635898a9d5..af9246c49f 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -4373,7 +4373,7 @@ static bool construct_printer_info_7(Printer_entry *print_hnd, PRINTER_INFO_7 *p
if (is_printer_published(print_hnd, snum, &guid)) {
if (asprintf(&guid_str, "{%s}",
- smb_uuid_string(talloc_tos(), guid)) == -1) {
+ GUID_string(talloc_tos(), &guid)) == -1) {
return false;
}
strupper_m(guid_str);
@@ -6280,7 +6280,7 @@ bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, NT_PRINTER_INFO_LEV
numlines = 0;
/* Get lines and convert them back to dos-codepage */
- qlines = fd_lines_load(fd, &numlines, 0);
+ qlines = fd_lines_load(fd, &numlines, 0, NULL);
DEBUGADD(10,("Lines returned = [%d]\n", numlines));
close(fd);
@@ -6293,7 +6293,7 @@ bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, NT_PRINTER_INFO_LEV
DEBUGADD(6,("Line[0] = [%s]\n", qlines[0]));
}
- file_lines_free(qlines);
+ TALLOC_FREE(qlines);
return True;
}
@@ -7512,7 +7512,7 @@ WERROR enumports_hook(TALLOC_CTX *ctx, int *count, char ***lines )
}
numlines = 0;
- qlines = fd_lines_load(fd, &numlines, 0);
+ qlines = fd_lines_load(fd, &numlines, 0, NULL);
DEBUGADD(10,("Lines returned = [%d]\n", numlines));
close(fd);
}
@@ -7537,7 +7537,7 @@ static WERROR enumports_level_1(RPC_BUFFER *buffer, uint32 offered, uint32 *need
result = enumports_hook(talloc_tos(), &numlines, &qlines );
if (!W_ERROR_IS_OK(result)) {
- file_lines_free(qlines);
+ TALLOC_FREE(qlines);
return result;
}
@@ -7545,7 +7545,7 @@ static WERROR enumports_level_1(RPC_BUFFER *buffer, uint32 offered, uint32 *need
if((ports=SMB_MALLOC_ARRAY( PORT_INFO_1, numlines )) == NULL) {
DEBUG(10,("Returning WERR_NOMEM [%s]\n",
dos_errstr(WERR_NOMEM)));
- file_lines_free(qlines);
+ TALLOC_FREE(qlines);
return WERR_NOMEM;
}
@@ -7554,7 +7554,7 @@ static WERROR enumports_level_1(RPC_BUFFER *buffer, uint32 offered, uint32 *need
fill_port_1(&ports[i], qlines[i]);
}
}
- file_lines_free(qlines);
+ TALLOC_FREE(qlines);
*returned = numlines;
@@ -7603,13 +7603,13 @@ static WERROR enumports_level_2(RPC_BUFFER *buffer, uint32 offered, uint32 *need
result = enumports_hook(talloc_tos(), &numlines, &qlines );
if ( !W_ERROR_IS_OK(result)) {
- file_lines_free(qlines);
+ TALLOC_FREE(qlines);
return result;
}
if(numlines) {
if((ports=SMB_MALLOC_ARRAY( PORT_INFO_2, numlines)) == NULL) {
- file_lines_free(qlines);
+ TALLOC_FREE(qlines);
return WERR_NOMEM;
}
@@ -7619,7 +7619,7 @@ static WERROR enumports_level_2(RPC_BUFFER *buffer, uint32 offered, uint32 *need
}
}
- file_lines_free(qlines);
+ TALLOC_FREE(qlines);
*returned = numlines;
diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c
index bb9c3687fb..b99c77c9b8 100644
--- a/source3/rpc_server/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srv_srvsvc_nt.c
@@ -1700,7 +1700,9 @@ WERROR _srvsvc_NetShareAdd(pipes_struct *p,
DEBUG(5,("_srvsvc_NetShareAdd: %d\n", __LINE__));
- *r->out.parm_error = 0;
+ if (r->out.parm_error) {
+ *r->out.parm_error = 0;
+ }
get_current_user(&user,p);
@@ -2110,7 +2112,7 @@ WERROR _srvsvc_NetGetFileSecurity(pipes_struct *p,
psd->dacl->revision = NT4_ACL_REVISION;
- close_file(fsp, NORMAL_CLOSE);
+ close_file(NULL, fsp, NORMAL_CLOSE);
vfs_ChDir(conn, oldcwd);
conn_free_internal(conn);
return WERR_OK;
@@ -2118,7 +2120,7 @@ WERROR _srvsvc_NetGetFileSecurity(pipes_struct *p,
error_exit:
if (fsp) {
- close_file(fsp, NORMAL_CLOSE);
+ close_file(NULL, fsp, NORMAL_CLOSE);
}
if (oldcwd) {
@@ -2148,6 +2150,8 @@ WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p,
connection_struct *conn = NULL;
int snum;
char *oldcwd = NULL;
+ struct security_descriptor *psd = NULL;
+ uint32_t security_info_sent = 0;
ZERO_STRUCT(st);
@@ -2196,9 +2200,29 @@ WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p,
goto error_exit;
}
+ psd = r->in.sd_buf->sd;
+ security_info_sent = r->in.securityinformation;
+
+ if (psd->owner_sid==0) {
+ security_info_sent &= ~OWNER_SECURITY_INFORMATION;
+ }
+ if (psd->group_sid==0) {
+ security_info_sent &= ~GROUP_SECURITY_INFORMATION;
+ }
+ if (psd->sacl==0) {
+ security_info_sent &= ~SACL_SECURITY_INFORMATION;
+ }
+ if (psd->dacl==0) {
+ security_info_sent &= ~DACL_SECURITY_INFORMATION;
+ }
+
+ /* Convert all the generic bits. */
+ security_acl_map_generic(psd->dacl, &file_generic_mapping);
+ security_acl_map_generic(psd->sacl, &file_generic_mapping);
+
nt_status = SMB_VFS_FSET_NT_ACL(fsp,
- r->in.securityinformation,
- r->in.sd_buf->sd);
+ security_info_sent,
+ psd);
if (!NT_STATUS_IS_OK(nt_status) ) {
DEBUG(3,("_srvsvc_NetSetFileSecurity: Unable to set NT ACL "
@@ -2207,7 +2231,7 @@ WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p,
goto error_exit;
}
- close_file(fsp, NORMAL_CLOSE);
+ close_file(NULL, fsp, NORMAL_CLOSE);
vfs_ChDir(conn, oldcwd);
conn_free_internal(conn);
return WERR_OK;
@@ -2215,7 +2239,7 @@ WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p,
error_exit:
if (fsp) {
- close_file(fsp, NORMAL_CLOSE);
+ close_file(NULL, fsp, NORMAL_CLOSE);
}
if (oldcwd) {
diff --git a/source3/rpc_server/srv_svcctl.c b/source3/rpc_server/srv_svcctl.c
index 483fb8e1e9..4b3fdda3cb 100644
--- a/source3/rpc_server/srv_svcctl.c
+++ b/source3/rpc_server/srv_svcctl.c
@@ -18,6 +18,7 @@
*/
#include "includes.h"
+#include "librpc/gen_ndr/srv_svcctl.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
@@ -155,23 +156,7 @@ static bool api_svcctl_control_service(pipes_struct *p)
static bool api_svcctl_query_service_config(pipes_struct *p)
{
- SVCCTL_Q_QUERY_SERVICE_CONFIG q_u;
- SVCCTL_R_QUERY_SERVICE_CONFIG 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(!svcctl_io_q_query_service_config("", &q_u, data, 0))
- return False;
-
- r_u.status = _svcctl_query_service_config(p, &q_u, &r_u);
-
- if(!svcctl_io_r_query_service_config("", &r_u, rdata, 0))
- return False;
-
- return True;
+ return proxy_svcctl_call(p, SVCCTL_QUERY_SERVICE_CONFIG_W);
}
/*******************************************************************
diff --git a/source3/rpc_server/srv_svcctl_nt.c b/source3/rpc_server/srv_svcctl_nt.c
index 6bb538a311..a7215ac686 100644
--- a/source3/rpc_server/srv_svcctl_nt.c
+++ b/source3/rpc_server/srv_svcctl_nt.c
@@ -6,6 +6,7 @@
*
* Largely Rewritten (Again) by:
* Copyright (C) Gerald (Jerry) Carter 2005.
+ * 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
@@ -61,7 +62,7 @@ static const struct generic_mapping svc_generic_map =
bool init_service_op_table( void )
{
const char **service_list = lp_svcctl_list();
- int num_services = SVCCTL_NUM_INTERNAL_SERVICES + str_list_count( service_list );
+ int num_services = SVCCTL_NUM_INTERNAL_SERVICES + str_list_length( service_list );
int i;
if ( !(svcctl_ops = TALLOC_ARRAY( NULL, struct service_control_op, num_services+1)) ) {
@@ -140,7 +141,6 @@ static NTSTATUS svcctl_access_check( SEC_DESC *sec_desc, NT_USER_TOKEN *token,
static SEC_DESC* construct_scm_sd( TALLOC_CTX *ctx )
{
SEC_ACE ace[2];
- SEC_ACCESS mask;
size_t i = 0;
SEC_DESC *sd;
SEC_ACL *acl;
@@ -148,13 +148,13 @@ static SEC_DESC* construct_scm_sd( TALLOC_CTX *ctx )
/* basic access for Everyone */
- init_sec_access(&mask, SC_MANAGER_READ_ACCESS );
- init_sec_ace(&ace[i++], &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
+ init_sec_ace(&ace[i++], &global_sid_World,
+ SEC_ACE_TYPE_ACCESS_ALLOWED, SC_MANAGER_READ_ACCESS, 0);
/* Full Access 'BUILTIN\Administrators' */
- init_sec_access(&mask,SC_MANAGER_ALL_ACCESS );
- init_sec_ace(&ace[i++], &global_sid_Builtin_Administrators, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
+ init_sec_ace(&ace[i++], &global_sid_Builtin_Administrators,
+ SEC_ACE_TYPE_ACCESS_ALLOWED, SC_MANAGER_ALL_ACCESS, 0);
/* create the security descriptor */
@@ -611,7 +611,9 @@ WERROR _svcctl_query_service_status_ex( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_
/********************************************************************
********************************************************************/
-static WERROR fill_svc_config( TALLOC_CTX *ctx, const char *name, SERVICE_CONFIG *config, NT_USER_TOKEN *token )
+static WERROR fill_svc_config( TALLOC_CTX *ctx, const char *name,
+ struct QUERY_SERVICE_CONFIG *config,
+ NT_USER_TOKEN *token )
{
REGVAL_CTR *values;
REGISTRY_VALUE *val;
@@ -623,20 +625,17 @@ static WERROR fill_svc_config( TALLOC_CTX *ctx, const char *name, SERVICE_CONFIG
/* now fill in the individual values */
- config->displayname = TALLOC_ZERO_P( ctx, UNISTR2 );
if ( (val = regval_ctr_getvalue( values, "DisplayName" )) != NULL )
- init_unistr2( config->displayname, regval_sz( val ), UNI_STR_TERMINATE );
+ config->displayname = regval_sz(val);
else
- init_unistr2( config->displayname, name, UNI_STR_TERMINATE );
+ config->displayname = name;
if ( (val = regval_ctr_getvalue( values, "ObjectName" )) != NULL ) {
- config->startname = TALLOC_ZERO_P( ctx, UNISTR2 );
- init_unistr2( config->startname, regval_sz( val ), UNI_STR_TERMINATE );
+ config->startname = regval_sz(val);
}
if ( (val = regval_ctr_getvalue( values, "ImagePath" )) != NULL ) {
- config->executablepath = TALLOC_ZERO_P( ctx, UNISTR2 );
- init_unistr2( config->executablepath, regval_sz( val ), UNI_STR_TERMINATE );
+ config->executablepath = regval_sz(val);
}
/* a few hard coded values */
@@ -664,11 +663,13 @@ static WERROR fill_svc_config( TALLOC_CTX *ctx, const char *name, SERVICE_CONFIG
}
/********************************************************************
+ _svcctl_QueryServiceConfigW
********************************************************************/
-WERROR _svcctl_query_service_config( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CONFIG *q_u, SVCCTL_R_QUERY_SERVICE_CONFIG *r_u )
+WERROR _svcctl_QueryServiceConfigW(pipes_struct *p,
+ struct svcctl_QueryServiceConfigW *r)
{
- SERVICE_INFO *info = find_service_info_by_hnd( p, &q_u->handle );
+ SERVICE_INFO *info = find_service_info_by_hnd( p, r->in.handle );
uint32 buffer_size;
WERROR wresult;
@@ -683,17 +684,17 @@ WERROR _svcctl_query_service_config( pipes_struct *p, SVCCTL_Q_QUERY_SERVICE_CON
/* we have to set the outgoing buffer size to the same as the
incoming buffer size (even in the case of failure */
- r_u->needed = q_u->buffer_size;
+ *r->out.bytes_needed = r->in.buf_size;
- wresult = fill_svc_config( p->mem_ctx, info->name, &r_u->config, p->pipe_user.nt_user_token );
+ wresult = fill_svc_config( p->mem_ctx, info->name, r->out.query, p->pipe_user.nt_user_token );
if ( !W_ERROR_IS_OK(wresult) )
return wresult;
- buffer_size = svcctl_sizeof_service_config( &r_u->config );
- r_u->needed = (buffer_size > q_u->buffer_size) ? buffer_size : q_u->buffer_size;
+ buffer_size = ndr_size_QUERY_SERVICE_CONFIG(r->out.query, 0);
+ *r->out.bytes_needed = (buffer_size > r->in.buf_size) ? buffer_size : r->in.buf_size;
- if (buffer_size > q_u->buffer_size ) {
- ZERO_STRUCTP( &r_u->config );
+ if (buffer_size > r->in.buf_size ) {
+ TALLOC_FREE(r->out.query);
return WERR_INSUFFICIENT_BUFFER;
}
@@ -957,12 +958,6 @@ WERROR _svcctl_EnumServicesStatusW(pipes_struct *p, struct svcctl_EnumServicesSt
return WERR_NOT_SUPPORTED;
}
-WERROR _svcctl_QueryServiceConfigW(pipes_struct *p, struct svcctl_QueryServiceConfigW *r)
-{
- p->rng_fault_state = True;
- return WERR_NOT_SUPPORTED;
-}
-
WERROR _svcctl_QueryServiceLockStatusW(pipes_struct *p, struct svcctl_QueryServiceLockStatusW *r)
{
p->rng_fault_state = True;
diff --git a/source3/rpc_server/srv_winreg_nt.c b/source3/rpc_server/srv_winreg_nt.c
index 3991c5ae02..7e842ed54d 100644
--- a/source3/rpc_server/srv_winreg_nt.c
+++ b/source3/rpc_server/srv_winreg_nt.c
@@ -230,11 +230,11 @@ WERROR _winreg_QueryValue(pipes_struct *p, struct winreg_QueryValue *r)
if ( !regkey )
return WERR_BADFID;
- if ((r->out.value_length == NULL) || (r->out.type == NULL)) {
+ if ((r->out.data_length == NULL) || (r->out.type == NULL)) {
return WERR_INVALID_PARAM;
}
- *r->out.value_length = *r->out.type = REG_NONE;
+ *r->out.data_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));
@@ -290,8 +290,8 @@ WERROR _winreg_QueryValue(pipes_struct *p, struct winreg_QueryValue *r)
if (r->out.data_size) {
*r->out.data_size = 0;
}
- if (r->out.value_length) {
- *r->out.value_length = 0;
+ if (r->out.data_length) {
+ *r->out.data_length = 0;
}
return status;
}
@@ -306,18 +306,18 @@ WERROR _winreg_QueryValue(pipes_struct *p, struct winreg_QueryValue *r)
*r->out.type = val->type;
}
- *r->out.value_length = outbuf_size;
+ *r->out.data_length = outbuf_size;
if ( *r->in.data_size == 0 || !r->out.data ) {
status = WERR_OK;
- } else if ( *r->out.value_length > *r->in.data_size ) {
+ } else if ( *r->out.data_length > *r->in.data_size ) {
status = WERR_MORE_DATA;
} else {
- memcpy( r->out.data, outbuf, *r->out.value_length );
+ memcpy( r->out.data, outbuf, *r->out.data_length );
status = WERR_OK;
}
- *r->out.data_size = *r->out.value_length;
+ *r->out.data_size = *r->out.data_length;
if (free_prs) prs_mem_free(&prs_hkpd);
if (free_buf) SAFE_FREE(outbuf);
@@ -514,8 +514,8 @@ WERROR _winreg_InitiateSystemShutdownEx(pipes_struct *p, struct winreg_InitiateS
/* pull the message string and perform necessary sanity checks on it */
- if ( r->in.message && r->in.message->name && r->in.message->name->name ) {
- if ( (msg = talloc_strdup(p->mem_ctx, r->in.message->name->name )) == NULL ) {
+ if ( r->in.message && r->in.message->string ) {
+ if ( (msg = talloc_strdup(p->mem_ctx, r->in.message->string )) == NULL ) {
return WERR_NOMEM;
}
chkmsg = TALLOC_ARRAY(p->mem_ctx, char, strlen(msg)+1);
diff --git a/source3/rpcclient/cmd_drsuapi.c b/source3/rpcclient/cmd_drsuapi.c
index 71757f5ea3..8fbd798ed0 100644
--- a/source3/rpcclient/cmd_drsuapi.c
+++ b/source3/rpcclient/cmd_drsuapi.c
@@ -103,7 +103,7 @@ static WERROR cmd_drsuapi_cracknames(struct rpc_pipe_client *cli,
werr = cracknames(cli, mem_ctx,
&bind_handle,
- DRSUAPI_DS_NAME_FORMAT_UKNOWN,
+ DRSUAPI_DS_NAME_FORMAT_UNKNOWN,
DRSUAPI_DS_NAME_FORMAT_FQDN_1779,
1,
argv+1,
@@ -419,7 +419,7 @@ static WERROR cmd_drsuapi_getncchanges(struct rpc_pipe_client *cli,
werr = cracknames(cli, mem_ctx,
&bind_handle,
- DRSUAPI_DS_NAME_FORMAT_UKNOWN,
+ DRSUAPI_DS_NAME_FORMAT_UNKNOWN,
DRSUAPI_DS_NAME_FORMAT_FQDN_1779,
1,
&name,
@@ -495,9 +495,9 @@ static WERROR cmd_drsuapi_getncchanges(struct rpc_pipe_client *cli,
if (level_out == 1) {
out_level = 1;
ctr1 = &ctr.ctr1;
- } else if (level_out == 2) {
+ } else if (level_out == 2 && ctr.ctr2.mszip1.ts) {
out_level = 1;
- ctr1 = ctr.ctr2.ctr.mszip1.ctr1;
+ ctr1 = &ctr.ctr2.mszip1.ts->ctr1;
}
status = cli_get_session_key(mem_ctx, cli, &session_key);
@@ -527,9 +527,16 @@ static WERROR cmd_drsuapi_getncchanges(struct rpc_pipe_client *cli,
ctr6 = &ctr.ctr6;
} else if (level_out == 7
&& ctr.ctr7.level == 6
- && ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_MSZIP) {
+ && ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_MSZIP
+ && ctr.ctr7.ctr.mszip6.ts) {
out_level = 6;
- ctr6 = ctr.ctr7.ctr.mszip6.ctr6;
+ ctr6 = &ctr.ctr7.ctr.mszip6.ts->ctr6;
+ } else if (level_out == 7
+ && ctr.ctr7.level == 6
+ && ctr.ctr7.type == DRSUAPI_COMPRESSION_TYPE_XPRESS
+ && ctr.ctr7.ctr.xpress6.ts) {
+ out_level = 6;
+ ctr6 = &ctr.ctr7.ctr.xpress6.ts->ctr6;
}
if (out_level == 6) {
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c
index 5b5b4ff78c..aa8662ce9d 100644
--- a/source3/rpcclient/cmd_lsarpc.c
+++ b/source3/rpcclient/cmd_lsarpc.c
@@ -61,12 +61,11 @@ done:
static void display_query_info_1(struct lsa_AuditLogInfo *r)
{
d_printf("percent_full:\t%d\n", r->percent_full);
- d_printf("log_size:\t%d\n", r->log_size);
+ d_printf("maximum_log_size:\t%d\n", r->maximum_log_size);
d_printf("retention_time:\t%lld\n", (long long)r->retention_time);
d_printf("shutdown_in_progress:\t%d\n", r->shutdown_in_progress);
d_printf("time_to_shutdown:\t%lld\n", (long long)r->time_to_shutdown);
d_printf("next_audit_record:\t%d\n", r->next_audit_record);
- d_printf("unknown:\t%d\n", r->unknown);
}
static void display_query_info_2(struct lsa_AuditEventsInfo *r)
@@ -103,7 +102,6 @@ static void display_query_info_11(struct lsa_AuditFullQueryInfo *r)
{
d_printf("Shutdown on full: %d\n", r->shutdown_on_full);
d_printf("Log is full: %d\n", r->log_is_full);
- d_printf("Unknown: %d\n", r->unknown);
}
static void display_query_info_12(struct lsa_DnsDomainInfo *r)
@@ -112,8 +110,8 @@ static void display_query_info_12(struct lsa_DnsDomainInfo *r)
d_printf("Domain DNS Name: %s\n", r->dns_domain.string);
d_printf("Domain Forest Name: %s\n", r->dns_forest.string);
d_printf("Domain Sid: %s\n", sid_string_tos(r->sid));
- d_printf("Domain GUID: %s\n", smb_uuid_string(talloc_tos(),
- r->domain_guid));
+ d_printf("Domain GUID: %s\n", GUID_string(talloc_tos(),
+ &r->domain_guid));
}
static void display_lsa_query_info(union lsa_PolicyInformation *info,
@@ -1184,7 +1182,8 @@ static NTSTATUS cmd_lsa_get_username(struct rpc_pipe_client *cli,
/* Print results */
printf("Account Name: %s, Authority Name: %s\n",
- account_name->string, authority_name->string);
+ account_name->string, authority_name ? authority_name->string :
+ "");
rpccli_lsa_Close(cli, mem_ctx, &pol);
done:
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c
index 87ba65c14b..cdcc0ec28d 100644
--- a/source3/rpcclient/cmd_netlogon.c
+++ b/source3/rpcclient/cmd_netlogon.c
@@ -688,7 +688,7 @@ static NTSTATUS cmd_netlogon_sam_logon(struct rpc_pipe_client *cli,
const char **argv)
{
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
- int logon_type = NET_LOGON_TYPE;
+ int logon_type = NetlogonNetworkInformation;
const char *username, *password;
int auth_level = 2;
uint32 logon_param = 0;
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index fa1e0fda4d..3494e9123a 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -79,17 +79,17 @@ static void display_samr_user_info_21(struct samr_UserInfo21 *r)
dump_data(0, (uint8_t *)r->parameters.array, r->parameters.length*2);
printf("\tLogon Time :\t%s\n",
- http_timestring(nt_time_to_unix(r->last_logon)));
+ http_timestring(talloc_tos(), nt_time_to_unix(r->last_logon)));
printf("\tLogoff Time :\t%s\n",
- http_timestring(nt_time_to_unix(r->last_logoff)));
+ http_timestring(talloc_tos(), nt_time_to_unix(r->last_logoff)));
printf("\tKickoff Time :\t%s\n",
- http_timestring(nt_time_to_unix(r->acct_expiry)));
+ http_timestring(talloc_tos(), nt_time_to_unix(r->acct_expiry)));
printf("\tPassword last set Time :\t%s\n",
- http_timestring(nt_time_to_unix(r->last_password_change)));
+ http_timestring(talloc_tos(), nt_time_to_unix(r->last_password_change)));
printf("\tPassword can change Time :\t%s\n",
- http_timestring(nt_time_to_unix(r->allow_password_change)));
+ http_timestring(talloc_tos(), nt_time_to_unix(r->allow_password_change)));
printf("\tPassword must change Time:\t%s\n",
- http_timestring(nt_time_to_unix(r->force_password_change)));
+ http_timestring(talloc_tos(), nt_time_to_unix(r->force_password_change)));
printf("\tunknown_2[0..31]...\n"); /* user passwords? */
@@ -146,24 +146,24 @@ static void display_sam_dom_info_1(struct samr_DomInfo1 *info1)
display_time(info1->min_password_age));
}
-static void display_sam_dom_info_2(struct samr_DomInfo2 *info2)
+static void display_sam_dom_info_2(struct samr_DomGeneralInformation *general)
{
- printf("Domain:\t\t%s\n", info2->domain_name.string);
- printf("Server:\t\t%s\n", info2->primary.string);
- printf("Comment:\t%s\n", info2->comment.string);
+ printf("Domain:\t\t%s\n", general->domain_name.string);
+ printf("Server:\t\t%s\n", general->primary.string);
+ printf("Comment:\t%s\n", general->oem_information.string);
- printf("Total Users:\t%d\n", info2->num_users);
- printf("Total Groups:\t%d\n", info2->num_groups);
- printf("Total Aliases:\t%d\n", info2->num_aliases);
+ printf("Total Users:\t%d\n", general->num_users);
+ printf("Total Groups:\t%d\n", general->num_groups);
+ printf("Total Aliases:\t%d\n", general->num_aliases);
- printf("Sequence No:\t%llu\n", (unsigned long long)info2->sequence_num);
+ printf("Sequence No:\t%llu\n", (unsigned long long)general->sequence_num);
printf("Force Logoff:\t%d\n",
- (int)nt_time_to_unix_abs(&info2->force_logoff_time));
+ (int)nt_time_to_unix_abs(&general->force_logoff_time));
- printf("Unknown 2:\t0x%x\n", info2->unknown2);
- printf("Server Role:\t%s\n", server_role_str(info2->role));
- printf("Unknown 3:\t0x%x\n", info2->unknown3);
+ printf("Unknown 2:\t0x%x\n", general->unknown2);
+ printf("Server Role:\t%s\n", server_role_str(general->role));
+ printf("Unknown 3:\t0x%x\n", general->unknown3);
}
static void display_sam_dom_info_3(struct samr_DomInfo3 *info3)
@@ -172,9 +172,9 @@ static void display_sam_dom_info_3(struct samr_DomInfo3 *info3)
(int)nt_time_to_unix_abs(&info3->force_logoff_time));
}
-static void display_sam_dom_info_4(struct samr_DomInfo4 *info4)
+static void display_sam_dom_info_4(struct samr_DomOEMInformation *oem)
{
- printf("Comment:\t%s\n", info4->comment.string);
+ printf("Comment:\t%s\n", oem->oem_information.string);
}
static void display_sam_dom_info_5(struct samr_DomInfo5 *info5)
@@ -196,7 +196,7 @@ static void display_sam_dom_info_8(struct samr_DomInfo8 *info8)
{
printf("Sequence No:\t%llu\n", (unsigned long long)info8->sequence_num);
printf("Domain Create Time:\t%s\n",
- http_timestring(nt_time_to_unix(info8->domain_create_time)));
+ http_timestring(talloc_tos(), nt_time_to_unix(info8->domain_create_time)));
}
static void display_sam_dom_info_9(struct samr_DomInfo9 *info9)
@@ -218,7 +218,7 @@ static void display_sam_dom_info_13(struct samr_DomInfo13 *info13)
{
printf("Sequence No:\t%llu\n", (unsigned long long)info13->sequence_num);
printf("Domain Create Time:\t%s\n",
- http_timestring(nt_time_to_unix(info13->domain_create_time)));
+ http_timestring(talloc_tos(), nt_time_to_unix(info13->domain_create_time)));
printf("Unknown1:\t%d\n", info13->unknown1);
printf("Unknown2:\t%d\n", info13->unknown2);
@@ -1607,13 +1607,13 @@ static NTSTATUS cmd_samr_query_dominfo(struct rpc_pipe_client *cli,
display_sam_dom_info_1(&info->info1);
break;
case 2:
- display_sam_dom_info_2(&info->info2);
+ display_sam_dom_info_2(&info->general);
break;
case 3:
display_sam_dom_info_3(&info->info3);
break;
case 4:
- display_sam_dom_info_4(&info->info4);
+ display_sam_dom_info_4(&info->oem);
break;
case 5:
display_sam_dom_info_5(&info->info5);
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index 2a9f2b82bb..378ec891a7 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -691,7 +691,7 @@ static void display_reg_value(REGISTRY_VALUE value)
printf("%s: REG_SZ: %s\n", value.valuename, text ? text : "");
break;
case REG_BINARY: {
- char *hex = hex_encode(NULL, value.data_p, value.size);
+ char *hex = hex_encode_talloc(NULL, value.data_p, value.size);
size_t i, len;
printf("%s: REG_BINARY:", value.valuename);
len = strlen(hex);
diff --git a/source3/samba4-templates.mk b/source3/samba4-templates.mk
new file mode 100644
index 0000000000..e691af59e9
--- /dev/null
+++ b/source3/samba4-templates.mk
@@ -0,0 +1,144 @@
+# Templates file for Samba 4
+# This relies on GNU make.
+#
+# © 2008 Jelmer Vernooij <jelmer@samba.org>
+#
+###############################################################################
+# Templates
+###############################################################################
+
+# Partially link
+# Arguments: target object file, source object files
+define partial_link_template
+$(1): $(2) ;
+ @echo Partially linking $$@
+ @mkdir -p $$(@D)
+ @$$(PARTLINK) -o $$@ $$^
+endef
+
+# Link a binary
+# Arguments: target file, depends, flags
+define binary_link_template
+$(1)4: $(2) $(LIBREPLACE_OBJ) ;
+ @echo Linking $$@
+ @$$(BNLD) $$(BNLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3) $$(LIBS) $$(LIBREPLACE_OBJ)
+clean::
+ @rm -f $(1)
+
+everything:: $(1)4
+
+endef
+
+# Link a host-machine binary
+# Arguments: target file, depends, flags
+define host_binary_link_template
+$(1)4: $(2) $(LIBREPLACE_OBJ) ;
+ @echo Linking $$@
+ @$$(HOSTLD) $$(HOSTLD_FLAGS) -L$${builddir}/bin/static -o $$@ $$(INSTALL_LINK_FLAGS) $(3) $$(LIBREPLACE_OBJ)
+
+clean::
+ rm -f $(1)
+
+binaries:: $(1)4
+
+
+endef
+
+# Create a prototype header
+# Arguments: header file, c files
+define proto_header_template
+echo:: ;
+ echo $(1) ;
+
+proto:: $(1) ;
+
+clean:: ;
+ rm -f $(1) ;
+
+$(1): $(2) ;
+ @echo "Creating $$@"
+ @$$(PERL) $$(srcdir)/../source4/script/mkproto.pl --srcdir=$$(srcdir)/../source4 --builddir=$$(builddir)/../source4 --public=/dev/null --private=$$@ $$^
+endef
+
+# Shared module
+# Arguments: Target, dependencies, objects
+define shared_module_template
+
+$(1): $(2) ;
+ @echo Linking $$@
+ @mkdir -p $$(@D)
+ @$$(MDLD) $$(LDFLAGS) $$(MDLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
+
+PLUGINS += $(1)
+
+endef
+
+# Shared library
+# Arguments: Target, dependencies, link flags, soname
+define shared_library_template
+$(1): $(2)
+ @echo Linking $$@
+ @mkdir -p $$(@D)
+ @$$(SHLD) $$(LDFLAGS) $$(SHLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) \
+ $(3) \
+ $$(if $$(SONAMEFLAG), $$(SONAMEFLAG)$(notdir $(4))) $$(LIBS)
+
+ifneq ($(notdir $(1)),$(notdir $(4)))
+$(4): $(1)
+ @echo "Creating symbolic link for $$@"
+ @ln -fs $$(<F) $$@
+endif
+
+ifneq ($(notdir $(1)),$(notdir $(5)))
+$(5): $(1)
+ @echo "Creating symbolic link for $$@"
+ @ln -fs $$(<F) $$@
+endif
+endef
+
+# Shared alias
+# Arguments: Target, subsystem name, alias name
+define shared_module_alias_template
+bin/modules/$(2)/$(3).$$(SHLIBEXT): $(1)
+ @ln -fs $$(<F) $$@
+
+PLUGINS += bin/modules/$(2)/$(3).$$(SHLIBEXT)
+
+uninstallplugins::
+ @-rm $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
+installplugins::
+ @ln -fs $(1) $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT)
+
+endef
+
+define shared_module_install_template
+installplugins:: bin/modules/$(1)/$(2)
+ @echo Installing $(2) as $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
+ @mkdir -p $$(DESTDIR)$$(modulesdir)/$(1)/
+ @cp bin/modules/$(1)/$(2) $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
+uninstallplugins::
+ @echo Uninstalling $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
+ @-rm $$(DESTDIR)$$(modulesdir)/$(1)/$(2)
+
+endef
+
+# abspath for older makes
+abspath = $(shell cd $(dir $(1)); pwd)/$(notdir $(1))
+
+# Install a binary
+# Arguments: path to binary to install
+define binary_install_template
+installbin:: $$(DESTDIR)$$(bindir)/$(notdir $(1))4
+
+uninstallbin::
+ @echo "Removing $(notdir $(1))4"
+ @rm -f $$(DESTDIR)$$(bindir)/$(1)4
+endef
+
+define sbinary_install_template
+installsbin:: $$(DESTDIR)$$(sbindir)/$(notdir $(1))4 installdirs
+
+uninstallsbin::
+ @echo "Removing $(notdir $(1))4"
+ @rm -f $$(DESTDIR)$$(sbindir)/$(1)4
+endef
diff --git a/source3/samba4.m4 b/source3/samba4.m4
new file mode 100644
index 0000000000..05d655217f
--- /dev/null
+++ b/source3/samba4.m4
@@ -0,0 +1,162 @@
+BLDSHARED=true
+AC_SUBST(BLDSHARED)
+smbtorture4_path=bin/smbtorture4
+m4_include(build/m4/public.m4)
+
+m4_include(build/m4/check_python.m4)
+
+m4_include(build/m4/ac_pkg_swig.m4)
+
+AC_PROG_SWIG(1.3.36)
+
+AC_SAMBA_PYTHON_DEVEL([
+SMB_EXT_LIB(EXT_LIB_PYTHON, [$PYTHON_LDFLAGS], [$PYTHON_CFLAGS])
+SMB_ENABLE(EXT_LIB_PYTHON,YES)
+SMB_ENABLE(LIBPYTHON,YES)
+],[
+AC_MSG_ERROR([Python not found. Please install Python 2.x and its development headers/libraries.])
+])
+
+AC_MSG_CHECKING(python library directory)
+pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1, 0, '\\${prefix}')"`
+AC_MSG_RESULT($pythondir)
+
+AC_SUBST(pythondir)
+
+m4_include(lib/smbreadline/readline.m4)
+m4_include(heimdal_build/internal.m4)
+m4_include(../lib/util/fault.m4)
+m4_include(../lib/util/signal.m4)
+m4_include(../lib/util/util.m4)
+m4_include(../lib/util/fsusage.m4)
+m4_include(../lib/util/xattr.m4)
+m4_include(../lib/util/capability.m4)
+m4_include(../lib/util/time.m4)
+m4_include(../lib/popt/samba.m4)
+m4_include(lib/charset/config.m4)
+m4_include(lib/socket/config.m4)
+m4_include(nsswitch/nsstest.m4)
+m4_include(../pidl/config.m4)
+m4_include(../lib/zlib/zlib.m4)
+AC_ZLIB([
+SMB_EXT_LIB(ZLIB, [${ZLIB_LIBS}])
+],[
+SMB_INCLUDE_MK(lib/zlib.mk)
+])
+
+
+AC_CONFIG_FILES(../source4/lib/registry/registry.pc)
+AC_CONFIG_FILES(../source4/librpc/dcerpc.pc)
+AC_CONFIG_FILES(../librpc/ndr.pc)
+AC_CONFIG_FILES(../source4/lib/torture/torture.pc)
+AC_CONFIG_FILES(../source4/auth/gensec/gensec.pc)
+AC_CONFIG_FILES(../source4/param/samba-hostconfig.pc)
+AC_CONFIG_FILES(../source4/librpc/dcerpc_samr.pc)
+AC_CONFIG_FILES(../source4/librpc/dcerpc_atsvc.pc)
+
+SMB_EXT_LIB_FROM_PKGCONFIG(LIBTALLOC, talloc >= 1.2.0,
+ [],
+ [
+ SMB_INCLUDE_MK(../lib/talloc/config.mk)
+ ]
+)
+
+SMB_EXT_LIB_FROM_PKGCONFIG(LIBTDB, tdb >= 1.1.3,
+ [],
+ [
+ m4_include(../lib/tdb/libtdb.m4)
+ SMB_INCLUDE_MK(../lib/tdb/config.mk)
+ ]
+)
+
+SMB_INCLUDE_MK(../lib/tdb/python.mk)
+
+SMB_EXT_LIB_FROM_PKGCONFIG(LIBLDB, ldb >= 0.9.1,
+ [
+ SMB_INCLUDE_MK(lib/ldb/ldb_ildap/config.mk)
+ SMB_INCLUDE_MK(lib/ldb/tools/config.mk)
+ define_ldb_modulesdir=no
+ ],
+ [
+ # Here we need to do some tricks
+ # with AC_CONFIG_COMMANDS_PRE
+ # as that's the deferrs the commands
+ # to location after $prefix and $exec_prefix
+ # have usefull values and directly before
+ # creating config.status.
+ #
+ # The 'eval eval echo' trick is used to
+ # actually get the raw absolute directory
+ # path as this is needed in config.h
+ define_ldb_modulesdir=yes
+ AC_CONFIG_COMMANDS_PRE([
+ if test x"$define_ldb_modulesdir" = x"yes";then
+ LDB_MODULESDIR=`eval eval echo ${modulesdir}/ldb`
+ AC_DEFINE_UNQUOTED(LDB_MODULESDIR, "${LDB_MODULESDIR}" , [ldb Modules directory])
+ fi
+ ])
+ ldbdir="\$(abspath \$(srcdir)/../source4/lib/ldb)"
+ AC_SUBST(ldbdir)
+ m4_include(lib/ldb/sqlite3.m4)
+ m4_include(lib/ldb/libldb.m4)
+ SMB_INCLUDE_MK(lib/ldb/config.mk)
+ AC_CONFIG_FILES(../source4/lib/ldb/ldb.pc)
+ ]
+)
+SMB_INCLUDE_MK(lib/ldb/python.mk)
+
+# Not sure why we need this..
+SMB_ENABLE(swig_ldb,YES)
+
+m4_include(lib/tls/config.m4)
+eventsdir="../source4/lib/events"
+m4_include(lib/events/libevents.m4)
+
+dnl m4_include(auth/kerberos/config.m4)
+m4_include(auth/gensec/config.m4)
+m4_include(smbd/process_model.m4)
+m4_include(ntvfs/posix/config.m4)
+m4_include(ntvfs/unixuid/config.m4)
+m4_include(auth/config.m4)
+m4_include(kdc/config.m4)
+m4_include(ntvfs/sysdep/config.m4)
+m4_include(nsswitch/config.m4)
+
+dnl Samba 4 files
+AC_SUBST(LD)
+AC_LIBREPLACE_SHLD_FLAGS
+SMB_WRITE_MAKEVARS(samba4-config.mk, [prefix exec_prefix CPPFLAGS LDSHFLAGS POPT_OBJ CFLAGS TALLOC_OBJ POPT_LIBS])
+
+oldbuilddir="$builddir"
+builddir="$builddir/../source4"
+SMB_WRITE_PERLVARS(../source4/build/smb_build/config.pm)
+builddir="$oldbuilddir"
+
+echo "configure: creating ../source4/config.mk"
+cat >../source4/config.mk<<CEOF
+# config.mk - Autogenerated by configure, DO NOT EDIT!
+$SMB_INFO_EXT_LIBS
+$SMB_INFO_SUBSYSTEMS
+$SMB_INFO_LIBRARIES
+CEOF
+
+AC_OUTPUT_COMMANDS([
+cd ${srcdir}/../source4
+USESHARED=false $PERL -I${builddir} -I${builddir}/build \
+ -I. -Ibuild \
+ build/smb_build/main.pl --output=../source3/samba4-data.mk main.mk || exit $?
+cd ../source3
+],[
+srcdir="$srcdir"
+builddir="$builddir"
+PERL="$PERL"
+
+export PERL
+export srcdir
+export builddir
+])
+
+AC_CONFIG_COMMANDS([Makefile-samba4], [
+echo "include samba4.mk" >> ${builddir}/Makefile
+])
+
diff --git a/source3/samba4.mk b/source3/samba4.mk
new file mode 100644
index 0000000000..93022c5239
--- /dev/null
+++ b/source3/samba4.mk
@@ -0,0 +1,171 @@
+# samba 4 bits
+
+PROG_LD = $(LD)
+BNLD = $(CC)
+HOSTLD = $(CC)
+PARTLINK = $(PROG_LD) -r
+MDLD = $(SHLD)
+MDLD_FLAGS = $(LDSHFLAGS)
+
+samba4srcdir = $(srcdir)/../source4
+
+# Flags used for the samba 4 files
+# $(srcdir)/include is required for config.h
+SAMBA4_CFLAGS = -I.. -I$(samba4srcdir) -I$(samba4srcdir)/include \
+ -I$(samba4srcdir)/../lib/replace -I$(samba4srcdir)/lib \
+ -I$(heimdalsrcdir)/lib/hcrypto -I$(tallocdir) \
+ -I$(srcdir)/include -D_SAMBA_BUILD_=4 -DHAVE_CONFIG_H
+
+.SUFFIXES: .ho
+
+# No cross compilation for now, thanks
+.c.ho:
+ @if (: >> $@ || : > $@) >/dev/null 2>&1; then rm -f $@; else \
+ dir=`echo $@ | sed 's,/[^/]*$$,,;s,^$$,.,'` $(MAKEDIR); fi
+ @if test -n "$(CC_CHECKER)"; then \
+ echo "Checking $*.c with '$(CC_CHECKER)'";\
+ $(CHECK_CC); \
+ fi
+ @echo Compiling $*.c
+ @$(COMPILE) && exit 0;\
+ echo "The following command failed:" 1>&2;\
+ echo "$(subst ",\",$(COMPILE_CC))" 1>&2;\
+ $(COMPILE_CC) >/dev/null 2>&1
+
+# The order really does matter here! GNU Make 3.80 will break if the more specific
+# overrides are not specified first.
+ifeq ($(MAKE_VERSION),3.81)
+%.o: CFLAGS+=$(FLAGS)
+$(samba4srcdir)/%.o: CFLAGS=$(SAMBA4_CFLAGS)
+$(samba4srcdir)/%.ho: CFLAGS=$(SAMBA4_CFLAGS)
+$(heimdalsrcdir)/%.o: CFLAGS=-I$(heimdalbuildsrcdir) $(SAMBA4_CFLAGS) -I$(srcdir)
+$(heimdalsrcdir)/%.ho: CFLAGS=-I$(heimdalbuildsrcdir) $(SAMBA4_CFLAGS) -I$(srcdir)
+else
+$(heimdalsrcdir)/%.o: CFLAGS=-I$(heimdalbuildsrcdir) $(SAMBA4_CFLAGS) -I$(srcdir)
+$(heimdalsrcdir)/%.ho: CFLAGS=-I$(heimdalbuildsrcdir) $(SAMBA4_CFLAGS) -I$(srcdir)
+$(samba4srcdir)/%.o: CFLAGS=$(SAMBA4_CFLAGS)
+$(samba4srcdir)/%.ho: CFLAGS=$(SAMBA4_CFLAGS)
+%.o: CFLAGS+=$(FLAGS)
+endif
+
+# Create a static library
+%.a:
+ @echo Linking $@
+ @rm -f $@
+ @mkdir -p $(@D)
+ @$(AR) -rc $@ $^
+
+INTERN_LDFLAGS = -L${builddir}/bin/static -L${builddir}/bin/shared
+
+pidldir = $(samba4srcdir)/../pidl
+include $(pidldir)/config.mk
+include samba4-config.mk
+include samba4-templates.mk
+
+zlibsrcdir := $(samba4srcdir)/../lib/zlib
+dynconfigsrcdir := $(samba4srcdir)/dynconfig
+heimdalsrcdir := $(samba4srcdir)/heimdal
+dsdbsrcdir := $(samba4srcdir)/dsdb
+smbdsrcdir := $(samba4srcdir)/smbd
+clustersrcdir := $(samba4srcdir)/cluster
+libnetsrcdir := $(samba4srcdir)/libnet
+authsrcdir := $(samba4srcdir)/auth
+nsswitchsrcdir := $(samba4srcdir)/nsswitch
+libsrcdir := $(samba4srcdir)/lib
+libsocketsrcdir := $(samba4srcdir)/lib/socket
+libcharsetsrcdir := $(samba4srcdir)/lib/charset
+ldb_sambasrcdir := $(samba4srcdir)/lib/ldb-samba
+libtlssrcdir := $(samba4srcdir)/lib/tls
+libregistrysrcdir := $(samba4srcdir)/lib/registry
+libmessagingsrcdir := $(samba4srcdir)/lib/messaging
+libeventssrcdir := $(samba4srcdir)/lib/events
+libcmdlinesrcdir := $(samba4srcdir)/lib/cmdline
+poptsrcdir := $(samba4srcdir)/../lib/popt
+socketwrappersrcdir := $(samba4srcdir)/../lib/socket_wrapper
+nsswrappersrcdir := $(samba4srcdir)/../lib/nss_wrapper
+libstreamsrcdir := $(samba4srcdir)/lib/stream
+libutilsrcdir := $(samba4srcdir)/../lib/util
+libtdrsrcdir := $(samba4srcdir)/lib/tdr
+libdbwrapsrcdir := $(samba4srcdir)/lib/dbwrap
+libcryptosrcdir := $(samba4srcdir)/../lib/crypto
+libtorturesrcdir := $(samba4srcdir)/lib/torture
+libcompressionsrcdir := $(samba4srcdir)/../lib/compression
+libgencachesrcdir := $(samba4srcdir)/lib
+paramsrcdir := $(samba4srcdir)/param
+smb_serversrcdir := $(samba4srcdir)/smb_server
+rpc_serversrcdir := $(samba4srcdir)/rpc_server
+ldap_serversrcdir := $(samba4srcdir)/ldap_server
+web_serversrcdir := $(samba4srcdir)/web_server
+winbindsrcdir := $(samba4srcdir)/winbind
+nbt_serversrcdir := $(samba4srcdir)/nbt_server
+wrepl_serversrcdir := $(samba4srcdir)/wrepl_server
+cldap_serversrcdir := $(samba4srcdir)/cldap_server
+librpcsrcdir := $(samba4srcdir)/librpc
+torturesrcdir := $(samba4srcdir)/torture
+utilssrcdir := $(samba4srcdir)/utils
+ntvfssrcdir := $(samba4srcdir)/ntvfs
+ntptrsrcdir := $(samba4srcdir)/ntptr
+clientsrcdir := $(samba4srcdir)/client
+libclisrcdir := $(samba4srcdir)/libcli
+libclinbtsrcdir := $(samba4srcdir)/../libcli/nbt
+pyscriptsrcdir := $(samba4srcdir)/scripting/python
+kdcsrcdir := $(samba4srcdir)/kdc
+smbreadlinesrcdir := $(samba4srcdir)/lib/smbreadline
+ntp_signdsrcdir := $(samba4srcdir)/ntp_signd
+tdbsrcdir := $(samba4srcdir)/../lib/tdb
+ldbsrcdir := $(samba4srcdir)/lib/ldb
+tallocsrcdir := $(samba4srcdir)/../lib/talloc
+comsrcdir := $(samba4srcdir)/lib/com
+override ASN1C = bin/asn1_compile4
+override ET_COMPILER = bin/compile_et4
+include samba4-data.mk
+include $(samba4srcdir)/static_deps.mk
+include $(samba4srcdir)/build/make/python.mk
+
+INSTALLPERMS = 0755
+
+$(DESTDIR)$(bindir)/%: bin/%4 installdirs
+ @mkdir -p $(@D)
+ @echo Installing $(@F) as $@
+ @if test -f $@; then rm -f $@.old; mv $@ $@.old; fi
+ @cp $< $@
+ @chmod $(INSTALLPERMS) $@
+
+$(DESTDIR)$(sbindir)/%: bin/%4 installdirs
+ @mkdir -p $(@D)
+ @echo Installing $(@F) as $@
+ @if test -f $@; then rm -f $@.old; mv $@ $@.old; fi
+ @cp $< $@
+ @chmod $(INSTALLPERMS) $@
+
+clean::
+ @echo Removing samba 4 objects
+ @-find $(samba4srcdir) -name '*.o' -exec rm -f '{}' \;
+ @echo Removing samba 4 hostcc objects
+ @-find $(samba4srcdir) -name '*.ho' -exec rm -f '{}' \;
+ @echo Removing samba 4 libraries
+ @-rm -f $(STATIC_LIBS) $(SHARED_LIBS)
+ @-rm -f bin/static/*.a bin/shared/*.$(SHLIBEXT) bin/mergedobj/*.o
+ @echo Removing samba 4 modules
+ @-rm -f bin/modules/*/*.$(SHLIBEXT)
+ @-rm -f bin/*_init_module.c
+ @echo Removing samba 4 dummy targets
+ @-rm -f bin/.*_*
+ @echo Removing samba 4 generated files
+ @-rm -f bin/*_init_module.c
+ @-rm -rf $(samba4srcdir)/librpc/gen_*
+
+proto:: $(PROTO_HEADERS)
+modules:: $(PLUGINS)
+
+all:: basics bin/samba4 bin/regpatch4 bin/regdiff4 bin/regshell4 bin/regtree4 bin/smbclient4
+torture:: basics bin/smbtorture4
+everything:: basics $(patsubst %,%4,$(BINARIES))
+
+
+etags::
+ etags --append=yes `find $(samba4srcdir) -name "*.[ch]"`
+
+ctags::
+ ctags --append=yes `find $(samba4srcdir) -name "*.[ch]"`
+
diff --git a/source3/script/build_idl.sh b/source3/script/build_idl.sh
index 7aaddc70c7..34f262ee00 100755
--- a/source3/script/build_idl.sh
+++ b/source3/script/build_idl.sh
@@ -1,18 +1,14 @@
#!/bin/sh
-PIDL_ARGS="--outputdir librpc/gen_ndr --header --ndr-parser --samba3-ndr-server --samba3-ndr-client --"
-PIDL_EXTRA_ARGS="$*"
+ARGS="--includedir=../librpc/idl --outputdir librpc/gen_ndr --header --ndr-parser --samba3-ndr-server --samba3-ndr-client $PIDL_ARGS --"
+IDL_FILES="$*"
oldpwd=`pwd`
cd ${srcdir}
[ -d librpc/gen_ndr ] || mkdir -p librpc/gen_ndr || exit 1
-if [ -z "$PIDL" ] ; then
- PIDL=pidl
-fi
-
-PIDL="$PIDL ${PIDL_ARGS} ${PIDL_EXTRA_ARGS}"
+PIDL="$PIDL $ARGS"
##
## Find newer files rather than rebuild all of them
@@ -23,12 +19,12 @@ for f in ${IDL_FILES}; do
basename=`basename $f .idl`
ndr="librpc/gen_ndr/ndr_$basename.c"
- if [ -f $ndr ] && false; then
- if [ "x`find librpc/idl/$f -newer $ndr -print`" = "xlibrpc/idl/$f" ]; then
- list="$list librpc/idl/$f"
+ if [ -f $ndr ]; then
+ if [ "x`find $f -newer $ndr -print`" = "x$f" ]; then
+ list="$list $f"
fi
else
- list="$list librpc/idl/$f"
+ list="$list $f"
fi
done
diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh
index 15e48b00ef..0894b2507d 100755
--- a/source3/script/tests/selftest.sh
+++ b/source3/script/tests/selftest.sh
@@ -166,9 +166,9 @@ cat >$SERVERCONFFILE<<EOF
domain logons = yes
time server = yes
- add user script = $PERL $SRCDIR/lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action add --name %u
- add machine script = $PERL $SRCDIR/lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action add --name %u
- delete user script = $PERL $SRCDIR/lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action delete --name %u
+ add user script = $PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action add --name %u
+ add machine script = $PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action add --name %u
+ delete user script = $PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action delete --name %u
kernel oplocks = no
kernel change notify = no
diff --git a/source3/script/tests/wb_pad.sh b/source3/script/tests/wb_pad.sh
new file mode 100755
index 0000000000..f1f5ca24c4
--- /dev/null
+++ b/source3/script/tests/wb_pad.sh
@@ -0,0 +1,82 @@
+#!/bin/sh
+#
+# 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/>.
+
+tempdir=`mktemp -d /tmp/wb_padXXXXXX`
+test -n "$tempdir" || exit 1
+cat >> $tempdir/wb_pad.c << _EOF
+#include "nsswitch/winbind_client.h"
+
+int main(int argc, const char **argv)
+{
+ struct winbindd_request req;
+ struct winbindd_response resp;
+
+ if (argc != 2) {
+ printf("usage: %s [req|resp]\n", argv[0]);
+ return 0;
+ }
+
+ if (strcmp(argv[1], "req") == 0) {
+ printf("%d\n", (uint32_t)sizeof(req));
+ }
+ if (strcmp(argv[1], "resp") == 0) {
+ printf("%d\n", (uint32_t)sizeof(resp));
+ }
+
+ return 0;
+}
+_EOF
+
+cleanup() {
+ rm -f $tempdir/wb_pad_32 $tempdir/wb_pad_64 $tempdir/wb_pad.c
+ rmdir $tempdir
+}
+
+cflags="-I. -I./../lib/replace -Iinclude"
+${CC:-gcc} -m32 $RPM_OPT_FLAGS $CFLAGS -o $tempdir/wb_pad_32 $cflags $tempdir/wb_pad.c
+if [ $? -ne 0 ]; then
+ cleanup
+ exit 1
+fi
+${CC:-gcc} -m64 $RPM_OPT_FLAGS $CFLAGS -o $tempdir/wb_pad_64 $cflags $tempdir/wb_pad.c
+if [ $? -ne 0 ]; then
+ cleanup
+ exit 1
+fi
+
+out_64_req=`$tempdir/wb_pad_64 req`
+out_64_resp=`$tempdir/wb_pad_64 resp`
+out_32_req=`$tempdir/wb_pad_32 req`
+out_32_resp=`$tempdir/wb_pad_32 resp`
+
+cleanup
+
+if test "$out_64_req" != "$out_32_req"; then
+ echo "winbind request size differs!"
+ echo "64bit: $out_64_req"
+ echo "32bit: $out_32_req"
+ exit 1
+fi
+
+if test "$out_64_resp" != "$out_32_resp"; then
+ echo "winbind response size differs!"
+ echo "64bit: $out_64_resp"
+ echo "32bit: $out_32_resp"
+ exit 1
+fi
+
+exit 0
diff --git a/source3/services/services_db.c b/source3/services/services_db.c
index 49761c3233..0f5264bcd8 100644
--- a/source3/services/services_db.c
+++ b/source3/services/services_db.c
@@ -89,23 +89,23 @@ struct service_display_info common_unix_svcs[] = {
static SEC_DESC* construct_service_sd( TALLOC_CTX *ctx )
{
SEC_ACE ace[4];
- SEC_ACCESS mask;
size_t i = 0;
- SEC_DESC *sd;
- SEC_ACL *acl;
+ SEC_DESC *sd = NULL;
+ SEC_ACL *acl = NULL;
size_t sd_size;
/* basic access for Everyone */
- init_sec_access(&mask, SERVICE_READ_ACCESS );
- init_sec_ace(&ace[i++], &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
+ init_sec_ace(&ace[i++], &global_sid_World,
+ SEC_ACE_TYPE_ACCESS_ALLOWED, SERVICE_READ_ACCESS, 0);
- init_sec_access(&mask,SERVICE_EXECUTE_ACCESS );
- init_sec_ace(&ace[i++], &global_sid_Builtin_Power_Users, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
+ init_sec_ace(&ace[i++], &global_sid_Builtin_Power_Users,
+ SEC_ACE_TYPE_ACCESS_ALLOWED, SERVICE_EXECUTE_ACCESS, 0);
- init_sec_access(&mask,SERVICE_ALL_ACCESS );
- init_sec_ace(&ace[i++], &global_sid_Builtin_Server_Operators, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
- init_sec_ace(&ace[i++], &global_sid_Builtin_Administrators, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0);
+ init_sec_ace(&ace[i++], &global_sid_Builtin_Server_Operators,
+ SEC_ACE_TYPE_ACCESS_ALLOWED, SERVICE_ALL_ACCESS, 0);
+ init_sec_ace(&ace[i++], &global_sid_Builtin_Administrators,
+ SEC_ACE_TYPE_ACCESS_ALLOWED, SERVICE_ALL_ACCESS, 0);
/* create the security descriptor */
@@ -188,11 +188,11 @@ static char *cleanup_string( const char *string )
static bool read_init_file( const char *servicename, struct rcinit_file_information **service_info )
{
- struct rcinit_file_information *info;
+ struct rcinit_file_information *info = NULL;
char *filepath = NULL;
char str[1024];
- XFILE *f;
- char *p;
+ XFILE *f = NULL;
+ char *p = NULL;
if ( !(info = TALLOC_ZERO_P( NULL, struct rcinit_file_information ) ) )
return False;
@@ -335,12 +335,12 @@ static void fill_service_values( const char *name, REGVAL_CTR *values )
static void add_new_svc_name( REGISTRY_KEY *key_parent, REGSUBKEY_CTR *subkeys,
const char *name )
{
- REGISTRY_KEY *key_service, *key_secdesc;
+ REGISTRY_KEY *key_service = NULL, *key_secdesc = NULL;
WERROR wresult;
char *path = NULL;
- REGVAL_CTR *values;
- REGSUBKEY_CTR *svc_subkeys;
- SEC_DESC *sd;
+ REGVAL_CTR *values = NULL;
+ REGSUBKEY_CTR *svc_subkeys = NULL;
+ SEC_DESC *sd = NULL;
DATA_BLOB sd_blob;
NTSTATUS status;
@@ -444,7 +444,7 @@ void svcctl_init_keys( void )
{
const char **service_list = lp_svcctl_list();
int i;
- REGSUBKEY_CTR *subkeys;
+ REGSUBKEY_CTR *subkeys = NULL;
REGISTRY_KEY *key = NULL;
WERROR wresult;
@@ -502,9 +502,9 @@ void svcctl_init_keys( void )
SEC_DESC *svcctl_get_secdesc( TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token )
{
- REGISTRY_KEY *key;
- REGVAL_CTR *values;
- REGISTRY_VALUE *val;
+ REGISTRY_KEY *key = NULL;
+ REGVAL_CTR *values = NULL;
+ REGISTRY_VALUE *val = NULL;
SEC_DESC *ret_sd = NULL;
char *path= NULL;
WERROR wresult;
@@ -563,10 +563,10 @@ done:
bool svcctl_set_secdesc( TALLOC_CTX *ctx, const char *name, SEC_DESC *sec_desc, NT_USER_TOKEN *token )
{
- REGISTRY_KEY *key;
+ REGISTRY_KEY *key = NULL;
WERROR wresult;
char *path = NULL;
- REGVAL_CTR *values;
+ REGVAL_CTR *values = NULL;
prs_struct ps;
bool ret = False;
@@ -620,8 +620,8 @@ const char *svcctl_lookup_dispname(TALLOC_CTX *ctx, const char *name, NT_USER_TO
{
char *display_name = NULL;
REGISTRY_KEY *key = NULL;
- REGVAL_CTR *values;
- REGISTRY_VALUE *val;
+ REGVAL_CTR *values = NULL;
+ REGISTRY_VALUE *val = NULL;
char *path = NULL;
WERROR wresult;
@@ -670,8 +670,8 @@ const char *svcctl_lookup_description(TALLOC_CTX *ctx, const char *name, NT_USER
{
char *description = NULL;
REGISTRY_KEY *key = NULL;
- REGVAL_CTR *values;
- REGISTRY_VALUE *val;
+ REGVAL_CTR *values = NULL;
+ REGISTRY_VALUE *val = NULL;
char *path = NULL;
WERROR wresult;
@@ -715,7 +715,7 @@ const char *svcctl_lookup_description(TALLOC_CTX *ctx, const char *name, NT_USER
REGVAL_CTR *svcctl_fetch_regvalues( const char *name, NT_USER_TOKEN *token )
{
REGISTRY_KEY *key = NULL;
- REGVAL_CTR *values;
+ REGVAL_CTR *values = NULL;
char *path = NULL;
WERROR wresult;
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index 74275368bd..c3fd0a2bc0 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -24,7 +24,17 @@
/* The signal we'll use to signify aio done. */
#ifndef RT_SIGNAL_AIO
-#define RT_SIGNAL_AIO (SIGRTMIN+3)
+#ifndef SIGRTMIN
+#define SIGRTMIN NSIG
+#endif
+#define RT_SIGNAL_AIO (SIGRTMIN+3)
+#endif
+
+#ifndef HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIVAL_PTR
+#ifdef HAVE_STRUCT_SIGEVENT_SIGEV_VALUE_SIGVAL_PTR
+#define sival_int sigval_int
+#define sival_ptr sigval_ptr
+#endif
#endif
/****************************************************************************
@@ -581,6 +591,11 @@ static bool handle_aio_completed(struct aio_extra *aio_ex, int *perr)
{
int err;
+ if(!aio_ex) {
+ DEBUG(3, ("handle_aio_completed: Non-existing aio_ex passed\n"));
+ return false;
+ }
+
/* Ensure the operation has really completed. */
if (SMB_VFS_AIO_ERROR(aio_ex->fsp, &aio_ex->acb) == EINPROGRESS) {
DEBUG(10,( "handle_aio_completed: operation mid %u still in "
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index 479361a8c1..4374b50eac 100644
--- a/source3/smbd/blocking.c
+++ b/source3/smbd/blocking.c
@@ -33,10 +33,10 @@ typedef struct _blocking_lock_record {
files_struct *fsp;
struct timeval expire_time;
int lock_num;
- SMB_BIG_UINT offset;
- SMB_BIG_UINT count;
- uint32 lock_pid;
- uint32 blocking_pid; /* PID that blocks us. */
+ uint64_t offset;
+ uint64_t count;
+ uint32_t lock_pid;
+ uint32_t blocking_pid; /* PID that blocks us. */
enum brl_flavour lock_flav;
enum brl_type lock_type;
char *inbuf;
@@ -154,12 +154,12 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck,
files_struct *fsp,
int lock_timeout,
int lock_num,
- uint32 lock_pid,
+ uint32_t lock_pid,
enum brl_type lock_type,
enum brl_flavour lock_flav,
- SMB_BIG_UINT offset,
- SMB_BIG_UINT count,
- uint32 blocking_pid)
+ uint64_t offset,
+ uint64_t count,
+ uint32_t blocking_pid)
{
static bool set_lock_msg;
size_t length = smb_len(req->inbuf)+4;
@@ -331,7 +331,7 @@ static void reply_lockingX_error(blocking_lock_record *blr, NTSTATUS status)
char *inbuf = blr->inbuf;
files_struct *fsp = blr->fsp;
uint16 num_ulocks = SVAL(inbuf,smb_vwv6);
- SMB_BIG_UINT count = (SMB_BIG_UINT)0, offset = (SMB_BIG_UINT) 0;
+ uint64_t count = (uint64_t)0, offset = (uint64_t) 0;
uint32 lock_pid;
unsigned char locktype = CVAL(inbuf,smb_vwv3);
bool large_file_format = (locktype & LOCKING_ANDX_LARGE_FILES);
@@ -420,7 +420,7 @@ static bool process_lockingX(blocking_lock_record *blr)
files_struct *fsp = blr->fsp;
uint16 num_ulocks = SVAL(inbuf,smb_vwv6);
uint16 num_locks = SVAL(inbuf,smb_vwv7);
- SMB_BIG_UINT count = (SMB_BIG_UINT)0, offset = (SMB_BIG_UINT)0;
+ uint64_t count = (uint64_t)0, offset = (uint64_t)0;
uint32 lock_pid;
bool large_file_format = (locktype & LOCKING_ANDX_LARGE_FILES);
char *data;
@@ -704,7 +704,6 @@ static void process_blocking_lock_queue(void)
* sitting around....
*/
chain_size = 0;
- file_chain_reset();
fsp = blr->fsp;
conn = conn_find(SVAL(blr->inbuf,smb_tid));
@@ -875,8 +874,8 @@ static void process_blocking_lock_cancel_message(struct messaging_context *ctx,
bool blocking_lock_cancel(files_struct *fsp,
uint32 lock_pid,
- SMB_BIG_UINT offset,
- SMB_BIG_UINT count,
+ uint64_t offset,
+ uint64_t count,
enum brl_flavour lock_flav,
unsigned char locktype,
NTSTATUS err)
diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c
index 2596e73380..64a4311256 100644
--- a/source3/smbd/chgpasswd.c
+++ b/source3/smbd/chgpasswd.c
@@ -1131,7 +1131,7 @@ NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passw
if ((can_change_time != 0) && (time(NULL) < can_change_time)) {
DEBUG(1, ("user %s cannot change password now, must "
"wait until %s\n", username,
- http_timestring(can_change_time)));
+ http_timestring(talloc_tos(), can_change_time)));
if (samr_reject_reason) {
*samr_reject_reason = SAMR_REJECT_OTHER;
}
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index 818b4c70a8..d4c531ab19 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -505,7 +505,8 @@ static NTSTATUS update_write_time_on_close(struct files_struct *fsp)
delete on close is done on normal and shutdown close.
****************************************************************************/
-static NTSTATUS close_normal_file(files_struct *fsp, enum file_close_type close_type)
+static NTSTATUS close_normal_file(struct smb_request *req, files_struct *fsp,
+ enum file_close_type close_type)
{
NTSTATUS status = NT_STATUS_OK;
NTSTATUS saved_status1 = NT_STATUS_OK;
@@ -536,7 +537,7 @@ static NTSTATUS close_normal_file(files_struct *fsp, enum file_close_type close_
if (fsp->print_file) {
print_fsp_end(fsp, close_type);
- file_free(fsp);
+ file_free(req, fsp);
return NT_STATUS_OK;
}
@@ -585,7 +586,7 @@ static NTSTATUS close_normal_file(files_struct *fsp, enum file_close_type close_
conn->num_files_open,
nt_errstr(status) ));
- file_free(fsp);
+ file_free(req, fsp);
return status;
}
@@ -593,7 +594,8 @@ static NTSTATUS close_normal_file(files_struct *fsp, enum file_close_type close_
Close a directory opened by an NT SMB call.
****************************************************************************/
-static NTSTATUS close_directory(files_struct *fsp, enum file_close_type close_type)
+static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp,
+ enum file_close_type close_type)
{
struct share_mode_lock *lck = 0;
bool delete_dir = False;
@@ -698,7 +700,7 @@ static NTSTATUS close_directory(files_struct *fsp, enum file_close_type close_ty
* Do the code common to files and directories.
*/
close_filestruct(fsp);
- file_free(fsp);
+ file_free(req, fsp);
return status;
}
@@ -706,17 +708,18 @@ static NTSTATUS close_directory(files_struct *fsp, enum file_close_type close_ty
Close a files_struct.
****************************************************************************/
-NTSTATUS close_file(files_struct *fsp, enum file_close_type close_type)
+NTSTATUS close_file(struct smb_request *req, files_struct *fsp,
+ enum file_close_type close_type)
{
NTSTATUS status;
struct files_struct *base_fsp = fsp->base_fsp;
if(fsp->is_directory) {
- status = close_directory(fsp, close_type);
+ status = close_directory(req, fsp, close_type);
} else if (fsp->fake_file_handle != NULL) {
- status = close_fake_file(fsp);
+ status = close_fake_file(req, fsp);
} else {
- status = close_normal_file(fsp, close_type);
+ status = close_normal_file(req, fsp, close_type);
}
if ((base_fsp != NULL) && (close_type != SHUTDOWN_CLOSE)) {
@@ -731,7 +734,7 @@ NTSTATUS close_file(files_struct *fsp, enum file_close_type close_type)
*/
SMB_ASSERT(base_fsp->base_fsp == NULL);
- close_file(base_fsp, close_type);
+ close_file(req, base_fsp, close_type);
}
return status;
@@ -768,5 +771,5 @@ void msg_close_file(struct messaging_context *msg_ctx,
DEBUG(10,("msg_close_file: failed to find file.\n"));
return;
}
- close_file(fsp, NORMAL_CLOSE);
+ close_file(NULL, fsp, NORMAL_CLOSE);
}
diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c
index b9433bb965..7f34d2b8e2 100644
--- a/source3/smbd/conn.c
+++ b/source3/smbd/conn.c
@@ -252,8 +252,8 @@ void conn_free_internal(connection_struct *conn)
/* Free vfs_connection_struct */
handle = conn->vfs_handles;
while(handle) {
- DLIST_REMOVE(conn->vfs_handles, handle);
thandle = handle->next;
+ DLIST_REMOVE(conn->vfs_handles, handle);
if (handle->free_data)
handle->free_data(&handle->data);
handle = thandle;
diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c
index 8dd5964f5f..3b72a9505a 100644
--- a/source3/smbd/connection.c
+++ b/source3/smbd/connection.c
@@ -2,17 +2,17 @@
Unix SMB/CIFS implementation.
connection claim routines
Copyright (C) Andrew Tridgell 1998
-
+
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/>.
*/
@@ -63,7 +63,7 @@ static int count_fn(struct db_record *rec,
void *udp)
{
struct count_stat *cs = (struct count_stat *)udp;
-
+
if (crec->cnum == -1) {
return 0;
}
@@ -159,7 +159,7 @@ bool claim_connection(connection_struct *conn, const char *name,
}
crec.start = time(NULL);
crec.bcast_msg_flags = msg_flags;
-
+
strlcpy(crec.machine,get_remote_machine_name(),sizeof(crec.machine));
strlcpy(crec.addr,conn?conn->client_address:
client_addr(get_client_fd(),addr,sizeof(addr)),
@@ -224,109 +224,3 @@ bool register_message_flags(bool doreg, uint32 msg_flags)
return True;
}
-
-/*********************************************************************
-*********************************************************************/
-
-static TDB_DATA* make_pipe_rec_key( struct pipe_open_rec *prec )
-{
- TDB_DATA *kbuf = NULL;
- fstring key_string;
-
- if ( !prec )
- return NULL;
-
- if ( (kbuf = TALLOC_P(prec, TDB_DATA)) == NULL ) {
- return NULL;
- }
-
- snprintf( key_string, sizeof(key_string), "%s/%d/%d",
- prec->name, procid_to_pid(&prec->pid), prec->pnum );
-
- *kbuf = string_term_tdb_data(talloc_strdup(prec, key_string));
- if (kbuf->dptr == NULL )
- return NULL;
-
- return kbuf;
-}
-
-/*********************************************************************
-*********************************************************************/
-
-static void fill_pipe_open_rec( struct pipe_open_rec *prec, smb_np_struct *p )
-{
- prec->pid = pid_to_procid(sys_getpid());
- prec->pnum = p->pnum;
- prec->uid = geteuid();
- fstrcpy( prec->name, p->name );
-
- return;
-}
-
-/*********************************************************************
-*********************************************************************/
-
-bool store_pipe_opendb( smb_np_struct *p )
-{
- struct db_record *dbrec;
- struct pipe_open_rec *prec;
- TDB_DATA *key;
- TDB_DATA data;
- bool ret = False;
-
- if ( (prec = TALLOC_P( NULL, struct pipe_open_rec)) == NULL ) {
- DEBUG(0,("store_pipe_opendb: talloc failed!\n"));
- return False;
- }
-
- fill_pipe_open_rec( prec, p );
- if ( (key = make_pipe_rec_key( prec )) == NULL ) {
- goto done;
- }
-
- data.dptr = (uint8 *)prec;
- data.dsize = sizeof(struct pipe_open_rec);
-
- if (!(dbrec = connections_fetch_record(prec, *key))) {
- DEBUG(0, ("connections_fetch_record failed\n"));
- goto done;
- }
-
- ret = NT_STATUS_IS_OK(dbrec->store(dbrec, data, TDB_REPLACE));
-
-done:
- TALLOC_FREE( prec );
- return ret;
-}
-
-/*********************************************************************
-*********************************************************************/
-
-bool delete_pipe_opendb( smb_np_struct *p )
-{
- struct db_record *dbrec;
- struct pipe_open_rec *prec;
- TDB_DATA *key;
- bool ret = False;
-
- if ( (prec = TALLOC_P( NULL, struct pipe_open_rec)) == NULL ) {
- DEBUG(0,("store_pipe_opendb: talloc failed!\n"));
- return False;
- }
-
- fill_pipe_open_rec( prec, p );
- if ( (key = make_pipe_rec_key( prec )) == NULL ) {
- goto done;
- }
-
- if (!(dbrec = connections_fetch_record(prec, *key))) {
- DEBUG(0, ("connections_fetch_record failed\n"));
- goto done;
- }
-
- ret = NT_STATUS_IS_OK(dbrec->delete_rec(dbrec));
-
-done:
- TALLOC_FREE( prec );
- return ret;
-}
diff --git a/source3/smbd/dfree.c b/source3/smbd/dfree.c
index 1ddcd48d40..cd09d73923 100644
--- a/source3/smbd/dfree.c
+++ b/source3/smbd/dfree.c
@@ -23,10 +23,10 @@
Normalise for DOS usage.
****************************************************************************/
-static void disk_norm(bool small_query, SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT *dsize)
+static void disk_norm(bool small_query, uint64_t *bsize,uint64_t *dfree,uint64_t *dsize)
{
/* check if the disk is beyond the max disk size */
- SMB_BIG_UINT maxdisksize = lp_maxdisksize();
+ uint64_t maxdisksize = lp_maxdisksize();
if (maxdisksize) {
/* convert to blocks - and don't overflow */
maxdisksize = ((maxdisksize*1024)/(*bsize))*1024;
@@ -62,13 +62,13 @@ static void disk_norm(bool small_query, SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,
Return number of 1K blocks available on a path and total number.
****************************************************************************/
-SMB_BIG_UINT sys_disk_free(connection_struct *conn, const char *path, bool small_query,
- SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT *dsize)
+uint64_t sys_disk_free(connection_struct *conn, const char *path, bool small_query,
+ uint64_t *bsize,uint64_t *dfree,uint64_t *dsize)
{
- SMB_BIG_UINT dfree_retval;
- SMB_BIG_UINT dfree_q = 0;
- SMB_BIG_UINT bsize_q = 0;
- SMB_BIG_UINT dsize_q = 0;
+ uint64_t dfree_retval;
+ uint64_t dfree_q = 0;
+ uint64_t bsize_q = 0;
+ uint64_t dsize_q = 0;
const char *dfree_command;
(*dfree) = (*dsize) = 0;
@@ -90,7 +90,7 @@ SMB_BIG_UINT sys_disk_free(connection_struct *conn, const char *path, bool small
path);
if (!syscmd) {
- return (SMB_BIG_UINT)-1;
+ return (uint64_t)-1;
}
DEBUG (3, ("disk_free: Running command %s\n", syscmd));
@@ -112,7 +112,7 @@ SMB_BIG_UINT sys_disk_free(connection_struct *conn, const char *path, bool small
*bsize = STR_TO_SMB_BIG_UINT(p, NULL);
else
*bsize = 1024;
- file_lines_free(lines);
+ TALLOC_FREE(lines);
DEBUG (3, ("Parsed output of dfree, dsize=%u, dfree=%u, bsize=%u\n",
(unsigned int)*dsize, (unsigned int)*dfree, (unsigned int)*bsize));
@@ -126,14 +126,14 @@ SMB_BIG_UINT sys_disk_free(connection_struct *conn, const char *path, bool small
if (sys_fsusage(path, dfree, dsize) != 0) {
DEBUG (0, ("disk_free: sys_fsusage() failed. Error was : %s\n",
strerror(errno) ));
- return (SMB_BIG_UINT)-1;
+ return (uint64_t)-1;
}
}
} else {
if (sys_fsusage(path, dfree, dsize) != 0) {
DEBUG (0, ("disk_free: sys_fsusage() failed. Error was : %s\n",
strerror(errno) ));
- return (SMB_BIG_UINT)-1;
+ return (uint64_t)-1;
}
}
@@ -174,16 +174,16 @@ SMB_BIG_UINT sys_disk_free(connection_struct *conn, const char *path, bool small
Potentially returned cached dfree info.
****************************************************************************/
-SMB_BIG_UINT get_dfree_info(connection_struct *conn,
+uint64_t get_dfree_info(connection_struct *conn,
const char *path,
bool small_query,
- SMB_BIG_UINT *bsize,
- SMB_BIG_UINT *dfree,
- SMB_BIG_UINT *dsize)
+ uint64_t *bsize,
+ uint64_t *dfree,
+ uint64_t *dsize)
{
int dfree_cache_time = lp_dfree_cache_time(SNUM(conn));
struct dfree_cached_info *dfc = conn->dfree_info;
- SMB_BIG_UINT dfree_ret;
+ uint64_t dfree_ret;
if (!dfree_cache_time) {
return SMB_VFS_DISK_FREE(conn,path,small_query,bsize,dfree,dsize);
@@ -199,7 +199,7 @@ SMB_BIG_UINT get_dfree_info(connection_struct *conn,
dfree_ret = SMB_VFS_DISK_FREE(conn,path,small_query,bsize,dfree,dsize);
- if (dfree_ret == (SMB_BIG_UINT)-1) {
+ if (dfree_ret == (uint64_t)-1) {
/* Don't cache bad data. */
return dfree_ret;
}
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index 88c6a51770..784b36d9bd 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -277,14 +277,15 @@ static bool set_ea_dos_attribute(connection_struct *conn, const char *path, SMB_
* are not violating security in doing the setxattr.
*/
- if (!NT_STATUS_IS_OK(open_file_fchmod(conn,path,sbuf,&fsp)))
+ if (!NT_STATUS_IS_OK(open_file_fchmod(NULL, conn, path, sbuf,
+ &fsp)))
return ret;
become_root();
if (SMB_VFS_SETXATTR(conn, path, SAMBA_XATTR_DOS_ATTRIB, attrstr, strlen(attrstr), 0) == 0) {
ret = True;
}
unbecome_root();
- close_file_fchmod(fsp);
+ close_file_fchmod(NULL, fsp);
return ret;
}
DEBUG(10,("set_ea_dos_attribute: set EA %s on file %s\n", attrstr, path));
@@ -540,12 +541,13 @@ int file_set_dosmode(connection_struct *conn, const char *fname,
* break batch oplocks open by others. JRA.
*/
files_struct *fsp;
- if (!NT_STATUS_IS_OK(open_file_fchmod(conn,fname,st,&fsp)))
+ if (!NT_STATUS_IS_OK(open_file_fchmod(NULL, conn, fname, st,
+ &fsp)))
return -1;
become_root();
ret = SMB_VFS_FCHMOD(fsp, unixmode);
unbecome_root();
- close_file_fchmod(fsp);
+ close_file_fchmod(NULL, fsp);
if (!newfile) {
notify_fname(conn, NOTIFY_ACTION_MODIFIED,
FILE_NOTIFY_CHANGE_ATTRIBUTES, fname);
diff --git a/source3/smbd/fake_file.c b/source3/smbd/fake_file.c
index 8dd9abee1a..58b09604c4 100644
--- a/source3/smbd/fake_file.c
+++ b/source3/smbd/fake_file.c
@@ -98,7 +98,7 @@ enum FAKE_FILE_TYPE is_fake_file(const char *fname)
Open a fake quota file with a share mode.
****************************************************************************/
-NTSTATUS open_fake_file(connection_struct *conn,
+NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
uint16_t current_vuid,
enum FAKE_FILE_TYPE fake_file_type,
const char *fname,
@@ -118,7 +118,7 @@ NTSTATUS open_fake_file(connection_struct *conn,
}
- status = file_new(conn, &fsp);
+ status = file_new(req, conn, &fsp);
if(!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -137,7 +137,7 @@ NTSTATUS open_fake_file(connection_struct *conn,
fsp->fake_file_handle = init_fake_file_handle(fake_file_type);
if (fsp->fake_file_handle==NULL) {
- file_free(fsp);
+ file_free(req, fsp);
return NT_STATUS_NO_MEMORY;
}
@@ -146,16 +146,8 @@ NTSTATUS open_fake_file(connection_struct *conn,
return NT_STATUS_OK;
}
-void destroy_fake_file_handle(struct fake_file_handle **fh)
+NTSTATUS close_fake_file(struct smb_request *req, files_struct *fsp)
{
- if (!fh) {
- return;
- }
- TALLOC_FREE(*fh);
-}
-
-NTSTATUS close_fake_file(files_struct *fsp)
-{
- file_free(fsp);
+ file_free(req, fsp);
return NT_STATUS_OK;
}
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index 41a0b9296a..562f1e8d94 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -101,8 +101,7 @@ get any fatal errors that should immediately terminate the calling
SMB processing whilst resolving.
If the saved_last_component != 0, then the unmodified last component
-of the pathname is returned there. This is used in an exceptional
-case in reply_mv (so far). If saved_last_component == 0 then nothing
+of the pathname is returned there. If saved_last_component == 0 then nothing
is returned there.
If last_component_wcard is true then a MS wildcard was detected and
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 17c473f028..4a27d02cfe 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -28,9 +28,6 @@ static int real_max_open_files;
static struct bitmap *file_bmap;
static files_struct *Files;
-
-/* a fsp to use when chaining */
-static files_struct *chain_fsp = NULL;
static int files_used;
@@ -57,7 +54,8 @@ static unsigned long get_gen_count(void)
Find first available file slot.
****************************************************************************/
-NTSTATUS file_new(connection_struct *conn, files_struct **result)
+NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
+ files_struct **result)
{
int i;
static int first_file;
@@ -120,13 +118,17 @@ NTSTATUS file_new(connection_struct *conn, files_struct **result)
DEBUG(5,("allocated file structure %d, fnum = %d (%d used)\n",
i, fsp->fnum, files_used));
- chain_fsp = fsp;
-
- /* A new fsp invalidates a negative fsp_fi_cache. */
- if (fsp_fi_cache.fsp == NULL) {
- ZERO_STRUCT(fsp_fi_cache);
+ if (req != NULL) {
+ req->chain_fsp = fsp;
}
+ /* A new fsp invalidates the positive and
+ negative fsp_fi_cache as the new fsp is pushed
+ at the start of the list and we search from
+ a cache hit to the *end* of the list. */
+
+ ZERO_STRUCT(fsp_fi_cache);
+
*result = fsp;
return NT_STATUS_OK;
}
@@ -142,7 +144,7 @@ void file_close_conn(connection_struct *conn)
for (fsp=Files;fsp;fsp=next) {
next = fsp->next;
if (fsp->conn == conn) {
- close_file(fsp,SHUTDOWN_CLOSE);
+ close_file(NULL, fsp, SHUTDOWN_CLOSE);
}
}
}
@@ -158,7 +160,7 @@ void file_close_pid(uint16 smbpid, int vuid)
for (fsp=Files;fsp;fsp=next) {
next = fsp->next;
if ((fsp->file_pid == smbpid) && (fsp->vuid == vuid)) {
- close_file(fsp,SHUTDOWN_CLOSE);
+ close_file(NULL, fsp, SHUTDOWN_CLOSE);
}
}
}
@@ -216,7 +218,7 @@ void file_close_user(int vuid)
for (fsp=Files;fsp;fsp=next) {
next=fsp->next;
if (fsp->vuid == vuid) {
- close_file(fsp,SHUTDOWN_CLOSE);
+ close_file(NULL, fsp, SHUTDOWN_CLOSE);
}
}
}
@@ -326,8 +328,7 @@ files_struct *file_find_di_first(struct file_id id)
fsp_fi_cache.id = id;
for (fsp=Files;fsp;fsp=fsp->next) {
- if ( fsp->fh->fd != -1 &&
- file_id_equal(&fsp->file_id, &id)) {
+ if (file_id_equal(&fsp->file_id, &id)) {
/* Setup positive cache. */
fsp_fi_cache.fsp = fsp;
return fsp;
@@ -348,8 +349,7 @@ files_struct *file_find_di_next(files_struct *start_fsp)
files_struct *fsp;
for (fsp = start_fsp->next;fsp;fsp=fsp->next) {
- if ( fsp->fh->fd != -1 &&
- file_id_equal(&fsp->file_id, &start_fsp->file_id)) {
+ if (file_id_equal(&fsp->file_id, &start_fsp->file_id)) {
return fsp;
}
}
@@ -394,15 +394,13 @@ void file_sync_all(connection_struct *conn)
Free up a fsp.
****************************************************************************/
-void file_free(files_struct *fsp)
+void file_free(struct smb_request *req, files_struct *fsp)
{
DLIST_REMOVE(Files, fsp);
string_free(&fsp->fsp_name);
- if (fsp->fake_file_handle) {
- destroy_fake_file_handle(&fsp->fake_file_handle);
- }
+ TALLOC_FREE(fsp->fake_file_handle);
if (fsp->fh->ref_count == 1) {
SAFE_FREE(fsp->fh);
@@ -431,8 +429,8 @@ void file_free(files_struct *fsp)
information */
ZERO_STRUCTP(fsp);
- if (fsp == chain_fsp) {
- chain_fsp = NULL;
+ if ((req != NULL) && (fsp == req->chain_fsp)) {
+ req->chain_fsp = NULL;
}
/* Closing a file can invalidate the positive cache. */
@@ -472,44 +470,33 @@ files_struct *file_fnum(uint16 fnum)
Get an fsp from a packet given the offset of a 16 bit fnum.
****************************************************************************/
-files_struct *file_fsp(uint16 fid)
+files_struct *file_fsp(struct smb_request *req, uint16 fid)
{
files_struct *fsp;
- if (chain_fsp) {
- return chain_fsp;
+ if ((req != NULL) && (req->chain_fsp != NULL)) {
+ return req->chain_fsp;
}
fsp = file_fnum(fid);
- if (fsp) {
- chain_fsp = fsp;
+ if ((fsp != NULL) && (req != NULL)) {
+ req->chain_fsp = fsp;
}
return fsp;
}
/****************************************************************************
- Reset the chained fsp - done at the start of a packet reply.
-****************************************************************************/
-
-void file_chain_reset(void)
-{
- chain_fsp = NULL;
-}
-
-/****************************************************************************
Duplicate the file handle part for a DOS or FCB open.
****************************************************************************/
-NTSTATUS dup_file_fsp(files_struct *fsp,
- uint32 access_mask,
- uint32 share_access,
- uint32 create_options,
- files_struct **result)
+NTSTATUS dup_file_fsp(struct smb_request *req, files_struct *fsp,
+ uint32 access_mask, uint32 share_access,
+ uint32 create_options, files_struct **result)
{
NTSTATUS status;
files_struct *dup_fsp;
- status = file_new(fsp->conn, &dup_fsp);
+ status = file_new(NULL, fsp->conn, &dup_fsp);
if (!NT_STATUS_IS_OK(status)) {
return status;
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index f4c45999ba..0ce226809e 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -5,17 +5,17 @@
SMB Version handling
Copyright (C) John H Terpstra 1995-1998
-
+
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/>.
*/
@@ -162,7 +162,7 @@ void send_trans_reply(connection_struct *conn, const uint8_t *inbuf,
copy_trans_params_and_data(outbuf, align,
rparam, tot_param_sent, this_lparam,
rdata, tot_data_sent, this_ldata);
-
+
SSVAL(outbuf,smb_vwv3,this_lparam);
SSVAL(outbuf,smb_vwv4,smb_offset(smb_buf(outbuf)+1,outbuf));
SSVAL(outbuf,smb_vwv5,tot_param_sent);
@@ -194,11 +194,15 @@ void send_trans_reply(connection_struct *conn, const uint8_t *inbuf,
Start the first part of an RPC reply which began with an SMBtrans request.
****************************************************************************/
-static void api_rpc_trans_reply(connection_struct *conn, struct smb_request *req, smb_np_struct *p)
+static void api_rpc_trans_reply(connection_struct *conn,
+ struct smb_request *req,
+ files_struct *fsp,
+ int max_trans_reply)
{
bool is_data_outstanding;
- char *rdata = (char *)SMB_MALLOC(p->max_trans_reply);
- int data_len;
+ uint8_t *rdata = SMB_MALLOC_ARRAY(uint8_t, max_trans_reply);
+ ssize_t data_len;
+ NTSTATUS status;
if(rdata == NULL) {
DEBUG(0,("api_rpc_trans_reply: malloc fail.\n"));
@@ -206,14 +210,15 @@ static void api_rpc_trans_reply(connection_struct *conn, struct smb_request *req
return;
}
- if((data_len = read_from_pipe( p, rdata, p->max_trans_reply,
- &is_data_outstanding)) < 0) {
+ status = np_read(fsp, rdata, max_trans_reply, &data_len,
+ &is_data_outstanding);
+ if (!NT_STATUS_IS_OK(status)) {
SAFE_FREE(rdata);
api_no_reply(conn,req);
return;
}
- send_trans_reply(conn, req->inbuf, NULL, 0, rdata, data_len,
+ send_trans_reply(conn, req->inbuf, NULL, 0, (char *)rdata, data_len,
is_data_outstanding);
SAFE_FREE(rdata);
return;
@@ -223,25 +228,18 @@ static void api_rpc_trans_reply(connection_struct *conn, struct smb_request *req
WaitNamedPipeHandleState
****************************************************************************/
-static void api_WNPHS(connection_struct *conn, struct smb_request *req, smb_np_struct *p,
- char *param, int param_len)
+static void api_WNPHS(connection_struct *conn, struct smb_request *req,
+ struct files_struct *fsp, char *param, int param_len)
{
- uint16 priority;
-
if (!param || param_len < 2) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
return;
}
- priority = SVAL(param,0);
- DEBUG(4,("WaitNamedPipeHandleState priority %x\n", priority));
+ DEBUG(4,("WaitNamedPipeHandleState priority %x\n",
+ (int)SVAL(param,0)));
- if (wait_rpc_pipe_hnd_state(p, priority)) {
- /* now send the reply */
- send_trans_reply(conn, req->inbuf, NULL, 0, NULL, 0, False);
- return;
- }
- api_no_reply(conn,req);
+ send_trans_reply(conn, req->inbuf, NULL, 0, NULL, 0, False);
}
@@ -249,25 +247,17 @@ static void api_WNPHS(connection_struct *conn, struct smb_request *req, smb_np_s
SetNamedPipeHandleState
****************************************************************************/
-static void api_SNPHS(connection_struct *conn, struct smb_request *req, smb_np_struct *p,
- char *param, int param_len)
+static void api_SNPHS(connection_struct *conn, struct smb_request *req,
+ struct files_struct *fsp, char *param, int param_len)
{
- uint16 id;
-
if (!param || param_len < 2) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
return;
}
- id = SVAL(param,0);
- DEBUG(4,("SetNamedPipeHandleState to code %x\n", id));
+ DEBUG(4,("SetNamedPipeHandleState to code %x\n", (int)SVAL(param,0)));
- if (set_rpc_pipe_hnd_state(p, id)) {
- /* now send the reply */
- send_trans_reply(conn, req->inbuf, NULL, 0, NULL, 0, False);
- return;
- }
- api_no_reply(conn,req);
+ send_trans_reply(conn, req->inbuf, NULL, 0, NULL, 0, False);
}
@@ -297,14 +287,14 @@ static void api_no_reply(connection_struct *conn, struct smb_request *req)
static void api_fd_reply(connection_struct *conn, uint16 vuid,
struct smb_request *req,
- uint16 *setup, char *data, char *params,
+ uint16 *setup, uint8_t *data, char *params,
int suwcnt, int tdscnt, int tpscnt,
int mdrcnt, int mprcnt)
{
- bool reply = False;
- smb_np_struct *p = NULL;
+ struct files_struct *fsp;
int pnum;
int subcommand;
+ NTSTATUS status;
DEBUG(5,("api_fd_reply\n"));
@@ -318,12 +308,14 @@ static void api_fd_reply(connection_struct *conn, uint16 vuid,
/* Get the file handle and hence the file name. */
/*
* NB. The setup array has already been transformed
- * via SVAL and so is in gost byte order.
+ * via SVAL and so is in host byte order.
*/
pnum = ((int)setup[1]) & 0xFFFF;
subcommand = ((int)setup[0]) & 0xFFFF;
- if(!(p = get_rpc_pipe(pnum))) {
+ fsp = file_fsp(req, pnum);
+
+ if (!fsp_is_np(fsp)) {
if (subcommand == TRANSACT_WAITNAMEDPIPEHANDLESTATE) {
/* Win9x does this call with a unicode pipe name, not a pnum. */
/* Just return success for now... */
@@ -338,37 +330,37 @@ static void api_fd_reply(connection_struct *conn, uint16 vuid,
return;
}
- if (vuid != p->vuid) {
+ if (vuid != fsp->vuid) {
DEBUG(1, ("Got pipe request (pnum %x) using invalid VUID %d, "
- "expected %d\n", pnum, vuid, p->vuid));
+ "expected %d\n", pnum, vuid, fsp->vuid));
reply_nterror(req, NT_STATUS_INVALID_HANDLE);
return;
}
- DEBUG(3,("Got API command 0x%x on pipe \"%s\" (pnum %x)\n", subcommand, p->name, pnum));
-
- /* record maximum data length that can be transmitted in an SMBtrans */
- p->max_trans_reply = mdrcnt;
+ DEBUG(3,("Got API command 0x%x on pipe \"%s\" (pnum %x)\n",
+ subcommand, fsp->fsp_name, pnum));
- DEBUG(10,("api_fd_reply: p:%p max_trans_reply: %d\n", p, p->max_trans_reply));
+ DEBUG(10, ("api_fd_reply: p:%p max_trans_reply: %d\n", fsp, mdrcnt));
switch (subcommand) {
- case TRANSACT_DCERPCCMD:
+ case TRANSACT_DCERPCCMD: {
/* dce/rpc command */
- reply = write_to_pipe(p, data, tdscnt);
- if (!reply) {
+ ssize_t nwritten;
+ status = np_write(fsp, data, tdscnt, &nwritten);
+ if (!NT_STATUS_IS_OK(status)) {
api_no_reply(conn, req);
return;
}
- api_rpc_trans_reply(conn, req, p);
+ api_rpc_trans_reply(conn, req, fsp, mdrcnt);
break;
+ }
case TRANSACT_WAITNAMEDPIPEHANDLESTATE:
/* Wait Named Pipe Handle state */
- api_WNPHS(conn, req, p, params, tpscnt);
+ api_WNPHS(conn, req, fsp, params, tpscnt);
break;
case TRANSACT_SETNAMEDPIPEHANDLESTATE:
/* Set Named Pipe Handle state */
- api_SNPHS(conn, req, p, params, tpscnt);
+ api_SNPHS(conn, req, fsp, params, tpscnt);
break;
default:
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
@@ -406,7 +398,7 @@ static void named_pipe(connection_struct *conn, uint16 vuid,
DEBUG(4,("named pipe command from Win95 (wow!)\n"));
api_fd_reply(conn, vuid, req,
- setup, data, params,
+ setup, (uint8_t *)data, params,
suwcnt, tdscnt, tpscnt,
mdrcnt, mprcnt);
return;
@@ -414,7 +406,7 @@ static void named_pipe(connection_struct *conn, uint16 vuid,
if (strlen(name) < 1) {
api_fd_reply(conn, vuid, req,
- setup, data,
+ setup, (uint8_t *)data,
params, suwcnt, tdscnt,
tpscnt, mdrcnt, mprcnt);
return;
@@ -735,11 +727,11 @@ void reply_transs(struct smb_request *req)
state->received_param += pcnt;
state->received_data += dcnt;
-
+
if ((state->received_data > state->total_data) ||
(state->received_param > state->total_param))
goto bad_param;
-
+
if (pcnt) {
if (pdisp > state->total_param ||
pcnt > state->total_param ||
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index fe1d766b9d..0c866da706 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -1154,7 +1154,7 @@ static int get_server_info(uint32 servertype,
bool local_list_only;
int i;
- lines = file_lines_load(lock_path(SERVER_LIST), NULL, 0);
+ lines = file_lines_load(lock_path(SERVER_LIST), NULL, 0, NULL);
if (!lines) {
DEBUG(4,("Can't open %s - %s\n",lock_path(SERVER_LIST),strerror(errno)));
return 0;
@@ -1186,7 +1186,7 @@ static int get_server_info(uint32 servertype,
*servers = SMB_REALLOC_ARRAY(*servers,struct srv_info_struct, alloced);
if (!*servers) {
DEBUG(0,("get_server_info: failed to enlarge servers info struct!\n"));
- file_lines_free(lines);
+ TALLOC_FREE(lines);
return 0;
}
memset((char *)((*servers)+count),'\0',sizeof(**servers)*(alloced-count));
@@ -1267,7 +1267,7 @@ static int get_server_info(uint32 servertype,
}
}
- file_lines_free(lines);
+ TALLOC_FREE(lines);
return count;
}
diff --git a/source3/smbd/map_username.c b/source3/smbd/map_username.c
index 7536758bcb..a8899dd538 100644
--- a/source3/smbd/map_username.c
+++ b/source3/smbd/map_username.c
@@ -116,7 +116,7 @@ bool map_username(fstring user)
}
numlines = 0;
- qlines = fd_lines_load(fd, &numlines,0);
+ qlines = fd_lines_load(fd, &numlines,0, NULL);
DEBUGADD(10,("Lines returned = [%d]\n", numlines));
close(fd);
@@ -127,7 +127,7 @@ bool map_username(fstring user)
fstrcpy( user, qlines[0] );
}
- file_lines_free(qlines);
+ TALLOC_FREE(qlines);
return numlines != 0;
}
diff --git a/source3/smbd/noquotas.c b/source3/smbd/noquotas.c
index c8ff8edf62..392b32437a 100644
--- a/source3/smbd/noquotas.c
+++ b/source3/smbd/noquotas.c
@@ -23,14 +23,14 @@
* Needed for auto generation of proto.h.
*/
-bool disk_quotas(const char *path,SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT *dsize)
+bool disk_quotas(const char *path,uint64_t *bsize,uint64_t *dfree,uint64_t *dsize)
{
(*bsize) = 512; /* This value should be ignored */
/* And just to be sure we set some values that hopefully */
/* will be larger that any possible real-world value */
- (*dfree) = (SMB_BIG_UINT)-1;
- (*dsize) = (SMB_BIG_UINT)-1;
+ (*dfree) = (uint64_t)-1;
+ (*dsize) = (uint64_t)-1;
/* As we have select not to use quotas, allways fail */
return False;
diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c
index 84b8e1098e..06da717799 100644
--- a/source3/smbd/notify_internal.c
+++ b/source3/smbd/notify_internal.c
@@ -166,7 +166,7 @@ static NTSTATUS notify_load(struct notify_context *notify, struct db_record *rec
status = NT_STATUS_OK;
if (blob.length > 0) {
enum ndr_err_code ndr_err;
- ndr_err = ndr_pull_struct_blob(&blob, notify->array, notify->array,
+ ndr_err = ndr_pull_struct_blob(&blob, notify->array, NULL, notify->array,
(ndr_pull_flags_fn_t)ndr_pull_notify_array);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = ndr_map_error2ntstatus(ndr_err);
@@ -220,7 +220,7 @@ static NTSTATUS notify_save(struct notify_context *notify, struct db_record *rec
tmp_ctx = talloc_new(notify);
NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
- ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, notify->array,
+ ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, NULL, notify->array,
(ndr_push_flags_fn_t)ndr_push_notify_array);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(tmp_ctx);
@@ -258,7 +258,7 @@ static void notify_handler(struct messaging_context *msg_ctx, void *private_data
return;
}
- ndr_err = ndr_pull_struct_blob(data, tmp_ctx, &ev,
+ ndr_err = ndr_pull_struct_blob(data, tmp_ctx, NULL, &ev,
(ndr_pull_flags_fn_t)ndr_pull_notify_event);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(tmp_ctx);
@@ -561,7 +561,7 @@ static NTSTATUS notify_send(struct notify_context *notify, struct notify_entry *
tmp_ctx = talloc_new(notify);
- ndr_err = ndr_push_struct_blob(&data, tmp_ctx, &ev,
+ ndr_err = ndr_push_struct_blob(&data, tmp_ctx, NULL, &ev,
(ndr_push_flags_fn_t)ndr_push_notify_event);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
talloc_free(tmp_ctx);
diff --git a/source3/smbd/ntquotas.c b/source3/smbd/ntquotas.c
index c616c494dc..ae7034011e 100644
--- a/source3/smbd/ntquotas.c
+++ b/source3/smbd/ntquotas.c
@@ -22,14 +22,14 @@
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_QUOTA
-static SMB_BIG_UINT limit_nt2unix(SMB_BIG_UINT in, SMB_BIG_UINT bsize)
+static uint64_t limit_nt2unix(uint64_t in, uint64_t bsize)
{
- SMB_BIG_UINT ret = (SMB_BIG_UINT)0;
+ uint64_t ret = (uint64_t)0;
- ret = (SMB_BIG_UINT)(in/bsize);
+ ret = (uint64_t)(in/bsize);
if (in>0 && ret==0) {
/* we have to make sure that a overflow didn't set NO_LIMIT */
- ret = (SMB_BIG_UINT)1;
+ ret = (uint64_t)1;
}
if (in == SMB_NTQUOTAS_NO_LIMIT)
@@ -42,11 +42,11 @@ static SMB_BIG_UINT limit_nt2unix(SMB_BIG_UINT in, SMB_BIG_UINT bsize)
return ret;
}
-static SMB_BIG_UINT limit_unix2nt(SMB_BIG_UINT in, SMB_BIG_UINT bsize)
+static uint64_t limit_unix2nt(uint64_t in, uint64_t bsize)
{
- SMB_BIG_UINT ret = (SMB_BIG_UINT)0;
+ uint64_t ret = (uint64_t)0;
- ret = (SMB_BIG_UINT)(in*bsize);
+ ret = (uint64_t)(in*bsize);
if (ret < in) {
/* we overflow */
@@ -59,14 +59,14 @@ static SMB_BIG_UINT limit_unix2nt(SMB_BIG_UINT in, SMB_BIG_UINT bsize)
return ret;
}
-static SMB_BIG_UINT limit_blk2inodes(SMB_BIG_UINT in)
+static uint64_t limit_blk2inodes(uint64_t in)
{
- SMB_BIG_UINT ret = (SMB_BIG_UINT)0;
+ uint64_t ret = (uint64_t)0;
- ret = (SMB_BIG_UINT)(in/2);
+ ret = (uint64_t)(in/2);
if (ret == 0 && in != 0)
- ret = (SMB_BIG_UINT)1;
+ ret = (uint64_t)1;
return ret;
}
@@ -100,7 +100,7 @@ int vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, DOM_SID *psid,
return ret;
}
- qt->usedspace = (SMB_BIG_UINT)D.curblocks*D.bsize;
+ qt->usedspace = (uint64_t)D.curblocks*D.bsize;
qt->softlim = limit_unix2nt(D.softlimit, D.bsize);
qt->hardlim = limit_unix2nt(D.hardlimit, D.bsize);
qt->qflags = D.qflags;
@@ -121,7 +121,7 @@ int vfs_set_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, DOM_SID *psid,
id.uid = -1;
- D.bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE;
+ D.bsize = (uint64_t)QUOTABLOCK_SIZE;
D.softlimit = limit_nt2unix(qt->softlim,D.bsize);
D.hardlimit = limit_nt2unix(qt->hardlim,D.bsize);
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 584399c86c..69ddcdae8d 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -22,6 +22,7 @@
extern int max_send;
extern enum protocol_types Protocol;
+extern const struct generic_mapping file_generic_mapping;
static char *nttrans_realloc(char **ptr, size_t size)
{
@@ -267,7 +268,8 @@ bool is_ntfs_stream_name(const char *fname)
static void nt_open_pipe(char *fname, connection_struct *conn,
struct smb_request *req, int *ppnum)
{
- smb_np_struct *p = NULL;
+ files_struct *fsp;
+ NTSTATUS status;
DEBUG(4,("nt_open_pipe: Opening pipe %s.\n", fname));
@@ -284,19 +286,13 @@ static void nt_open_pipe(char *fname, connection_struct *conn,
DEBUG(3,("nt_open_pipe: Known pipe %s opening.\n", fname));
- p = open_rpc_pipe_p(fname, conn, req->vuid);
- if (!p) {
- reply_doserror(req, ERRSRV, ERRnofids);
+ status = np_open(req, conn, fname, &fsp);
+ if (!NT_STATUS_IS_OK(status)) {
+ reply_nterror(req, status);
return;
}
- /* TODO: Add pipe to db */
-
- if ( !store_pipe_opendb( p ) ) {
- DEBUG(3,("nt_open_pipe: failed to store %s pipe open.\n", fname));
- }
-
- *ppnum = p->pnum;
+ *ppnum = fsp->fnum;
return;
}
@@ -390,7 +386,7 @@ void reply_ntcreate_and_X(struct smb_request *req)
uint32 create_disposition;
uint32 create_options;
uint16 root_dir_fid;
- SMB_BIG_UINT allocation_size;
+ uint64_t allocation_size;
/* Breakout the oplock request bits so we can set the
reply bits separately. */
uint32 fattr=0;
@@ -422,10 +418,10 @@ void reply_ntcreate_and_X(struct smb_request *req)
create_options = IVAL(req->inbuf,smb_ntcreate_CreateOptions);
root_dir_fid = (uint16)IVAL(req->inbuf,smb_ntcreate_RootDirectoryFid);
- allocation_size = (SMB_BIG_UINT)IVAL(req->inbuf,
+ allocation_size = (uint64_t)IVAL(req->inbuf,
smb_ntcreate_AllocationSize);
#ifdef LARGE_SMB_OFF_T
- allocation_size |= (((SMB_BIG_UINT)IVAL(
+ allocation_size |= (((uint64_t)IVAL(
req->inbuf,
smb_ntcreate_AllocationSize + 4)) << 32);
#endif
@@ -739,6 +735,10 @@ static NTSTATUS set_sd(files_struct *fsp, uint8 *data, uint32 sd_len,
security_info_sent &= ~DACL_SECURITY_INFORMATION;
}
+ /* Convert all the generic bits. */
+ security_acl_map_generic(psd->dacl, &file_generic_mapping);
+ security_acl_map_generic(psd->sacl, &file_generic_mapping);
+
status = SMB_VFS_FSET_NT_ACL(fsp, security_info_sent, psd);
TALLOC_FREE(psd);
@@ -814,7 +814,7 @@ static void call_nt_transact_create(connection_struct *conn,
struct ea_list *ea_list = NULL;
NTSTATUS status;
size_t param_len;
- SMB_BIG_UINT allocation_size;
+ uint64_t allocation_size;
int oplock_request;
uint8_t oplock_granted;
TALLOC_CTX *ctx = talloc_tos();
@@ -857,9 +857,9 @@ static void call_nt_transact_create(connection_struct *conn,
sd_len = IVAL(params,36);
ea_len = IVAL(params,40);
root_dir_fid = (uint16)IVAL(params,4);
- allocation_size = (SMB_BIG_UINT)IVAL(params,12);
+ allocation_size = (uint64_t)IVAL(params,12);
#ifdef LARGE_SMB_OFF_T
- allocation_size |= (((SMB_BIG_UINT)IVAL(params,16)) << 32);
+ allocation_size |= (((uint64_t)IVAL(params,16)) << 32);
#endif
/*
@@ -1183,7 +1183,7 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx,
&info, &fsp2);
if (!NT_STATUS_IS_OK(status)) {
- close_file(fsp1,ERROR_CLOSE);
+ close_file(NULL, fsp1, ERROR_CLOSE);
return status;
}
@@ -1197,12 +1197,12 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx,
* Thus we don't look at the error return from the
* close of fsp1.
*/
- close_file(fsp1,NORMAL_CLOSE);
+ close_file(NULL, fsp1, NORMAL_CLOSE);
/* Ensure the modtime is set correctly on the destination file. */
set_close_write_time(fsp2, get_mtimespec(&sbuf1));
- status = close_file(fsp2,NORMAL_CLOSE);
+ status = close_file(NULL, fsp2, NORMAL_CLOSE);
/* Grrr. We have to do this as open_file_ntcreate adds aARCH when it
creates the file. This isn't the correct thing to do in the copy
@@ -1394,7 +1394,7 @@ static void call_nt_transact_notify_change(connection_struct *conn,
return;
}
- fsp = file_fsp(SVAL(setup,4));
+ fsp = file_fsp(req, SVAL(setup,4));
filter = IVAL(setup, 0);
recursive = (SVAL(setup, 6) != 0) ? True : False;
@@ -1494,7 +1494,7 @@ static void call_nt_transact_rename(connection_struct *conn,
return;
}
- fsp = file_fsp(SVAL(params, 0));
+ fsp = file_fsp(req, SVAL(params, 0));
if (!check_fsp(conn, req, fsp)) {
return;
}
@@ -1563,7 +1563,7 @@ static void call_nt_transact_query_security_desc(connection_struct *conn,
return;
}
- fsp = file_fsp(SVAL(params,0));
+ fsp = file_fsp(req, SVAL(params,0));
if(!fsp) {
reply_doserror(req, ERRDOS, ERRbadfid);
return;
@@ -1659,7 +1659,7 @@ static void call_nt_transact_set_security_desc(connection_struct *conn,
return;
}
- if((fsp = file_fsp(SVAL(params,0))) == NULL) {
+ if((fsp = file_fsp(req, SVAL(params,0))) == NULL) {
reply_doserror(req, ERRDOS, ERRbadfid);
return;
}
@@ -1723,7 +1723,7 @@ static void call_nt_transact_ioctl(connection_struct *conn,
DEBUG(10,("call_nt_transact_ioctl: function[0x%08X] FID[0x%04X] isFSctl[0x%02X] compfilter[0x%02X]\n",
function, fidnum, isFSctl, compfilter));
- fsp=file_fsp(fidnum);
+ fsp=file_fsp(req, fidnum);
/* this check is done in each implemented function case for now
because I don't want to break anything... --metze
FSP_BELONGS_CONN(fsp,conn);*/
@@ -2030,7 +2030,7 @@ static void call_nt_transact_get_user_quota(connection_struct *conn,
}
/* maybe we can check the quota_fnum */
- fsp = file_fsp(SVAL(params,0));
+ fsp = file_fsp(req, SVAL(params,0));
if (!check_fsp_ntquota_handle(conn, req, fsp)) {
DEBUG(3,("TRANSACT_GET_USER_QUOTA: no valid QUOTA HANDLE\n"));
reply_nterror(req, NT_STATUS_INVALID_HANDLE);
@@ -2127,16 +2127,16 @@ static void call_nt_transact_get_user_quota(connection_struct *conn,
/* then the len of the SID 4 bytes */
SIVAL(entry,4,sid_len);
- /* unknown data 8 bytes SMB_BIG_UINT */
- SBIG_UINT(entry,8,(SMB_BIG_UINT)0); /* this is not 0 in windows...-metze*/
+ /* unknown data 8 bytes uint64_t */
+ SBIG_UINT(entry,8,(uint64_t)0); /* this is not 0 in windows...-metze*/
- /* the used disk space 8 bytes SMB_BIG_UINT */
+ /* the used disk space 8 bytes uint64_t */
SBIG_UINT(entry,16,tmp_list->quotas->usedspace);
- /* the soft quotas 8 bytes SMB_BIG_UINT */
+ /* the soft quotas 8 bytes uint64_t */
SBIG_UINT(entry,24,tmp_list->quotas->softlim);
- /* the hard quotas 8 bytes SMB_BIG_UINT */
+ /* the hard quotas 8 bytes uint64_t */
SBIG_UINT(entry,32,tmp_list->quotas->hardlim);
/* and now the SID */
@@ -2225,16 +2225,16 @@ static void call_nt_transact_get_user_quota(connection_struct *conn,
/* then the len of the SID 4 bytes */
SIVAL(entry,4,sid_len);
- /* unknown data 8 bytes SMB_BIG_UINT */
- SBIG_UINT(entry,8,(SMB_BIG_UINT)0); /* this is not 0 in windows...-mezte*/
+ /* unknown data 8 bytes uint64_t */
+ SBIG_UINT(entry,8,(uint64_t)0); /* this is not 0 in windows...-mezte*/
- /* the used disk space 8 bytes SMB_BIG_UINT */
+ /* the used disk space 8 bytes uint64_t */
SBIG_UINT(entry,16,qt.usedspace);
- /* the soft quotas 8 bytes SMB_BIG_UINT */
+ /* the soft quotas 8 bytes uint64_t */
SBIG_UINT(entry,24,qt.softlim);
- /* the hard quotas 8 bytes SMB_BIG_UINT */
+ /* the hard quotas 8 bytes uint64_t */
SBIG_UINT(entry,32,qt.hardlim);
/* and now the SID */
@@ -2297,7 +2297,7 @@ static void call_nt_transact_set_user_quota(connection_struct *conn,
}
/* maybe we can check the quota_fnum */
- fsp = file_fsp(SVAL(params,0));
+ fsp = file_fsp(req, SVAL(params,0));
if (!check_fsp_ntquota_handle(conn, req, fsp)) {
DEBUG(3,("TRANSACT_GET_USER_QUOTA: no valid QUOTA HANDLE\n"));
reply_nterror(req, NT_STATUS_INVALID_HANDLE);
@@ -2328,10 +2328,10 @@ static void call_nt_transact_set_user_quota(connection_struct *conn,
* maybe its the change time in NTTIME
*/
- /* the used space 8 bytes (SMB_BIG_UINT)*/
- qt.usedspace = (SMB_BIG_UINT)IVAL(pdata,16);
+ /* the used space 8 bytes (uint64_t)*/
+ qt.usedspace = (uint64_t)IVAL(pdata,16);
#ifdef LARGE_SMB_OFF_T
- qt.usedspace |= (((SMB_BIG_UINT)IVAL(pdata,20)) << 32);
+ qt.usedspace |= (((uint64_t)IVAL(pdata,20)) << 32);
#else /* LARGE_SMB_OFF_T */
if ((IVAL(pdata,20) != 0)&&
((qt.usedspace != 0xFFFFFFFF)||
@@ -2342,10 +2342,10 @@ static void call_nt_transact_set_user_quota(connection_struct *conn,
}
#endif /* LARGE_SMB_OFF_T */
- /* the soft quotas 8 bytes (SMB_BIG_UINT)*/
- qt.softlim = (SMB_BIG_UINT)IVAL(pdata,24);
+ /* the soft quotas 8 bytes (uint64_t)*/
+ qt.softlim = (uint64_t)IVAL(pdata,24);
#ifdef LARGE_SMB_OFF_T
- qt.softlim |= (((SMB_BIG_UINT)IVAL(pdata,28)) << 32);
+ qt.softlim |= (((uint64_t)IVAL(pdata,28)) << 32);
#else /* LARGE_SMB_OFF_T */
if ((IVAL(pdata,28) != 0)&&
((qt.softlim != 0xFFFFFFFF)||
@@ -2356,10 +2356,10 @@ static void call_nt_transact_set_user_quota(connection_struct *conn,
}
#endif /* LARGE_SMB_OFF_T */
- /* the hard quotas 8 bytes (SMB_BIG_UINT)*/
- qt.hardlim = (SMB_BIG_UINT)IVAL(pdata,32);
+ /* the hard quotas 8 bytes (uint64_t)*/
+ qt.hardlim = (uint64_t)IVAL(pdata,32);
#ifdef LARGE_SMB_OFF_T
- qt.hardlim |= (((SMB_BIG_UINT)IVAL(pdata,36)) << 32);
+ qt.hardlim |= (((uint64_t)IVAL(pdata,36)) << 32);
#else /* LARGE_SMB_OFF_T */
if ((IVAL(pdata,36) != 0)&&
((qt.hardlim != 0xFFFFFFFF)||
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 8b32907a4b..d858fb969f 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -890,7 +890,8 @@ static bool open_match_attributes(connection_struct *conn,
Try and find a duplicated file handle.
****************************************************************************/
-static files_struct *fcb_or_dos_open(connection_struct *conn,
+static files_struct *fcb_or_dos_open(struct smb_request *req,
+ connection_struct *conn,
const char *fname,
struct file_id id,
uint16 file_pid,
@@ -940,7 +941,7 @@ static files_struct *fcb_or_dos_open(connection_struct *conn,
}
/* We need to duplicate this fsp. */
- if (!NT_STATUS_IS_OK(dup_file_fsp(fsp, access_mask, share_access,
+ if (!NT_STATUS_IS_OK(dup_file_fsp(req, fsp, access_mask, share_access,
create_options, &dup_fsp))) {
return NULL;
}
@@ -1178,7 +1179,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
DEBUG(10, ("open_file_ntcreate: printer open fname=%s\n", fname));
- return print_fsp_open(conn, fname, req->vuid, result);
+ return print_fsp_open(req, conn, fname, req->vuid, result);
}
if (!parent_dirname_talloc(talloc_tos(), fname, &parent_dir,
@@ -1435,7 +1436,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
return NT_STATUS_ACCESS_DENIED;
}
- status = file_new(conn, &fsp);
+ status = file_new(req, conn, &fsp);
if(!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -1464,7 +1465,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
fname, &old_write_time);
if (lck == NULL) {
- file_free(fsp);
+ file_free(req, fsp);
DEBUG(0, ("Could not get share mode lock\n"));
return NT_STATUS_SHARING_VIOLATION;
}
@@ -1475,7 +1476,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
oplock_request)) {
schedule_defer_open(lck, request_time, req);
TALLOC_FREE(lck);
- file_free(fsp);
+ file_free(req, fsp);
return NT_STATUS_SHARING_VIOLATION;
}
@@ -1495,7 +1496,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
oplock_request)) {
schedule_defer_open(lck, request_time, req);
TALLOC_FREE(lck);
- file_free(fsp);
+ file_free(req, fsp);
return NT_STATUS_SHARING_VIOLATION;
}
}
@@ -1503,7 +1504,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
if (NT_STATUS_EQUAL(status, NT_STATUS_DELETE_PENDING)) {
/* DELETE_PENDING is not deferred for a second */
TALLOC_FREE(lck);
- file_free(fsp);
+ file_free(req, fsp);
return status;
}
@@ -1524,13 +1525,13 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
DEBUG(0, ("DOS open without an SMB "
"request!\n"));
TALLOC_FREE(lck);
- file_free(fsp);
+ file_free(req, fsp);
return NT_STATUS_INTERNAL_ERROR;
}
/* Use the client requested access mask here,
* not the one we open with. */
- fsp_dup = fcb_or_dos_open(conn, fname, id,
+ fsp_dup = fcb_or_dos_open(req, conn, fname, id,
req->smbpid,
req->vuid,
access_mask,
@@ -1539,7 +1540,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
if (fsp_dup) {
TALLOC_FREE(lck);
- file_free(fsp);
+ file_free(req, fsp);
if (pinfo) {
*pinfo = FILE_WAS_OPENED;
}
@@ -1625,7 +1626,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
} else {
status = NT_STATUS_ACCESS_DENIED;
}
- file_free(fsp);
+ file_free(req, fsp);
return status;
}
@@ -1663,7 +1664,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
if (lck != NULL) {
TALLOC_FREE(lck);
}
- file_free(fsp);
+ file_free(req, fsp);
return fsp_open;
}
@@ -1694,7 +1695,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
DEBUG(0, ("open_file_ntcreate: Could not get share "
"mode lock for %s\n", fname));
fd_close(fsp);
- file_free(fsp);
+ file_free(req, fsp);
return NT_STATUS_SHARING_VIOLATION;
}
@@ -1705,7 +1706,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
schedule_defer_open(lck, request_time, req);
TALLOC_FREE(lck);
fd_close(fsp);
- file_free(fsp);
+ file_free(req, fsp);
return NT_STATUS_SHARING_VIOLATION;
}
@@ -1724,7 +1725,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
schedule_defer_open(lck, request_time, req);
TALLOC_FREE(lck);
fd_close(fsp);
- file_free(fsp);
+ file_free(req, fsp);
return NT_STATUS_SHARING_VIOLATION;
}
}
@@ -1733,7 +1734,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
struct deferred_open_record state;
fd_close(fsp);
- file_free(fsp);
+ file_free(req, fsp);
state.delayed_for_oplocks = False;
state.id = id;
@@ -1775,7 +1776,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
TALLOC_FREE(lck);
fd_close(fsp);
- file_free(fsp);
+ file_free(req, fsp);
return NT_STATUS_SHARING_VIOLATION;
}
@@ -1801,7 +1802,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
status = map_nt_error_from_unix(errno);
TALLOC_FREE(lck);
fd_close(fsp);
- file_free(fsp);
+ file_free(req, fsp);
return status;
}
}
@@ -1852,7 +1853,8 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
/* Handle strange delete on close create semantics. */
if ((create_options & FILE_DELETE_ON_CLOSE)
- && (is_ntfs_stream_name(fname)
+ && (((conn->fs_capabilities & FILE_NAMED_STREAMS)
+ && is_ntfs_stream_name(fname))
|| can_set_initial_delete_on_close(lck))) {
status = can_set_delete_on_close(fsp, True, new_dos_attributes);
@@ -1861,7 +1863,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
del_share_mode(lck, fsp);
TALLOC_FREE(lck);
fd_close(fsp);
- file_free(fsp);
+ file_free(req, fsp);
return status;
}
/* Note that here we set the *inital* delete on close flag,
@@ -1947,7 +1949,8 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
Open a file for for write to ensure that we can fchmod it.
****************************************************************************/
-NTSTATUS open_file_fchmod(connection_struct *conn, const char *fname,
+NTSTATUS open_file_fchmod(struct smb_request *req, connection_struct *conn,
+ const char *fname,
SMB_STRUCT_STAT *psbuf, files_struct **result)
{
files_struct *fsp = NULL;
@@ -1957,7 +1960,7 @@ NTSTATUS open_file_fchmod(connection_struct *conn, const char *fname,
return NT_STATUS_INVALID_PARAMETER;
}
- status = file_new(conn, &fsp);
+ status = file_new(req, conn, &fsp);
if(!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -1974,7 +1977,7 @@ NTSTATUS open_file_fchmod(connection_struct *conn, const char *fname,
*/
if (!NT_STATUS_IS_OK(status)) {
- file_free(fsp);
+ file_free(req, fsp);
return status;
}
@@ -1986,10 +1989,10 @@ NTSTATUS open_file_fchmod(connection_struct *conn, const char *fname,
Close the fchmod file fd - ensure no locks are lost.
****************************************************************************/
-NTSTATUS close_file_fchmod(files_struct *fsp)
+NTSTATUS close_file_fchmod(struct smb_request *req, files_struct *fsp)
{
NTSTATUS status = fd_close(fsp);
- file_free(fsp);
+ file_free(req, fsp);
return status;
}
@@ -2116,7 +2119,9 @@ NTSTATUS open_directory(connection_struct *conn,
(unsigned int)create_disposition,
(unsigned int)file_attributes));
- if (!(file_attributes & FILE_FLAG_POSIX_SEMANTICS) && is_ntfs_stream_name(fname)) {
+ if (!(file_attributes & FILE_FLAG_POSIX_SEMANTICS) &&
+ (conn->fs_capabilities & FILE_NAMED_STREAMS) &&
+ is_ntfs_stream_name(fname)) {
DEBUG(2, ("open_directory: %s is a stream name!\n", fname));
return NT_STATUS_NOT_A_DIRECTORY;
}
@@ -2195,7 +2200,7 @@ NTSTATUS open_directory(connection_struct *conn,
return NT_STATUS_NOT_A_DIRECTORY;
}
- status = file_new(conn, &fsp);
+ status = file_new(req, conn, &fsp);
if(!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -2233,7 +2238,7 @@ NTSTATUS open_directory(connection_struct *conn,
if (lck == NULL) {
DEBUG(0, ("open_directory: Could not get share mode lock for %s\n", fname));
- file_free(fsp);
+ file_free(req, fsp);
return NT_STATUS_SHARING_VIOLATION;
}
@@ -2243,7 +2248,7 @@ NTSTATUS open_directory(connection_struct *conn,
if (!NT_STATUS_IS_OK(status)) {
TALLOC_FREE(lck);
- file_free(fsp);
+ file_free(req, fsp);
return status;
}
@@ -2256,7 +2261,7 @@ NTSTATUS open_directory(connection_struct *conn,
status = can_set_delete_on_close(fsp, True, 0);
if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, NT_STATUS_DIRECTORY_NOT_EMPTY)) {
TALLOC_FREE(lck);
- file_free(fsp);
+ file_free(req, fsp);
return status;
}
@@ -2297,7 +2302,7 @@ NTSTATUS create_directory(connection_struct *conn, struct smb_request *req, cons
&fsp);
if (NT_STATUS_IS_OK(status)) {
- close_file(fsp, NORMAL_CLOSE);
+ close_file(req, fsp, NORMAL_CLOSE);
}
return status;
@@ -2507,7 +2512,7 @@ static NTSTATUS open_streams_for_delete(connection_struct *conn,
DEBUG(10, ("Closing stream # %d, %s\n", i,
streams[i]->fsp_name));
- close_file(streams[i], NORMAL_CLOSE);
+ close_file(NULL, streams[i], NORMAL_CLOSE);
}
fail:
@@ -2528,7 +2533,7 @@ NTSTATUS create_file_unixpath(connection_struct *conn,
uint32_t create_options,
uint32_t file_attributes,
uint32_t oplock_request,
- SMB_BIG_UINT allocation_size,
+ uint64_t allocation_size,
struct security_descriptor *sd,
struct ea_list *ea_list,
@@ -2605,9 +2610,7 @@ NTSTATUS create_file_unixpath(connection_struct *conn,
&& (create_disposition != FILE_CREATE)
&& (share_access & FILE_SHARE_DELETE)
&& (access_mask & DELETE_ACCESS)
- && (((dos_mode(conn, fname, &sbuf) & FILE_ATTRIBUTE_READONLY)
- && !lp_delete_readonly(SNUM(conn)))
- || !can_delete_file_in_directory(conn, fname))) {
+ && (!can_delete_file_in_directory(conn, fname))) {
status = NT_STATUS_ACCESS_DENIED;
goto fail;
}
@@ -2763,6 +2766,10 @@ NTSTATUS create_file_unixpath(connection_struct *conn,
fsp->access_mask = FILE_GENERIC_ALL;
+ /* Convert all the generic bits. */
+ security_acl_map_generic(sd->dacl, &file_generic_mapping);
+ security_acl_map_generic(sd->sacl, &file_generic_mapping);
+
status = SMB_VFS_FSET_NT_ACL(fsp, sec_info_sent, sd);
fsp->access_mask = saved_access_mask;
@@ -2802,7 +2809,7 @@ NTSTATUS create_file_unixpath(connection_struct *conn,
}
} else {
fsp->initial_allocation_size = smb_roundup(
- fsp->conn, (SMB_BIG_UINT)sbuf.st_size);
+ fsp->conn, (uint64_t)sbuf.st_size);
}
}
@@ -2836,11 +2843,11 @@ NTSTATUS create_file_unixpath(connection_struct *conn,
DEBUG(10, ("create_file_unixpath: %s\n", nt_errstr(status)));
if (fsp != NULL) {
- close_file(fsp, ERROR_CLOSE);
+ close_file(req, fsp, ERROR_CLOSE);
fsp = NULL;
}
if (base_fsp != NULL) {
- close_file(base_fsp, ERROR_CLOSE);
+ close_file(req, base_fsp, ERROR_CLOSE);
base_fsp = NULL;
}
return status;
@@ -2856,7 +2863,7 @@ NTSTATUS create_file(connection_struct *conn,
uint32_t create_options,
uint32_t file_attributes,
uint32_t oplock_request,
- SMB_BIG_UINT allocation_size,
+ uint64_t allocation_size,
struct security_descriptor *sd,
struct ea_list *ea_list,
@@ -2894,7 +2901,7 @@ NTSTATUS create_file(connection_struct *conn,
* This filename is relative to a directory fid.
*/
char *parent_fname = NULL;
- files_struct *dir_fsp = file_fsp(root_dir_fid);
+ files_struct *dir_fsp = file_fsp(req, root_dir_fid);
if (dir_fsp == NULL) {
status = NT_STATUS_INVALID_HANDLE;
@@ -2907,7 +2914,8 @@ NTSTATUS create_file(connection_struct *conn,
* Check to see if this is a mac fork of some kind.
*/
- if (is_ntfs_stream_name(fname)) {
+ if ((conn->fs_capabilities & FILE_NAMED_STREAMS) &&
+ is_ntfs_stream_name(fname)) {
status = NT_STATUS_OBJECT_PATH_NOT_FOUND;
goto fail;
}
@@ -2994,7 +3002,7 @@ NTSTATUS create_file(connection_struct *conn,
* also tries a QUERY_FILE_INFO on the file and then
* close it
*/
- status = open_fake_file(conn, req->vuid,
+ status = open_fake_file(req, conn, req->vuid,
fake_file_type, fname,
access_mask, &fsp);
if (!NT_STATUS_IS_OK(status)) {
@@ -3086,7 +3094,7 @@ NTSTATUS create_file(connection_struct *conn,
DEBUG(10, ("create_file: %s\n", nt_errstr(status)));
if (fsp != NULL) {
- close_file(fsp, ERROR_CLOSE);
+ close_file(req, fsp, ERROR_CLOSE);
fsp = NULL;
}
return status;
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 1d3514429f..88e7b766be 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -545,7 +545,7 @@ static bool user_ok(const char *user, int snum)
ret = True;
if (lp_invalid_users(snum)) {
- str_list_copy(talloc_tos(), &invalid, lp_invalid_users(snum));
+ invalid = str_list_copy(talloc_tos(), lp_invalid_users(snum));
if (invalid &&
str_list_substitute(invalid, "%S", lp_servicename(snum))) {
@@ -561,7 +561,7 @@ static bool user_ok(const char *user, int snum)
TALLOC_FREE(invalid);
if (ret && lp_valid_users(snum)) {
- str_list_copy(talloc_tos(), &valid, lp_valid_users(snum));
+ valid = str_list_copy(talloc_tos(), lp_valid_users(snum));
if ( valid &&
str_list_substitute(valid, "%S", lp_servicename(snum)) ) {
diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c
index 4fdcdcc557..25a1fe2e63 100644
--- a/source3/smbd/pipes.c
+++ b/source3/smbd/pipes.c
@@ -32,18 +32,6 @@
#define MAX_PIPE_NAME_LEN 24
-/* PIPE/<name>/<pid>/<pnum> */
-#define PIPEDB_KEY_FORMAT "PIPE/%s/%u/%d"
-
-struct pipe_dbrec {
- struct server_id pid;
- int pnum;
- uid_t uid;
-
- char name[MAX_PIPE_NAME_LEN];
- fstring user;
-};
-
/****************************************************************************
Reply to an open and X on a named pipe.
This code is basically stolen from reply_open_and_X with some
@@ -54,9 +42,10 @@ void reply_open_pipe_and_X(connection_struct *conn, struct smb_request *req)
{
const char *fname = NULL;
char *pipe_name = NULL;
- smb_np_struct *p;
+ files_struct *fsp;
int size=0,fmode=0,mtime=0,rmode=0;
TALLOC_CTX *ctx = talloc_tos();
+ NTSTATUS status;
/* XXXX we need to handle passed times, sattr and flags */
srvstr_pull_buf_talloc(ctx, req->inbuf, req->flags2, &pipe_name,
@@ -101,9 +90,9 @@ void reply_open_pipe_and_X(connection_struct *conn, struct smb_request *req)
/* can be opened and add it in after the open. */
DEBUG(3,("Known pipe %s opening.\n",fname));
- p = open_rpc_pipe_p(fname, conn, req->vuid);
- if (!p) {
- reply_doserror(req, ERRSRV, ERRnofids);
+ status = np_open(req, conn, fname, &fsp);
+ if (!NT_STATUS_IS_OK(status)) {
+ reply_nterror(req, status);
return;
}
@@ -119,7 +108,7 @@ void reply_open_pipe_and_X(connection_struct *conn, struct smb_request *req)
rmode = 1;
}
- SSVAL(req->outbuf,smb_vwv2, p->pnum);
+ SSVAL(req->outbuf,smb_vwv2, fsp->fnum);
SSVAL(req->outbuf,smb_vwv3,fmode);
srv_put_dos_date3((char *)req->outbuf,smb_vwv4,mtime);
SIVAL(req->outbuf,smb_vwv6,size);
@@ -136,27 +125,32 @@ void reply_open_pipe_and_X(connection_struct *conn, struct smb_request *req)
void reply_pipe_write(struct smb_request *req)
{
- smb_np_struct *p = get_rpc_pipe_p(SVAL(req->inbuf,smb_vwv0));
+ files_struct *fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv0));
size_t numtowrite = SVAL(req->inbuf,smb_vwv1);
- int nwritten;
- char *data;
+ ssize_t nwritten;
+ uint8_t *data;
- if (!p) {
+ if (!fsp_is_np(fsp)) {
reply_doserror(req, ERRDOS, ERRbadfid);
return;
}
- if (p->vuid != req->vuid) {
+ if (fsp->vuid != req->vuid) {
reply_nterror(req, NT_STATUS_INVALID_HANDLE);
return;
}
- data = smb_buf(req->inbuf) + 3;
+ data = (uint8_t *)smb_buf(req->inbuf) + 3;
if (numtowrite == 0) {
nwritten = 0;
} else {
- nwritten = write_to_pipe(p, data, numtowrite);
+ NTSTATUS status;
+ status = np_write(fsp, data, numtowrite, &nwritten);
+ if (!NT_STATUS_IS_OK(status)) {
+ reply_nterror(req, status);
+ return;
+ }
}
if ((nwritten == 0 && numtowrite != 0) || (nwritten < 0)) {
@@ -168,7 +162,8 @@ void reply_pipe_write(struct smb_request *req)
SSVAL(req->outbuf,smb_vwv0,nwritten);
- DEBUG(3,("write-IPC pnum=%04x nwritten=%d\n", p->pnum, nwritten));
+ DEBUG(3,("write-IPC pnum=%04x nwritten=%d\n", fsp->fnum,
+ (int)nwritten));
return;
}
@@ -182,31 +177,33 @@ void reply_pipe_write(struct smb_request *req)
void reply_pipe_write_and_X(struct smb_request *req)
{
- smb_np_struct *p = get_rpc_pipe_p(SVAL(req->inbuf,smb_vwv2));
+ files_struct *fsp = file_fsp(req, SVAL(req->inbuf, smb_vwv2));
size_t numtowrite = SVAL(req->inbuf,smb_vwv10);
- int nwritten = -1;
+ ssize_t nwritten;
int smb_doff = SVAL(req->inbuf, smb_vwv11);
bool pipe_start_message_raw =
((SVAL(req->inbuf, smb_vwv7)
& (PIPE_START_MESSAGE|PIPE_RAW_MODE))
== (PIPE_START_MESSAGE|PIPE_RAW_MODE));
- char *data;
+ uint8_t *data;
- if (!p) {
+ if (!fsp_is_np(fsp)) {
reply_doserror(req, ERRDOS, ERRbadfid);
return;
}
- if (p->vuid != req->vuid) {
+ if (fsp->vuid != req->vuid) {
reply_nterror(req, NT_STATUS_INVALID_HANDLE);
return;
}
- data = smb_base(req->inbuf) + smb_doff;
+ data = (uint8_t *)smb_base(req->inbuf) + smb_doff;
if (numtowrite == 0) {
nwritten = 0;
} else {
+ NTSTATUS status;
+
if(pipe_start_message_raw) {
/*
* For the start of a message in named pipe byte mode,
@@ -225,7 +222,11 @@ void reply_pipe_write_and_X(struct smb_request *req)
data += 2;
numtowrite -= 2;
}
- nwritten = write_to_pipe(p, data, numtowrite);
+ status = np_write(fsp, data, numtowrite, &nwritten);
+ if (!NT_STATUS_IS_OK(status)) {
+ reply_nterror(req, status);
+ return;
+ }
}
if ((nwritten == 0 && numtowrite != 0) || (nwritten < 0)) {
@@ -238,7 +239,8 @@ void reply_pipe_write_and_X(struct smb_request *req)
nwritten = (pipe_start_message_raw ? nwritten + 2 : nwritten);
SSVAL(req->outbuf,smb_vwv2,nwritten);
- DEBUG(3,("writeX-IPC pnum=%04x nwritten=%d\n", p->pnum, nwritten));
+ DEBUG(3,("writeX-IPC pnum=%04x nwritten=%d\n", fsp->fnum,
+ (int)nwritten));
chain_reply(req);
}
@@ -251,12 +253,13 @@ void reply_pipe_write_and_X(struct smb_request *req)
void reply_pipe_read_and_X(struct smb_request *req)
{
- smb_np_struct *p = get_rpc_pipe_p(SVAL(req->inbuf,smb_vwv2));
+ files_struct *fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv0));
int smb_maxcnt = SVAL(req->inbuf,smb_vwv5);
int smb_mincnt = SVAL(req->inbuf,smb_vwv6);
- int nread = -1;
- char *data;
+ ssize_t nread;
+ uint8_t *data;
bool unused;
+ NTSTATUS status;
/* we don't use the offset given to use for pipe reads. This
is deliberate, instead we always return the next lump of
@@ -265,18 +268,23 @@ void reply_pipe_read_and_X(struct smb_request *req)
uint32 smb_offs = IVAL(req->inbuf,smb_vwv3);
#endif
- if (!p) {
+ if (!fsp_is_np(fsp)) {
reply_doserror(req, ERRDOS, ERRbadfid);
return;
}
+ if (fsp->vuid != req->vuid) {
+ reply_nterror(req, NT_STATUS_INVALID_HANDLE);
+ return;
+ }
+
reply_outbuf(req, 12, smb_maxcnt);
- data = smb_buf(req->outbuf);
+ data = (uint8_t *)smb_buf(req->outbuf);
- nread = read_from_pipe(p, data, smb_maxcnt, &unused);
+ status = np_read(fsp, data, smb_maxcnt, &nread, &unused);
- if (nread < 0) {
+ if (!NT_STATUS_IS_OK(status)) {
reply_doserror(req, ERRDOS, ERRnoaccess);
return;
}
@@ -288,33 +296,7 @@ void reply_pipe_read_and_X(struct smb_request *req)
SSVAL(smb_buf(req->outbuf),-2,nread);
DEBUG(3,("readX-IPC pnum=%04x min=%d max=%d nread=%d\n",
- p->pnum, smb_mincnt, smb_maxcnt, nread));
+ fsp->fnum, smb_mincnt, smb_maxcnt, (int)nread));
chain_reply(req);
}
-
-/****************************************************************************
- Reply to a close.
-****************************************************************************/
-
-void reply_pipe_close(connection_struct *conn, struct smb_request *req)
-{
- smb_np_struct *p = get_rpc_pipe_p(SVAL(req->inbuf,smb_vwv0));
-
- if (!p) {
- reply_doserror(req, ERRDOS, ERRbadfid);
- return;
- }
-
- DEBUG(5,("reply_pipe_close: pnum:%x\n", p->pnum));
-
- if (!close_rpc_pipe_hnd(p)) {
- reply_doserror(req, ERRDOS, ERRbadfid);
- return;
- }
-
- /* TODO: REMOVE PIPE FROM DB */
-
- reply_outbuf(req, 0, 0);
- return;
-}
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index 7479aea076..848d3e4a6d 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -890,13 +890,12 @@ static bool nt4_compatible_acls(void)
not get. Deny entries are implicit on get with ace->perms = 0.
****************************************************************************/
-static SEC_ACCESS map_canon_ace_perms(int snum,
+static uint32_t map_canon_ace_perms(int snum,
enum security_ace_type *pacl_type,
mode_t perms,
bool directory_ace)
{
- SEC_ACCESS sa;
- uint32 nt_mask = 0;
+ uint32_t nt_mask = 0;
*pacl_type = SEC_ACE_TYPE_ACCESS_ALLOWED;
@@ -935,8 +934,7 @@ static SEC_ACCESS map_canon_ace_perms(int snum,
DEBUG(10,("map_canon_ace_perms: Mapped (UNIX) %x to (NT) %x\n",
(unsigned int)perms, (unsigned int)nt_mask ));
- init_sec_access(&sa,nt_mask);
- return sa;
+ return nt_mask;
}
/****************************************************************************
@@ -988,7 +986,7 @@ static mode_t map_nt_perms( uint32 *mask, int type)
Unpack a SEC_DESC into a UNIX owner and group.
****************************************************************************/
-NTSTATUS unpack_nt_owners(int snum, uid_t *puser, gid_t *pgrp, uint32 security_info_sent, SEC_DESC *psd)
+NTSTATUS unpack_nt_owners(int snum, uid_t *puser, gid_t *pgrp, uint32 security_info_sent, const SEC_DESC *psd)
{
DOM_SID owner_sid;
DOM_SID grp_sid;
@@ -1329,11 +1327,13 @@ static void check_owning_objs(canon_ace *ace, DOM_SID *pfile_owner_sid, DOM_SID
Unpack a SEC_DESC into two canonical ace lists.
****************************************************************************/
-static bool create_canon_ace_lists(files_struct *fsp, SMB_STRUCT_STAT *pst,
- DOM_SID *pfile_owner_sid,
- DOM_SID *pfile_grp_sid,
- canon_ace **ppfile_ace, canon_ace **ppdir_ace,
- SEC_ACL *dacl)
+static bool create_canon_ace_lists(files_struct *fsp,
+ SMB_STRUCT_STAT *pst,
+ DOM_SID *pfile_owner_sid,
+ DOM_SID *pfile_grp_sid,
+ canon_ace **ppfile_ace,
+ canon_ace **ppdir_ace,
+ const SEC_ACL *dacl)
{
bool all_aces_are_inherit_only = (fsp->is_directory ? True : False);
canon_ace *file_ace = NULL;
@@ -2016,12 +2016,14 @@ static mode_t create_default_mode(files_struct *fsp, bool interitable_mode)
succeeding.
****************************************************************************/
-static bool unpack_canon_ace(files_struct *fsp,
- SMB_STRUCT_STAT *pst,
- DOM_SID *pfile_owner_sid,
- DOM_SID *pfile_grp_sid,
- canon_ace **ppfile_ace, canon_ace **ppdir_ace,
- uint32 security_info_sent, SEC_DESC *psd)
+static bool unpack_canon_ace(files_struct *fsp,
+ SMB_STRUCT_STAT *pst,
+ DOM_SID *pfile_owner_sid,
+ DOM_SID *pfile_grp_sid,
+ canon_ace **ppfile_ace,
+ canon_ace **ppdir_ace,
+ uint32 security_info_sent,
+ const SEC_DESC *psd)
{
canon_ace *file_ace = NULL;
canon_ace *dir_ace = NULL;
@@ -2958,9 +2960,7 @@ static NTSTATUS posix_get_nt_acl_common(struct connection_struct *conn,
*/
for (ace = file_ace; ace != NULL; ace = ace->next) {
- SEC_ACCESS acc;
-
- acc = map_canon_ace_perms(SNUM(conn),
+ uint32_t acc = map_canon_ace_perms(SNUM(conn),
&nt_acl_type,
ace->perms,
S_ISDIR(sbuf->st_mode));
@@ -2975,19 +2975,14 @@ static NTSTATUS posix_get_nt_acl_common(struct connection_struct *conn,
/* The User must have access to a profile share - even
* if we can't map the SID. */
if (lp_profile_acls(SNUM(conn))) {
- SEC_ACCESS acc;
-
- init_sec_access(&acc,FILE_GENERIC_ALL);
init_sec_ace(&nt_ace_list[num_aces++],
&global_sid_Builtin_Users,
SEC_ACE_TYPE_ACCESS_ALLOWED,
- acc, 0);
+ FILE_GENERIC_ALL, 0);
}
for (ace = dir_ace; ace != NULL; ace = ace->next) {
- SEC_ACCESS acc;
-
- acc = map_canon_ace_perms(SNUM(conn),
+ uint32_t acc = map_canon_ace_perms(SNUM(conn),
&nt_acl_type,
ace->perms,
S_ISDIR(sbuf->st_mode));
@@ -3005,10 +3000,7 @@ static NTSTATUS posix_get_nt_acl_common(struct connection_struct *conn,
/* The User must have access to a profile share - even
* if we can't map the SID. */
if (lp_profile_acls(SNUM(conn))) {
- SEC_ACCESS acc;
-
- init_sec_access(&acc,FILE_GENERIC_ALL);
- init_sec_ace(&nt_ace_list[num_aces++], &global_sid_Builtin_Users, SEC_ACE_TYPE_ACCESS_ALLOWED, acc,
+ init_sec_ace(&nt_ace_list[num_aces++], &global_sid_Builtin_Users, SEC_ACE_TYPE_ACCESS_ALLOWED, FILE_GENERIC_ALL,
SEC_ACE_FLAG_OBJECT_INHERIT|SEC_ACE_FLAG_CONTAINER_INHERIT|
SEC_ACE_FLAG_INHERIT_ONLY|0);
}
@@ -3199,7 +3191,7 @@ int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid)
return -1;
}
- if (!NT_STATUS_IS_OK(open_file_fchmod(conn,fname,&st,&fsp))) {
+ if (!NT_STATUS_IS_OK(open_file_fchmod(NULL, conn, fname, &st, &fsp))) {
return -1;
}
@@ -3214,7 +3206,7 @@ int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid)
ret = SMB_VFS_FCHOWN(fsp, uid, (gid_t)-1);
unbecome_root();
- close_file_fchmod(fsp);
+ close_file_fchmod(NULL, fsp);
return ret;
}
@@ -3223,26 +3215,26 @@ int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid)
Take care of parent ACL inheritance.
****************************************************************************/
-static NTSTATUS append_parent_acl(files_struct *fsp,
- SMB_STRUCT_STAT *psbuf,
- SEC_DESC *psd,
+NTSTATUS append_parent_acl(files_struct *fsp,
+ const SEC_DESC *pcsd,
SEC_DESC **pp_new_sd)
{
SEC_DESC *parent_sd = NULL;
files_struct *parent_fsp = NULL;
- TALLOC_CTX *mem_ctx = talloc_parent(psd);
+ TALLOC_CTX *mem_ctx = talloc_tos();
char *parent_name = NULL;
SEC_ACE *new_ace = NULL;
- unsigned int num_aces = psd->dacl->num_aces;
+ unsigned int num_aces = pcsd->dacl->num_aces;
SMB_STRUCT_STAT sbuf;
NTSTATUS status;
int info;
unsigned int i, j;
- bool is_dacl_protected = (psd->type & SE_DESC_DACL_PROTECTED);
+ SEC_DESC *psd = dup_sec_desc(talloc_tos(), pcsd);
+ bool is_dacl_protected = (pcsd->type & SE_DESC_DACL_PROTECTED);
ZERO_STRUCT(sbuf);
- if (mem_ctx == NULL) {
+ if (psd == NULL) {
return NT_STATUS_NO_MEMORY;
}
@@ -3272,7 +3264,7 @@ static NTSTATUS append_parent_acl(files_struct *fsp,
status = SMB_VFS_GET_NT_ACL(parent_fsp->conn, parent_fsp->fsp_name,
DACL_SECURITY_INFORMATION, &parent_sd );
- close_file(parent_fsp, NORMAL_CLOSE);
+ close_file(NULL, parent_fsp, NORMAL_CLOSE);
if (!NT_STATUS_IS_OK(status)) {
return status;
@@ -3398,11 +3390,6 @@ static NTSTATUS append_parent_acl(files_struct *fsp,
parent_name));
}
- /* This sucks. psd should be const and we should
- * be doing a deep-copy here. We're getting away
- * with is as we know parent_sd is talloced off
- * talloc_tos() as well as psd. JRA. */
-
psd->dacl->aces = new_ace;
psd->dacl->num_aces = i;
psd->type &= ~(SE_DESC_DACL_AUTO_INHERITED|
@@ -3418,7 +3405,7 @@ static NTSTATUS append_parent_acl(files_struct *fsp,
This should be the only external function needed for the UNIX style set ACL.
****************************************************************************/
-NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
+NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const SEC_DESC *psd)
{
connection_struct *conn = fsp->conn;
uid_t user = (uid_t)-1;
@@ -3523,16 +3510,22 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
create_file_sids(&sbuf, &file_owner_sid, &file_grp_sid);
+ /* See here: http://www.codeproject.com/KB/winsdk/accessctrl2.aspx
+ * for details. JRA.
+ */
+
if ((security_info_sent & DACL_SECURITY_INFORMATION) &&
psd->dacl != NULL &&
(psd->type & (SE_DESC_DACL_AUTO_INHERITED|
SE_DESC_DACL_AUTO_INHERIT_REQ))==
(SE_DESC_DACL_AUTO_INHERITED|
SE_DESC_DACL_AUTO_INHERIT_REQ) ) {
- status = append_parent_acl(fsp, &sbuf, psd, &psd);
+ SEC_DESC *new_sd = NULL;
+ status = append_parent_acl(fsp, psd, &new_sd);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
+ psd = new_sd;
}
acl_perms = unpack_canon_ace( fsp, &sbuf, &file_owner_sid, &file_grp_sid,
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index b2d19e11e3..a8b93d8e1c 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -105,7 +105,11 @@ static bool valid_smb_header(const uint8_t *inbuf)
if (is_encrypted_packet(inbuf)) {
return true;
}
- return (strncmp(smb_base(inbuf),"\377SMB",4) == 0);
+ /*
+ * This used to be (strncmp(smb_base(inbuf),"\377SMB",4) == 0)
+ * but it just looks weird to call strncmp for this one.
+ */
+ return (IVAL(smb_base(inbuf), 0) == 0x424D53FF);
}
/* Socket functions for smbd packet processing. */
@@ -376,6 +380,7 @@ void init_smb_request(struct smb_request *req,
req->unread_bytes = unread_bytes;
req->encrypted = encrypted;
req->conn = conn_find(req->tid);
+ req->chain_fsp = NULL;
/* Ensure we have at least wct words and 2 bytes of bcc. */
if (smb_size + req->wct*2 > req_size) {
@@ -706,7 +711,7 @@ The timeout is in milliseconds
****************************************************************************/
static NTSTATUS receive_message_or_smb(TALLOC_CTX *mem_ctx, char **buffer,
- size_t *buffer_len, int timeout,
+ size_t *buffer_len,
size_t *p_unread, bool *p_encrypted)
{
fd_set r_fds, w_fds;
@@ -720,13 +725,8 @@ static NTSTATUS receive_message_or_smb(TALLOC_CTX *mem_ctx, char **buffer,
again:
- if (timeout >= 0) {
- to.tv_sec = timeout / 1000;
- to.tv_usec = (timeout % 1000) * 1000;
- } else {
- to.tv_sec = SMBD_SELECT_TIMEOUT;
- to.tv_usec = 0;
- }
+ to.tv_sec = SMBD_SELECT_TIMEOUT;
+ to.tv_usec = 0;
/*
* Note that this call must be before processing any SMB
@@ -747,7 +747,7 @@ static NTSTATUS receive_message_or_smb(TALLOC_CTX *mem_ctx, char **buffer,
pop_message = True;
} else {
struct timeval tv;
- SMB_BIG_INT tdif;
+ int64_t tdif;
GetTimeOfDay(&tv);
tdif = usec_time_diff(&msg->end_time, &tv);
@@ -869,7 +869,7 @@ static NTSTATUS receive_message_or_smb(TALLOC_CTX *mem_ctx, char **buffer,
/* Did we timeout ? */
if (selrtn == 0) {
- return NT_STATUS_IO_TIMEOUT;
+ goto again;
}
/*
@@ -978,7 +978,7 @@ force write permissions on print services.
*/
static const struct smb_message_struct {
const char *name;
- void (*fn_new)(struct smb_request *req);
+ void (*fn)(struct smb_request *req);
int flags;
} smb_messages[256] = {
@@ -1354,7 +1354,7 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req, in
exit_server_cleanly("Non-SMB packet");
}
- if (smb_messages[type].fn_new == NULL) {
+ if (smb_messages[type].fn == NULL) {
DEBUG(0,("Unknown message type %d!\n",type));
smb_dump("Unknown", 1, (char *)req->inbuf, size);
reply_unknown_new(req, type);
@@ -1476,7 +1476,7 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req, in
return conn;
}
- smb_messages[type].fn_new(req);
+ smb_messages[type].fn(req);
return req->conn;
}
@@ -1491,8 +1491,6 @@ static void construct_reply(char *inbuf, int size, size_t unread_bytes, bool enc
struct smb_request *req;
chain_size = 0;
- file_chain_reset();
- reset_chain_p();
if (!(req = talloc(talloc_tos(), struct smb_request))) {
smb_panic("could not allocate smb_request");
@@ -1540,25 +1538,6 @@ static void process_smb(char *inbuf, size_t nread, size_t unread_bytes, bool enc
DO_PROFILE_INC(smb_count);
- if (trans_num == 0) {
- char addr[INET6_ADDRSTRLEN];
-
- /* on the first packet, check the global hosts allow/ hosts
- deny parameters before doing any parsing of the packet
- passed to us by the client. This prevents attacks on our
- parsing code from hosts not in the hosts allow list */
-
- if (!check_access(smbd_server_fd(), lp_hostsallow(-1),
- lp_hostsdeny(-1))) {
- /* send a negative session response "not listening on calling name" */
- 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)srv_send_smb(smbd_server_fd(),(char *)buf,false);
- exit_server_cleanly("connection denied");
- }
- }
-
DEBUG( 6, ( "got message type 0x%x of len 0x%x\n", msg_type,
smb_len(inbuf) ) );
DEBUG( 3, ( "Transaction %d of length %d (%u toread)\n", trans_num,
@@ -1738,6 +1717,7 @@ void chain_reply(struct smb_request *req)
smb_panic("could not allocate smb_request");
}
init_smb_request(req2, (uint8 *)inbuf2,0, req->encrypted);
+ req2->chain_fsp = req->chain_fsp;
/* process the request */
switch_message(smb_com2, req2, new_size);
@@ -1837,23 +1817,6 @@ void chain_reply(struct smb_request *req)
}
/****************************************************************************
- Setup the needed select timeout in milliseconds.
-****************************************************************************/
-
-static int setup_select_timeout(void)
-{
- int select_timeout;
-
- select_timeout = SMBD_SELECT_TIMEOUT*1000;
-
- if (print_notify_messages_pending()) {
- select_timeout = MIN(select_timeout, 1000);
- }
-
- return select_timeout;
-}
-
-/****************************************************************************
Check if services need reloading.
****************************************************************************/
@@ -1907,113 +1870,40 @@ void check_reload(time_t t)
}
/****************************************************************************
- Process any timeout housekeeping. Return False if the caller should exit.
+ Process commands from the client
****************************************************************************/
-static void timeout_processing(int *select_timeout,
- time_t *last_timeout_processing_time)
+void smbd_process(void)
{
- time_t t;
-
- *last_timeout_processing_time = t = time(NULL);
-
- /* become root again if waiting */
- change_to_root_user();
-
- /* check if we need to reload services */
- check_reload(t);
-
- if(global_machine_password_needs_changing &&
- /* for ADS we need to do a regular ADS password change, not a domain
- password change */
- lp_security() == SEC_DOMAIN) {
-
- unsigned char trust_passwd_hash[16];
- time_t lct;
- void *lock;
-
- /*
- * We're in domain level security, and the code that
- * read the machine password flagged that the machine
- * password needs changing.
- */
-
- /*
- * First, open the machine password file with an exclusive lock.
- */
-
- lock = secrets_get_trust_account_lock(NULL, lp_workgroup());
+ unsigned int num_smbs = 0;
+ size_t unread_bytes = 0;
- if (lock == NULL) {
- DEBUG(0,("process: unable to lock the machine account password for \
-machine %s in domain %s.\n", global_myname(), lp_workgroup() ));
- return;
- }
+ char addr[INET6_ADDRSTRLEN];
- if(!secrets_fetch_trust_account_password(lp_workgroup(), trust_passwd_hash, &lct, NULL)) {
- DEBUG(0,("process: unable to read the machine account password for \
-machine %s in domain %s.\n", global_myname(), lp_workgroup()));
- TALLOC_FREE(lock);
- return;
- }
+ /*
+ * Before the first packet, check the global hosts allow/ hosts deny
+ * parameters before doing any parsing of packets passed to us by the
+ * client. This prevents attacks on our parsing code from hosts not in
+ * the hosts allow list.
+ */
+ if (!check_access(smbd_server_fd(), lp_hostsallow(-1),
+ lp_hostsdeny(-1))) {
/*
- * Make sure someone else hasn't already done this.
+ * send a negative session response "not listening on calling
+ * name"
*/
-
- if(t < lct + lp_machine_password_timeout()) {
- global_machine_password_needs_changing = False;
- TALLOC_FREE(lock);
- return;
- }
-
- /* always just contact the PDC here */
-
- change_trust_account_password( lp_workgroup(), NULL);
- global_machine_password_needs_changing = False;
- TALLOC_FREE(lock);
+ 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)srv_send_smb(smbd_server_fd(),(char *)buf,false);
+ exit_server_cleanly("connection denied");
}
- /* update printer queue caches if necessary */
-
- update_monitored_printq_cache();
-
- /*
- * Now we are root, check if the log files need pruning.
- * Force a log file check.
- */
- force_check_log_size();
- check_log_size();
-
- /* Send any queued printer notify message to interested smbd's. */
-
- print_notify_send_messages(smbd_messaging_context(), 0);
-
- /*
- * Modify the select timeout depending upon
- * what we have remaining in our queues.
- */
-
- *select_timeout = setup_select_timeout();
-
- return;
-}
-
-/****************************************************************************
- Process commands from the client
-****************************************************************************/
-
-void smbd_process(void)
-{
- time_t last_timeout_processing_time = time(NULL);
- unsigned int num_smbs = 0;
- size_t unread_bytes = 0;
-
max_recv = MIN(lp_maxxmit(),BUFFER_SIZE);
while (True) {
- int select_timeout = setup_select_timeout();
- int num_echos;
+ NTSTATUS status;
char *inbuf = NULL;
size_t inbuf_len = 0;
bool encrypted = false;
@@ -2021,82 +1911,24 @@ void smbd_process(void)
errno = 0;
- /* Did someone ask for immediate checks on things like blocking locks ? */
- if (select_timeout == 0) {
- timeout_processing(&select_timeout,
- &last_timeout_processing_time);
- num_smbs = 0; /* Reset smb counter. */
- }
-
run_events(smbd_event_context(), 0, NULL, NULL);
- while (True) {
- NTSTATUS status;
-
- status = receive_message_or_smb(
- talloc_tos(), &inbuf, &inbuf_len,
- select_timeout, &unread_bytes, &encrypted);
-
- if (NT_STATUS_IS_OK(status)) {
- break;
- }
-
- if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
- timeout_processing(
- &select_timeout,
- &last_timeout_processing_time);
- continue;
- }
+ status = receive_message_or_smb(
+ talloc_tos(), &inbuf, &inbuf_len,
+ &unread_bytes, &encrypted);
+ if (!NT_STATUS_IS_OK(status)) {
DEBUG(3, ("receive_message_or_smb failed: %s, "
"exiting\n", nt_errstr(status)));
return;
-
- num_smbs = 0; /* Reset smb counter. */
}
-
- /*
- * Ensure we do timeout processing if the SMB we just got was
- * only an echo request. This allows us to set the select
- * timeout in 'receive_message_or_smb()' to any value we like
- * without worrying that the client will send echo requests
- * faster than the select timeout, thus starving out the
- * essential processing (change notify, blocking locks) that
- * the timeout code does. JRA.
- */
- num_echos = smb_echo_count;
-
process_smb(inbuf, inbuf_len, unread_bytes, encrypted);
TALLOC_FREE(inbuf);
- if (smb_echo_count != num_echos) {
- timeout_processing(&select_timeout,
- &last_timeout_processing_time);
- num_smbs = 0; /* Reset smb counter. */
- }
-
num_smbs++;
- /*
- * If we are getting smb requests in a constant stream
- * with no echos, make sure we attempt timeout processing
- * every select_timeout milliseconds - but only check for this
- * every 200 smb requests.
- */
-
- if ((num_smbs % 200) == 0) {
- time_t new_check_time = time(NULL);
- if(new_check_time - last_timeout_processing_time >= (select_timeout/1000)) {
- timeout_processing(
- &select_timeout,
- &last_timeout_processing_time);
- num_smbs = 0; /* Reset smb counter. */
- last_timeout_processing_time = new_check_time; /* Reset time. */
- }
- }
-
/* The timeout_processing function isn't run nearly
often enough to implement 'max log size' without
overrunning the size of the file by many megabytes.
diff --git a/source3/smbd/quotas.c b/source3/smbd/quotas.c
index f47e89bd22..3aa4652508 100644
--- a/source3/smbd/quotas.c
+++ b/source3/smbd/quotas.c
@@ -45,7 +45,7 @@
* Declare here, define at end: reduces likely "include" interaction problems.
* David Lee <T.D.Lee@durham.ac.uk>
*/
-bool disk_quotas_vxfs(const char *name, char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize);
+bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
#endif /* VXFS_QUOTA */
@@ -63,13 +63,13 @@ bool disk_quotas_vxfs(const char *name, char *path, SMB_BIG_UINT *bsize, SMB_BIG
#include "samba_linux_quota.h"
typedef struct _LINUX_SMB_DISK_QUOTA {
- SMB_BIG_UINT bsize;
- SMB_BIG_UINT hardlimit; /* In bsize units. */
- SMB_BIG_UINT softlimit; /* In bsize units. */
- SMB_BIG_UINT curblocks; /* In bsize units. */
- SMB_BIG_UINT ihardlimit; /* inode hard limit. */
- SMB_BIG_UINT isoftlimit; /* inode soft limit. */
- SMB_BIG_UINT curinodes; /* Current used inodes. */
+ uint64_t bsize;
+ uint64_t hardlimit; /* In bsize units. */
+ uint64_t softlimit; /* In bsize units. */
+ uint64_t curblocks; /* In bsize units. */
+ uint64_t ihardlimit; /* inode hard limit. */
+ uint64_t isoftlimit; /* inode soft limit. */
+ uint64_t curinodes; /* Current used inodes. */
} LINUX_SMB_DISK_QUOTA;
@@ -95,13 +95,13 @@ static int get_smb_linux_xfs_quota(char *path, uid_t euser_id, gid_t egrp_id, LI
if (ret)
return ret;
- dp->bsize = (SMB_BIG_UINT)512;
- dp->softlimit = (SMB_BIG_UINT)D.d_blk_softlimit;
- dp->hardlimit = (SMB_BIG_UINT)D.d_blk_hardlimit;
- dp->ihardlimit = (SMB_BIG_UINT)D.d_ino_hardlimit;
- dp->isoftlimit = (SMB_BIG_UINT)D.d_ino_softlimit;
- dp->curinodes = (SMB_BIG_UINT)D.d_icount;
- dp->curblocks = (SMB_BIG_UINT)D.d_bcount;
+ dp->bsize = (uint64_t)512;
+ dp->softlimit = (uint64_t)D.d_blk_softlimit;
+ dp->hardlimit = (uint64_t)D.d_blk_hardlimit;
+ dp->ihardlimit = (uint64_t)D.d_ino_hardlimit;
+ dp->isoftlimit = (uint64_t)D.d_ino_softlimit;
+ dp->curinodes = (uint64_t)D.d_icount;
+ dp->curblocks = (uint64_t)D.d_bcount;
return ret;
}
@@ -134,13 +134,13 @@ static int get_smb_linux_v1_quota(char *path, uid_t euser_id, gid_t egrp_id, LIN
if (ret && errno != EDQUOT)
return ret;
- dp->bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE;
- dp->softlimit = (SMB_BIG_UINT)D.dqb_bsoftlimit;
- dp->hardlimit = (SMB_BIG_UINT)D.dqb_bhardlimit;
- dp->ihardlimit = (SMB_BIG_UINT)D.dqb_ihardlimit;
- dp->isoftlimit = (SMB_BIG_UINT)D.dqb_isoftlimit;
- dp->curinodes = (SMB_BIG_UINT)D.dqb_curinodes;
- dp->curblocks = (SMB_BIG_UINT)D.dqb_curblocks;
+ dp->bsize = (uint64_t)QUOTABLOCK_SIZE;
+ dp->softlimit = (uint64_t)D.dqb_bsoftlimit;
+ dp->hardlimit = (uint64_t)D.dqb_bhardlimit;
+ dp->ihardlimit = (uint64_t)D.dqb_ihardlimit;
+ dp->isoftlimit = (uint64_t)D.dqb_isoftlimit;
+ dp->curinodes = (uint64_t)D.dqb_curinodes;
+ dp->curblocks = (uint64_t)D.dqb_curblocks;
return ret;
}
@@ -160,13 +160,13 @@ static int get_smb_linux_v2_quota(char *path, uid_t euser_id, gid_t egrp_id, LIN
if (ret && errno != EDQUOT)
return ret;
- dp->bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE;
- dp->softlimit = (SMB_BIG_UINT)D.dqb_bsoftlimit;
- dp->hardlimit = (SMB_BIG_UINT)D.dqb_bhardlimit;
- dp->ihardlimit = (SMB_BIG_UINT)D.dqb_ihardlimit;
- dp->isoftlimit = (SMB_BIG_UINT)D.dqb_isoftlimit;
- dp->curinodes = (SMB_BIG_UINT)D.dqb_curinodes;
- dp->curblocks = ((SMB_BIG_UINT)D.dqb_curspace) / dp->bsize;
+ dp->bsize = (uint64_t)QUOTABLOCK_SIZE;
+ dp->softlimit = (uint64_t)D.dqb_bsoftlimit;
+ dp->hardlimit = (uint64_t)D.dqb_bhardlimit;
+ dp->ihardlimit = (uint64_t)D.dqb_ihardlimit;
+ dp->isoftlimit = (uint64_t)D.dqb_isoftlimit;
+ dp->curinodes = (uint64_t)D.dqb_curinodes;
+ dp->curblocks = ((uint64_t)D.dqb_curspace) / dp->bsize;
return ret;
}
@@ -190,13 +190,13 @@ static int get_smb_linux_gen_quota(char *path, uid_t euser_id, gid_t egrp_id, LI
if (ret && errno != EDQUOT)
return ret;
- dp->bsize = (SMB_BIG_UINT)QUOTABLOCK_SIZE;
- dp->softlimit = (SMB_BIG_UINT)D.dqb_bsoftlimit;
- dp->hardlimit = (SMB_BIG_UINT)D.dqb_bhardlimit;
- dp->ihardlimit = (SMB_BIG_UINT)D.dqb_ihardlimit;
- dp->isoftlimit = (SMB_BIG_UINT)D.dqb_isoftlimit;
- dp->curinodes = (SMB_BIG_UINT)D.dqb_curinodes;
- dp->curblocks = ((SMB_BIG_UINT)D.dqb_curspace) / dp->bsize;
+ dp->bsize = (uint64_t)QUOTABLOCK_SIZE;
+ dp->softlimit = (uint64_t)D.dqb_bsoftlimit;
+ dp->hardlimit = (uint64_t)D.dqb_bhardlimit;
+ dp->ihardlimit = (uint64_t)D.dqb_ihardlimit;
+ dp->isoftlimit = (uint64_t)D.dqb_isoftlimit;
+ dp->curinodes = (uint64_t)D.dqb_curinodes;
+ dp->curblocks = ((uint64_t)D.dqb_curspace) / dp->bsize;
return ret;
}
@@ -205,7 +205,7 @@ static int get_smb_linux_gen_quota(char *path, uid_t euser_id, gid_t egrp_id, LI
Try to get the disk space from disk quotas (LINUX version).
****************************************************************************/
-bool disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
+bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
{
int r;
SMB_STRUCT_STAT S;
@@ -306,7 +306,7 @@ bool disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB
try to get the disk space from disk quotas (CRAY VERSION)
****************************************************************************/
-bool disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
+bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
{
struct mntent *mnt;
FILE *fd;
@@ -454,7 +454,7 @@ static int my_xdr_getquota_rslt(XDR *xdrsp, struct getquota_rslt *gqr)
}
/* Restricted to SUNOS5 for the moment, I haven`t access to others to test. */
-static bool nfs_quotas(char *nfspath, uid_t euser_id, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
+static bool nfs_quotas(char *nfspath, uid_t euser_id, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
{
uid_t uid = euser_id;
struct dqblk D;
@@ -468,7 +468,7 @@ static bool nfs_quotas(char *nfspath, uid_t euser_id, SMB_BIG_UINT *bsize, SMB_B
enum clnt_stat clnt_stat;
bool ret = True;
- *bsize = *dfree = *dsize = (SMB_BIG_UINT)0;
+ *bsize = *dfree = *dsize = (uint64_t)0;
len=strcspn(mnttype, ":");
pathname=strstr(mnttype, ":");
@@ -544,7 +544,7 @@ static bool nfs_quotas(char *nfspath, uid_t euser_id, SMB_BIG_UINT *bsize, SMB_B
*bsize = gqr.getquota_rslt_u.gqr_rquota.rq_bsize;
*dsize = D.dqb_bsoftlimit;
- if (D.dqb_curblocks == D.dqb_curblocks == 1)
+ if (D.dqb_curblocks == 1)
*bsize = 512;
if (D.dqb_curblocks > D.dqb_bsoftlimit) {
@@ -575,9 +575,9 @@ Quota code by Peter Urbanec (amiga@cse.unsw.edu.au).
****************************************************************************/
bool disk_quotas(const char *path,
- SMB_BIG_UINT *bsize,
- SMB_BIG_UINT *dfree,
- SMB_BIG_UINT *dsize)
+ uint64_t *bsize,
+ uint64_t *dfree,
+ uint64_t *dsize)
{
uid_t euser_id;
int ret;
@@ -750,7 +750,7 @@ bool disk_quotas(const char *path,
try to get the disk space from disk quotas - OSF1 version
****************************************************************************/
-bool disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
+bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
{
int r, save_errno;
struct dqblk D;
@@ -816,7 +816,7 @@ try to get the disk space from disk quotas (IRIX 6.2 version)
#include <sys/quota.h>
#include <mntent.h>
-bool disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
+bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
{
uid_t euser_id;
int r;
@@ -1009,7 +1009,7 @@ static int my_xdr_getquota_rslt(XDR *xdrsp, struct getquota_rslt *gqr)
}
/* Works on FreeBSD, too. :-) */
-static bool nfs_quotas(char *nfspath, uid_t euser_id, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
+static bool nfs_quotas(char *nfspath, uid_t euser_id, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
{
uid_t uid = euser_id;
struct dqblk D;
@@ -1023,7 +1023,7 @@ static bool nfs_quotas(char *nfspath, uid_t euser_id, SMB_BIG_UINT *bsize, SMB_B
enum clnt_stat clnt_stat;
bool ret = True;
- *bsize = *dfree = *dsize = (SMB_BIG_UINT)0;
+ *bsize = *dfree = *dsize = (uint64_t)0;
len=strcspn(mnttype, ":");
pathname=strstr(mnttype, ":");
@@ -1104,7 +1104,7 @@ static bool nfs_quotas(char *nfspath, uid_t euser_id, SMB_BIG_UINT *bsize, SMB_B
*bsize = gqr.getquota_rslt_u.gqr_rquota.rq_bsize;
*dsize = D.dqb_bsoftlimit;
- if (D.dqb_curblocks == D.dqb_curblocks == 1)
+ if (D.dqb_curblocks == 1)
*bsize = DEV_BSIZE;
if (D.dqb_curblocks > D.dqb_bsoftlimit) {
@@ -1134,7 +1134,7 @@ static bool nfs_quotas(char *nfspath, uid_t euser_id, SMB_BIG_UINT *bsize, SMB_B
try to get the disk space from disk quotas - default version
****************************************************************************/
-bool disk_quotas(const char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
+bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
{
int r;
struct dqblk D;
@@ -1353,7 +1353,7 @@ Hints for porting:
#include <sys/fs/vx_aioctl.h>
#include <sys/fs/vx_ioctl.h>
-bool disk_quotas_vxfs(const char *name, char *path, SMB_BIG_UINT *bsize, SMB_BIG_UINT *dfree, SMB_BIG_UINT *dsize)
+bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
{
uid_t user_id, euser_id;
int ret;
@@ -1437,14 +1437,14 @@ bool disk_quotas_vxfs(const char *name, char *path, SMB_BIG_UINT *bsize, SMB_BIG
#else /* WITH_QUOTAS */
-bool disk_quotas(const char *path,SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT *dsize)
+bool disk_quotas(const char *path,uint64_t *bsize,uint64_t *dfree,uint64_t *dsize)
{
(*bsize) = 512; /* This value should be ignored */
/* And just to be sure we set some values that hopefully */
/* will be larger that any possible real-world value */
- (*dfree) = (SMB_BIG_UINT)-1;
- (*dsize) = (SMB_BIG_UINT)-1;
+ (*dfree) = (uint64_t)-1;
+ (*dsize) = (uint64_t)-1;
/* As we have select not to use quotas, allways fail */
return false;
@@ -1455,7 +1455,7 @@ bool disk_quotas(const char *path,SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BI
/* wrapper to the new sys_quota interface
this file should be removed later
*/
-bool disk_quotas(const char *path,SMB_BIG_UINT *bsize,SMB_BIG_UINT *dfree,SMB_BIG_UINT *dsize)
+bool disk_quotas(const char *path,uint64_t *bsize,uint64_t *dfree,uint64_t *dsize)
{
int r;
SMB_DISK_QUOTA D;
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 6933533672..25480c6e3b 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -29,7 +29,6 @@
/* look in server.c for some explanation of these variables */
extern enum protocol_types Protocol;
extern int max_recv;
-unsigned int smb_echo_count = 0;
extern uint32 global_client_caps;
extern bool global_encrypted_passwords_negotiated;
@@ -340,8 +339,7 @@ bool check_fsp_open(connection_struct *conn, struct smb_request *req,
}
/****************************************************************************
- Check if we have a correct fsp pointing to a file. Replacement for the
- CHECK_FSP macro.
+ Check if we have a correct fsp pointing to a file.
****************************************************************************/
bool check_fsp(connection_struct *conn, struct smb_request *req,
@@ -426,22 +424,22 @@ void reply_special(char *inbuf)
* header.
*/
char outbuf[smb_size];
-
+
static bool already_got_session = False;
*name1 = *name2 = 0;
-
+
memset(outbuf, '\0', sizeof(outbuf));
smb_setlen(outbuf,0);
-
+
switch (msg_type) {
case 0x81: /* session request */
-
+
if (already_got_session) {
exit_server_cleanly("multiple session request not permitted");
}
-
+
SCVAL(outbuf,0,0x82);
SCVAL(outbuf,3,0);
if (name_len(inbuf+4) > 50 ||
@@ -480,24 +478,24 @@ void reply_special(char *inbuf)
already_got_session = True;
break;
-
+
case 0x89: /* session keepalive request
(some old clients produce this?) */
SCVAL(outbuf,0,SMBkeepalive);
SCVAL(outbuf,3,0);
break;
-
+
case 0x82: /* positive session response */
case 0x83: /* negative session response */
case 0x84: /* retarget session response */
DEBUG(0,("Unexpected session response\n"));
break;
-
+
case SMBkeepalive: /* session keepalive */
default:
return;
}
-
+
DEBUG(5,("init msg_type=0x%x msg_flags=0x%x\n",
msg_type, msg_flags));
@@ -749,7 +747,12 @@ void reply_tcon_and_X(struct smb_request *req)
SSVAL(req->outbuf, smb_vwv2, SMB_SUPPORT_SEARCH_BITS|
(lp_csc_policy(SNUM(conn)) << 2));
- init_dfsroot(conn, req->inbuf, req->outbuf);
+ if (lp_msdfs_root(SNUM(conn)) && lp_host_msdfs()) {
+ DEBUG(2,("Serving %s as a Dfs root\n",
+ lp_servicename(SNUM(conn)) ));
+ SSVAL(req->outbuf, smb_vwv2,
+ SMB_SHARE_IN_DFS | SVAL(req->outbuf, smb_vwv2));
+ }
}
@@ -827,8 +830,8 @@ void reply_ioctl(struct smb_request *req)
switch (ioctl_code) {
case IOCTL_QUERY_JOB_INFO:
{
- files_struct *fsp = file_fsp(SVAL(req->inbuf,
- smb_vwv0));
+ files_struct *fsp = file_fsp(
+ req, SVAL(req->inbuf, smb_vwv0));
if (!fsp) {
reply_doserror(req, ERRDOS, ERRbadfid);
END_PROFILE(SMBioctl);
@@ -1059,7 +1062,7 @@ void reply_getatr(struct smb_request *req)
SSVAL(req->outbuf, smb_flg2,
SVAL(req->outbuf, smb_flg2) | FLAGS2_IS_LONG_NAME);
}
-
+
DEBUG(3,("reply_getatr: name=%s mode=%d size=%u\n", fname, mode, (unsigned int)size ) );
END_PROFILE(SMBgetatr);
@@ -1166,9 +1169,9 @@ void reply_setatr(struct smb_request *req)
}
reply_outbuf(req, 0, 0);
-
+
DEBUG( 3, ( "setatr name=%s mode=%d\n", fname, mode ) );
-
+
END_PROFILE(SMBsetatr);
return;
}
@@ -1180,17 +1183,17 @@ void reply_setatr(struct smb_request *req)
void reply_dskattr(struct smb_request *req)
{
connection_struct *conn = req->conn;
- SMB_BIG_UINT dfree,dsize,bsize;
+ uint64_t dfree,dsize,bsize;
START_PROFILE(SMBdskattr);
- if (get_dfree_info(conn,".",True,&bsize,&dfree,&dsize) == (SMB_BIG_UINT)-1) {
+ if (get_dfree_info(conn,".",True,&bsize,&dfree,&dsize) == (uint64_t)-1) {
reply_unixerror(req, ERRHRD, ERRgeneral);
END_PROFILE(SMBdskattr);
return;
}
reply_outbuf(req, 5, 0);
-
+
if (Protocol <= PROTOCOL_LANMAN2) {
double total_space, free_space;
/* we need to scale this to a number that DOS6 can handle. We
@@ -1202,9 +1205,9 @@ void reply_dskattr(struct smb_request *req)
total_space = dsize * (double)bsize;
free_space = dfree * (double)bsize;
- dsize = (SMB_BIG_UINT)((total_space+63*512) / (64*512));
- dfree = (SMB_BIG_UINT)((free_space+63*512) / (64*512));
-
+ dsize = (uint64_t)((total_space+63*512) / (64*512));
+ dfree = (uint64_t)((free_space+63*512) / (64*512));
+
if (dsize > 0xFFFF) dsize = 0xFFFF;
if (dfree > 0xFFFF) dfree = 0xFFFF;
@@ -1689,7 +1692,7 @@ void reply_open(struct smb_request *req)
if (fattr & aDIR) {
DEBUG(3,("attempt to open a directory %s\n",fsp->fsp_name));
- close_file(fsp,ERROR_CLOSE);
+ close_file(req, fsp, ERROR_CLOSE);
reply_doserror(req, ERRDOS,ERRnoaccess);
END_PROFILE(SMBopen);
return;
@@ -1710,7 +1713,7 @@ void reply_open(struct smb_request *req)
SCVAL(req->outbuf,smb_flg,
CVAL(req->outbuf,smb_flg)|CORE_OPLOCK_GRANTED);
}
-
+
if(EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) {
SCVAL(req->outbuf,smb_flg,
CVAL(req->outbuf,smb_flg)|CORE_OPLOCK_GRANTED);
@@ -1746,7 +1749,7 @@ void reply_open_and_X(struct smb_request *req)
int smb_action = 0;
files_struct *fsp;
NTSTATUS status;
- SMB_BIG_UINT allocation_size;
+ uint64_t allocation_size;
ssize_t retval = -1;
uint32 access_mask;
uint32 share_mode;
@@ -1769,7 +1772,7 @@ void reply_open_and_X(struct smb_request *req)
core_oplock_request = CORE_OPLOCK_REQUEST(req->inbuf);
oplock_request = ex_oplock_request | core_oplock_request;
smb_ofun = SVAL(req->inbuf,smb_vwv8);
- allocation_size = (SMB_BIG_UINT)IVAL(req->inbuf,smb_vwv9);
+ allocation_size = (uint64_t)IVAL(req->inbuf,smb_vwv9);
/* If it's an IPC, pass off the pipe handler. */
if (IS_IPC(conn)) {
@@ -1832,14 +1835,14 @@ void reply_open_and_X(struct smb_request *req)
if (((smb_action == FILE_WAS_CREATED) || (smb_action == FILE_WAS_OVERWRITTEN)) && allocation_size) {
fsp->initial_allocation_size = smb_roundup(fsp->conn, allocation_size);
if (vfs_allocate_file_space(fsp, fsp->initial_allocation_size) == -1) {
- close_file(fsp,ERROR_CLOSE);
+ close_file(req, fsp, ERROR_CLOSE);
reply_nterror(req, NT_STATUS_DISK_FULL);
END_PROFILE(SMBopenX);
return;
}
retval = vfs_set_filelen(fsp, (SMB_OFF_T)allocation_size);
if (retval < 0) {
- close_file(fsp,ERROR_CLOSE);
+ close_file(req, fsp, ERROR_CLOSE);
reply_nterror(req, NT_STATUS_DISK_FULL);
END_PROFILE(SMBopenX);
return;
@@ -1850,7 +1853,7 @@ void reply_open_and_X(struct smb_request *req)
fattr = dos_mode(conn,fsp->fsp_name,&sbuf);
mtime = sbuf.st_mtime;
if (fattr & aDIR) {
- close_file(fsp,ERROR_CLOSE);
+ close_file(req, fsp, ERROR_CLOSE);
reply_doserror(req, ERRDOS, ERRnoaccess);
END_PROFILE(SMBopenX);
return;
@@ -2198,7 +2201,7 @@ void reply_ctemp(struct smb_request *req)
SCVAL(req->outbuf, smb_flg,
CVAL(req->outbuf,smb_flg)|CORE_OPLOCK_GRANTED);
}
-
+
if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) {
SCVAL(req->outbuf, smb_flg,
CVAL(req->outbuf,smb_flg)|CORE_OPLOCK_GRANTED);
@@ -2365,11 +2368,11 @@ static NTSTATUS do_unlink(connection_struct *conn,
/* The set is across all open files on this dev/inode pair. */
if (!set_delete_on_close(fsp, True, &conn->server_info->utok)) {
- close_file(fsp, NORMAL_CLOSE);
+ close_file(req, fsp, NORMAL_CLOSE);
return NT_STATUS_ACCESS_DENIED;
}
- return close_file(fsp,NORMAL_CLOSE);
+ return close_file(req, fsp, NORMAL_CLOSE);
}
/****************************************************************************
@@ -2810,7 +2813,7 @@ void reply_readbraw(struct smb_request *req)
* return a zero length response here.
*/
- fsp = file_fsp(SVAL(req->inbuf,smb_vwv0));
+ fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv0));
/*
* We have to do a check_fsp by hand here, as
@@ -2889,8 +2892,8 @@ void reply_readbraw(struct smb_request *req)
maxcount = MIN(65535,maxcount);
if (is_locked(fsp,(uint32)req->smbpid,
- (SMB_BIG_UINT)maxcount,
- (SMB_BIG_UINT)startpos,
+ (uint64_t)maxcount,
+ (uint64_t)startpos,
READ_LOCK)) {
reply_readbraw_error();
END_PROFILE(SMBreadbraw);
@@ -2911,14 +2914,14 @@ void reply_readbraw(struct smb_request *req)
if (nread < mincount)
nread = 0;
#endif
-
+
DEBUG( 3, ( "reply_readbraw: fnum=%d start=%.0f max=%lu "
"min=%lu nread=%lu\n",
fsp->fnum, (double)startpos,
(unsigned long)maxcount,
(unsigned long)mincount,
(unsigned long)nread ) );
-
+
send_file_readbraw(conn, fsp, startpos, nread, mincount);
DEBUG(5,("reply_readbraw finished\n"));
@@ -2952,7 +2955,7 @@ void reply_lockread(struct smb_request *req)
return;
}
- fsp = file_fsp(SVAL(req->inbuf,smb_vwv0));
+ fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv0));
if (!check_fsp(conn, req, fsp)) {
END_PROFILE(SMBlockread);
@@ -2975,7 +2978,7 @@ void reply_lockread(struct smb_request *req)
reply_outbuf(req, 5, numtoread + 3);
data = smb_buf(req->outbuf) + 3;
-
+
/*
* NB. Discovered by Menny Hamburger at Mainsoft. This is a core+
* protocol request that predates the read/write lock concept.
@@ -2983,12 +2986,12 @@ void reply_lockread(struct smb_request *req)
* for a write lock. JRA.
* Note that the requested lock size is unaffected by max_recv.
*/
-
+
br_lck = do_lock(smbd_messaging_context(),
fsp,
req->smbpid,
- (SMB_BIG_UINT)numtoread,
- (SMB_BIG_UINT)startpos,
+ (uint64_t)numtoread,
+ (uint64_t)startpos,
WRITE_LOCK,
WINDOWS_LOCK,
False, /* Non-blocking lock. */
@@ -3019,7 +3022,7 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n",
END_PROFILE(SMBlockread);
return;
}
-
+
srv_set_message((char *)req->outbuf, 5, nread+3, False);
SSVAL(req->outbuf,smb_vwv0,nread);
@@ -3027,7 +3030,7 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n",
p = smb_buf(req->outbuf);
SCVAL(p,0,0); /* pad byte. */
SSVAL(p,1,nread);
-
+
DEBUG(3,("lockread fnum=%d num=%d nread=%d\n",
fsp->fnum, (int)numtoread, (int)nread));
@@ -3060,7 +3063,7 @@ void reply_read(struct smb_request *req)
return;
}
- fsp = file_fsp(SVAL(req->inbuf,smb_vwv0));
+ fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv0));
if (!check_fsp(conn, req, fsp)) {
END_PROFILE(SMBread);
@@ -3091,9 +3094,9 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n",
reply_outbuf(req, 5, numtoread+3);
data = smb_buf(req->outbuf) + 3;
-
- if (is_locked(fsp, (uint32)req->smbpid, (SMB_BIG_UINT)numtoread,
- (SMB_BIG_UINT)startpos, READ_LOCK)) {
+
+ if (is_locked(fsp, (uint32)req->smbpid, (uint64_t)numtoread,
+ (uint64_t)startpos, READ_LOCK)) {
reply_doserror(req, ERRDOS,ERRlock);
END_PROFILE(SMBread);
return;
@@ -3114,7 +3117,7 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n",
SSVAL(req->outbuf,smb_vwv5,nread+3);
SCVAL(smb_buf(req->outbuf),0,1);
SSVAL(smb_buf(req->outbuf),1,nread);
-
+
DEBUG( 3, ( "read fnum=%d num=%d nread=%d\n",
fsp->fnum, (int)numtoread, (int)nread ) );
@@ -3304,7 +3307,7 @@ void reply_read_and_X(struct smb_request *req)
return;
}
- fsp = file_fsp(SVAL(req->inbuf,smb_vwv2));
+ fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv2));
startpos = IVAL_TO_SMB_OFF_T(req->inbuf,smb_vwv3);
smb_maxcnt = SVAL(req->inbuf,smb_vwv5);
@@ -3379,8 +3382,8 @@ void reply_read_and_X(struct smb_request *req)
}
- if (is_locked(fsp, (uint32)req->smbpid, (SMB_BIG_UINT)smb_maxcnt,
- (SMB_BIG_UINT)startpos, READ_LOCK)) {
+ if (is_locked(fsp, (uint32)req->smbpid, (uint64_t)smb_maxcnt,
+ (uint64_t)startpos, READ_LOCK)) {
END_PROFILE(SMBreadX);
reply_doserror(req, ERRDOS, ERRlock);
return;
@@ -3452,7 +3455,7 @@ void reply_writebraw(struct smb_request *req)
return;
}
- fsp = file_fsp(SVAL(req->inbuf,smb_vwv0));
+ fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv0));
if (!check_fsp(conn, req, fsp)) {
error_to_writebrawerr(req);
END_PROFILE(SMBwritebraw);
@@ -3489,8 +3492,8 @@ void reply_writebraw(struct smb_request *req)
return;
}
- if (is_locked(fsp,(uint32)req->smbpid,(SMB_BIG_UINT)tcount,
- (SMB_BIG_UINT)startpos, WRITE_LOCK)) {
+ if (is_locked(fsp,(uint32)req->smbpid,(uint64_t)tcount,
+ (uint64_t)startpos, WRITE_LOCK)) {
reply_doserror(req, ERRDOS, ERRlock);
error_to_writebrawerr(req);
END_PROFILE(SMBwritebraw);
@@ -3656,8 +3659,8 @@ void reply_writeunlock(struct smb_request *req)
END_PROFILE(SMBwriteunlock);
return;
}
-
- fsp = file_fsp(SVAL(req->inbuf,smb_vwv0));
+
+ fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv0));
if (!check_fsp(conn, req, fsp)) {
END_PROFILE(SMBwriteunlock);
@@ -3673,10 +3676,10 @@ void reply_writeunlock(struct smb_request *req)
numtowrite = SVAL(req->inbuf,smb_vwv1);
startpos = IVAL_TO_SMB_OFF_T(req->inbuf,smb_vwv2);
data = smb_buf(req->inbuf) + 3;
-
+
if (numtowrite
- && is_locked(fsp, (uint32)req->smbpid, (SMB_BIG_UINT)numtowrite,
- (SMB_BIG_UINT)startpos, WRITE_LOCK)) {
+ && is_locked(fsp, (uint32)req->smbpid, (uint64_t)numtowrite,
+ (uint64_t)startpos, WRITE_LOCK)) {
reply_doserror(req, ERRDOS, ERRlock);
END_PROFILE(SMBwriteunlock);
return;
@@ -3690,7 +3693,7 @@ void reply_writeunlock(struct smb_request *req)
} else {
nwritten = write_file(req,fsp,data,startpos,numtowrite);
}
-
+
status = sync_file(conn, fsp, False /* write through */);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(5,("reply_writeunlock: sync_file for %s returned %s\n",
@@ -3710,8 +3713,8 @@ void reply_writeunlock(struct smb_request *req)
status = do_unlock(smbd_messaging_context(),
fsp,
req->smbpid,
- (SMB_BIG_UINT)numtowrite,
- (SMB_BIG_UINT)startpos,
+ (uint64_t)numtowrite,
+ (uint64_t)startpos,
WINDOWS_LOCK);
if (NT_STATUS_V(status)) {
@@ -3722,12 +3725,12 @@ void reply_writeunlock(struct smb_request *req)
}
reply_outbuf(req, 1, 0);
-
+
SSVAL(req->outbuf,smb_vwv0,nwritten);
-
+
DEBUG(3,("writeunlock fnum=%d num=%d wrote=%d\n",
fsp->fnum, (int)numtowrite, (int)nwritten));
-
+
END_PROFILE(SMBwriteunlock);
return;
}
@@ -3764,7 +3767,7 @@ void reply_write(struct smb_request *req)
return;
}
- fsp = file_fsp(SVAL(req->inbuf,smb_vwv0));
+ fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv0));
if (!check_fsp(conn, req, fsp)) {
END_PROFILE(SMBwrite);
@@ -3780,9 +3783,9 @@ void reply_write(struct smb_request *req)
numtowrite = SVAL(req->inbuf,smb_vwv1);
startpos = IVAL_TO_SMB_OFF_T(req->inbuf,smb_vwv2);
data = smb_buf(req->inbuf) + 3;
-
- if (is_locked(fsp, (uint32)req->smbpid, (SMB_BIG_UINT)numtowrite,
- (SMB_BIG_UINT)startpos, WRITE_LOCK)) {
+
+ if (is_locked(fsp, (uint32)req->smbpid, (uint64_t)numtowrite,
+ (uint64_t)startpos, WRITE_LOCK)) {
reply_doserror(req, ERRDOS, ERRlock);
END_PROFILE(SMBwrite);
return;
@@ -3831,14 +3834,14 @@ void reply_write(struct smb_request *req)
}
reply_outbuf(req, 1, 0);
-
+
SSVAL(req->outbuf,smb_vwv0,nwritten);
if (nwritten < (ssize_t)numtowrite) {
SCVAL(req->outbuf,smb_rcls,ERRHRD);
SSVAL(req->outbuf,smb_err,ERRdiskfull);
}
-
+
DEBUG(3,("write fnum=%d num=%d wrote=%d\n", fsp->fnum, (int)numtowrite, (int)nwritten));
END_PROFILE(SMBwrite);
@@ -3994,7 +3997,7 @@ void reply_write_and_X(struct smb_request *req)
return;
}
- fsp = file_fsp(SVAL(req->inbuf,smb_vwv2));
+ fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv2));
startpos = IVAL_TO_SMB_OFF_T(req->inbuf,smb_vwv3);
write_through = BITSETW(req->inbuf+smb_vwv7,0);
@@ -4037,8 +4040,8 @@ void reply_write_and_X(struct smb_request *req)
}
if (is_locked(fsp,(uint32)req->smbpid,
- (SMB_BIG_UINT)numtowrite,
- (SMB_BIG_UINT)startpos, WRITE_LOCK)) {
+ (uint64_t)numtowrite,
+ (uint64_t)startpos, WRITE_LOCK)) {
reply_doserror(req, ERRDOS, ERRlock);
END_PROFILE(SMBwriteX);
return;
@@ -4059,7 +4062,7 @@ void reply_write_and_X(struct smb_request *req)
END_PROFILE(SMBwriteX);
return;
}
-
+
nwritten = write_file(req,fsp,data,startpos,numtowrite);
}
@@ -4115,7 +4118,7 @@ void reply_lseek(struct smb_request *req)
return;
}
- fsp = file_fsp(SVAL(req->inbuf,smb_vwv0));
+ fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv0));
if (!check_fsp(conn, req, fsp)) {
return;
@@ -4175,7 +4178,7 @@ void reply_lseek(struct smb_request *req)
reply_outbuf(req, 2, 0);
SIVAL(req->outbuf,smb_vwv0,res);
-
+
DEBUG(3,("lseek fnum=%d ofs=%.0f newpos = %.0f mode=%d\n",
fsp->fnum, (double)startpos, (double)res, mode));
@@ -4201,12 +4204,12 @@ void reply_flush(struct smb_request *req)
}
fnum = SVAL(req->inbuf,smb_vwv0);
- fsp = file_fsp(fnum);
+ fsp = file_fsp(req, fnum);
if ((fnum != 0xFFFF) && !check_fsp(conn, req, fsp)) {
return;
}
-
+
if (!fsp) {
file_sync_all(conn);
} else {
@@ -4219,7 +4222,7 @@ void reply_flush(struct smb_request *req)
return;
}
}
-
+
reply_outbuf(req, 0, 0);
DEBUG(3,("flush\n"));
@@ -4263,17 +4266,10 @@ void reply_close(struct smb_request *req)
return;
}
- /* If it's an IPC, pass off to the pipe handler. */
- if (IS_IPC(conn)) {
- reply_pipe_close(conn, req);
- END_PROFILE(SMBclose);
- return;
- }
-
- fsp = file_fsp(SVAL(req->inbuf,smb_vwv0));
+ fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv0));
/*
- * We can only use CHECK_FSP if we know it's not a directory.
+ * We can only use check_fsp if we know it's not a directory.
*/
if(!fsp || (fsp->conn != conn) || (fsp->vuid != req->vuid)) {
@@ -4287,7 +4283,7 @@ void reply_close(struct smb_request *req)
* Special case - close NT SMB directory handle.
*/
DEBUG(3,("close directory fnum=%d\n", fsp->fnum));
- status = close_file(fsp,NORMAL_CLOSE);
+ status = close_file(req, fsp, NORMAL_CLOSE);
} else {
time_t t;
/*
@@ -4297,7 +4293,7 @@ void reply_close(struct smb_request *req)
DEBUG(3,("close fd=%d fnum=%d (numopen=%d)\n",
fsp->fh->fd, fsp->fnum,
conn->num_files_open));
-
+
/*
* Take care of any time sent in the close.
*/
@@ -4310,8 +4306,8 @@ void reply_close(struct smb_request *req)
* was detected on close - normally this is due to
* a disk full error. If not then it was probably an I/O error.
*/
-
- status = close_file(fsp,NORMAL_CLOSE);
+
+ status = close_file(req, fsp, NORMAL_CLOSE);
}
if (!NT_STATUS_IS_OK(status)) {
@@ -4348,7 +4344,7 @@ void reply_writeclose(struct smb_request *req)
return;
}
- fsp = file_fsp(SVAL(req->inbuf,smb_vwv0));
+ fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv0));
if (!check_fsp(conn, req, fsp)) {
END_PROFILE(SMBwriteclose);
@@ -4365,15 +4361,15 @@ void reply_writeclose(struct smb_request *req)
mtime = convert_time_t_to_timespec(srv_make_unix_date3(
req->inbuf+smb_vwv4));
data = smb_buf(req->inbuf) + 1;
-
+
if (numtowrite
- && is_locked(fsp, (uint32)req->smbpid, (SMB_BIG_UINT)numtowrite,
- (SMB_BIG_UINT)startpos, WRITE_LOCK)) {
+ && is_locked(fsp, (uint32)req->smbpid, (uint64_t)numtowrite,
+ (uint64_t)startpos, WRITE_LOCK)) {
reply_doserror(req, ERRDOS,ERRlock);
END_PROFILE(SMBwriteclose);
return;
}
-
+
nwritten = write_file(req,fsp,data,startpos,numtowrite);
set_close_write_time(fsp, mtime);
@@ -4386,19 +4382,19 @@ void reply_writeclose(struct smb_request *req)
if (numtowrite) {
DEBUG(3,("reply_writeclose: zero length write doesn't close file %s\n",
fsp->fsp_name ));
- close_status = close_file(fsp,NORMAL_CLOSE);
+ close_status = close_file(req, fsp, NORMAL_CLOSE);
}
DEBUG(3,("writeclose fnum=%d num=%d wrote=%d (numopen=%d)\n",
fsp->fnum, (int)numtowrite, (int)nwritten,
conn->num_files_open));
-
+
if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0)) {
reply_doserror(req, ERRHRD, ERRdiskfull);
END_PROFILE(SMBwriteclose);
return;
}
-
+
if(!NT_STATUS_IS_OK(close_status)) {
reply_nterror(req, close_status);
END_PROFILE(SMBwriteclose);
@@ -4406,7 +4402,7 @@ void reply_writeclose(struct smb_request *req)
}
reply_outbuf(req, 1, 0);
-
+
SSVAL(req->outbuf,smb_vwv0,nwritten);
END_PROFILE(SMBwriteclose);
return;
@@ -4422,7 +4418,7 @@ void reply_writeclose(struct smb_request *req)
void reply_lock(struct smb_request *req)
{
connection_struct *conn = req->conn;
- SMB_BIG_UINT count,offset;
+ uint64_t count,offset;
NTSTATUS status;
files_struct *fsp;
struct byte_range_lock *br_lck = NULL;
@@ -4435,7 +4431,7 @@ void reply_lock(struct smb_request *req)
return;
}
- fsp = file_fsp(SVAL(req->inbuf,smb_vwv0));
+ fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv0));
if (!check_fsp(conn, req, fsp)) {
END_PROFILE(SMBlock);
@@ -4444,8 +4440,8 @@ void reply_lock(struct smb_request *req)
release_level_2_oplocks_on_change(fsp);
- count = (SMB_BIG_UINT)IVAL(req->inbuf,smb_vwv1);
- offset = (SMB_BIG_UINT)IVAL(req->inbuf,smb_vwv3);
+ count = (uint64_t)IVAL(req->inbuf,smb_vwv1);
+ offset = (uint64_t)IVAL(req->inbuf,smb_vwv3);
DEBUG(3,("lock fd=%d fnum=%d offset=%.0f count=%.0f\n",
fsp->fh->fd, fsp->fnum, (double)offset, (double)count));
@@ -4482,7 +4478,7 @@ void reply_lock(struct smb_request *req)
void reply_unlock(struct smb_request *req)
{
connection_struct *conn = req->conn;
- SMB_BIG_UINT count,offset;
+ uint64_t count,offset;
NTSTATUS status;
files_struct *fsp;
@@ -4494,16 +4490,16 @@ void reply_unlock(struct smb_request *req)
return;
}
- fsp = file_fsp(SVAL(req->inbuf,smb_vwv0));
+ fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv0));
if (!check_fsp(conn, req, fsp)) {
END_PROFILE(SMBunlock);
return;
}
-
- count = (SMB_BIG_UINT)IVAL(req->inbuf,smb_vwv1);
- offset = (SMB_BIG_UINT)IVAL(req->inbuf,smb_vwv3);
-
+
+ count = (uint64_t)IVAL(req->inbuf,smb_vwv1);
+ offset = (uint64_t)IVAL(req->inbuf,smb_vwv3);
+
status = do_unlock(smbd_messaging_context(),
fsp,
req->smbpid,
@@ -4611,8 +4607,6 @@ void reply_echo(struct smb_request *req)
TALLOC_FREE(req->outbuf);
- smb_echo_count++;
-
END_PROFILE(SMBecho);
return;
}
@@ -4626,7 +4620,7 @@ void reply_printopen(struct smb_request *req)
connection_struct *conn = req->conn;
files_struct *fsp;
NTSTATUS status;
-
+
START_PROFILE(SMBsplopen);
if (req->wct < 2) {
@@ -4642,7 +4636,7 @@ void reply_printopen(struct smb_request *req)
}
/* Open for exclusive use, write only. */
- status = print_fsp_open(conn, NULL, req->vuid, &fsp);
+ status = print_fsp_open(req, conn, NULL, req->vuid, &fsp);
if (!NT_STATUS_IS_OK(status)) {
reply_nterror(req, status);
@@ -4652,7 +4646,7 @@ void reply_printopen(struct smb_request *req)
reply_outbuf(req, 1, 0);
SSVAL(req->outbuf,smb_vwv0,fsp->fnum);
-
+
DEBUG(3,("openprint fd=%d fnum=%d\n",
fsp->fh->fd, fsp->fnum));
@@ -4678,7 +4672,7 @@ void reply_printclose(struct smb_request *req)
return;
}
- fsp = file_fsp(SVAL(req->inbuf,smb_vwv0));
+ fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv0));
if (!check_fsp(conn, req, fsp)) {
END_PROFILE(SMBsplclose);
@@ -4690,11 +4684,11 @@ void reply_printclose(struct smb_request *req)
END_PROFILE(SMBsplclose);
return;
}
-
+
DEBUG(3,("printclose fd=%d fnum=%d\n",
fsp->fh->fd,fsp->fnum));
-
- status = close_file(fsp,NORMAL_CLOSE);
+
+ status = close_file(req, fsp, NORMAL_CLOSE);
if(!NT_STATUS_IS_OK(status)) {
reply_nterror(req, status);
@@ -4744,7 +4738,7 @@ void reply_printqueue(struct smb_request *req)
SSVAL(req->outbuf,smb_vwv1,0);
SCVAL(smb_buf(req->outbuf),0,1);
SSVAL(smb_buf(req->outbuf),1,0);
-
+
DEBUG(3,("printqueue start_index=%d max_count=%d\n",
start_index, max_count));
@@ -4760,7 +4754,7 @@ void reply_printqueue(struct smb_request *req)
num_to_get = 0;
else
num_to_get = MIN(num_to_get,count-first);
-
+
for (i=first;i<first+num_to_get;i++) {
char blob[28];
@@ -4793,10 +4787,10 @@ void reply_printqueue(struct smb_request *req)
}
SAFE_FREE(queue);
-
+
DEBUG(3,("%d entries returned in queue\n",count));
}
-
+
END_PROFILE(SMBsplretq);
return;
}
@@ -4819,8 +4813,8 @@ void reply_printwrite(struct smb_request *req)
END_PROFILE(SMBsplwr);
return;
}
-
- fsp = file_fsp(SVAL(req->inbuf,smb_vwv0));
+
+ fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv0));
if (!check_fsp(conn, req, fsp)) {
END_PROFILE(SMBsplwr);
@@ -5217,7 +5211,7 @@ static bool resolve_wildcards(TALLOC_CTX *ctx,
char *ext1 = NULL;
char *ext2 = NULL;
char *p,*p2, *pname1, *pname2;
-
+
name2_copy = talloc_strdup(ctx, name2);
if (!name2_copy) {
return False;
@@ -5229,7 +5223,7 @@ static bool resolve_wildcards(TALLOC_CTX *ctx,
if (!pname1 || !pname2) {
return False;
}
-
+
/* Truncate the copy of name2 at the last '/' */
*pname2 = '\0';
@@ -5583,10 +5577,10 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
DEBUG(3,("rename_internals_fsp: succeeded doing rename on %s -> %s\n",
fsp->fsp_name,newname));
- rename_open_files(conn, lck, newname);
-
notify_rename(conn, fsp->is_directory, fsp->fsp_name, newname);
+ rename_open_files(conn, lck, newname);
+
/*
* A rename acts as a new file create w.r.t. allowing an initial delete
* on close, probably because in Windows there is a new handle to the
@@ -5789,7 +5783,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
last_component_dest,
attrs, replace_if_exists);
- close_file(fsp, NORMAL_CLOSE);
+ close_file(req, fsp, NORMAL_CLOSE);
DEBUG(3, ("rename_internals: Error %s rename %s -> %s\n",
nt_errstr(status), directory,newname));
@@ -5893,7 +5887,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
status = rename_internals_fsp(conn, fsp, destname, dname,
attrs, replace_if_exists);
- close_file(fsp, NORMAL_CLOSE);
+ close_file(req, fsp, NORMAL_CLOSE);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(3, ("rename_internals_fsp returned %s for "
@@ -6108,7 +6102,7 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
TALLOC_FREE(dest);
if (!NT_STATUS_IS_OK(status)) {
- close_file(fsp1,ERROR_CLOSE);
+ close_file(NULL, fsp1, ERROR_CLOSE);
return status;
}
@@ -6127,7 +6121,7 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
ret = vfs_transfer_file(fsp1, fsp2, src_sbuf.st_size);
}
- close_file(fsp1,NORMAL_CLOSE);
+ close_file(NULL, fsp1, NORMAL_CLOSE);
/* Ensure the modtime is set correctly on the destination file. */
set_close_write_time(fsp2, get_mtimespec(&src_sbuf));
@@ -6138,7 +6132,7 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
* Thus we don't look at the error return from the
* close of fsp1.
*/
- status = close_file(fsp2,NORMAL_CLOSE);
+ status = close_file(NULL, fsp2, NORMAL_CLOSE);
if (!NT_STATUS_IS_OK(status)) {
return status;
@@ -6502,17 +6496,17 @@ uint32 get_lock_pid( char *data, int data_offset, bool large_file_format)
Get a lock count, dealing with large count requests.
****************************************************************************/
-SMB_BIG_UINT get_lock_count( char *data, int data_offset, bool large_file_format)
+uint64_t get_lock_count( char *data, int data_offset, bool large_file_format)
{
- SMB_BIG_UINT count = 0;
+ uint64_t count = 0;
if(!large_file_format) {
- count = (SMB_BIG_UINT)IVAL(data,SMB_LKLEN_OFFSET(data_offset));
+ count = (uint64_t)IVAL(data,SMB_LKLEN_OFFSET(data_offset));
} else {
#if defined(HAVE_LONGLONG)
- count = (((SMB_BIG_UINT) IVAL(data,SMB_LARGE_LKLEN_OFFSET_HIGH(data_offset))) << 32) |
- ((SMB_BIG_UINT) IVAL(data,SMB_LARGE_LKLEN_OFFSET_LOW(data_offset)));
+ count = (((uint64_t) IVAL(data,SMB_LARGE_LKLEN_OFFSET_HIGH(data_offset))) << 32) |
+ ((uint64_t) IVAL(data,SMB_LARGE_LKLEN_OFFSET_LOW(data_offset)));
#else /* HAVE_LONGLONG */
/*
@@ -6529,7 +6523,7 @@ SMB_BIG_UINT get_lock_count( char *data, int data_offset, bool large_file_format
SIVAL(data,SMB_LARGE_LKLEN_OFFSET_HIGH(data_offset),0);
}
- count = (SMB_BIG_UINT)IVAL(data,SMB_LARGE_LKLEN_OFFSET_LOW(data_offset));
+ count = (uint64_t)IVAL(data,SMB_LARGE_LKLEN_OFFSET_LOW(data_offset));
#endif /* HAVE_LONGLONG */
}
@@ -6546,26 +6540,26 @@ static uint32 map_lock_offset(uint32 high, uint32 low)
unsigned int i;
uint32 mask = 0;
uint32 highcopy = high;
-
+
/*
* Try and find out how many significant bits there are in high.
*/
-
+
for(i = 0; highcopy; i++)
highcopy >>= 1;
-
+
/*
* We use 31 bits not 32 here as POSIX
* lock offsets may not be negative.
*/
-
+
mask = (~0) << (31 - i);
-
+
if(low & mask)
return 0; /* Fail. */
-
+
high <<= (31 - i);
-
+
return (high|low);
}
#endif /* !defined(HAVE_LONGLONG) */
@@ -6574,19 +6568,19 @@ static uint32 map_lock_offset(uint32 high, uint32 low)
Get a lock offset, dealing with large offset requests.
****************************************************************************/
-SMB_BIG_UINT get_lock_offset( char *data, int data_offset, bool large_file_format, bool *err)
+uint64_t get_lock_offset( char *data, int data_offset, bool large_file_format, bool *err)
{
- SMB_BIG_UINT offset = 0;
+ uint64_t offset = 0;
*err = False;
if(!large_file_format) {
- offset = (SMB_BIG_UINT)IVAL(data,SMB_LKOFF_OFFSET(data_offset));
+ offset = (uint64_t)IVAL(data,SMB_LKOFF_OFFSET(data_offset));
} else {
#if defined(HAVE_LONGLONG)
- offset = (((SMB_BIG_UINT) IVAL(data,SMB_LARGE_LKOFF_OFFSET_HIGH(data_offset))) << 32) |
- ((SMB_BIG_UINT) IVAL(data,SMB_LARGE_LKOFF_OFFSET_LOW(data_offset)));
+ offset = (((uint64_t) IVAL(data,SMB_LARGE_LKOFF_OFFSET_HIGH(data_offset))) << 32) |
+ ((uint64_t) IVAL(data,SMB_LARGE_LKOFF_OFFSET_LOW(data_offset)));
#else /* HAVE_LONGLONG */
/*
@@ -6595,7 +6589,7 @@ SMB_BIG_UINT get_lock_offset( char *data, int data_offset, bool large_file_forma
* negotiated. For boxes without large unsigned ints mangle the
* lock offset by mapping the top 32 bits onto the lower 32.
*/
-
+
if(IVAL(data,SMB_LARGE_LKOFF_OFFSET_HIGH(data_offset)) != 0) {
uint32 low = IVAL(data,SMB_LARGE_LKOFF_OFFSET_LOW(data_offset));
uint32 high = IVAL(data,SMB_LARGE_LKOFF_OFFSET_HIGH(data_offset));
@@ -6603,7 +6597,7 @@ SMB_BIG_UINT get_lock_offset( char *data, int data_offset, bool large_file_forma
if((new_low = map_lock_offset(high, low)) == 0) {
*err = True;
- return (SMB_BIG_UINT)-1;
+ return (uint64_t)-1;
}
DEBUG(3,("get_lock_offset: truncating lock offset (high)0x%x (low)0x%x to offset 0x%x.\n",
@@ -6612,7 +6606,7 @@ SMB_BIG_UINT get_lock_offset( char *data, int data_offset, bool large_file_forma
SIVAL(data,SMB_LARGE_LKOFF_OFFSET_LOW(data_offset),new_low);
}
- offset = (SMB_BIG_UINT)IVAL(data,SMB_LARGE_LKOFF_OFFSET_LOW(data_offset));
+ offset = (uint64_t)IVAL(data,SMB_LARGE_LKOFF_OFFSET_LOW(data_offset));
#endif /* HAVE_LONGLONG */
}
@@ -6631,7 +6625,7 @@ void reply_lockingX(struct smb_request *req)
unsigned char oplocklevel;
uint16 num_ulocks;
uint16 num_locks;
- SMB_BIG_UINT count = 0, offset = 0;
+ uint64_t count = 0, offset = 0;
uint32 lock_pid;
int32 lock_timeout;
int i;
@@ -6647,8 +6641,8 @@ void reply_lockingX(struct smb_request *req)
END_PROFILE(SMBlockingX);
return;
}
-
- fsp = file_fsp(SVAL(req->inbuf,smb_vwv2));
+
+ fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv2));
locktype = CVAL(req->inbuf,smb_vwv3);
oplocklevel = CVAL(req->inbuf,smb_vwv3+1);
num_ulocks = SVAL(req->inbuf,smb_vwv6);
@@ -6660,7 +6654,7 @@ void reply_lockingX(struct smb_request *req)
END_PROFILE(SMBlockingX);
return;
}
-
+
data = smb_buf(req->inbuf);
if (locktype & LOCKING_ANDX_CHANGE_LOCKTYPE) {
@@ -6671,7 +6665,7 @@ void reply_lockingX(struct smb_request *req)
END_PROFILE(SMBlockingX);
return;
}
-
+
/* Check if this is an oplock break on a file
we have granted an oplock on.
*/
@@ -6688,7 +6682,7 @@ void reply_lockingX(struct smb_request *req)
* Make sure we have granted an exclusive or batch oplock on
* this file.
*/
-
+
if (fsp->oplock_type == 0) {
/* The Samba4 nbench simulator doesn't understand
@@ -6720,7 +6714,7 @@ void reply_lockingX(struct smb_request *req)
} else {
result = downgrade_oplock(fsp);
}
-
+
if (!result) {
DEBUG(0, ("reply_lockingX: error in removing "
"oplock on file %s\n", fsp->fsp_name));
@@ -6749,7 +6743,7 @@ void reply_lockingX(struct smb_request *req)
* We do this check *after* we have checked this is not a oplock break
* response message. JRA.
*/
-
+
release_level_2_oplocks_on_change(fsp);
if (smb_buflen(req->inbuf) <
@@ -6758,14 +6752,14 @@ void reply_lockingX(struct smb_request *req)
END_PROFILE(SMBlockingX);
return;
}
-
+
/* Data now points at the beginning of the list
of smb_unlkrng structs */
for(i = 0; i < (int)num_ulocks; i++) {
lock_pid = get_lock_pid( data, i, large_file_format);
count = get_lock_count( data, i, large_file_format);
offset = get_lock_offset( data, i, large_file_format, &err);
-
+
/*
* There is no error code marked "stupid client bug".... :-).
*/
@@ -6778,7 +6772,7 @@ void reply_lockingX(struct smb_request *req)
DEBUG(10,("reply_lockingX: unlock start=%.0f, len=%.0f for "
"pid %u, file %s\n", (double)offset, (double)count,
(unsigned int)lock_pid, fsp->fsp_name ));
-
+
status = do_unlock(smbd_messaging_context(),
fsp,
lock_pid,
@@ -6798,20 +6792,20 @@ void reply_lockingX(struct smb_request *req)
if (!lp_blocking_locks(SNUM(conn))) {
lock_timeout = 0;
}
-
+
/* Now do any requested locks */
data += ((large_file_format ? 20 : 10)*num_ulocks);
-
+
/* Data now points at the beginning of the list
of smb_lkrng structs */
-
+
for(i = 0; i < (int)num_locks; i++) {
enum brl_type lock_type = ((locktype & LOCKING_ANDX_SHARED_LOCK) ?
READ_LOCK:WRITE_LOCK);
lock_pid = get_lock_pid( data, i, large_file_format);
count = get_lock_count( data, i, large_file_format);
offset = get_lock_offset( data, i, large_file_format, &err);
-
+
/*
* There is no error code marked "stupid client bug".... :-).
*/
@@ -6820,12 +6814,12 @@ void reply_lockingX(struct smb_request *req)
reply_doserror(req, ERRDOS, ERRnoaccess);
return;
}
-
+
DEBUG(10,("reply_lockingX: lock start=%.0f, len=%.0f for pid "
"%u, file %s timeout = %d\n", (double)offset,
(double)count, (unsigned int)lock_pid,
fsp->fsp_name, (int)lock_timeout ));
-
+
if (locktype & LOCKING_ANDX_CANCEL_LOCK) {
if (lp_blocking_locks(SNUM(conn))) {
@@ -6924,7 +6918,7 @@ void reply_lockingX(struct smb_request *req)
return;
}
}
-
+
/* If any of the above locks failed, then we must unlock
all of the previous locks (X/Open spec). */
@@ -6941,7 +6935,7 @@ void reply_lockingX(struct smb_request *req)
count = get_lock_count( data, i, large_file_format);
offset = get_lock_offset( data, i, large_file_format,
&err);
-
+
/*
* There is no error code marked "stupid client
* bug".... :-).
@@ -6951,7 +6945,7 @@ void reply_lockingX(struct smb_request *req)
reply_doserror(req, ERRDOS, ERRnoaccess);
return;
}
-
+
do_unlock(smbd_messaging_context(),
fsp,
lock_pid,
@@ -6965,10 +6959,10 @@ void reply_lockingX(struct smb_request *req)
}
reply_outbuf(req, 2, 0);
-
+
DEBUG(3, ("lockingX fnum=%d type=%d num_locks=%d num_ulocks=%d\n",
fsp->fnum, (unsigned int)locktype, num_locks, num_ulocks));
-
+
END_PROFILE(SMBlockingX);
chain_reply(req);
}
@@ -7024,7 +7018,7 @@ void reply_setattrE(struct smb_request *req)
return;
}
- fsp = file_fsp(SVAL(req->inbuf,smb_vwv0));
+ fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv0));
if(!fsp || (fsp->conn != conn)) {
reply_doserror(req, ERRDOS, ERRbadfid);
@@ -7042,7 +7036,7 @@ void reply_setattrE(struct smb_request *req)
srv_make_unix_date2(req->inbuf+smb_vwv3)); /* atime. */
ts[1] = convert_time_t_to_timespec(
srv_make_unix_date2(req->inbuf+smb_vwv5)); /* mtime. */
-
+
reply_outbuf(req, 0, 0);
/*
@@ -7074,7 +7068,7 @@ void reply_setattrE(struct smb_request *req)
END_PROFILE(SMBsetattrE);
return;
}
-
+
DEBUG( 3, ( "reply_setattrE fnum=%d actime=%u modtime=%u\n",
fsp->fnum,
(unsigned int)ts[0].tv_sec,
@@ -7135,7 +7129,7 @@ void reply_getattrE(struct smb_request *req)
return;
}
- fsp = file_fsp(SVAL(req->inbuf,smb_vwv0));
+ fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv0));
if(!fsp || (fsp->conn != conn)) {
reply_doserror(req, ERRDOS, ERRbadfid);
@@ -7149,9 +7143,9 @@ void reply_getattrE(struct smb_request *req)
END_PROFILE(SMBgetattrE);
return;
}
-
+
mode = dos_mode(conn,fsp->fsp_name,&sbuf);
-
+
/*
* Convert the times into dos times. Set create
* date to be last modify date as UNIX doesn't save
@@ -7176,9 +7170,9 @@ void reply_getattrE(struct smb_request *req)
SIVAL(req->outbuf, smb_vwv8, allocation_size);
}
SSVAL(req->outbuf,smb_vwv10, mode);
-
+
DEBUG( 3, ( "reply_getattrE fnum=%d\n", fsp->fnum));
-
+
END_PROFILE(SMBgetattrE);
return;
}
diff --git a/source3/smbd/seal.c b/source3/smbd/seal.c
index e9dc46aa3c..3822ee191e 100644
--- a/source3/smbd/seal.c
+++ b/source3/smbd/seal.c
@@ -426,9 +426,14 @@ static NTSTATUS srv_enc_spnego_gss_negotiate(unsigned char **ppdata, size_t *p_d
data_blob_free(&auth_reply);
SAFE_FREE(*ppdata);
- *ppdata = response.data;
+ *ppdata = (unsigned char *)memdup(response.data, response.length);
+ if ((*ppdata) == NULL && response.length > 0) {
+ status = NT_STATUS_NO_MEMORY;
+ }
*p_data_size = response.length;
+ data_blob_free(&response);
+
return status;
}
#endif
@@ -463,8 +468,13 @@ static NTSTATUS srv_enc_ntlm_negotiate(unsigned char **ppdata, size_t *p_data_si
}
SAFE_FREE(*ppdata);
- *ppdata = response.data;
+ *ppdata = (unsigned char *)memdup(response.data, response.length);
+ if ((*ppdata) == NULL && response.length > 0) {
+ status = NT_STATUS_NO_MEMORY;
+ }
*p_data_size = response.length;
+ data_blob_free(&response);
+
return status;
}
@@ -585,8 +595,11 @@ static NTSTATUS srv_enc_spnego_ntlm_auth(connection_struct *conn,
}
SAFE_FREE(*ppdata);
- *ppdata = response.data;
+ *ppdata = (unsigned char *)memdup(response.data, response.length);
+ if ((*ppdata) == NULL && response.length > 0)
+ return NT_STATUS_NO_MEMORY;
*p_data_size = response.length;
+ data_blob_free(&response);
return status;
}
@@ -636,8 +649,11 @@ static NTSTATUS srv_enc_raw_ntlm_auth(connection_struct *conn,
/* Return the raw blob. */
SAFE_FREE(*ppdata);
- *ppdata = response.data;
+ *ppdata = (unsigned char *)memdup(response.data, response.length);
+ if ((*ppdata) == NULL && response.length > 0)
+ return NT_STATUS_NO_MEMORY;
*p_data_size = response.length;
+ data_blob_free(&response);
return status;
}
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 53116f3d98..4e81263ee4 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -840,7 +840,7 @@ bool reload_services(bool test)
if (lp_loaded()) {
char *fname = lp_configfile();
- if (file_exist(fname, NULL) &&
+ if (file_exist(fname) &&
!strcsequal(fname, get_dyn_CONFIGFILE())) {
set_dyn_CONFIGFILE(fname);
test = False;
@@ -888,7 +888,7 @@ bool reload_services(bool test)
enum server_exit_reason { SERVER_EXIT_NORMAL, SERVER_EXIT_ABNORMAL };
static void exit_server_common(enum server_exit_reason how,
- const char *const reason) NORETURN_ATTRIBUTE;
+ const char *const reason) _NORETURN_;
static void exit_server_common(enum server_exit_reason how,
const char *const reason)
@@ -1067,6 +1067,30 @@ static bool deadtime_fn(const struct timeval *now, void *private_data)
return True;
}
+/*
+ * Do the recurring log file and smb.conf reload checks.
+ */
+
+static bool housekeeping_fn(const struct timeval *now, void *private_data)
+{
+ change_to_root_user();
+
+ /* update printer queue caches if necessary */
+ update_monitored_printq_cache();
+
+ /* check if we need to reload services */
+ check_reload(time(NULL));
+
+ /* Change machine password if neccessary. */
+ attempt_machine_password_change();
+
+ /*
+ * Force a log file check.
+ */
+ force_check_log_size();
+ check_log_size();
+ return true;
+}
/****************************************************************************
main program.
@@ -1295,7 +1319,7 @@ extern void build_options(bool screen);
setpgid( (pid_t)0, (pid_t)0);
#endif
- if (!directory_exist(lp_lockdir(), NULL))
+ if (!directory_exist(lp_lockdir()))
mkdir(lp_lockdir(), 0755);
if (is_daemon)
@@ -1426,6 +1450,13 @@ extern void build_options(bool screen);
exit(1);
}
+ if (!(event_add_idle(smbd_event_context(), NULL,
+ timeval_set(SMBD_SELECT_TIMEOUT, 0),
+ "housekeeping", housekeeping_fn, NULL))) {
+ DEBUG(0, ("Could not add housekeeping event\n"));
+ exit(1);
+ }
+
#ifdef CLUSTER_SUPPORT
if (lp_clustering()) {
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 0b851f1e48..05197021a3 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -1296,10 +1296,9 @@ connection_struct *make_connection(const char *service_in, DATA_BLOB password,
void close_cnum(connection_struct *conn, uint16 vuid)
{
- if (IS_IPC(conn)) {
- pipe_close_conn(conn);
- } else {
- file_close_conn(conn);
+ file_close_conn(conn);
+
+ if (!IS_IPC(conn)) {
dptr_closecnum(conn);
}
diff --git a/source3/smbd/session.c b/source3/smbd/session.c
index 3b431a19be..8163eb30af 100644
--- a/source3/smbd/session.c
+++ b/source3/smbd/session.c
@@ -113,7 +113,10 @@ bool session_claim(user_struct *vuser)
break;
}
- sess_pid = ((struct sessionid *)rec->value.dptr)->pid;
+ memcpy(&sess_pid,
+ ((char *)rec->value.dptr)
+ + offsetof(struct sessionid, pid),
+ sizeof(sess_pid));
if (!process_exists(sess_pid)) {
DEBUG(5, ("%s has died -- re-using session\n",
diff --git a/source3/smbd/statvfs.c b/source3/smbd/statvfs.c
index 0e9a2c2ebe..ee33e13a48 100644
--- a/source3/smbd/statvfs.c
+++ b/source3/smbd/statvfs.c
@@ -118,7 +118,7 @@ static int darwin_statvfs(const char *path, vfs_statvfs_struct *statbuf)
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->FsIdentifier = *(uint64_t *)(&sbuf.f_fsid); /* Ick. */
statbuf->FsCapabilities = darwin_fs_capabilities(sbuf.f_mntonname);
return 0;
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 2e2da5cc71..1da45a8b58 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -47,9 +47,9 @@ static char *store_file_unix_basic_info2(connection_struct *conn,
Only do this for Windows clients.
********************************************************************/
-SMB_BIG_UINT smb_roundup(connection_struct *conn, SMB_BIG_UINT val)
+uint64_t smb_roundup(connection_struct *conn, uint64_t val)
{
- SMB_BIG_UINT rval = lp_allocation_roundup_size(SNUM(conn));
+ uint64_t rval = lp_allocation_roundup_size(SNUM(conn));
/* Only roundup for Windows clients. */
enum remote_arch_types ra_type = get_remote_arch();
@@ -64,18 +64,18 @@ SMB_BIG_UINT smb_roundup(connection_struct *conn, SMB_BIG_UINT val)
account sparse files.
********************************************************************/
-SMB_BIG_UINT get_allocation_size(connection_struct *conn, files_struct *fsp, const SMB_STRUCT_STAT *sbuf)
+uint64_t get_allocation_size(connection_struct *conn, files_struct *fsp, const SMB_STRUCT_STAT *sbuf)
{
- SMB_BIG_UINT ret;
+ uint64_t ret;
if(S_ISDIR(sbuf->st_mode)) {
return 0;
}
#if defined(HAVE_STAT_ST_BLOCKS) && defined(STAT_ST_BLOCKSIZE)
- ret = (SMB_BIG_UINT)STAT_ST_BLOCKSIZE * (SMB_BIG_UINT)sbuf->st_blocks;
+ ret = (uint64_t)STAT_ST_BLOCKSIZE * (uint64_t)sbuf->st_blocks;
#else
- ret = (SMB_BIG_UINT)get_file_size(*sbuf);
+ ret = (uint64_t)get_file_size(*sbuf);
#endif
if (fsp && fsp->initial_allocation_size)
@@ -1031,7 +1031,7 @@ static void call_trans2open(connection_struct *conn,
mtime = sbuf.st_mtime;
inode = sbuf.st_ino;
if (fattr & aDIR) {
- close_file(fsp,ERROR_CLOSE);
+ close_file(req, fsp, ERROR_CLOSE);
reply_doserror(req, ERRDOS,ERRnoaccess);
return;
}
@@ -1264,7 +1264,7 @@ static bool get_lanman2_dir_entry(TALLOC_CTX *ctx,
long prev_dirpos=0;
uint32 mode=0;
SMB_OFF_T file_size = 0;
- SMB_BIG_UINT allocation_size = 0;
+ uint64_t allocation_size = 0;
uint32 len;
struct timespec mdate_ts, adate_ts, create_date_ts;
time_t mdate = (time_t)0, adate = (time_t)0, create_date = (time_t)0;
@@ -1892,7 +1892,7 @@ static void call_trans2findfirst(connection_struct *conn,
bool requires_resume_key;
int info_level;
char *directory = NULL;
- const char *mask = NULL;
+ char *mask = NULL;
char *p;
int last_entry_off=0;
int dptr_num = -1;
@@ -1980,7 +1980,7 @@ close_if_end = %d requires_resume_key = %d level = 0x%x, max_data_bytes = %d\n",
return;
}
- ntstatus = unix_convert(ctx, conn, directory, True, &directory, NULL, &sbuf);
+ ntstatus = unix_convert(ctx, conn, directory, True, &directory, &mask, &sbuf);
if (!NT_STATUS_IS_OK(ntstatus)) {
reply_nterror(req, ntstatus);
return;
@@ -1996,10 +1996,12 @@ close_if_end = %d requires_resume_key = %d level = 0x%x, max_data_bytes = %d\n",
if(p == NULL) {
/* Windows and OS/2 systems treat search on the root '\' as if it were '\*' */
if((directory[0] == '.') && (directory[1] == '\0')) {
- mask = "*";
+ mask = talloc_strdup(ctx,"*");
+ if (!mask) {
+ reply_nterror(req, NT_STATUS_NO_MEMORY);
+ return;
+ }
mask_contains_wcard = True;
- } else {
- mask = directory;
}
directory = talloc_strdup(talloc_tos(), "./");
if (!directory) {
@@ -2007,7 +2009,6 @@ close_if_end = %d requires_resume_key = %d level = 0x%x, max_data_bytes = %d\n",
return;
}
} else {
- mask = p+1;
*p = 0;
}
@@ -2612,22 +2613,22 @@ static void call_trans2qfsinfo(connection_struct *conn,
switch (info_level) {
case SMB_INFO_ALLOCATION:
{
- SMB_BIG_UINT dfree,dsize,bsize,block_size,sectors_per_unit,bytes_per_sector;
+ uint64_t dfree,dsize,bsize,block_size,sectors_per_unit,bytes_per_sector;
data_len = 18;
- if (get_dfree_info(conn,".",False,&bsize,&dfree,&dsize) == (SMB_BIG_UINT)-1) {
+ if (get_dfree_info(conn,".",False,&bsize,&dfree,&dsize) == (uint64_t)-1) {
reply_unixerror(req, ERRHRD, ERRgeneral);
return;
}
block_size = lp_block_size(snum);
if (bsize < block_size) {
- SMB_BIG_UINT factor = block_size/bsize;
+ uint64_t factor = block_size/bsize;
bsize = block_size;
dsize /= factor;
dfree /= factor;
}
if (bsize > block_size) {
- SMB_BIG_UINT factor = bsize/block_size;
+ uint64_t factor = bsize/block_size;
bsize = block_size;
dsize *= factor;
dfree *= factor;
@@ -2732,21 +2733,21 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)st.st_dev, (unsi
case SMB_QUERY_FS_SIZE_INFO:
case SMB_FS_SIZE_INFORMATION:
{
- SMB_BIG_UINT dfree,dsize,bsize,block_size,sectors_per_unit,bytes_per_sector;
+ uint64_t dfree,dsize,bsize,block_size,sectors_per_unit,bytes_per_sector;
data_len = 24;
- if (get_dfree_info(conn,".",False,&bsize,&dfree,&dsize) == (SMB_BIG_UINT)-1) {
+ if (get_dfree_info(conn,".",False,&bsize,&dfree,&dsize) == (uint64_t)-1) {
reply_unixerror(req, ERRHRD, ERRgeneral);
return;
}
block_size = lp_block_size(snum);
if (bsize < block_size) {
- SMB_BIG_UINT factor = block_size/bsize;
+ uint64_t factor = block_size/bsize;
bsize = block_size;
dsize /= factor;
dfree /= factor;
}
if (bsize > block_size) {
- SMB_BIG_UINT factor = bsize/block_size;
+ uint64_t factor = bsize/block_size;
bsize = block_size;
dsize *= factor;
dfree *= factor;
@@ -2765,21 +2766,21 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
case SMB_FS_FULL_SIZE_INFORMATION:
{
- SMB_BIG_UINT dfree,dsize,bsize,block_size,sectors_per_unit,bytes_per_sector;
+ uint64_t dfree,dsize,bsize,block_size,sectors_per_unit,bytes_per_sector;
data_len = 32;
- if (get_dfree_info(conn,".",False,&bsize,&dfree,&dsize) == (SMB_BIG_UINT)-1) {
+ if (get_dfree_info(conn,".",False,&bsize,&dfree,&dsize) == (uint64_t)-1) {
reply_unixerror(req, ERRHRD, ERRgeneral);
return;
}
block_size = lp_block_size(snum);
if (bsize < block_size) {
- SMB_BIG_UINT factor = block_size/bsize;
+ uint64_t factor = block_size/bsize;
bsize = block_size;
dsize /= factor;
dfree /= factor;
}
if (bsize > block_size) {
- SMB_BIG_UINT factor = bsize/block_size;
+ uint64_t factor = bsize/block_size;
bsize = block_size;
dsize *= factor;
dfree *= factor;
@@ -2810,8 +2811,8 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
* what we have to send --metze:
*
* Unknown1: 24 NULL bytes
- * Soft Quota Treshold: 8 bytes seems like SMB_BIG_UINT or so
- * Hard Quota Limit: 8 bytes seems like SMB_BIG_UINT or so
+ * Soft Quota Treshold: 8 bytes seems like uint64_t or so
+ * Hard Quota Limit: 8 bytes seems like uint64_t or so
* Quota Flags: 2 byte :
* Unknown3: 6 NULL bytes
*
@@ -2859,9 +2860,9 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
DEBUG(10,("SMB_FS_QUOTA_INFORMATION: for service [%s]\n",lp_servicename(SNUM(conn))));
/* Unknown1 24 NULL bytes*/
- SBIG_UINT(pdata,0,(SMB_BIG_UINT)0);
- SBIG_UINT(pdata,8,(SMB_BIG_UINT)0);
- SBIG_UINT(pdata,16,(SMB_BIG_UINT)0);
+ SBIG_UINT(pdata,0,(uint64_t)0);
+ SBIG_UINT(pdata,8,(uint64_t)0);
+ SBIG_UINT(pdata,16,(uint64_t)0);
/* Default Soft Quota 8 bytes */
SBIG_UINT(pdata,24,quotas.softlim);
@@ -2934,7 +2935,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
/* We have POSIX ACLs, pathname, encryption,
* large read/write, and locking capability. */
- SBIG_UINT(pdata,4,((SMB_BIG_UINT)(
+ SBIG_UINT(pdata,4,((uint64_t)(
CIFS_UNIX_POSIX_ACLS_CAP|
CIFS_UNIX_POSIX_PATHNAMES_CAP|
CIFS_UNIX_FCNTL_LOCKS_CAP|
@@ -3036,9 +3037,9 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
SIVAL(pdata, 0, flags);
SIVAL(pdata, 4, SMB_WHOAMI_MASK);
SBIG_UINT(pdata, 8,
- (SMB_BIG_UINT)conn->server_info->utok.uid);
+ (uint64_t)conn->server_info->utok.uid);
SBIG_UINT(pdata, 16,
- (SMB_BIG_UINT)conn->server_info->utok.gid);
+ (uint64_t)conn->server_info->utok.gid);
if (data_len >= max_data_bytes) {
@@ -3077,7 +3078,7 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)bsize, (unsigned
/* GID list */
for (i = 0; i < conn->server_info->utok.ngroups; ++i) {
SBIG_UINT(pdata, data_len,
- (SMB_BIG_UINT)conn->server_info->utok.groups[i]);
+ (uint64_t)conn->server_info->utok.groups[i]);
data_len += 8;
}
@@ -3297,7 +3298,7 @@ cap_low = 0x%x, cap_high = 0x%x\n",
* but we didn't use the last 6 bytes for now
* --metze
*/
- fsp = file_fsp(SVAL(params,0));
+ fsp = file_fsp(req, SVAL(params,0));
if (!check_fsp_ntquota_handle(conn, req,
fsp)) {
@@ -3318,10 +3319,10 @@ cap_low = 0x%x, cap_high = 0x%x\n",
/* unknown_1 24 NULL bytes in pdata*/
- /* the soft quotas 8 bytes (SMB_BIG_UINT)*/
- quotas.softlim = (SMB_BIG_UINT)IVAL(pdata,24);
+ /* the soft quotas 8 bytes (uint64_t)*/
+ quotas.softlim = (uint64_t)IVAL(pdata,24);
#ifdef LARGE_SMB_OFF_T
- quotas.softlim |= (((SMB_BIG_UINT)IVAL(pdata,28)) << 32);
+ quotas.softlim |= (((uint64_t)IVAL(pdata,28)) << 32);
#else /* LARGE_SMB_OFF_T */
if ((IVAL(pdata,28) != 0)&&
((quotas.softlim != 0xFFFFFFFF)||
@@ -3334,10 +3335,10 @@ cap_low = 0x%x, cap_high = 0x%x\n",
}
#endif /* LARGE_SMB_OFF_T */
- /* the hard quotas 8 bytes (SMB_BIG_UINT)*/
- quotas.hardlim = (SMB_BIG_UINT)IVAL(pdata,32);
+ /* the hard quotas 8 bytes (uint64_t)*/
+ quotas.hardlim = (uint64_t)IVAL(pdata,32);
#ifdef LARGE_SMB_OFF_T
- quotas.hardlim |= (((SMB_BIG_UINT)IVAL(pdata,36)) << 32);
+ quotas.hardlim |= (((uint64_t)IVAL(pdata,36)) << 32);
#else /* LARGE_SMB_OFF_T */
if ((IVAL(pdata,36) != 0)&&
((quotas.hardlim != 0xFFFFFFFF)||
@@ -3753,7 +3754,7 @@ static void call_trans2qpipeinfo(connection_struct *conn,
unsigned int data_size = 0;
unsigned int param_size = 2;
uint16 info_level;
- smb_np_struct *p_pipe = NULL;
+ files_struct *fsp;
if (!params) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
@@ -3765,8 +3766,8 @@ static void call_trans2qpipeinfo(connection_struct *conn,
return;
}
- p_pipe = get_rpc_pipe_p(SVAL(params,0));
- if (p_pipe == NULL) {
+ fsp = file_fsp(req, SVAL(params,0));
+ if (!fsp_is_np(fsp)) {
reply_nterror(req, NT_STATUS_INVALID_HANDLE);
return;
}
@@ -3827,7 +3828,7 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
int mode=0;
int nlink;
SMB_OFF_T file_size=0;
- SMB_BIG_UINT allocation_size=0;
+ uint64_t allocation_size=0;
unsigned int data_size = 0;
unsigned int param_size = 2;
SMB_STRUCT_STAT sbuf;
@@ -3872,7 +3873,7 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
return;
}
- fsp = file_fsp(SVAL(params,0));
+ fsp = file_fsp(req, SVAL(params,0));
info_level = SVAL(params,2);
DEBUG(3,("call_trans2qfilepathinfo: TRANSACT2_QFILEINFO: level = %d\n", info_level));
@@ -4681,8 +4682,8 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
case SMB_QUERY_POSIX_LOCK:
{
NTSTATUS status = NT_STATUS_INVALID_LEVEL;
- SMB_BIG_UINT count;
- SMB_BIG_UINT offset;
+ uint64_t count;
+ uint64_t offset;
uint32 lock_pid;
enum brl_type lock_type;
@@ -4710,13 +4711,13 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
lock_pid = IVAL(pdata, POSIX_LOCK_PID_OFFSET);
#if defined(HAVE_LONGLONG)
- offset = (((SMB_BIG_UINT) IVAL(pdata,(POSIX_LOCK_START_OFFSET+4))) << 32) |
- ((SMB_BIG_UINT) IVAL(pdata,POSIX_LOCK_START_OFFSET));
- count = (((SMB_BIG_UINT) IVAL(pdata,(POSIX_LOCK_LEN_OFFSET+4))) << 32) |
- ((SMB_BIG_UINT) IVAL(pdata,POSIX_LOCK_LEN_OFFSET));
+ offset = (((uint64_t) IVAL(pdata,(POSIX_LOCK_START_OFFSET+4))) << 32) |
+ ((uint64_t) IVAL(pdata,POSIX_LOCK_START_OFFSET));
+ count = (((uint64_t) IVAL(pdata,(POSIX_LOCK_LEN_OFFSET+4))) << 32) |
+ ((uint64_t) IVAL(pdata,POSIX_LOCK_LEN_OFFSET));
#else /* HAVE_LONGLONG */
- offset = (SMB_BIG_UINT)IVAL(pdata,POSIX_LOCK_START_OFFSET);
- count = (SMB_BIG_UINT)IVAL(pdata,POSIX_LOCK_LEN_OFFSET);
+ offset = (uint64_t)IVAL(pdata,POSIX_LOCK_START_OFFSET);
+ count = (uint64_t)IVAL(pdata,POSIX_LOCK_LEN_OFFSET);
#endif /* HAVE_LONGLONG */
status = query_lock(fsp,
@@ -5015,12 +5016,12 @@ static NTSTATUS smb_set_file_size(connection_struct *conn,
if (vfs_set_filelen(new_fsp, size) == -1) {
status = map_nt_error_from_unix(errno);
- close_file(new_fsp,NORMAL_CLOSE);
+ close_file(req, new_fsp,NORMAL_CLOSE);
return status;
}
trigger_write_time_update_immediate(new_fsp);
- close_file(new_fsp,NORMAL_CLOSE);
+ close_file(req, new_fsp,NORMAL_CLOSE);
return NT_STATUS_OK;
}
@@ -5122,7 +5123,7 @@ static NTSTATUS smb_file_position_information(connection_struct *conn,
int total_data,
files_struct *fsp)
{
- SMB_BIG_UINT position_information;
+ uint64_t position_information;
if (total_data < 8) {
return NT_STATUS_INVALID_PARAMETER;
@@ -5133,9 +5134,9 @@ static NTSTATUS smb_file_position_information(connection_struct *conn,
return NT_STATUS_OK;
}
- position_information = (SMB_BIG_UINT)IVAL(pdata,0);
+ position_information = (uint64_t)IVAL(pdata,0);
#ifdef LARGE_SMB_OFF_T
- position_information |= (((SMB_BIG_UINT)IVAL(pdata,4)) << 32);
+ position_information |= (((uint64_t)IVAL(pdata,4)) << 32);
#else /* LARGE_SMB_OFF_T */
if (IVAL(pdata,4) != 0) {
/* more than 32 bits? */
@@ -5474,8 +5475,8 @@ static NTSTATUS smb_set_posix_lock(connection_struct *conn,
int total_data,
files_struct *fsp)
{
- SMB_BIG_UINT count;
- SMB_BIG_UINT offset;
+ uint64_t count;
+ uint64_t offset;
uint32 lock_pid;
bool blocking_lock = False;
enum brl_type lock_type;
@@ -5522,13 +5523,13 @@ static NTSTATUS smb_set_posix_lock(connection_struct *conn,
lock_pid = IVAL(pdata, POSIX_LOCK_PID_OFFSET);
#if defined(HAVE_LONGLONG)
- offset = (((SMB_BIG_UINT) IVAL(pdata,(POSIX_LOCK_START_OFFSET+4))) << 32) |
- ((SMB_BIG_UINT) IVAL(pdata,POSIX_LOCK_START_OFFSET));
- count = (((SMB_BIG_UINT) IVAL(pdata,(POSIX_LOCK_LEN_OFFSET+4))) << 32) |
- ((SMB_BIG_UINT) IVAL(pdata,POSIX_LOCK_LEN_OFFSET));
+ offset = (((uint64_t) IVAL(pdata,(POSIX_LOCK_START_OFFSET+4))) << 32) |
+ ((uint64_t) IVAL(pdata,POSIX_LOCK_START_OFFSET));
+ count = (((uint64_t) IVAL(pdata,(POSIX_LOCK_LEN_OFFSET+4))) << 32) |
+ ((uint64_t) IVAL(pdata,POSIX_LOCK_LEN_OFFSET));
#else /* HAVE_LONGLONG */
- offset = (SMB_BIG_UINT)IVAL(pdata,POSIX_LOCK_START_OFFSET);
- count = (SMB_BIG_UINT)IVAL(pdata,POSIX_LOCK_LEN_OFFSET);
+ offset = (uint64_t)IVAL(pdata,POSIX_LOCK_START_OFFSET);
+ count = (uint64_t)IVAL(pdata,POSIX_LOCK_LEN_OFFSET);
#endif /* HAVE_LONGLONG */
DEBUG(10,("smb_set_posix_lock: file %s, lock_type = %u,"
@@ -5701,7 +5702,7 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn,
const char *fname,
SMB_STRUCT_STAT *psbuf)
{
- SMB_BIG_UINT allocation_size = 0;
+ uint64_t allocation_size = 0;
NTSTATUS status = NT_STATUS_OK;
files_struct *new_fsp = NULL;
@@ -5713,9 +5714,9 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn,
return NT_STATUS_INVALID_PARAMETER;
}
- allocation_size = (SMB_BIG_UINT)IVAL(pdata,0);
+ allocation_size = (uint64_t)IVAL(pdata,0);
#ifdef LARGE_SMB_OFF_T
- allocation_size |= (((SMB_BIG_UINT)IVAL(pdata,4)) << 32);
+ allocation_size |= (((uint64_t)IVAL(pdata,4)) << 32);
#else /* LARGE_SMB_OFF_T */
if (IVAL(pdata,4) != 0) {
/* more than 32 bits? */
@@ -5770,7 +5771,7 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn,
if (allocation_size != get_file_size(*psbuf)) {
if (vfs_allocate_file_space(new_fsp, allocation_size) == -1) {
status = map_nt_error_from_unix(errno);
- close_file(new_fsp,NORMAL_CLOSE);
+ close_file(req, new_fsp, NORMAL_CLOSE);
return status;
}
}
@@ -5782,7 +5783,7 @@ static NTSTATUS smb_set_file_allocation_info(connection_struct *conn,
*/
trigger_write_time_update_immediate(new_fsp);
- close_file(new_fsp,NORMAL_CLOSE);
+ close_file(req, new_fsp, NORMAL_CLOSE);
return NT_STATUS_OK;
}
@@ -6195,7 +6196,7 @@ static NTSTATUS smb_posix_mkdir(connection_struct *conn,
&fsp);
if (NT_STATUS_IS_OK(status)) {
- close_file(fsp, NORMAL_CLOSE);
+ close_file(req, fsp, NORMAL_CLOSE);
}
info_level_return = SVAL(pdata,16);
@@ -6388,7 +6389,7 @@ static NTSTATUS smb_posix_open(connection_struct *conn,
/* Realloc the data size */
*ppdata = (char *)SMB_REALLOC(*ppdata,*pdata_return_size);
if (*ppdata == NULL) {
- close_file(fsp,ERROR_CLOSE);
+ close_file(req, fsp, ERROR_CLOSE);
*pdata_return_size = 0;
return NT_STATUS_NO_MEMORY;
}
@@ -6506,7 +6507,7 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
if (lck == NULL) {
DEBUG(0, ("smb_posix_unlink: Could not get share mode "
"lock for file %s\n", fsp->fsp_name));
- close_file(fsp, NORMAL_CLOSE);
+ close_file(req, fsp, NORMAL_CLOSE);
return NT_STATUS_INVALID_PARAMETER;
}
@@ -6522,7 +6523,7 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
continue;
}
/* Fail with sharing violation. */
- close_file(fsp, NORMAL_CLOSE);
+ close_file(req, fsp, NORMAL_CLOSE);
TALLOC_FREE(lck);
return NT_STATUS_SHARING_VIOLATION;
}
@@ -6539,12 +6540,12 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
psbuf);
if (!NT_STATUS_IS_OK(status)) {
- close_file(fsp, NORMAL_CLOSE);
+ close_file(req, fsp, NORMAL_CLOSE);
TALLOC_FREE(lck);
return status;
}
TALLOC_FREE(lck);
- return close_file(fsp, NORMAL_CLOSE);
+ return close_file(req, fsp, NORMAL_CLOSE);
}
/****************************************************************************
@@ -6581,7 +6582,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
return;
}
- fsp = file_fsp(SVAL(params,0));
+ fsp = file_fsp(req, SVAL(params,0));
/* Basic check for non-null fsp. */
if (!check_fsp_open(conn, req, fsp)) {
return;
@@ -7064,10 +7065,11 @@ static void call_trans2mkdir(connection_struct *conn, struct smb_request *req,
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
return;
}
- } else if (IVAL(pdata,0) != 4) {
- reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
- return;
}
+ /* If total_data == 4 Windows doesn't care what values
+ * are placed in that field, it just ignores them.
+ * The System i QNTC IBM SMB client puts bad values here,
+ * so ignore them. */
status = create_directory(conn, req, directory);
@@ -7249,7 +7251,7 @@ static void call_trans2ioctl(connection_struct *conn,
unsigned int max_data_bytes)
{
char *pdata = *ppdata;
- files_struct *fsp = file_fsp(SVAL(req->inbuf,smb_vwv15));
+ files_struct *fsp = file_fsp(req, SVAL(req->inbuf,smb_vwv15));
/* check for an invalid fid before proceeding */
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 1e137dd908..011f31dd24 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -501,13 +501,13 @@ ssize_t vfs_pwrite_data(struct smb_request *req,
Returns 0 on success, -1 on failure.
****************************************************************************/
-int vfs_allocate_file_space(files_struct *fsp, SMB_BIG_UINT len)
+int vfs_allocate_file_space(files_struct *fsp, uint64_t len)
{
int ret;
SMB_STRUCT_STAT st;
connection_struct *conn = fsp->conn;
- SMB_BIG_UINT space_avail;
- SMB_BIG_UINT bsize,dfree,dsize;
+ uint64_t space_avail;
+ uint64_t bsize,dfree,dsize;
release_level_2_oplocks_on_change(fsp);
@@ -527,10 +527,10 @@ int vfs_allocate_file_space(files_struct *fsp, SMB_BIG_UINT len)
if (ret == -1)
return ret;
- if (len == (SMB_BIG_UINT)st.st_size)
+ if (len == (uint64_t)st.st_size)
return 0;
- if (len < (SMB_BIG_UINT)st.st_size) {
+ if (len < (uint64_t)st.st_size) {
/* Shrink - use ftruncate. */
DEBUG(10,("vfs_allocate_file_space: file %s, shrink. Current size %.0f\n",
@@ -551,7 +551,7 @@ int vfs_allocate_file_space(files_struct *fsp, SMB_BIG_UINT len)
len -= st.st_size;
len /= 1024; /* Len is now number of 1k blocks needed. */
space_avail = get_dfree_info(conn,fsp->fsp_name,False,&bsize,&dfree,&dsize);
- if (space_avail == (SMB_BIG_UINT)-1) {
+ if (space_avail == (uint64_t)-1) {
return -1;
}
diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c
index 28400887ef..d984dd661c 100644
--- a/source3/torture/cmd_vfs.c
+++ b/source3/torture/cmd_vfs.c
@@ -105,7 +105,7 @@ static NTSTATUS cmd_disconnect(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int a
static NTSTATUS cmd_disk_free(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
- SMB_BIG_UINT diskfree, bsize, dfree, dsize;
+ uint64_t diskfree, bsize, dfree, dsize;
if (argc != 2) {
printf("Usage: disk_free <path>\n");
return NT_STATUS_OK;
@@ -272,7 +272,7 @@ static NTSTATUS cmd_open(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
flagstr++;
}
if ((flags & O_CREAT) && argc == 4) {
- if (sscanf(argv[3], "%o", &mode) == 0) {
+ if (sscanf(argv[3], "%ho", (unsigned short *)&mode) == 0) {
printf("open: error=-1 (invalid mode!)\n");
return NT_STATUS_UNSUCCESSFUL;
}
@@ -989,7 +989,7 @@ static NTSTATUS cmd_mknod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
return NT_STATUS_OK;
}
- if (sscanf(argv[2], "%o", &mode) == 0) {
+ if (sscanf(argv[2], "%ho", (unsigned short *)&mode) == 0) {
printf("open: error=-1 (invalid mode!)\n");
return NT_STATUS_UNSUCCESSFUL;
}
diff --git a/source3/torture/locktest.c b/source3/torture/locktest.c
index 2ba5ab8f06..b58cb3deec 100644
--- a/source3/torture/locktest.c
+++ b/source3/torture/locktest.c
@@ -71,7 +71,7 @@ struct record {
enum lock_op lock_op;
enum brl_type lock_type;
char conn, f;
- SMB_BIG_UINT start, len;
+ uint64_t start, len;
char needed;
};
@@ -303,8 +303,8 @@ static bool test_one(struct cli_state *cli[NSERVERS][NCONNECTIONS],
{
unsigned conn = rec->conn;
unsigned f = rec->f;
- SMB_BIG_UINT start = rec->start;
- SMB_BIG_UINT len = rec->len;
+ uint64_t start = rec->start;
+ uint64_t len = rec->len;
enum brl_type op = rec->lock_type;
int server;
bool ret[NSERVERS];
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index d8942e42b9..904fb5c262 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -294,15 +294,6 @@ static bool torture_open_connection_share(struct cli_state **c,
return True;
}
-void torture_open_connection_free_unclist(char **unc_list)
-{
- if (unc_list!=NULL)
- {
- SAFE_FREE(unc_list[0]);
- SAFE_FREE(unc_list);
- }
-}
-
bool torture_open_connection(struct cli_state **c, int conn_index)
{
char **unc_list = NULL;
@@ -311,7 +302,7 @@ bool torture_open_connection(struct cli_state **c, int conn_index)
if (use_multishare_conn==True) {
char *h, *s;
- unc_list = file_lines_load(multishare_conn_fname, &num_unc_names, 0);
+ unc_list = file_lines_load(multishare_conn_fname, &num_unc_names, 0, NULL);
if (!unc_list || num_unc_names <= 0) {
printf("Failed to load unc names list from '%s'\n", multishare_conn_fname);
exit(1);
@@ -321,14 +312,14 @@ bool torture_open_connection(struct cli_state **c, int conn_index)
NULL, &h, &s)) {
printf("Failed to parse UNC name %s\n",
unc_list[conn_index % num_unc_names]);
- torture_open_connection_free_unclist(unc_list);
+ TALLOC_FREE(unc_list);
exit(1);
}
result = torture_open_connection_share(c, h, s);
/* h, s were copied earlier */
- torture_open_connection_free_unclist(unc_list);
+ TALLOC_FREE(unc_list);
return result;
}
@@ -5075,7 +5066,7 @@ static bool run_local_gencache(int dummy)
return False;
}
- blob = data_blob_string_const("bar");
+ blob = data_blob_string_const_null("bar");
tm = time(NULL);
if (!gencache_set_data_blob("foo", &blob, tm)) {
@@ -5649,7 +5640,7 @@ static void usage(void)
*p = 0;
fstrcpy(share, p+1);
- fstrcpy(myname, get_myname(talloc_tos()));
+ fstrcpy(myname, talloc_get_myname(talloc_tos()));
if (!*myname) {
fprintf(stderr, "Failed to get my hostname.\n");
return 1;
diff --git a/source3/torture/vfstest.c b/source3/torture/vfstest.c
index 56e27eec1d..bb4dc35d2b 100644
--- a/source3/torture/vfstest.c
+++ b/source3/torture/vfstest.c
@@ -433,7 +433,7 @@ bool reload_services(bool test)
if (lp_loaded()) {
const char *fname = lp_configfile();
- if (file_exist(fname, NULL) &&
+ if (file_exist(fname) &&
!strcsequal(fname, get_dyn_CONFIGFILE())) {
set_dyn_CONFIGFILE(fname);
test = False;
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index 7dbe518c3d..4b1aa54731 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "utils/net.h"
+#include "librpc/gen_ndr/ndr_krb5pac.h"
#ifdef HAVE_ADS
@@ -43,7 +44,7 @@ static const char *assume_own_realm(struct net_context *c)
static int net_ads_cldap_netlogon(struct net_context *c, ADS_STRUCT *ads)
{
char addr[INET6_ADDRSTRLEN];
- struct nbt_cldap_netlogon_5 reply;
+ struct NETLOGON_SAM_LOGON_RESPONSE_EX reply;
print_sockaddr(addr, sizeof(addr), &ads->ldap.ss);
if ( !ads_cldap_netlogon_5(talloc_tos(), addr, ads->server.realm, &reply ) ) {
@@ -55,19 +56,19 @@ static int net_ads_cldap_netlogon(struct net_context *c, ADS_STRUCT *ads)
addr);
d_printf("Response Type: ");
- switch (reply.type) {
- case SAMLOGON_AD_UNK_R:
- d_printf("SAMLOGON\n");
+ switch (reply.command) {
+ case LOGON_SAM_LOGON_USER_UNKNOWN_EX:
+ d_printf("LOGON_SAM_LOGON_USER_UNKNOWN_EX\n");
break;
- case SAMLOGON_AD_R:
- d_printf("SAMLOGON_USER\n");
+ case LOGON_SAM_LOGON_RESPONSE_EX:
+ d_printf("LOGON_SAM_LOGON_RESPONSE_EX\n");
break;
default:
- d_printf("0x%x\n", reply.type);
+ d_printf("0x%x\n", reply.command);
break;
}
- d_printf("GUID: %s\n", smb_uuid_string(talloc_tos(), reply.domain_uuid));
+ d_printf("GUID: %s\n", GUID_string(talloc_tos(), &reply.domain_uuid));
d_printf("Flags:\n"
"\tIs a PDC: %s\n"
@@ -182,7 +183,8 @@ static int net_ads_info(struct net_context *c, int argc, const char **argv)
d_printf("Realm: %s\n", ads->config.realm);
d_printf("Bind Path: %s\n", ads->config.bind_path);
d_printf("LDAP port: %d\n", ads->ldap.port);
- d_printf("Server time: %s\n", http_timestring(ads->config.current_time));
+ d_printf("Server time: %s\n",
+ http_timestring(talloc_tos(), ads->config.current_time));
d_printf("KDC server: %s\n", ads->auth.kdc_server );
d_printf("Server time offset: %d\n", ads->auth.time_offset );
@@ -359,7 +361,7 @@ static int net_ads_workgroup(struct net_context *c, int argc, const char **argv)
{
ADS_STRUCT *ads;
char addr[INET6_ADDRSTRLEN];
- struct nbt_cldap_netlogon_5 reply;
+ struct NETLOGON_SAM_LOGON_RESPONSE_EX reply;
if (c->display_usage) {
d_printf("Usage:\n"
@@ -479,7 +481,7 @@ static int ads_user_add(struct net_context *c, int argc, const char **argv)
asprintf(&upn, "%s@%s", argv[0], ads->config.realm);
status = ads_krb5_set_password(ads->auth.kdc_server, upn, argv[1],
ads->auth.time_offset);
- safe_free(upn);
+ SAFE_FREE(upn);
if (ADS_ERR_OK(status)) {
d_printf("User %s added\n", argv[0]);
rc = 0;
@@ -533,7 +535,7 @@ static int ads_user_info(struct net_context *c, int argc, const char **argv)
asprintf(&searchstring, "(sAMAccountName=%s)", escaped_user);
rc = ads_search(ads, &res, searchstring, attrs);
- safe_free(searchstring);
+ SAFE_FREE(searchstring);
if (!ADS_ERR_OK(rc)) {
d_fprintf(stderr, "ads_search: %s\n", ads_errstr(rc));
diff --git a/source3/utils/net_dns.c b/source3/utils/net_dns.c
index 14d45e2b0f..4e617a1968 100644
--- a/source3/utils/net_dns.c
+++ b/source3/utils/net_dns.c
@@ -145,14 +145,14 @@ error:
int get_my_ip_address( struct sockaddr_storage **pp_ss )
{
- struct iface_struct nics[MAX_INTERFACES];
int i, n;
struct sockaddr_storage *list = NULL;
int count = 0;
- /* find the first non-loopback address from our list of interfaces */
+ /* Honor the configured list of interfaces to register */
- n = get_interfaces(nics, MAX_INTERFACES);
+ load_interfaces();
+ n = iface_count();
if (n <= 0) {
return -1;
@@ -163,19 +163,17 @@ int get_my_ip_address( struct sockaddr_storage **pp_ss )
}
for ( i=0; i<n; i++ ) {
- if (is_loopback_addr(&nics[i].ip)) {
+ const struct sockaddr_storage *nic_sa_storage = NULL;
+
+ if ((nic_sa_storage = iface_n_sockaddr_storage(i)) == NULL)
+ continue;
+
+ /* Don't register loopback addresses */
+ if (is_loopback_addr(nic_sa_storage)) {
continue;
}
-#if defined(HAVE_IPV6)
- if ((nics[i].ip.ss_family == AF_INET6)) {
- 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));
- }
+
+ memcpy(&list[count++], nic_sa_storage, sizeof(struct sockaddr_storage));
}
*pp_ss = list;
diff --git a/source3/utils/net_proto.h b/source3/utils/net_proto.h
index 1e355e54a3..ee4388f157 100644
--- a/source3/utils/net_proto.h
+++ b/source3/utils/net_proto.h
@@ -471,6 +471,8 @@ int net_run_function(struct net_context *c, int argc, const char **argv,
const char *whoami, struct functable *table);
void net_display_usage_from_functable(struct functable *table);
+const char *net_share_type_str(int num_type);
+
/* The following definitions come from utils/netlookup.c */
NTSTATUS net_lookup_name_from_sid(struct net_context *c,
diff --git a/source3/utils/net_rap.c b/source3/utils/net_rap.c
index 883524dc2d..32f4dd31b4 100644
--- a/source3/utils/net_rap.c
+++ b/source3/utils/net_rap.c
@@ -34,13 +34,6 @@
#define ERRMSG_BOTH_SERVER_IPADDRESS "\nTarget server and IP address both "\
"specified. Do not set both at the same time. The target IP address was used\n"
-const char *share_type[] = {
- "Disk",
- "Print",
- "Dev",
- "IPC"
-};
-
static int errmsg_not_implemented(void)
{
d_printf("\nNot implemented\n");
@@ -201,7 +194,7 @@ static void long_share_fn(const char *share_name, uint32 type,
const char *comment, void *state)
{
d_printf("%-12s %-8.8s %-50s\n",
- share_name, share_type[type], comment);
+ share_name, net_share_type_str(type), comment);
}
static void share_fn(const char *share_name, uint32 type,
@@ -388,7 +381,7 @@ static void display_conns_func(uint16 conn_id, uint16 conn_type, uint16 opens,
const char *username, const char *netname)
{
d_printf("%-14.14s %-8.8s %5d\n",
- netname, share_type[conn_type], opens);
+ netname, net_share_type_str(conn_type), opens);
}
static int rap_session_info(struct net_context *c, int argc, const char **argv)
diff --git a/source3/utils/net_registry_util.c b/source3/utils/net_registry_util.c
index 278377867a..cd291b5c74 100644
--- a/source3/utils/net_registry_util.c
+++ b/source3/utils/net_registry_util.c
@@ -27,7 +27,7 @@ void print_registry_key(const char *keyname, NTTIME *modtime)
d_printf("Keyname = %s\n", keyname);
d_printf("Modtime = %s\n",
modtime
- ? http_timestring(nt_time_to_unix(*modtime))
+ ? http_timestring(talloc_tos(), nt_time_to_unix(*modtime))
: "None");
d_printf("\n");
}
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index a849ec4c10..5f5a21dfbb 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -26,8 +26,6 @@
static int net_mode_share;
static bool sync_files(struct copy_clistate *cp_clistate, const char *mask);
-extern const char *share_type[];
-
/**
* @file net_rpc.c
*
@@ -506,13 +504,13 @@ NTSTATUS rpc_info_internals(struct net_context *c,
2,
&info);
if (NT_STATUS_IS_OK(result)) {
- d_printf("Domain Name: %s\n", info->info2.domain_name.string);
+ d_printf("Domain Name: %s\n", info->general.domain_name.string);
d_printf("Domain SID: %s\n", sid_str);
d_printf("Sequence number: %llu\n",
- (unsigned long long)info->info2.sequence_num);
- d_printf("Num users: %u\n", info->info2.num_users);
- d_printf("Num domain groups: %u\n", info->info2.num_groups);
- d_printf("Num local groups: %u\n", info->info2.num_aliases);
+ (unsigned long long)info->general.sequence_num);
+ d_printf("Num users: %u\n", info->general.num_users);
+ d_printf("Num domain groups: %u\n", info->general.num_groups);
+ d_printf("Num local groups: %u\n", info->general.num_aliases);
}
done:
@@ -2876,7 +2874,7 @@ static void display_share_info_1(struct net_context *c,
if (c->opt_long_list_entries) {
d_printf("%-12s %-8.8s %-50s\n",
r->shi1_netname,
- share_type[r->shi1_type & ~(STYPE_TEMPORARY|STYPE_HIDDEN)],
+ net_share_type_str(r->shi1_type & ~(STYPE_TEMPORARY|STYPE_HIDDEN)),
r->shi1_remark);
} else {
d_printf("%s\n", r->shi1_netname);
@@ -5014,8 +5012,7 @@ NTSTATUS rpc_init_shutdown_internals(struct net_context *c,
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
const char *msg = "This machine will be shutdown shortly";
uint32 timeout = 20;
- struct initshutdown_String msg_string;
- struct initshutdown_String_sub s;
+ struct lsa_StringLarge msg_string;
if (c->opt_comment) {
msg = c->opt_comment;
@@ -5024,8 +5021,7 @@ NTSTATUS rpc_init_shutdown_internals(struct net_context *c,
timeout = c->opt_timeout;
}
- s.name = msg;
- msg_string.name = &s;
+ msg_string.string = msg;
/* create an entry */
result = rpccli_initshutdown_Init(pipe_hnd, mem_ctx, NULL,
@@ -5069,16 +5065,14 @@ NTSTATUS rpc_reg_shutdown_internals(struct net_context *c,
{
const char *msg = "This machine will be shutdown shortly";
uint32 timeout = 20;
- struct initshutdown_String msg_string;
- struct initshutdown_String_sub s;
+ struct lsa_StringLarge msg_string;
NTSTATUS result;
WERROR werr;
if (c->opt_comment) {
msg = c->opt_comment;
}
- s.name = msg;
- msg_string.name = &s;
+ msg_string.string = msg;
if (c->opt_timeout) {
timeout = c->opt_timeout;
diff --git a/source3/utils/net_rpc_join.c b/source3/utils/net_rpc_join.c
index 5bc38f979f..2fe464a000 100644
--- a/source3/utils/net_rpc_join.c
+++ b/source3/utils/net_rpc_join.c
@@ -330,12 +330,8 @@ int net_rpc_join_newstyle(struct net_context *c, int argc, const char **argv)
/* Create a random machine account password */
- {
- char *str;
- str = generate_random_str(DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
- clear_trust_password = SMB_STRDUP(str);
- E_md4hash(clear_trust_password, md4_trust_password);
- }
+ clear_trust_password = generate_random_str(talloc_tos(), DEFAULT_TRUST_ACCOUNT_PASSWORD_LENGTH);
+ E_md4hash(clear_trust_password, md4_trust_password);
/* Set password on machine account */
@@ -468,7 +464,7 @@ done:
cli_shutdown(cli);
- SAFE_FREE(clear_trust_password);
+ TALLOC_FREE(clear_trust_password);
return retval;
}
diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c
index f4b305d4ab..ddd18a7b9f 100644
--- a/source3/utils/net_rpc_printer.c
+++ b/source3/utils/net_rpc_printer.c
@@ -2482,7 +2482,7 @@ NTSTATUS rpc_printer_migrate_settings_internals(struct net_context *c,
TALLOC_FREE( reg_ctr );
}
- safe_free(keylist);
+ SAFE_FREE(keylist);
/* close printer handles here */
if (got_hnd_src) {
diff --git a/source3/utils/net_rpc_registry.c b/source3/utils/net_rpc_registry.c
index 124af00b57..4a39043768 100644
--- a/source3/utils/net_rpc_registry.c
+++ b/source3/utils/net_rpc_registry.c
@@ -272,7 +272,7 @@ static NTSTATUS registry_enumvalues(TALLOC_CTX *ctx,
uint32 value_length;
char n;
- struct winreg_ValNameBuf name_buf;
+ struct winreg_StringBuf name_buf;
WERROR err;
n = '\0';
@@ -1186,7 +1186,7 @@ static NTSTATUS rpc_registry_getsd_internal(struct net_context *c,
blob.data = sd->data;
blob.length = sd->size;
- ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, &sec_desc,
+ ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, NULL, &sec_desc,
(ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
status = ndr_map_error2ntstatus(ndr_err);
diff --git a/source3/utils/net_rpc_service.c b/source3/utils/net_rpc_service.c
index d1349a903d..133173116c 100644
--- a/source3/utils/net_rpc_service.c
+++ b/source3/utils/net_rpc_service.c
@@ -264,8 +264,9 @@ static NTSTATUS rpc_service_status_internal(struct net_context *c,
WERROR result = WERR_GENERAL_FAILURE;
NTSTATUS status;
SERVICE_STATUS service_status;
- SERVICE_CONFIG config;
- fstring ascii_string;
+ struct QUERY_SERVICE_CONFIG config;
+ uint32_t buf_size = sizeof(config);
+ uint32_t ret_size = 0;
if (argc != 1 ) {
d_printf("Usage: net rpc service status <service>\n");
@@ -314,8 +315,23 @@ static NTSTATUS rpc_service_status_internal(struct net_context *c,
/* get the config */
- result = rpccli_svcctl_query_config(pipe_hnd, mem_ctx, &hService, &config );
- if ( !W_ERROR_IS_OK(result) ) {
+ status = rpccli_svcctl_QueryServiceConfigW(pipe_hnd, mem_ctx,
+ &hService,
+ &config,
+ buf_size,
+ &ret_size,
+ &result);
+ if (W_ERROR_EQUAL(result, WERR_INSUFFICIENT_BUFFER)) {
+ buf_size = ret_size;
+ status = rpccli_svcctl_QueryServiceConfigW(pipe_hnd, mem_ctx,
+ &hService,
+ &config,
+ buf_size,
+ &ret_size,
+ &result);
+ }
+
+ if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(result) ) {
d_fprintf(stderr, "Query config request failed. [%s]\n", dos_errstr(result));
goto done;
}
@@ -329,29 +345,24 @@ static NTSTATUS rpc_service_status_internal(struct net_context *c,
d_printf("\tError Control = 0x%x\n", config.error_control);
d_printf("\tTag ID = 0x%x\n", config.tag_id);
- if ( config.executablepath ) {
- rpcstr_pull( ascii_string, config.executablepath->buffer, sizeof(ascii_string), -1, STR_TERMINATE );
- d_printf("\tExecutable Path = %s\n", ascii_string);
+ if (config.executablepath) {
+ d_printf("\tExecutable Path = %s\n", config.executablepath);
}
- if ( config.loadordergroup ) {
- rpcstr_pull( ascii_string, config.loadordergroup->buffer, sizeof(ascii_string), -1, STR_TERMINATE );
- d_printf("\tLoad Order Group = %s\n", ascii_string);
+ if (config.loadordergroup) {
+ d_printf("\tLoad Order Group = %s\n", config.loadordergroup);
}
- if ( config.dependencies ) {
- rpcstr_pull( ascii_string, config.dependencies->buffer, sizeof(ascii_string), -1, STR_TERMINATE );
- d_printf("\tDependencies = %s\n", ascii_string);
+ if (config.dependencies) {
+ d_printf("\tDependencies = %s\n", config.dependencies);
}
- if ( config.startname ) {
- rpcstr_pull( ascii_string, config.startname->buffer, sizeof(ascii_string), -1, STR_TERMINATE );
- d_printf("\tStart Name = %s\n", ascii_string);
+ if (config.startname) {
+ d_printf("\tStart Name = %s\n", config.startname);
}
- if ( config.displayname ) {
- rpcstr_pull( ascii_string, config.displayname->buffer, sizeof(ascii_string), -1, STR_TERMINATE );
- d_printf("\tDisplay Name = %s\n", ascii_string);
+ if (config.displayname) {
+ d_printf("\tDisplay Name = %s\n", config.displayname);
}
done:
diff --git a/source3/utils/net_usershare.c b/source3/utils/net_usershare.c
index 8f263c636c..ce8e82182e 100644
--- a/source3/utils/net_usershare.c
+++ b/source3/utils/net_usershare.c
@@ -371,7 +371,7 @@ static int info_fn(struct file_list *fl, void *priv)
return -1;
}
- lines = fd_lines_load(fd, &numlines, 10240);
+ lines = fd_lines_load(fd, &numlines, 10240, NULL);
close(fd);
if (lines == NULL) {
@@ -385,7 +385,7 @@ static int info_fn(struct file_list *fl, void *priv)
&psd,
&guest_ok);
- file_lines_free(lines);
+ TALLOC_FREE(lines);
if (us_err != USERSHARE_OK) {
d_fprintf(stderr, "info_fn: file %s is not a well formed usershare file.\n",
diff --git a/source3/utils/net_util.c b/source3/utils/net_util.c
index 88850d29df..fbb3c24b03 100644
--- a/source3/utils/net_util.c
+++ b/source3/utils/net_util.c
@@ -2,6 +2,7 @@
* Unix SMB/CIFS implementation.
* Helper routines for net
* Copyright (C) Volker Lendecke 2006
+ * Copyright (C) Kai Blin 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
@@ -595,3 +596,14 @@ void net_display_usage_from_functable(struct functable *table)
d_printf("%s\n", table[i].usage);
}
}
+
+const char *net_share_type_str(int num_type)
+{
+ switch(num_type) {
+ case 0: return "Disk";
+ case 1: return "Print";
+ case 2: return "Dev";
+ case 3: return "IPC";
+ default: return "Unknown";
+ }
+}
diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c
index c04b628b1b..45da3f1e88 100644
--- a/source3/utils/nmblookup.c
+++ b/source3/utils/nmblookup.c
@@ -219,7 +219,7 @@ static bool query_one(const char *lookup, unsigned int lookup_type)
}
}
- safe_free(ip_list);
+ free(ip_list);
return (ip_list != NULL);
}
diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c
index 4586086d73..0a76761cb2 100644
--- a/source3/utils/ntlm_auth.c
+++ b/source3/utils/ntlm_auth.c
@@ -1813,7 +1813,7 @@ static void manage_ntlm_server_1_request(struct ntlm_auth_state *state,
if (ntlm_server_1_lm_session_key
&& (memcmp(zeros, lm_key,
sizeof(lm_key)) != 0)) {
- hex_lm_key = hex_encode(NULL,
+ hex_lm_key = hex_encode_talloc(NULL,
(const unsigned char *)lm_key,
sizeof(lm_key));
x_fprintf(x_stdout, "LANMAN-Session-Key: %s\n", hex_lm_key);
@@ -1823,7 +1823,7 @@ static void manage_ntlm_server_1_request(struct ntlm_auth_state *state,
if (ntlm_server_1_user_session_key
&& (memcmp(zeros, user_session_key,
sizeof(user_session_key)) != 0)) {
- hex_user_session_key = hex_encode(NULL,
+ hex_user_session_key = hex_encode_talloc(NULL,
(const unsigned char *)user_session_key,
sizeof(user_session_key));
x_fprintf(x_stdout, "User-Session-Key: %s\n", hex_user_session_key);
@@ -2262,7 +2262,7 @@ static bool check_auth_crap(void)
if (request_lm_key
&& (memcmp(zeros, lm_key,
sizeof(lm_key)) != 0)) {
- hex_lm_key = hex_encode(NULL, (const unsigned char *)lm_key,
+ hex_lm_key = hex_encode_talloc(NULL, (const unsigned char *)lm_key,
sizeof(lm_key));
x_fprintf(x_stdout, "LM_KEY: %s\n", hex_lm_key);
TALLOC_FREE(hex_lm_key);
@@ -2270,7 +2270,7 @@ static bool check_auth_crap(void)
if (request_user_session_key
&& (memcmp(zeros, user_session_key,
sizeof(user_session_key)) != 0)) {
- hex_user_session_key = hex_encode(NULL, (const unsigned char *)user_session_key,
+ hex_user_session_key = hex_encode_talloc(NULL, (const unsigned char *)user_session_key,
sizeof(user_session_key));
x_fprintf(x_stdout, "NT_KEY: %s\n", hex_user_session_key);
TALLOC_FREE(hex_user_session_key);
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index e1d6709073..6a7189e636 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -235,7 +235,7 @@ static int print_sam_info (struct samu *sam_pwent, bool verbosity, bool smbpwdst
uid_t uid;
time_t tmp;
- /* TODO: chaeck if entry is a user or a workstation */
+ /* TODO: check if entry is a user or a workstation */
if (!sam_pwent) return -1;
if (verbosity) {
@@ -260,25 +260,32 @@ static int print_sam_info (struct samu *sam_pwent, bool verbosity, bool smbpwdst
printf ("Munged dial: %s\n", pdb_get_munged_dial(sam_pwent));
tmp = pdb_get_logon_time(sam_pwent);
- printf ("Logon time: %s\n", tmp ? http_timestring(tmp) : "0");
+ printf ("Logon time: %s\n",
+ tmp ? http_timestring(talloc_tos(), tmp) : "0");
tmp = pdb_get_logoff_time(sam_pwent);
- printf ("Logoff time: %s\n", tmp ? http_timestring(tmp) : "0");
+ printf ("Logoff time: %s\n",
+ tmp ? http_timestring(talloc_tos(), tmp) : "0");
tmp = pdb_get_kickoff_time(sam_pwent);
- printf ("Kickoff time: %s\n", tmp ? http_timestring(tmp) : "0");
+ printf ("Kickoff time: %s\n",
+ tmp ? http_timestring(talloc_tos(), tmp) : "0");
tmp = pdb_get_pass_last_set_time(sam_pwent);
- printf ("Password last set: %s\n", tmp ? http_timestring(tmp) : "0");
+ printf ("Password last set: %s\n",
+ tmp ? http_timestring(talloc_tos(), tmp) : "0");
tmp = pdb_get_pass_can_change_time(sam_pwent);
- printf ("Password can change: %s\n", tmp ? http_timestring(tmp) : "0");
+ printf ("Password can change: %s\n",
+ tmp ? http_timestring(talloc_tos(), tmp) : "0");
tmp = pdb_get_pass_must_change_time(sam_pwent);
- printf ("Password must change: %s\n", tmp ? http_timestring(tmp) : "0");
+ printf ("Password must change: %s\n",
+ tmp ? http_timestring(talloc_tos(), tmp) : "0");
tmp = pdb_get_bad_password_time(sam_pwent);
- printf ("Last bad password : %s\n", tmp ? http_timestring(tmp) : "0");
+ printf ("Last bad password : %s\n",
+ tmp ? http_timestring(talloc_tos(), tmp) : "0");
printf ("Bad password count : %d\n",
pdb_get_bad_password_count(sam_pwent));
diff --git a/source3/utils/sharesec.c b/source3/utils/sharesec.c
index 9409690c8b..3ad949a6d3 100644
--- a/source3/utils/sharesec.c
+++ b/source3/utils/sharesec.c
@@ -153,7 +153,7 @@ static bool parse_ace(SEC_ACE *ace, const char *orig_str)
unsigned int aflags = 0;
unsigned int amask = 0;
DOM_SID sid;
- SEC_ACCESS mask;
+ uint32_t mask;
const struct perm_value *v;
char *str = SMB_STRDUP(orig_str);
TALLOC_CTX *frame = talloc_stackframe();
@@ -401,7 +401,7 @@ static void sort_acl(SEC_ACL *the_acl)
static int change_share_sec(TALLOC_CTX *mem_ctx, const char *sharename, char *the_acl, enum acl_mode mode)
{
- SEC_DESC *sd;
+ SEC_DESC *sd = NULL;
SEC_DESC *old = NULL;
size_t sd_size = 0;
uint32 i, j;
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index d488ce2187..10b55014c2 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -23,13 +23,13 @@
#include "includes.h"
-static int test_args = False;
+static int test_args;
#define CREATE_ACCESS_READ READ_CONTROL_ACCESS
/* numeric is set when the user wants numeric SIDs and ACEs rather
than going via LSA calls to resolve them */
-static int numeric = False;
+static int numeric;
enum acl_mode {SMB_ACL_SET, SMB_ACL_DELETE, SMB_ACL_MODIFY, SMB_ACL_ADD };
enum chown_mode {REQUEST_NONE, REQUEST_CHOWN, REQUEST_CHGRP};
@@ -179,9 +179,12 @@ static void SidToString(struct cli_state *cli, fstring str, const DOM_SID *sid)
return;
}
- slprintf(str, sizeof(fstring) - 1, "%s%s%s",
- domain, lp_winbind_separator(), name);
-
+ if (*domain) {
+ slprintf(str, sizeof(fstring) - 1, "%s%s%s",
+ domain, lp_winbind_separator(), name);
+ } else {
+ fstrcpy(str, name);
+ }
}
/* convert a string to a SID, either numeric or username/group */
@@ -196,6 +199,65 @@ static bool StringToSid(struct cli_state *cli, DOM_SID *sid, const char *str)
return NT_STATUS_IS_OK(cli_lsa_lookup_name(cli, str, &type, sid));
}
+static void print_ace_flags(FILE *f, uint8_t flags)
+{
+ char *str = talloc_strdup(NULL, "");
+
+ if (!str) {
+ goto out;
+ }
+
+ if (flags & SEC_ACE_FLAG_OBJECT_INHERIT) {
+ str = talloc_asprintf(str, "%s%s",
+ str, "OI|");
+ if (!str) {
+ goto out;
+ }
+ }
+ if (flags & SEC_ACE_FLAG_CONTAINER_INHERIT) {
+ str = talloc_asprintf(str, "%s%s",
+ str, "CI|");
+ if (!str) {
+ goto out;
+ }
+ }
+ if (flags & SEC_ACE_FLAG_NO_PROPAGATE_INHERIT) {
+ str = talloc_asprintf(str, "%s%s",
+ str, "NP|");
+ if (!str) {
+ goto out;
+ }
+ }
+ if (flags & SEC_ACE_FLAG_INHERIT_ONLY) {
+ str = talloc_asprintf(str, "%s%s",
+ str, "IO|");
+ if (!str) {
+ goto out;
+ }
+ }
+ if (flags & SEC_ACE_FLAG_INHERITED_ACE) {
+ str = talloc_asprintf(str, "%s%s",
+ str, "I|");
+ if (!str) {
+ goto out;
+ }
+ }
+ /* Ignore define SEC_ACE_FLAG_SUCCESSFUL_ACCESS ( 0x40 )
+ and SEC_ACE_FLAG_FAILED_ACCESS ( 0x80 ) as they're
+ audit ace flags. */
+
+ if (str[strlen(str)-1] == '|') {
+ str[strlen(str)-1] = '\0';
+ fprintf(f, "/%s/", str);
+ } else {
+ fprintf(f, "/0x%x/", flags);
+ }
+ TALLOC_FREE(str);
+ return;
+
+ out:
+ fprintf(f, "/0x%x/", flags);
+}
/* print an ACE on a FILE, using either numeric or ascii representation */
static void print_ace(struct cli_state *cli, FILE *f, SEC_ACE *ace)
@@ -210,7 +272,7 @@ static void print_ace(struct cli_state *cli, FILE *f, SEC_ACE *ace)
fprintf(f, "%s:", sidstr);
if (numeric) {
- fprintf(f, "%d/%d/0x%08x",
+ fprintf(f, "%d/0x%x/0x%08x",
ace->type, ace->flags, ace->access_mask);
return;
}
@@ -225,9 +287,7 @@ static void print_ace(struct cli_state *cli, FILE *f, SEC_ACE *ace)
fprintf(f, "%d", ace->type);
}
- /* Not sure what flags can be set in a file ACL */
-
- fprintf(f, "/%d/", ace->flags);
+ print_ace_flags(f, ace->flags);
/* Standard permissions */
@@ -263,6 +323,37 @@ static void print_ace(struct cli_state *cli, FILE *f, SEC_ACE *ace)
}
}
+static bool parse_ace_flags(const char *str, unsigned int *pflags)
+{
+ const char *p = str;
+ *pflags = 0;
+
+ while (*p) {
+ if (strnequal(p, "OI", 2)) {
+ *pflags |= SEC_ACE_FLAG_OBJECT_INHERIT;
+ p += 2;
+ } else if (strnequal(p, "CI", 2)) {
+ *pflags |= SEC_ACE_FLAG_CONTAINER_INHERIT;
+ p += 2;
+ } else if (strnequal(p, "NP", 2)) {
+ *pflags |= SEC_ACE_FLAG_NO_PROPAGATE_INHERIT;
+ p += 2;
+ } else if (strnequal(p, "IO", 2)) {
+ *pflags |= SEC_ACE_FLAG_INHERIT_ONLY;
+ p += 2;
+ } else if (*p == 'I') {
+ *pflags |= SEC_ACE_FLAG_INHERITED_ACE;
+ p += 1;
+ } else if (*p) {
+ return false;
+ }
+
+ if (*p != '|' && *p != '\0') {
+ return false;
+ }
+ }
+ return true;
+}
/* parse an ACE in the same format as print_ace() */
static bool parse_ace(struct cli_state *cli, SEC_ACE *ace,
@@ -275,7 +366,7 @@ static bool parse_ace(struct cli_state *cli, SEC_ACE *ace,
unsigned int aflags = 0;
unsigned int amask = 0;
DOM_SID sid;
- SEC_ACCESS mask;
+ uint32_t mask;
const struct perm_value *v;
char *str = SMB_STRDUP(orig_str);
TALLOC_CTX *frame = talloc_stackframe();
@@ -335,15 +426,40 @@ static bool parse_ace(struct cli_state *cli, SEC_ACE *ace,
/* Only numeric form accepted for flags at present */
- if (!(next_token_talloc(frame, &cp, &tok, "/") &&
- sscanf(tok, "%i", &aflags))) {
- printf("ACE '%s': bad integer flags entry at '%s'\n",
+ if (!next_token_talloc(frame, &cp, &tok, "/")) {
+ printf("ACE '%s': bad flags entry at '%s'\n",
orig_str, tok);
SAFE_FREE(str);
TALLOC_FREE(frame);
return False;
}
+ if (tok[0] < '0' || tok[0] > '9') {
+ if (!parse_ace_flags(tok, &aflags)) {
+ printf("ACE '%s': bad named flags entry at '%s'\n",
+ orig_str, tok);
+ SAFE_FREE(str);
+ TALLOC_FREE(frame);
+ return False;
+ }
+ } else if (strnequal(tok, "0x", 2)) {
+ if (!sscanf(tok, "%x", &aflags)) {
+ printf("ACE '%s': bad hex flags entry at '%s'\n",
+ orig_str, tok);
+ SAFE_FREE(str);
+ TALLOC_FREE(frame);
+ return False;
+ }
+ } else {
+ if (!sscanf(tok, "%i", &aflags)) {
+ printf("ACE '%s': bad integer flags entry at '%s'\n",
+ orig_str, tok);
+ SAFE_FREE(str);
+ TALLOC_FREE(frame);
+ return False;
+ }
+ }
+
if (!next_token_talloc(frame, &cp, &tok, "/")) {
printf("ACE '%s': missing / at '%s'\n",
orig_str, tok);
@@ -506,6 +622,7 @@ static void sec_desc_print(struct cli_state *cli, FILE *f, SEC_DESC *sd)
uint32 i;
fprintf(f, "REVISION:%d\n", sd->revision);
+ fprintf(f, "CONTROL:0x%x\n", sd->type);
/* Print owner and group sid */
@@ -626,29 +743,42 @@ static int owner_set(struct cli_state *cli, enum chown_mode change_mode,
}
-/* The MSDN is contradictory over the ordering of ACE entries in an ACL.
- However NT4 gives a "The information may have been modified by a
- computer running Windows NT 5.0" if denied ACEs do not appear before
- allowed ACEs. */
+/* The MSDN is contradictory over the ordering of ACE entries in an
+ ACL. However NT4 gives a "The information may have been modified
+ by a computer running Windows NT 5.0" if denied ACEs do not appear
+ before allowed ACEs. At
+ http://technet.microsoft.com/en-us/library/cc781716.aspx the
+ canonical order is specified as "Explicit Deny, Explicit Allow,
+ Inherited ACEs unchanged" */
static int ace_compare(SEC_ACE *ace1, SEC_ACE *ace2)
{
- if (sec_ace_equal(ace1, ace2))
+ if (sec_ace_equal(ace1, ace2))
return 0;
- if (ace1->type != ace2->type)
+ if ((ace1->flags & SEC_ACE_FLAG_INHERITED_ACE) &&
+ !(ace2->flags & SEC_ACE_FLAG_INHERITED_ACE))
+ return 1;
+ if (!(ace1->flags & SEC_ACE_FLAG_INHERITED_ACE) &&
+ (ace2->flags & SEC_ACE_FLAG_INHERITED_ACE))
+ return -1;
+ if ((ace1->flags & SEC_ACE_FLAG_INHERITED_ACE) &&
+ (ace2->flags & SEC_ACE_FLAG_INHERITED_ACE))
+ return ace1 - ace2;
+
+ if (ace1->type != ace2->type)
return ace2->type - ace1->type;
- if (sid_compare(&ace1->trustee, &ace2->trustee))
+ if (sid_compare(&ace1->trustee, &ace2->trustee))
return sid_compare(&ace1->trustee, &ace2->trustee);
- if (ace1->flags != ace2->flags)
+ if (ace1->flags != ace2->flags)
return ace1->flags - ace2->flags;
- if (ace1->access_mask != ace2->access_mask)
+ if (ace1->access_mask != ace2->access_mask)
return ace1->access_mask - ace2->access_mask;
- if (ace1->size != ace2->size)
+ if (ace1->size != ace2->size)
return ace1->size - ace2->size;
return memcmp(ace1, ace2, sizeof(SEC_ACE));
@@ -677,6 +807,7 @@ static void sort_acl(SEC_ACL *the_acl)
/*****************************************************
set the ACLs on a file given an ascii description
*******************************************************/
+
static int cacl_set(struct cli_state *cli, char *filename,
char *the_acl, enum acl_mode mode)
{
@@ -730,7 +861,7 @@ static int cacl_set(struct cli_state *cli, char *filename,
}
if (!found) {
- printf("ACL for ACE:");
+ printf("ACL for ACE:");
print_ace(cli, stdout, &sd->dacl->aces[i]);
printf(" not found\n");
}
@@ -762,7 +893,7 @@ static int cacl_set(struct cli_state *cli, char *filename,
old->owner_sid = sd->owner_sid;
}
- if (sd->group_sid) {
+ if (sd->group_sid) {
old->group_sid = sd->group_sid;
}
@@ -895,8 +1026,8 @@ static struct cli_state *connect_one(const char *server, const char *share)
{ "set", 'S', POPT_ARG_STRING, NULL, 'S', "Set acls", "ACLS" },
{ "chown", 'C', POPT_ARG_STRING, NULL, 'C', "Change ownership of a file", "USERNAME" },
{ "chgrp", 'G', POPT_ARG_STRING, NULL, 'G', "Change group ownership of a file", "GROUPNAME" },
- { "numeric", 0, POPT_ARG_NONE, &numeric, True, "Don't resolve sids or masks to names" },
- { "test-args", 't', POPT_ARG_NONE, &test_args, True, "Test arguments"},
+ { "numeric", 0, POPT_ARG_NONE, &numeric, 1, "Don't resolve sids or masks to names" },
+ { "test-args", 't', POPT_ARG_NONE, &test_args, 1, "Test arguments"},
POPT_COMMON_SAMBA
POPT_COMMON_CONNECTION
POPT_COMMON_CREDENTIALS
diff --git a/source3/utils/smbcquotas.c b/source3/utils/smbcquotas.c
index 11f8776a0e..b769c2bce0 100644
--- a/source3/utils/smbcquotas.c
+++ b/source3/utils/smbcquotas.c
@@ -180,11 +180,7 @@ static int parse_quota_set(TALLOC_CTX *ctx,
switch (todo) {
case PARSE_LIM:
-#if defined(HAVE_LONGLONG)
- if (sscanf(p,"%llu/%llu",&pqt->softlim,&pqt->hardlim)!=2) {
-#else
- if (sscanf(p,"%lu/%lu",&pqt->softlim,&pqt->hardlim)!=2) {
-#endif
+ if (sscanf(p,"%"PRIu64"/%"PRIu64,&pqt->softlim,&pqt->hardlim)!=2) {
return -1;
}
diff --git a/source3/utils/status_profile.c b/source3/utils/status_profile.c
index 48814fedea..a51537d3da 100644
--- a/source3/utils/status_profile.c
+++ b/source3/utils/status_profile.c
@@ -423,12 +423,12 @@ bool status_profile_dump(bool verbose)
static int print_count_samples(
const struct profile_stats * const current,
const struct profile_stats * const last,
- SMB_BIG_UINT delta_usec)
+ uint64_t delta_usec)
{
int i;
int count = 0;
unsigned step;
- SMB_BIG_UINT spent;
+ uint64_t spent;
int delta_sec;
const char * name;
char buf[40];
@@ -467,13 +467,13 @@ static int print_count_samples(
}
static struct profile_stats sample_data[2];
-static SMB_BIG_UINT sample_time[2];
+static uint64_t sample_time[2];
bool status_profile_rates(bool verbose)
{
- SMB_BIG_UINT remain_usec;
- SMB_BIG_UINT next_usec;
- SMB_BIG_UINT delta_usec;
+ uint64_t remain_usec;
+ uint64_t next_usec;
+ uint64_t delta_usec;
int last = 0;
int current = 1;
diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c
index 527db2d805..da129cf7c0 100644
--- a/source3/utils/testparm.c
+++ b/source3/utils/testparm.c
@@ -56,7 +56,7 @@ cannot be set in the smb.conf file. nmbd will abort with this setting.\n");
ret = 1;
}
- if (!directory_exist(lp_lockdir(), &st)) {
+ if (!directory_exist_stat(lp_lockdir(), &st)) {
fprintf(stderr, "ERROR: lock directory %s does not exist\n",
lp_lockdir());
ret = 1;
@@ -66,7 +66,7 @@ cannot be set in the smb.conf file. nmbd will abort with this setting.\n");
ret = 1;
}
- if (!directory_exist(lp_piddir(), &st)) {
+ if (!directory_exist_stat(lp_piddir(), &st)) {
fprintf(stderr, "ERROR: pid directory %s does not exist\n",
lp_piddir());
ret = 1;
@@ -329,9 +329,12 @@ rameter is ignored when using CUPS libraries.\n",
cname = poptGetArg(pc);
caddr = poptGetArg(pc);
+ poptFreeContext(pc);
+
if ( cname && ! caddr ) {
printf ( "ERROR: You must specify both a machine name and an IP address.\n" );
- return(1);
+ ret = 1;
+ goto done;
}
if (new_local_machine) {
@@ -346,7 +349,8 @@ rameter is ignored when using CUPS libraries.\n",
if (!lp_load_with_registry_shares(config_file,False,True,False,True)) {
fprintf(stderr,"Error loading services.\n");
- return(1);
+ ret = 1;
+ goto done;
}
fprintf(stderr,"Loaded services file OK.\n");
@@ -393,13 +397,15 @@ rameter is ignored when using CUPS libraries.\n",
(s=lp_servicenumber(section_name)) == -1) {
fprintf(stderr,"Unknown section %s\n",
section_name);
- return(1);
+ ret = 1;
+ goto done;
}
if (parameter_name) {
if (!dump_a_parameter( s, parameter_name, stdout, isGlobal)) {
fprintf(stderr,"Parameter %s unknown for section %s\n",
parameter_name, section_name);
- return(1);
+ ret = 1;
+ goto done;
}
} else {
if (isGlobal == True)
@@ -407,7 +413,7 @@ rameter is ignored when using CUPS libraries.\n",
else
lp_dump_one(stdout, show_defaults, s);
}
- return(ret);
+ goto done;
}
lp_dump(stdout, show_defaults, lp_numservices());
@@ -428,7 +434,10 @@ rameter is ignored when using CUPS libraries.\n",
}
}
}
+
+done:
+ gfree_loadparm();
TALLOC_FREE(frame);
- return(ret);
+ return ret;
}
diff --git a/source3/web/cgi.c b/source3/web/cgi.c
index 070e80cf91..ce36bd9310 100644
--- a/source3/web/cgi.c
+++ b/source3/web/cgi.c
@@ -451,7 +451,7 @@ static void cgi_download(char *file)
if (S_ISDIR(st.st_mode))
{
snprintf(buf, sizeof(buf), "%s/index.html", file);
- if (!file_exist(buf, &st) || !S_ISREG(st.st_mode))
+ if (!file_exist_stat(buf, &st) || !S_ISREG(st.st_mode))
{
cgi_setup_error("404 File Not Found","",
"The requested file was not found");
@@ -488,7 +488,8 @@ static void cgi_download(char *file)
printf("Content-Type: text/html\r\n");
}
}
- printf("Expires: %s\r\n", http_timestring(time(NULL)+EXPIRY_TIME));
+ printf("Expires: %s\r\n",
+ http_timestring(talloc_tos(), time(NULL)+EXPIRY_TIME));
lang = lang_tdb_current();
if (lang) {
@@ -604,7 +605,7 @@ void cgi_setup(const char *rootdir, int auth_required)
}
printf("HTTP/1.0 200 OK\r\nConnection: close\r\n");
- printf("Date: %s\r\n", http_timestring(time(NULL)));
+ printf("Date: %s\r\n", http_timestring(talloc_tos(), time(NULL)));
baseurl = "";
pathinfo = url+1;
}
diff --git a/source3/web/statuspage.c b/source3/web/statuspage.c
index ce24c7cddd..e684a075c2 100644
--- a/source3/web/statuspage.c
+++ b/source3/web/statuspage.c
@@ -43,9 +43,10 @@ static void initPid2Machine (void)
{
/* show machine name rather PID on table "Open Files"? */
if (PID_or_Machine) {
- PIDMAP *p;
+ PIDMAP *p, *next;
- for (p = pidmap; p != NULL; ) {
+ for (p = pidmap; p != NULL; p = next) {
+ next = p->next;
DLIST_REMOVE(pidmap, p);
SAFE_FREE(p->machine);
SAFE_FREE(p);
diff --git a/source3/web/swat.c b/source3/web/swat.c
index 1502c5bc2f..27c4b54e2f 100644
--- a/source3/web/swat.c
+++ b/source3/web/swat.c
@@ -384,7 +384,8 @@ static void show_parameters(int snum, int allparameters, unsigned int parm_filte
break;
case P_LIST:
- if (!str_list_compare(*(char ***)ptr, (char **)(parm->def.lvalue))) continue;
+ if (!str_list_equal(*(const char ***)ptr,
+ (const char **)(parm->def.lvalue))) continue;
break;
case P_STRING:
@@ -595,7 +596,7 @@ static void ViewModeBoxes(int mode)
****************************************************************************/
static void welcome_page(void)
{
- if (file_exist("help/welcome.html", NULL)) {
+ if (file_exist("help/welcome.html")) {
include_html("help/welcome.html");
} else {
include_html("help/welcome-no-samba-doc.html");
@@ -1439,7 +1440,7 @@ const char *lang_msg_rotate(TALLOC_CTX *ctx, const char *msgid)
cgi_load_variables();
- if (!file_exist(get_dyn_CONFIGFILE(), NULL)) {
+ if (!file_exist(get_dyn_CONFIGFILE())) {
have_read_access = True;
have_write_access = True;
} else {
diff --git a/source3/winbindd/idmap_ad.c b/source3/winbindd/idmap_ad.c
index 9fefb1bba7..60a2d8642a 100644
--- a/source3/winbindd/idmap_ad.c
+++ b/source3/winbindd/idmap_ad.c
@@ -517,6 +517,8 @@ again:
bidx = idx;
for (i = 0; (i < IDMAP_AD_MAX_IDS) && ids[idx]; i++, idx++) {
+ ids[idx]->status = ID_UNKNOWN;
+
sidstr = sid_binstring(ids[idx]->sid);
filter = talloc_asprintf_append_buffer(filter, "(objectSid=%s)", sidstr);
@@ -732,6 +734,16 @@ static NTSTATUS nss_ad_get_info( struct nss_domain_entry *e,
uint32 *gid )
{
ADS_STRUCT *ads_internal = NULL;
+ const char *attrs[] = {NULL, /* attr_homedir */
+ NULL, /* attr_shell */
+ NULL, /* attr_gecos */
+ NULL, /* attr_gidnumber */
+ NULL };
+ char *filter = NULL;
+ LDAPMessage *msg_internal = NULL;
+ ADS_STATUS ads_status = ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL);
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ char *sidstr = NULL;
/* Only do query if we are online */
if (idmap_is_offline()) {
@@ -743,24 +755,224 @@ static NTSTATUS nss_ad_get_info( struct nss_domain_entry *e,
ads_internal = ad_idmap_cached_connection();
- if ( !ads_internal || !ad_schema )
+ if ( !ads_internal || !ad_schema ) {
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
-
- if ( !homedir || !shell || !gecos )
+ }
+
+ if (!sid || !homedir || !shell || !gecos) {
return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ /* See if we can use the ADS connection struct swe were given */
- *homedir = ads_pull_string( ads, ctx, msg, ad_schema->posix_homedir_attr );
- *shell = ads_pull_string( ads, ctx, msg, ad_schema->posix_shell_attr );
- *gecos = ads_pull_string( ads, ctx, msg, ad_schema->posix_gecos_attr );
-
- if ( gid ) {
- if ( !ads_pull_uint32(ads, msg, ad_schema->posix_gidnumber_attr, gid ) )
- *gid = (uint32)-1;
+ if (ads) {
+ *homedir = ads_pull_string( ads, ctx, msg, ad_schema->posix_homedir_attr );
+ *shell = ads_pull_string( ads, ctx, msg, ad_schema->posix_shell_attr );
+ *gecos = ads_pull_string( ads, ctx, msg, ad_schema->posix_gecos_attr );
+
+ if (gid) {
+ if ( !ads_pull_uint32(ads, msg, ad_schema->posix_gidnumber_attr, gid ) )
+ *gid = (uint32)-1;
+ }
+
+ nt_status = NT_STATUS_OK;
+ goto done;
}
-
- return NT_STATUS_OK;
+
+ /* Have to do our own query */
+
+ attrs[0] = ad_schema->posix_homedir_attr;
+ attrs[1] = ad_schema->posix_shell_attr;
+ attrs[2] = ad_schema->posix_gecos_attr;
+ attrs[3] = ad_schema->posix_gidnumber_attr;
+
+ sidstr = sid_binstring(sid);
+ filter = talloc_asprintf(ctx, "(objectSid=%s)", sidstr);
+ SAFE_FREE(sidstr);
+
+ if (!filter) {
+ nt_status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
+
+ ads_status = ads_search_retry(ads_internal, &msg_internal, filter, attrs);
+ if (!ADS_ERR_OK(ads_status)) {
+ nt_status = ads_ntstatus(ads_status);
+ goto done;
+ }
+
+ *homedir = ads_pull_string(ads_internal, ctx, msg_internal, ad_schema->posix_homedir_attr);
+ *shell = ads_pull_string(ads_internal, ctx, msg_internal, ad_schema->posix_shell_attr);
+ *gecos = ads_pull_string(ads_internal, ctx, msg_internal, ad_schema->posix_gecos_attr);
+
+ if (gid) {
+ if (!ads_pull_uint32(ads_internal, msg_internal, ad_schema->posix_gidnumber_attr, gid))
+ *gid = (uint32)-1;
+ }
+
+ nt_status = NT_STATUS_OK;
+
+done:
+ if (msg_internal) {
+ ads_msgfree(ads_internal, msg_internal);
+ }
+
+ return nt_status;
}
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS nss_ad_map_to_alias(TALLOC_CTX *mem_ctx,
+ const char *domain,
+ const char *name,
+ char **alias)
+{
+ ADS_STRUCT *ads_internal = NULL;
+ const char *attrs[] = {NULL, /* attr_uid */
+ NULL };
+ char *filter = NULL;
+ LDAPMessage *msg = NULL;
+ ADS_STATUS ads_status = ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL);
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+
+ /* Check incoming parameters */
+
+ if ( !domain || !name || !*alias) {
+ nt_status = NT_STATUS_INVALID_PARAMETER;
+ goto done;
+ }
+
+ /* Only do query if we are online */
+
+ if (idmap_is_offline()) {
+ nt_status = NT_STATUS_FILE_IS_OFFLINE;
+ goto done;
+ }
+
+ ads_internal = ad_idmap_cached_connection();
+
+ if (!ads_internal || !ad_schema) {
+ nt_status = NT_STATUS_OBJECT_PATH_NOT_FOUND;
+ goto done;
+ }
+
+ attrs[0] = ad_schema->posix_uid_attr;
+
+ filter = talloc_asprintf(mem_ctx,
+ "(sAMAccountName=%s)",
+ name);
+ if (!filter) {
+ nt_status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
+
+ ads_status = ads_search_retry(ads_internal, &msg, filter, attrs);
+ if (!ADS_ERR_OK(ads_status)) {
+ nt_status = ads_ntstatus(ads_status);
+ goto done;
+ }
+
+ *alias = ads_pull_string(ads_internal, mem_ctx, msg, ad_schema->posix_uid_attr );
+
+ if (!*alias) {
+ return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ }
+
+ nt_status = NT_STATUS_OK;
+
+done:
+ if (filter) {
+ talloc_destroy(filter);
+ }
+ if (msg) {
+ ads_msgfree(ads_internal, msg);
+ }
+
+ return nt_status;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS nss_ad_map_from_alias( TALLOC_CTX *mem_ctx,
+ const char *domain,
+ const char *alias,
+ char **name )
+{
+ ADS_STRUCT *ads_internal = NULL;
+ const char *attrs[] = {"sAMAccountName",
+ NULL };
+ char *filter = NULL;
+ LDAPMessage *msg = NULL;
+ ADS_STATUS ads_status = ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL);
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ char *username;
+
+ /* Check incoming parameters */
+
+ if ( !alias || !name) {
+ nt_status = NT_STATUS_INVALID_PARAMETER;
+ goto done;
+ }
+
+ /* Only do query if we are online */
+
+ if (idmap_is_offline()) {
+ nt_status = NT_STATUS_FILE_IS_OFFLINE;
+ goto done;
+ }
+
+ ads_internal = ad_idmap_cached_connection();
+
+ if (!ads_internal || !ad_schema) {
+ nt_status = NT_STATUS_OBJECT_PATH_NOT_FOUND;
+ goto done;
+ }
+
+ filter = talloc_asprintf(mem_ctx,
+ "(%s=%s)",
+ ad_schema->posix_uid_attr,
+ alias);
+ if (!filter) {
+ nt_status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
+
+ ads_status = ads_search_retry(ads_internal, &msg, filter, attrs);
+ if (!ADS_ERR_OK(ads_status)) {
+ nt_status = ads_ntstatus(ads_status);
+ goto done;
+ }
+
+ username = ads_pull_string(ads_internal, mem_ctx, msg,
+ "sAMAccountName");
+ if (!username) {
+ return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ }
+
+ *name = talloc_asprintf(mem_ctx, "%s\\%s",
+ lp_workgroup(),
+ username);
+ if (!*name) {
+ nt_status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
+
+ nt_status = NT_STATUS_OK;
+
+done:
+ if (filter) {
+ talloc_destroy(filter);
+ }
+ if (msg) {
+ ads_msgfree(ads_internal, msg);
+ }
+
+ return nt_status;
+}
+
+
/************************************************************************
***********************************************************************/
@@ -786,21 +998,27 @@ static struct idmap_methods ad_methods = {
function which sets the intended schema model to use */
static struct nss_info_methods nss_rfc2307_methods = {
- .init = nss_rfc2307_init,
- .get_nss_info = nss_ad_get_info,
- .close_fn = nss_ad_close
+ .init = nss_rfc2307_init,
+ .get_nss_info = nss_ad_get_info,
+ .map_to_alias = nss_ad_map_to_alias,
+ .map_from_alias = nss_ad_map_from_alias,
+ .close_fn = nss_ad_close
};
static struct nss_info_methods nss_sfu_methods = {
- .init = nss_sfu_init,
- .get_nss_info = nss_ad_get_info,
- .close_fn = nss_ad_close
+ .init = nss_sfu_init,
+ .get_nss_info = nss_ad_get_info,
+ .map_to_alias = nss_ad_map_to_alias,
+ .map_from_alias = nss_ad_map_from_alias,
+ .close_fn = nss_ad_close
};
static struct nss_info_methods nss_sfu20_methods = {
- .init = nss_sfu20_init,
- .get_nss_info = nss_ad_get_info,
- .close_fn = nss_ad_close
+ .init = nss_sfu20_init,
+ .get_nss_info = nss_ad_get_info,
+ .map_to_alias = nss_ad_map_to_alias,
+ .map_from_alias = nss_ad_map_from_alias,
+ .close_fn = nss_ad_close
};
diff --git a/source3/winbindd/idmap_adex/cell_util.c b/source3/winbindd/idmap_adex/cell_util.c
new file mode 100644
index 0000000000..f5c08a0454
--- /dev/null
+++ b/source3/winbindd/idmap_adex/cell_util.c
@@ -0,0 +1,292 @@
+/*
+ * idmap_adex: Support for AD Forests
+ *
+ * Copyright (C) Gerald (Jerry) Carter 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 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 "idmap_adex.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_IDMAP
+
+/**********************************************************************
+**********************************************************************/
+
+ char *find_attr_string(char **list, size_t num_lines, const char *substr)
+{
+ int i;
+ int cmplen = strlen(substr);
+
+ for (i = 0; i < num_lines; i++) {
+ /* make sure to avoid substring matches like uid
+ and uidNumber */
+ if ((StrnCaseCmp(list[i], substr, cmplen) == 0) &&
+ (list[i][cmplen] == '=')) {
+ /* Don't return an empty string */
+ if (list[i][cmplen + 1] != '\0')
+ return &(list[i][cmplen + 1]);
+
+ return NULL;
+ }
+ }
+
+ return NULL;
+}
+
+/**********************************************************************
+**********************************************************************/
+
+ bool is_object_class(char **list, size_t num_lines, const char *substr)
+{
+ int i;
+
+ for (i = 0; i < num_lines; i++) {
+ if (strequal(list[i], substr)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/**********************************************************************
+ Find out about the cell (e.g. use2307Attrs, etc...)
+**********************************************************************/
+
+ NTSTATUS cell_lookup_settings(struct likewise_cell * cell)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+
+ /* Parameter check */
+
+ if (!cell) {
+ nt_status = NT_STATUS_INVALID_PARAMETER;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ /* Only supporting Forest-wide, schema based searches */
+
+ cell_set_flags(cell, LWCELL_FLAG_USE_RFC2307_ATTRS);
+ cell_set_flags(cell, LWCELL_FLAG_SEARCH_FOREST);
+
+ cell->provider = &ccp_unified;
+
+ nt_status = NT_STATUS_OK;
+
+done:
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ DEBUG(1,("LWI: Failed to obtain cell settings (%s)\n",
+ nt_errstr(nt_status)));
+ }
+
+ return nt_status;
+}
+
+
+static NTSTATUS cell_lookup_forest(struct likewise_cell *c)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ struct gc_info *gc = NULL;
+
+ if (!c) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ if ((gc = TALLOC_ZERO_P(NULL, struct gc_info)) == NULL) {
+ nt_status = NT_STATUS_NO_MEMORY;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ /* Query the rootDSE for the forest root naming conect first.
+ Check that the a GC server for the forest has not already
+ been added */
+
+ nt_status = gc_find_forest_root(gc, cell_dns_domain(c));
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ c->forest_name = talloc_strdup(c, gc->forest_name);
+ BAIL_ON_PTR_ERROR(c->forest_name, nt_status);
+
+done:
+ if (gc) {
+ talloc_free(gc);
+ }
+
+ return nt_status;
+}
+
+/**********************************************************************
+**********************************************************************/
+
+ NTSTATUS cell_locate_membership(ADS_STRUCT * ads)
+{
+ ADS_STATUS status;
+ char *domain_dn = ads_build_dn(lp_realm());
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ DOM_SID sid;
+ struct likewise_cell *cell = NULL;
+
+ /* In the Likewise plugin, I had to support the concept of cells
+ based on the machine's membership in an OU. However, now I'll
+ just assume our membership in the forest cell */
+
+ DEBUG(2, ("locate_cell_membership: Located membership "
+ "in cell \"%s\"\n", domain_dn));
+
+ if ((cell = cell_new()) == NULL) {
+ nt_status = NT_STATUS_NO_MEMORY;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ status = ads_domain_sid(ads, &sid);
+ if (!ADS_ERR_OK(status)) {
+ DEBUG(3,("locate_cell_membership: Failed to find "
+ "domain SID for %s\n", domain_dn));
+ }
+
+ /* save the SID and search base for our domain */
+
+ cell_set_dns_domain(cell, lp_realm());
+ cell_set_connection(cell, ads);
+ cell_set_dn(cell, domain_dn);
+ cell_set_domain_sid(cell, &sid);
+
+ /* Now save our forest root */
+
+ cell_lookup_forest(cell);
+
+ /* Add the cell to the list */
+
+ if (!cell_list_add(cell)) {
+ nt_status = NT_STATUS_INSUFFICIENT_RESOURCES;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ /* Done! */
+ nt_status = NT_STATUS_OK;
+
+done:
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ DEBUG(0,("LWI: Failed to locate cell membership (%s)\n",
+ nt_errstr(nt_status)));
+ }
+
+ SAFE_FREE(domain_dn);
+
+ return nt_status;
+}
+
+/*********************************************************************
+ ********************************************************************/
+
+ int min_id_value(void)
+{
+ int id_val;
+
+ id_val = lp_parm_int(-1, "lwidentity", "min_id_value", MIN_ID_VALUE);
+
+ /* Still don't let it go below 50 */
+
+ return MAX(50, id_val);
+}
+
+/********************************************************************
+ *******************************************************************/
+
+ char *cell_dn_to_dns(const char *dn)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ char *domain = NULL;
+ char *dns_name = NULL;
+ const char *tmp_dn;
+ char *buffer = NULL;
+ TALLOC_CTX *frame = talloc_stackframe();
+
+ if (!dn || !*dn) {
+ goto done;
+ }
+
+ tmp_dn = talloc_strdup(frame, dn);
+ BAIL_ON_PTR_ERROR(tmp_dn, nt_status);
+
+ while (next_token_talloc(frame, &tmp_dn, &buffer, ",")) {
+
+ /* skip everything up the where DC=... begins */
+ if (StrnCaseCmp(buffer, "DC=", 3) != 0)
+ continue;
+
+ if (!domain) {
+ domain = talloc_strdup(frame, &buffer[3]);
+ } else {
+ domain = talloc_asprintf_append(domain, ".%s",
+ &buffer[3]);
+ }
+ BAIL_ON_PTR_ERROR(domain, nt_status);
+ }
+
+ dns_name = SMB_STRDUP(domain);
+ BAIL_ON_PTR_ERROR(dns_name, nt_status);
+
+ nt_status = NT_STATUS_OK;
+
+done:
+ PRINT_NTSTATUS_ERROR(nt_status, "cell_dn_to_dns", 1);
+
+ talloc_destroy(frame);
+
+ return dns_name;
+}
+
+/*********************************************************************
+ ********************************************************************/
+
+ NTSTATUS get_sid_type(ADS_STRUCT *ads,
+ LDAPMessage *msg,
+ enum lsa_SidType *type)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ uint32_t atype;
+
+ if (!ads_pull_uint32(ads, msg, "sAMAccountType", &atype)) {
+ nt_status = NT_STATUS_INVALID_USER_BUFFER;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ switch (atype &0xF0000000) {
+ case ATYPE_SECURITY_GLOBAL_GROUP:
+ *type = SID_NAME_DOM_GRP;
+ break;
+ case ATYPE_SECURITY_LOCAL_GROUP:
+ *type = SID_NAME_ALIAS;
+ break;
+ case ATYPE_NORMAL_ACCOUNT:
+ case ATYPE_WORKSTATION_TRUST:
+ case ATYPE_INTERDOMAIN_TRUST:
+ *type = SID_NAME_USER;
+ break;
+ default:
+ *type = SID_NAME_USE_NONE;
+ nt_status = NT_STATUS_INVALID_ACCOUNT_NAME;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ nt_status = NT_STATUS_OK;
+
+done:
+ return nt_status;
+}
diff --git a/source3/winbindd/idmap_adex/domain_util.c b/source3/winbindd/idmap_adex/domain_util.c
new file mode 100644
index 0000000000..6851503cc8
--- /dev/null
+++ b/source3/winbindd/idmap_adex/domain_util.c
@@ -0,0 +1,286 @@
+/*
+ * idmap_adex: Domain search interface
+ *
+ * Copyright (C) Gerald (Jerry) Carter 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 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 "idmap_adex.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_IDMAP
+
+struct dc_info {
+ struct dc_info *prev, *next;
+ char *dns_name;
+ struct likewise_cell *domain_cell;
+};
+
+static struct dc_info *_dc_server_list = NULL;
+
+
+/**********************************************************************
+ *********************************************************************/
+
+static struct dc_info *dc_list_head(void)
+{
+ return _dc_server_list;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS dc_add_domain(const char *domain)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ struct dc_info *dc = NULL;
+
+ if (!domain) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ DEBUG(10,("dc_add_domain: Attempting to add domain %s\n", domain));
+
+ /* Check for duplicates */
+
+ dc = dc_list_head();
+ while (dc) {
+ if (strequal (dc->dns_name, domain))
+ break;
+ dc = dc->next;
+ }
+
+ if (dc) {
+ DEBUG(10,("dc_add_domain: %s already in list\n", domain));
+ return NT_STATUS_OK;
+ }
+
+ dc = TALLOC_ZERO_P(NULL, struct dc_info);
+ BAIL_ON_PTR_ERROR(dc, nt_status);
+
+ dc->dns_name = talloc_strdup(dc, domain);
+ BAIL_ON_PTR_ERROR(dc->dns_name, nt_status);
+
+ DLIST_ADD_END(_dc_server_list, dc, struct dc_info*);
+
+ nt_status = NT_STATUS_OK;
+
+ DEBUG(5,("dc_add_domain: Successfully added %s\n", domain));
+
+done:
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ talloc_destroy(dc);
+ DEBUG(0,("LWI: Failed to add new DC connection for %s (%s)\n",
+ domain, nt_errstr(nt_status)));
+ }
+
+ return nt_status;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static void dc_server_list_destroy(void)
+{
+ struct dc_info *dc = dc_list_head();
+
+ while (dc) {
+ struct dc_info *p = dc->next;
+
+ cell_destroy(dc->domain_cell);
+ talloc_destroy(dc);
+
+ dc = p;
+ }
+
+ return;
+}
+
+
+/**********************************************************************
+ *********************************************************************/
+
+ NTSTATUS domain_init_list(void)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ struct winbindd_tdc_domain *domains = NULL;
+ size_t num_domains = 0;
+ int i;
+
+ if (_dc_server_list != NULL) {
+ dc_server_list_destroy();
+ }
+
+ /* Add our domain */
+
+ nt_status = dc_add_domain(lp_realm());
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ if (!wcache_tdc_fetch_list(&domains, &num_domains)) {
+ nt_status = NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ /* Add all domains with an incoming trust path */
+
+ for (i=0; i<num_domains; i++) {
+ uint32_t flags = (NETR_TRUST_FLAG_INBOUND|NETR_TRUST_FLAG_IN_FOREST);
+
+ /* We just require one of the flags to be set here */
+
+ if (domains[i].trust_flags & flags) {
+ nt_status = dc_add_domain(domains[i].dns_name);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+ }
+
+ nt_status = NT_STATUS_OK;
+
+done:
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ DEBUG(2,("LWI: Failed to initialize DC list (%s)\n",
+ nt_errstr(nt_status)));
+ }
+
+ TALLOC_FREE(domains);
+
+ return nt_status;
+}
+
+/********************************************************************
+ *******************************************************************/
+
+static NTSTATUS dc_do_search(struct dc_info *dc,
+ const char *search_base,
+ int scope,
+ const char *expr,
+ const char **attrs,
+ LDAPMessage ** msg)
+{
+ ADS_STATUS status = ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL);
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+
+ status = cell_do_search(dc->domain_cell, search_base,
+ scope, expr, attrs, msg);
+ nt_status = ads_ntstatus(status);
+
+ return nt_status;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static struct dc_info *dc_find_domain(const char *dns_domain)
+{
+ struct dc_info *dc = dc_list_head();
+
+ if (!dc)
+ return NULL;
+
+ while (dc) {
+ if (strequal(dc->dns_name, dns_domain)) {
+ return dc;
+ }
+
+ dc = dc->next;
+ }
+
+ return NULL;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+ NTSTATUS dc_search_domains(struct likewise_cell **cell,
+ LDAPMessage **msg,
+ const char *dn,
+ const DOM_SID *sid)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ TALLOC_CTX *frame = talloc_stackframe();
+ char *dns_domain;
+ const char *attrs[] = { "*", NULL };
+ struct dc_info *dc = NULL;
+ const char *base = NULL;
+
+ if (!dn || !*dn) {
+ nt_status = NT_STATUS_INVALID_PARAMETER;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ dns_domain = cell_dn_to_dns(dn);
+ BAIL_ON_PTR_ERROR(dns_domain, nt_status);
+
+ if ((dc = dc_find_domain(dns_domain)) == NULL) {
+ nt_status = NT_STATUS_TRUSTED_DOMAIN_FAILURE;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ /* Reparse the cell settings for the domain if necessary */
+
+ if (!dc->domain_cell) {
+ char *base_dn;
+
+ base_dn = ads_build_dn(dc->dns_name);
+ BAIL_ON_PTR_ERROR(base_dn, nt_status);
+
+ nt_status = cell_connect_dn(&dc->domain_cell, base_dn);
+ SAFE_FREE(base_dn);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ nt_status = cell_lookup_settings(dc->domain_cell);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ /* By definition this is already part of a larger
+ forest-wide search scope */
+
+ cell_set_flags(dc->domain_cell, LWCELL_FLAG_SEARCH_FOREST);
+ }
+
+ /* Check whether we are operating in non-schema or RFC2307
+ mode */
+
+ if (cell_flags(dc->domain_cell) & LWCELL_FLAG_USE_RFC2307_ATTRS) {
+ nt_status = dc_do_search(dc, dn, LDAP_SCOPE_BASE,
+ "(objectclass=*)", attrs, msg);
+ } else {
+ const char *sid_str = NULL;
+ char *filter = NULL;
+
+ sid_str = sid_string_talloc(frame, sid);
+ BAIL_ON_PTR_ERROR(sid_str, nt_status);
+
+ filter = talloc_asprintf(frame, "(keywords=backLink=%s)",
+ sid_str);
+ BAIL_ON_PTR_ERROR(filter, nt_status);
+
+ base = cell_search_base(dc->domain_cell);
+ BAIL_ON_PTR_ERROR(base, nt_status);
+
+ nt_status = dc_do_search(dc, base, LDAP_SCOPE_SUBTREE,
+ filter, attrs, msg);
+ }
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ *cell = dc->domain_cell;
+
+done:
+ talloc_destroy(CONST_DISCARD(char*, base));
+ talloc_destroy(frame);
+
+ return nt_status;
+}
diff --git a/source3/winbindd/idmap_adex/gc_util.c b/source3/winbindd/idmap_adex/gc_util.c
new file mode 100644
index 0000000000..6dc02336d5
--- /dev/null
+++ b/source3/winbindd/idmap_adex/gc_util.c
@@ -0,0 +1,848 @@
+/*
+ * idmap_adex: Global Catalog search interface
+ *
+ * Copyright (C) Gerald (Jerry) Carter 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 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 "idmap_adex.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_IDMAP
+
+static struct gc_info *_gc_server_list = NULL;
+
+
+/**********************************************************************
+ *********************************************************************/
+
+static struct gc_info *gc_list_head(void)
+{
+ return _gc_server_list;
+}
+
+/**********************************************************************
+ Checks if either of the domains is a subdomain of the other
+ *********************************************************************/
+
+static bool is_subdomain(const char* a, const char *b)
+{
+ char *s;
+ TALLOC_CTX *frame = talloc_stackframe();
+ char *x, *y;
+ bool ret = false;
+
+ /* Trivial cases */
+
+ if (!a && !b)
+ return true;
+
+ if (!a || !b)
+ return false;
+
+ /* Normalize the case */
+
+ x = talloc_strdup(frame, a);
+ y = talloc_strdup(frame, b);
+ if (!x || !y) {
+ ret = false;
+ goto done;
+ }
+
+ strupper_m(x);
+ strupper_m(y);
+
+ /* Exact match */
+
+ if (strcmp(x, y) == 0) {
+ ret = true;
+ goto done;
+ }
+
+ /* Check for trailing substrings */
+
+ s = strstr_m(x, y);
+ if (s && (strlen(s) == strlen(y))) {
+ ret = true;
+ goto done;
+ }
+
+ s = strstr_m(y, x);
+ if (s && (strlen(s) == strlen(x))) {
+ ret = true;
+ goto done;
+ }
+
+done:
+ talloc_destroy(frame);
+
+ return ret;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+ NTSTATUS gc_find_forest_root(struct gc_info *gc, const char *domain)
+{
+ ADS_STRUCT *ads = NULL;
+ ADS_STATUS ads_status;
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ struct NETLOGON_SAM_LOGON_RESPONSE_EX cldap_reply;
+ TALLOC_CTX *frame = talloc_stackframe();
+
+ if (!gc || !domain) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ ZERO_STRUCT(cldap_reply);
+
+ ads = ads_init(domain, NULL, NULL);
+ BAIL_ON_PTR_ERROR(ads, nt_status);
+
+ ads->auth.flags = ADS_AUTH_NO_BIND;
+ ads_status = ads_connect(ads);
+ if (!ADS_ERR_OK(ads_status)) {
+ DEBUG(4, ("find_forest_root: ads_connect(%s) failed! (%s)\n",
+ domain, ads_errstr(ads_status)));
+ }
+ nt_status = ads_ntstatus(ads_status);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ if (!ads_cldap_netlogon_5(frame,
+ ads->config.ldap_server_name,
+ ads->config.realm,
+ &cldap_reply))
+ {
+ DEBUG(4,("find_forest_root: Failed to get a CLDAP reply from %s!\n",
+ ads->server.ldap_server));
+ nt_status = NT_STATUS_IO_TIMEOUT;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ gc->forest_name = talloc_strdup(gc, cldap_reply.forest);
+ BAIL_ON_PTR_ERROR(gc->forest_name, nt_status);
+
+done:
+ if (ads) {
+ ads_destroy(&ads);
+ }
+
+ return nt_status;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS gc_add_forest(const char *domain)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ struct gc_info *gc = NULL;
+ struct gc_info *find_gc = NULL;
+ char *dn;
+ ADS_STRUCT *ads = NULL;
+ struct likewise_cell *primary_cell = NULL;
+
+ primary_cell = cell_list_head();
+ if (!primary_cell) {
+ nt_status = NT_STATUS_INVALID_SERVER_STATE;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ /* Check for duplicates based on domain name first as this
+ requires no connection */
+
+ find_gc = gc_list_head();
+ while (find_gc) {
+ if (strequal (find_gc->forest_name, domain))
+ break;
+ find_gc = find_gc->next;
+ }
+
+ if (find_gc) {
+ DEBUG(10,("gc_add_forest: %s already in list\n", find_gc->forest_name));
+ return NT_STATUS_OK;
+ }
+
+ if ((gc = TALLOC_ZERO_P(NULL, struct gc_info)) == NULL) {
+ nt_status = NT_STATUS_NO_MEMORY;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ /* Query the rootDSE for the forest root naming conect first.
+ Check that the a GC server for the forest has not already
+ been added */
+
+ nt_status = gc_find_forest_root(gc, domain);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ find_gc = gc_list_head();
+ while (find_gc) {
+ if (strequal (find_gc->forest_name, gc->forest_name))
+ break;
+ find_gc = find_gc->next;
+ }
+
+ if (find_gc) {
+ DEBUG(10,("gc_add_forest: Forest %s already in list\n",
+ find_gc->forest_name));
+ return NT_STATUS_OK;
+ }
+
+ /* Not found, so add it here. Make sure we connect to
+ a DC in _this_ domain and not the forest root. */
+
+ dn = ads_build_dn(gc->forest_name);
+ BAIL_ON_PTR_ERROR(dn, nt_status);
+
+ gc->search_base = talloc_strdup(gc, dn);
+ SAFE_FREE(dn);
+ BAIL_ON_PTR_ERROR(gc->search_base, nt_status);
+
+#if 0
+ /* Can't use cell_connect_dn() here as there is no way to
+ specifiy the LWCELL_FLAG_GC_CELL flag setting for cell_connect() */
+
+ nt_status = cell_connect_dn(&gc->forest_cell, gc->search_base);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+#else
+
+ gc->forest_cell = cell_new();
+ BAIL_ON_PTR_ERROR(gc->forest_cell, nt_status);
+
+ /* Set the DNS domain, dn, etc ... and add it to the list */
+
+ cell_set_dns_domain(gc->forest_cell, gc->forest_name);
+ cell_set_dn(gc->forest_cell, gc->search_base);
+ cell_set_flags(gc->forest_cell, LWCELL_FLAG_GC_CELL);
+#endif
+
+ /* It is possible to belong to a non-forest cell and a
+ non-provisioned forest (at our domain levele). In that
+ case, we should just inherit the flags from our primary
+ cell since the GC searches will match our own schema
+ model. */
+
+ if (strequal(primary_cell->forest_name, gc->forest_name)
+ || is_subdomain(primary_cell->dns_domain, gc->forest_name))
+ {
+ cell_set_flags(gc->forest_cell, cell_flags(primary_cell));
+ } else {
+ /* outside of our domain */
+
+ nt_status = cell_connect(gc->forest_cell);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ nt_status = cell_lookup_settings(gc->forest_cell);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ /* Drop the connection now that we have the settings */
+
+ ads = cell_connection(gc->forest_cell);
+ ads_destroy(&ads);
+ cell_set_connection(gc->forest_cell, NULL);
+ }
+
+ DLIST_ADD_END(_gc_server_list, gc, struct gc_info*);
+
+ DEBUG(10,("gc_add_forest: Added %s to Global Catalog list of servers\n",
+ gc->forest_name));
+
+ nt_status = NT_STATUS_OK;
+
+done:
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ talloc_destroy(gc);
+ DEBUG(3,("LWI: Failed to add new GC connection for %s (%s)\n",
+ domain, nt_errstr(nt_status)));
+ }
+
+ return nt_status;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static void gc_server_list_destroy(void)
+{
+ struct gc_info *gc = gc_list_head();
+
+ while (gc) {
+ struct gc_info *p = gc->next;
+
+ cell_destroy(gc->forest_cell);
+ talloc_destroy(gc);
+
+ gc = p;
+ }
+
+ _gc_server_list = NULL;
+
+ return;
+}
+
+/**********************************************************************
+ Setup the initial list of forests and initial the forest cell
+ settings for each. FIXME!!!
+ *********************************************************************/
+
+ NTSTATUS gc_init_list(void)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ struct winbindd_tdc_domain *domains = NULL;
+ size_t num_domains = 0;
+ int i;
+
+ if (_gc_server_list != NULL) {
+ gc_server_list_destroy();
+ }
+
+ if (!wcache_tdc_fetch_list(&domains, &num_domains)) {
+ nt_status = NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ /* Find our forest first. Have to try all domains here starting
+ with our own. gc_add_forest() filters duplicates */
+
+ nt_status = gc_add_forest(lp_realm());
+ WARN_ON_NTSTATUS_ERROR(nt_status);
+
+ for (i=0; i<num_domains; i++) {
+ uint32_t flags = (NETR_TRUST_FLAG_IN_FOREST);
+
+ /* I think we should be able to break out of loop once
+ we add a GC for our forest and not have to test every one.
+ In fact, this entire loop is probably irrelevant since
+ the GC location code should always find a GC given lp_realm().
+ Will have to spend time testing before making the change.
+ --jerry */
+
+ if ((domains[i].trust_flags & flags) == flags) {
+ nt_status = gc_add_forest(domains[i].dns_name);
+ WARN_ON_NTSTATUS_ERROR(nt_status);
+ /* Don't BAIL here since not every domain may
+ have a GC server */
+ }
+ }
+
+ /* Now add trusted forests. gc_add_forest() will filter out
+ duplicates. Check everything with an incoming trust path
+ that is not in our own forest. */
+
+ for (i=0; i<num_domains; i++) {
+ uint32_t flags = domains[i].trust_flags;
+ uint32_t attribs = domains[i].trust_attribs;
+
+ /* Skip non_AD domains */
+
+ if (strlen(domains[i].dns_name) == 0) {
+ continue;
+ }
+
+ /* Only add a GC for a forest outside of our own.
+ Ignore QUARANTINED/EXTERNAL trusts */
+
+ if ((flags & NETR_TRUST_FLAG_INBOUND)
+ && !(flags & NETR_TRUST_FLAG_IN_FOREST)
+ && (attribs & NETR_TRUST_ATTRIBUTE_FOREST_TRANSITIVE))
+ {
+ nt_status = gc_add_forest(domains[i].dns_name);
+ WARN_ON_NTSTATUS_ERROR(nt_status);
+ }
+ }
+
+ nt_status = NT_STATUS_OK;
+
+done:
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ DEBUG(2,("LWI: Failed to initialized GC list (%s)\n",
+ nt_errstr(nt_status)));
+ }
+
+ TALLOC_FREE(domains);
+
+ return nt_status;
+}
+
+
+/**********************************************************************
+ *********************************************************************/
+
+ struct gc_info *gc_search_start(void)
+{
+ NTSTATUS nt_status = NT_STATUS_OK;
+ struct gc_info *gc = gc_list_head();
+
+ if (!gc) {
+ nt_status = gc_init_list();
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ gc = gc_list_head();
+ }
+
+done:
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ DEBUG(2,("LWI: Failed to initialize GC list (%s)\n",
+ nt_errstr(nt_status)));
+ }
+
+ return gc;
+}
+
+/**********************************************************************
+ Search Global Catalog. Always search our own forest. The flags set
+ controls whether or not we search cross forest. Assume that the
+ resulting set is always returned from one GC so that we don't have to
+ both combining the LDAPMessage * results
+ *********************************************************************/
+
+ NTSTATUS gc_search_forest(struct gc_info *gc,
+ LDAPMessage **msg,
+ const char *filter)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ ADS_STATUS ads_status = ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL);
+ const char *attrs[] = {"*", NULL};
+ LDAPMessage *m = NULL;
+
+ if (!gc || !msg || !filter) {
+ nt_status = NT_STATUS_INVALID_PARAMETER;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ /* When you have multiple domain trees in a forest, the
+ GC will search all naming contexts when you send it
+ and empty ("") base search suffix. Tested against
+ Windows 2003. */
+
+ ads_status = cell_do_search(gc->forest_cell, "",
+ LDAP_SCOPE_SUBTREE, filter, attrs, &m);
+ nt_status = ads_ntstatus(ads_status);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ *msg = m;
+
+done:
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ DEBUG(2,("LWI: Forest wide search %s failed (%s)\n",
+ filter, nt_errstr(nt_status)));
+ }
+
+ return nt_status;
+}
+
+/**********************************************************************
+ Search all forests via GC and return the results in an array of
+ ADS_STRUCT/LDAPMessage pairs.
+ *********************************************************************/
+
+ NTSTATUS gc_search_all_forests(const char *filter,
+ ADS_STRUCT ***ads_list,
+ LDAPMessage ***msg_list,
+ int *num_resp, uint32_t flags)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ struct gc_info *gc = NULL;
+ uint32_t test_flags = ADEX_GC_SEARCH_CHECK_UNIQUE;
+
+ *ads_list = NULL;
+ *msg_list = NULL;
+ *num_resp = 0;
+
+ if ((gc = gc_search_start()) == NULL) {
+ nt_status = NT_STATUS_INVALID_DOMAIN_STATE;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ while (gc) {
+ LDAPMessage *m = NULL;
+
+ nt_status = gc_search_forest(gc, &m, filter);
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ gc = gc->next;
+ continue;
+ }
+
+ nt_status = add_ads_result_to_array(cell_connection(gc->forest_cell),
+ m, ads_list, msg_list,
+ num_resp);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ /* If there can only be one match, then we are done */
+
+ if ((*num_resp > 0) && ((flags & test_flags) == test_flags)) {
+ break;
+ }
+
+ gc = gc->next;
+ }
+
+ if (*num_resp == 0) {
+ nt_status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ nt_status = NT_STATUS_OK;
+
+done:
+ return nt_status;
+}
+
+/**********************************************************************
+ Search all forests via GC and return the results in an array of
+ ADS_STRUCT/LDAPMessage pairs.
+ *********************************************************************/
+
+ NTSTATUS gc_search_all_forests_unique(const char *filter,
+ ADS_STRUCT **ads,
+ LDAPMessage **msg)
+{
+ ADS_STRUCT **ads_list = NULL;
+ LDAPMessage **msg_list = NULL;
+ int num_resp;
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+
+ nt_status = gc_search_all_forests(filter, &ads_list,
+ &msg_list, &num_resp,
+ ADEX_GC_SEARCH_CHECK_UNIQUE);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ nt_status = check_result_unique(ads_list[0], msg_list[0]);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ *ads = ads_list[0];
+ *msg = msg_list[0];
+
+done:
+ /* Be care that we don't free the msg result being returned */
+
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ free_result_array(ads_list, msg_list, num_resp);
+ } else {
+ talloc_destroy(ads_list);
+ talloc_destroy(msg_list);
+ }
+
+ return nt_status;
+}
+
+/*********************************************************************
+ ********************************************************************/
+
+ NTSTATUS gc_name_to_sid(const char *domain,
+ const char *name,
+ DOM_SID *sid,
+ enum lsa_SidType *sid_type)
+{
+ TALLOC_CTX *frame = talloc_stackframe();
+ char *p, *name_user;
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ char *name_filter;
+ ADS_STRUCT *ads = NULL;
+ LDAPMessage *msg = NULL;
+ LDAPMessage *e = NULL;
+ char *dn = NULL;
+ char *dns_domain = NULL;
+ ADS_STRUCT **ads_list = NULL;
+ LDAPMessage **msg_list = NULL;
+ int num_resp = 0;
+ int i;
+
+ /* Strip the "DOMAIN\" prefix if necessary and search for
+ a matching sAMAccountName in the forest */
+
+ if ((p = strchr_m( name, '\\' )) == NULL)
+ name_user = talloc_strdup( frame, name );
+ else
+ name_user = talloc_strdup( frame, p+1 );
+ BAIL_ON_PTR_ERROR(name_user, nt_status);
+
+ name_filter = talloc_asprintf(frame, "(sAMAccountName=%s)", name_user);
+ BAIL_ON_PTR_ERROR(name_filter, nt_status);
+
+ nt_status = gc_search_all_forests(name_filter, &ads_list,
+ &msg_list, &num_resp, 0);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ /* Assume failure until we know otherwise*/
+
+ nt_status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+
+ /* Match the domain name from the DN */
+
+ for (i=0; i<num_resp; i++) {
+ ads = ads_list[i];
+ msg = msg_list[i];
+
+ e = ads_first_entry(ads, msg);
+ while (e) {
+ struct winbindd_tdc_domain *domain_rec;
+
+ dn = ads_get_dn(ads, e);
+ BAIL_ON_PTR_ERROR(dn, nt_status);
+
+ dns_domain = cell_dn_to_dns(dn);
+ SAFE_FREE(dn);
+ BAIL_ON_PTR_ERROR(dns_domain, nt_status);
+
+ domain_rec = wcache_tdc_fetch_domain(frame, dns_domain);
+ SAFE_FREE(dns_domain);
+
+ /* Ignore failures and continue the search */
+
+ if (!domain_rec) {
+ e = ads_next_entry(ads, e);
+ continue;
+ }
+
+ /* Check for a match on the domain name */
+
+ if (strequal(domain, domain_rec->domain_name)) {
+ if (!ads_pull_sid(ads, e, "objectSid", sid)) {
+ nt_status = NT_STATUS_INVALID_SID;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ talloc_destroy(domain_rec);
+
+ nt_status = get_sid_type(ads, msg, sid_type);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ /* We're done! */
+ nt_status = NT_STATUS_OK;
+ break;
+ }
+
+ /* once more around thew merry-go-round */
+
+ talloc_destroy(domain_rec);
+ e = ads_next_entry(ads, e);
+ }
+ }
+
+done:
+ free_result_array(ads_list, msg_list, num_resp);
+ talloc_destroy(frame);
+
+ return nt_status;
+}
+
+/********************************************************************
+ Pull an attribute string value
+ *******************************************************************/
+
+static NTSTATUS get_object_account_name(ADS_STRUCT *ads,
+ LDAPMessage *msg,
+ char **name)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ char *sam_name = NULL;
+ struct winbindd_tdc_domain *domain_rec = NULL;
+ char *dns_domain = NULL;
+ char *dn = NULL;
+ TALLOC_CTX *frame = talloc_stackframe();
+ int len;
+
+ /* Check parameters */
+
+ if (!ads || !msg || !name) {
+ nt_status = NT_STATUS_INVALID_PARAMETER;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ /* get the name and domain */
+
+ dn = ads_get_dn(ads, msg);
+ BAIL_ON_PTR_ERROR(dn, nt_status);
+
+ DEBUG(10,("get_object_account_name: dn = \"%s\"\n", dn));
+
+ dns_domain = cell_dn_to_dns(dn);
+ SAFE_FREE(dn);
+ BAIL_ON_PTR_ERROR(dns_domain, nt_status);
+
+ domain_rec = wcache_tdc_fetch_domain(frame, dns_domain);
+ SAFE_FREE(dns_domain);
+
+ if (!domain_rec) {
+ nt_status = NT_STATUS_TRUSTED_DOMAIN_FAILURE;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ sam_name = ads_pull_string(ads, frame, msg, "sAMAccountName");
+ BAIL_ON_PTR_ERROR(sam_name, nt_status);
+
+ len = asprintf(name, "%s\\%s", domain_rec->domain_name, sam_name);
+ if (len == -1) {
+ *name = NULL;
+ BAIL_ON_PTR_ERROR((*name), nt_status);
+ }
+
+ nt_status = NT_STATUS_OK;
+
+done:
+ talloc_destroy(frame);
+
+ return nt_status;
+}
+
+/*********************************************************************
+ ********************************************************************/
+
+ NTSTATUS gc_sid_to_name(const DOM_SID *sid,
+ char **name,
+ enum lsa_SidType *sid_type)
+{
+ TALLOC_CTX *frame = talloc_stackframe();
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ char *filter;
+ ADS_STRUCT *ads = NULL;
+ LDAPMessage *msg = NULL;
+ char *sid_string;
+
+ *name = NULL;
+
+ sid_string = sid_binstring(sid);
+ BAIL_ON_PTR_ERROR(sid_string, nt_status);
+
+ filter = talloc_asprintf(frame, "(objectSid=%s)", sid_string);
+ SAFE_FREE(sid_string);
+ BAIL_ON_PTR_ERROR(filter, nt_status);
+
+ nt_status = gc_search_all_forests_unique(filter, &ads, &msg);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ nt_status = get_object_account_name(ads, msg, name);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ nt_status = get_sid_type(ads, msg, sid_type);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+done:
+ ads_msgfree(ads, msg);
+ talloc_destroy(frame);
+
+ return nt_status;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+ NTSTATUS add_ads_result_to_array(ADS_STRUCT *ads,
+ LDAPMessage *msg,
+ ADS_STRUCT ***ads_list,
+ LDAPMessage ***msg_list,
+ int *size)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ ADS_STRUCT **ads_tmp = NULL;
+ LDAPMessage **msg_tmp = NULL;
+ int count = *size;
+
+ if (!ads || !msg) {
+ nt_status = NT_STATUS_INVALID_PARAMETER;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+#if 0
+ /* Don't add a response with no entries */
+
+ if (ads_count_replies(ads, msg) == 0) {
+ return NT_STATUS_OK;
+ }
+#endif
+
+ if (count == 0) {
+ ads_tmp = TALLOC_ARRAY(NULL, ADS_STRUCT*, 1);
+ BAIL_ON_PTR_ERROR(ads_tmp, nt_status);
+
+ msg_tmp = TALLOC_ARRAY(NULL, LDAPMessage*, 1);
+ BAIL_ON_PTR_ERROR(msg_tmp, nt_status);
+ } else {
+ ads_tmp = TALLOC_REALLOC_ARRAY(*ads_list, *ads_list, ADS_STRUCT*,
+ count+1);
+ BAIL_ON_PTR_ERROR(ads_tmp, nt_status);
+
+ msg_tmp = TALLOC_REALLOC_ARRAY(*msg_list, *msg_list, LDAPMessage*,
+ count+1);
+ BAIL_ON_PTR_ERROR(msg_tmp, nt_status);
+ }
+
+ ads_tmp[count] = ads;
+ msg_tmp[count] = msg;
+ count++;
+
+ *ads_list = ads_tmp;
+ *msg_list = msg_tmp;
+ *size = count;
+
+ nt_status = NT_STATUS_OK;
+
+done:
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ talloc_destroy(ads_tmp);
+ talloc_destroy(msg_tmp);
+ }
+
+ return nt_status;
+}
+
+/**********************************************************************
+ Frees search results. Do not free the ads_list as these are
+ references back to the GC search structures.
+ *********************************************************************/
+
+ void free_result_array(ADS_STRUCT **ads_list,
+ LDAPMessage **msg_list,
+ int num_resp)
+{
+ int i;
+
+ for (i=0; i<num_resp; i++) {
+ ads_msgfree(ads_list[i], msg_list[i]);
+ }
+
+ talloc_destroy(ads_list);
+ talloc_destroy(msg_list);
+}
+
+/**********************************************************************
+ Check that we have exactly one entry from the search
+ *********************************************************************/
+
+ NTSTATUS check_result_unique(ADS_STRUCT *ads, LDAPMessage *msg)
+{
+ NTSTATUS nt_status;
+ int count;
+
+ count = ads_count_replies(ads, msg);
+
+ if (count <= 0) {
+ nt_status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ if (count > 1) {
+ nt_status = NT_STATUS_DUPLICATE_NAME;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ nt_status = NT_STATUS_OK;
+
+done:
+ return nt_status;
+}
diff --git a/source3/winbindd/idmap_adex/idmap_adex.c b/source3/winbindd/idmap_adex/idmap_adex.c
new file mode 100644
index 0000000000..7596b1cbd8
--- /dev/null
+++ b/source3/winbindd/idmap_adex/idmap_adex.c
@@ -0,0 +1,460 @@
+/*
+ * idmap_adex: Support for D Forests
+ *
+ * Copyright (C) Gerald (Jerry) Carter 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 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 "idmap_adex.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_IDMAP
+
+#define WINBIND_CCACHE_NAME "MEMORY:winbind_ccache"
+
+NTSTATUS init_module(void);
+
+/*
+ * IdMap backend
+ */
+
+/********************************************************************
+ Basic init function responsible for determining our current mode
+ (standalone or using Centeris Cells). This must return success or
+ it will be dropped from the idmap backend list.
+ *******************************************************************/
+
+static NTSTATUS _idmap_adex_init(struct idmap_domain *dom,
+ const char *params)
+{
+ ADS_STRUCT *ads = NULL;
+ ADS_STATUS status;
+ static NTSTATUS init_status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND;
+ DOM_SID domain_sid;
+ fstring dcname;
+ struct sockaddr_storage ip;
+ struct likewise_cell *lwcell;
+
+ if (NT_STATUS_IS_OK(init_status))
+ return NT_STATUS_OK;
+
+ /* Silently fail if we are not a member server in security = ads */
+
+ if ((lp_server_role() != ROLE_DOMAIN_MEMBER) ||
+ (lp_security() != SEC_ADS)) {
+ init_status = NT_STATUS_INVALID_SERVER_STATE;
+ BAIL_ON_NTSTATUS_ERROR(init_status);
+ }
+
+ /* fetch our domain SID first */
+
+ if (!secrets_fetch_domain_sid(lp_workgroup(), &domain_sid)) {
+ init_status = NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
+ BAIL_ON_NTSTATUS_ERROR(init_status);
+ }
+
+ /* reuse the same ticket cache as winbindd */
+
+ setenv("KRB5CCNAME", WINBIND_CCACHE_NAME, 1);
+
+ /* Establish a connection to a DC */
+
+ if ((ads = ads_init(lp_realm(), lp_workgroup(), NULL)) == NULL) {
+ init_status = NT_STATUS_NO_MEMORY;
+ BAIL_ON_NTSTATUS_ERROR(init_status);
+ }
+
+ ads->auth.password =
+ secrets_fetch_machine_password(lp_workgroup(), NULL, NULL);
+ ads->auth.realm = SMB_STRDUP(lp_realm());
+
+ /* get the DC name here to setup the server affinity cache and
+ local krb5.conf */
+
+ get_dc_name(lp_workgroup(), lp_realm(), dcname, &ip);
+
+ status = ads_connect(ads);
+ if (!ADS_ERR_OK(status)) {
+ DEBUG(0, ("_idmap_adex_init: ads_connect() failed! (%s)\n",
+ ads_errstr(status)));
+ }
+ init_status = ads_ntstatus(status);
+ BAIL_ON_NTSTATUS_ERROR(init_status);
+
+
+ /* Find out cell membership */
+
+ init_status = cell_locate_membership(ads);
+ if (!NT_STATUS_IS_OK(init_status)) {
+ DEBUG(0,("LWI: Fail to locate cell membership (%s).",
+ nt_errstr(init_status)));
+ goto done;
+ }
+
+ /* Fill in the cell information */
+
+ lwcell = cell_list_head();
+
+ init_status = cell_lookup_settings(lwcell);
+ BAIL_ON_NTSTATUS_ERROR(init_status);
+
+ /* Miscellaneous setup. E.g. set up the list of GC
+ servers and domain list for our forest (does not actually
+ connect). */
+
+ init_status = gc_init_list();
+ BAIL_ON_NTSTATUS_ERROR(init_status);
+
+ init_status = domain_init_list();
+ BAIL_ON_NTSTATUS_ERROR(init_status);
+
+done:
+ if (!NT_STATUS_IS_OK(init_status)) {
+ DEBUG(1,("Likewise initialization failed (%s)\n",
+ nt_errstr(init_status)));
+ }
+
+ /* cleanup */
+
+ if (!NT_STATUS_IS_OK(init_status)) {
+ cell_list_destroy();
+
+ /* init_status stores the failure reason but we need to
+ return success or else idmap_init() will drop us from the
+ backend list */
+ return NT_STATUS_OK;
+ }
+
+ init_status = NT_STATUS_OK;
+
+ return init_status;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS _idmap_adex_get_sid_from_id(struct
+ idmap_domain
+ *dom, struct
+ id_map
+ **ids)
+{
+ int i;
+ bool one_mapped = false;
+ bool all_mapped = true;
+ NTSTATUS nt_status;
+ struct likewise_cell *cell;
+
+ nt_status = _idmap_adex_init(dom, NULL);
+ if (!NT_STATUS_IS_OK(nt_status))
+ return nt_status;
+
+ if ((cell = cell_list_head()) == NULL) {
+ return NT_STATUS_INVALID_SERVER_STATE;
+ }
+
+ /* have to work through these one by one */
+ for (i = 0; ids[i]; i++) {
+ NTSTATUS status;
+ status = cell->provider->get_sid_from_id(ids[i]->sid,
+ ids[i]->xid.id,
+ ids[i]->xid.type);
+ /* Fail if we cannot find any DC */
+ if (NT_STATUS_EQUAL
+ (status, NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND)) {
+ return status;
+ }
+
+ if (!NT_STATUS_IS_OK(status)) {
+ ids[i]->status = ID_UNMAPPED;
+ all_mapped = false;
+ continue;
+ }
+
+ ids[i]->status = ID_MAPPED;
+ one_mapped = true;
+ }
+
+ return NT_STATUS_OK;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS _idmap_adex_get_id_from_sid(struct
+ idmap_domain
+ *dom, struct
+ id_map
+ **ids)
+{
+ int i;
+ bool one_mapped = false;
+ bool all_mapped = true;
+ NTSTATUS nt_status;
+ struct likewise_cell *cell;
+
+ nt_status = _idmap_adex_init(dom, NULL);
+ if (!NT_STATUS_IS_OK(nt_status))
+ return nt_status;
+
+ if ((cell = cell_list_head()) == NULL) {
+ return NT_STATUS_INVALID_SERVER_STATE;
+ }
+
+ /* have to work through these one by one */
+ for (i = 0; ids[i]; i++) {
+ NTSTATUS status;
+ status = cell->provider->get_id_from_sid(&ids[i]->xid.id,
+ &ids[i]->xid.
+ type, ids[i]->sid);
+ /* Fail if we cannot find any DC */
+ if (NT_STATUS_EQUAL
+ (status, NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND)) {
+ return status;
+ }
+
+ if (!NT_STATUS_IS_OK(status)) {
+ ids[i]->status = ID_UNMAPPED;
+ all_mapped = false;
+ continue;
+ }
+
+ ids[i]->status = ID_MAPPED;
+ one_mapped = true;
+ }
+
+ return NT_STATUS_OK;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS _idmap_adex_set_mapping(struct
+ idmap_domain
+ *dom, const struct
+ id_map *map)
+{
+ DEBUG(0, ("_idmap_adex_set_mapping: not implemented\n"));
+ return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS _idmap_adex_remove_mapping(struct
+ idmap_domain
+ *dom, const
+ struct
+ id_map
+ *map)
+{
+ DEBUG(0, ("_idmap_adex_remove_mapping: not implemented\n"));
+ return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS _idmap_adex_dump(struct idmap_domain
+ *dom, struct id_map **maps, int *num_map)
+{
+ return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS _idmap_adex_close(struct idmap_domain
+ *dom)
+{
+ /* FIXME! need to do cleanup here */
+
+ return NT_STATUS_OK;
+}
+
+/*
+ * IdMap NSS plugin
+ */
+
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS _nss_adex_init(struct nss_domain_entry
+ *e)
+{
+ return _idmap_adex_init(NULL, NULL);
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS _nss_adex_get_info(struct
+ nss_domain_entry *e,
+ const DOM_SID * sid,
+ TALLOC_CTX * ctx,
+ ADS_STRUCT * ads,
+ LDAPMessage * msg,
+ char **homedir,
+ char **shell, char **gecos, gid_t * p_gid)
+{
+ NTSTATUS nt_status;
+ struct likewise_cell *cell;
+
+ nt_status = _idmap_adex_init(NULL, NULL);
+ if (!NT_STATUS_IS_OK(nt_status))
+ return nt_status;
+
+ if ((cell = cell_list_head()) == NULL) {
+ return NT_STATUS_INVALID_SERVER_STATE;
+ }
+
+ return cell->provider->get_nss_info(sid, ctx, homedir,
+ shell, gecos, p_gid);
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS _nss_adex_map_to_alias(TALLOC_CTX * mem_ctx, const char
+ *domain, const char
+ *name, char **alias)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ struct likewise_cell *cell = NULL;
+
+ nt_status = _idmap_adex_init(NULL, NULL);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ if ((cell = cell_list_head()) == NULL) {
+ nt_status = NT_STATUS_INVALID_SERVER_STATE;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ nt_status = cell->provider->map_to_alias(mem_ctx, domain,
+ name, alias);
+
+ /* go ahead and allow the cache mgr to mark this in
+ negative cache */
+
+ if (!NT_STATUS_IS_OK(nt_status))
+ nt_status = NT_STATUS_NONE_MAPPED;
+
+done:
+ return nt_status;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS _nss_adex_map_from_alias(TALLOC_CTX * mem_ctx, const char
+ *domain, const char
+ *alias, char **name)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ struct likewise_cell *cell = NULL;
+
+ nt_status = _idmap_adex_init(NULL, NULL);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ if ((cell = cell_list_head()) == NULL) {
+ nt_status = NT_STATUS_INVALID_SERVER_STATE;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+
+ nt_status = cell->provider->map_from_alias(mem_ctx, domain,
+ alias, name);
+
+ /* go ahead and allow the cache mgr to mark this in
+ negative cache */
+
+ if (!NT_STATUS_IS_OK(nt_status))
+ nt_status = NT_STATUS_NONE_MAPPED;
+
+done:
+ return nt_status;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS _nss_adex_close(void)
+{
+ return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static struct idmap_methods adex_idmap_methods = {
+
+ .init = _idmap_adex_init,
+ .unixids_to_sids = _idmap_adex_get_sid_from_id,
+ .sids_to_unixids = _idmap_adex_get_id_from_sid,
+ .set_mapping = _idmap_adex_set_mapping,
+ .remove_mapping = _idmap_adex_remove_mapping,
+ .dump_data = _idmap_adex_dump,
+ .close_fn = _idmap_adex_close
+};
+static struct nss_info_methods adex_nss_methods = {
+ .init = _nss_adex_init,
+ .get_nss_info = _nss_adex_get_info,
+ .map_to_alias = _nss_adex_map_to_alias,
+ .map_from_alias = _nss_adex_map_from_alias,
+ .close_fn = _nss_adex_close
+};
+
+/**********************************************************************
+ Register with the idmap and idmap_nss subsystems. We have to protect
+ against the idmap and nss_info interfaces being in a half-registered
+ state.
+ **********************************************************************/
+NTSTATUS idmap_adex_init(void)
+{
+ static NTSTATUS idmap_status = NT_STATUS_UNSUCCESSFUL;
+ static NTSTATUS nss_status = NT_STATUS_UNSUCCESSFUL;
+ if (!NT_STATUS_IS_OK(idmap_status)) {
+ idmap_status =
+ smb_register_idmap(SMB_IDMAP_INTERFACE_VERSION,
+ "adex", &adex_idmap_methods);
+ if (!NT_STATUS_IS_OK(idmap_status)) {
+ DEBUG(0,
+ ("idmap_centeris_init: Failed to register the adex"
+ "idmap plugin.\n"));
+ return idmap_status;
+ }
+ }
+
+ if (!NT_STATUS_IS_OK(nss_status)) {
+ nss_status =
+ smb_register_idmap_nss(SMB_NSS_INFO_INTERFACE_VERSION,
+ "adex", &adex_nss_methods);
+ if (!NT_STATUS_IS_OK(nss_status)) {
+ DEBUG(0,
+ ("idmap_adex_init: Failed to register the adex"
+ "nss plugin.\n"));
+ return nss_status;
+ }
+ }
+
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS nss_info_adex_init(void)
+{
+ return idmap_adex_init();
+}
diff --git a/source3/winbindd/idmap_adex/idmap_adex.h b/source3/winbindd/idmap_adex/idmap_adex.h
new file mode 100644
index 0000000000..e068d5c340
--- /dev/null
+++ b/source3/winbindd/idmap_adex/idmap_adex.h
@@ -0,0 +1,257 @@
+/*
+ * idmap_centeris: Support for Local IDs and Centeris Cell Structure
+ *
+ * Copyright (C) Gerald (Jerry) Carter 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 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.
+ */
+
+#ifndef _IDMAP_ADEX_H
+#define _IDMAP_ADEX_H
+
+#include "winbindd/winbindd.h"
+
+#define ADEX_CELL_RDN "$LikewiseIdentityCell"
+
+#define ADEX_OC_USER "centerisLikewiseUser"
+#define ADEX_OC_GROUP "centerisLikewiseGroup"
+
+#define AD_USER "User"
+#define AD_GROUP "Group"
+
+#define ADEX_OC_POSIX_USER "posixAccount"
+#define ADEX_OC_POSIX_GROUP "posixGroup"
+
+#define ADEX_ATTR_UIDNUM "uidNumber"
+#define ADEX_ATTR_GIDNUM "gidNUmber"
+#define ADEX_ATTR_HOMEDIR "unixHomeDirectory"
+#define ADEX_ATTR_USERPW "unixUserPassword"
+#define ADEX_ATTR_GROUPALIAS "groupAlias" /* Not part of RFC2307 */
+#define ADEX_ATTR_SHELL "loginShell"
+#define ADEX_ATTR_GECOS "gecos"
+#define ADEX_ATTR_UID "uid"
+#define ADEX_ATTR_DISPLAYNAME "displayName"
+
+#define MIN_ID_VALUE 100
+
+#define BAIL_ON_NTSTATUS_ERROR(x) \
+ do { \
+ if (!NT_STATUS_IS_OK(x)) { \
+ DEBUG(10,("Failed! (%s)\n", nt_errstr(x))); \
+ goto done; \
+ } \
+ } \
+ while (0); \
+
+#define WARN_ON_NTSTATUS_ERROR(x) \
+ do { \
+ if (!NT_STATUS_IS_OK(x)) { \
+ DEBUG(10,("Failure ignored! (%s)\n", nt_errstr(x))); \
+ } \
+ } \
+ while (0); \
+
+#define BAIL_ON_ADS_ERROR(x) \
+ do { \
+ if (!ADS_ERR_OK(x)) { \
+ goto done; \
+ } \
+ } \
+ while (0);
+
+#define BAIL_ON_PTR_ERROR(p, x) \
+ do { \
+ if ((p) == NULL ) { \
+ DEBUG(10,("NULL pointer!\n")); \
+ x = NT_STATUS_NO_MEMORY; \
+ goto done; \
+ } \
+ } while (0);
+
+#define PRINT_NTSTATUS_ERROR(x, hdr, level) \
+ do { \
+ if (!NT_STATUS_IS_OK(x)) { \
+ DEBUG(level,("LWI ("hdr"): %s\n", nt_errstr(x))); \
+ } \
+ } while(0);
+/*
+ * Cell Provider API
+ */
+
+struct cell_provider_api {
+ NTSTATUS(*get_sid_from_id) (DOM_SID * sid,
+ uint32_t id, enum id_type type);
+ NTSTATUS(*get_id_from_sid) (uint32_t * id,
+ enum id_type * type, const DOM_SID * sid);
+ NTSTATUS(*get_nss_info) (const DOM_SID * sid,
+ TALLOC_CTX * ctx,
+ char **homedir,
+ char **shell, char **gecos, gid_t * p_gid);
+ NTSTATUS(*map_to_alias) (TALLOC_CTX * mem_ctx,
+ const char *domain,
+ const char *name, char **alias);
+ NTSTATUS(*map_from_alias) (TALLOC_CTX * mem_ctx,
+ const char *domain,
+ const char *alias, char **name);
+};
+
+/* registered providers */
+
+extern struct cell_provider_api ccp_unified;
+extern struct cell_provider_api ccp_local;
+
+#define LWCELL_FLAG_USE_RFC2307_ATTRS 0x00000001
+#define LWCELL_FLAG_SEARCH_FOREST 0x00000002
+#define LWCELL_FLAG_GC_CELL 0x00000004
+#define LWCELL_FLAG_LOCAL_MODE 0x00000008
+
+struct likewise_cell {
+ struct likewise_cell *prev, *next;
+ ADS_STRUCT *conn;
+ struct likewise_cell *gc_search_cell;
+ DOM_SID domain_sid;
+ char *dns_domain;
+ char *forest_name;
+ char *dn;
+ struct GUID *links; /* only held by owning cell */
+ size_t num_links;
+ uint32_t flags;
+ struct cell_provider_api *provider;
+};
+
+/* Search flags used for Global Catalog API */
+
+#define ADEX_GC_SEARCH_CHECK_UNIQUE 0x00000001
+
+struct gc_info {
+ struct gc_info *prev, *next;
+ char *forest_name;
+ char *search_base;
+ struct likewise_cell *forest_cell;
+};
+
+/* Available functions outside of idmap_lwidentity.c */
+
+/* cell_util.c */
+
+char *find_attr_string(char **list, size_t num_lines, const char *substr);
+bool is_object_class(char **list, size_t num_lines, const char *substr);
+int min_id_value(void);
+char *cell_dn_to_dns(const char *dn);
+NTSTATUS get_sid_type(ADS_STRUCT *ads,
+ LDAPMessage *msg,
+ enum lsa_SidType *type);
+
+NTSTATUS cell_locate_membership(ADS_STRUCT * ads);
+NTSTATUS cell_lookup_settings(struct likewise_cell * cell);
+NTSTATUS cell_follow_links(struct likewise_cell *cell);
+NTSTATUS cell_set_local_provider(void);
+
+/* likewise_cell.c */
+
+struct likewise_cell *cell_new(void);
+struct likewise_cell *cell_list_head(void);
+
+bool cell_list_add(struct likewise_cell *cell);
+bool cell_list_remove(struct likewise_cell * cell);
+
+void cell_list_destroy(void);
+void cell_destroy(struct likewise_cell *c);
+void cell_set_forest_searches(struct likewise_cell *c,
+ bool search);
+void cell_set_dns_domain(struct likewise_cell *c,
+ const char *dns_domain);
+void cell_set_connection(struct likewise_cell *c,
+ ADS_STRUCT *ads);
+void cell_set_dn(struct likewise_cell *c,
+ const char *dn);
+void cell_set_domain_sid(struct likewise_cell *c,
+ DOM_SID *sid);
+void cell_set_flags(struct likewise_cell *c, uint32_t flags);
+void cell_clear_flags(struct likewise_cell *c, uint32_t flags);
+
+const char* cell_search_base(struct likewise_cell *c);
+const char *cell_dns_domain(struct likewise_cell *c);
+ADS_STRUCT *cell_connection(struct likewise_cell *c);
+bool cell_search_forest(struct likewise_cell *c);
+ADS_STATUS cell_do_search(struct likewise_cell *c,
+ const char *search_base,
+ int scope,
+ const char *expr,
+ const char **attrs,
+ LDAPMessage ** msg);
+uint32_t cell_flags(struct likewise_cell *c);
+
+NTSTATUS cell_connect_dn(struct likewise_cell **c,
+ const char *dn);
+NTSTATUS cell_connect(struct likewise_cell *c);
+
+
+/* gc_util.c */
+
+NTSTATUS gc_init_list(void);
+
+NTSTATUS gc_find_forest_root(struct gc_info *gc,
+ const char *domain);
+
+struct gc_info *gc_search_start(void);
+
+NTSTATUS gc_search_forest(struct gc_info *gc,
+ LDAPMessage **msg,
+ const char *filter);
+
+NTSTATUS gc_search_all_forests(const char *filter,
+ ADS_STRUCT ***ads_list,
+ LDAPMessage ***msg_list,
+ int *num_resp, uint32_t flags);
+
+NTSTATUS gc_search_all_forests_unique(const char *filter,
+ ADS_STRUCT **ads,
+ LDAPMessage **msg);
+
+NTSTATUS gc_name_to_sid(const char *domain,
+ const char *name,
+ DOM_SID *sid,
+ enum lsa_SidType *sid_type);
+
+NTSTATUS gc_sid_to_name(const DOM_SID *sid,
+ char **name,
+ enum lsa_SidType *sid_type);
+
+NTSTATUS add_ads_result_to_array(ADS_STRUCT *ads,
+ LDAPMessage *msg,
+ ADS_STRUCT ***ads_list,
+ LDAPMessage ***msg_list,
+ int *size);
+
+void free_result_array(ADS_STRUCT **ads_list,
+ LDAPMessage **msg_list,
+ int num_resp);
+
+NTSTATUS check_result_unique(ADS_STRUCT *ads,
+ LDAPMessage *msg);
+
+
+/* domain_util.c */
+
+NTSTATUS domain_init_list(void);
+
+NTSTATUS dc_search_domains(struct likewise_cell **cell,
+ LDAPMessage **msg,
+ const char *dn,
+ const DOM_SID *user_sid);
+
+
+#endif /* _IDMAP_ADEX_H */
diff --git a/source3/winbindd/idmap_adex/likewise_cell.c b/source3/winbindd/idmap_adex/likewise_cell.c
new file mode 100644
index 0000000000..7723b3e015
--- /dev/null
+++ b/source3/winbindd/idmap_adex/likewise_cell.c
@@ -0,0 +1,443 @@
+/*
+ * idmap_adex: Support for AD Forests
+ *
+ * Copyright (C) Gerald (Jerry) Carter 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 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 "idmap_adex.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_IDMAP
+
+static struct likewise_cell *_lw_cell_list = NULL;
+
+/**********************************************************************
+ Return the current HEAD of the list
+ *********************************************************************/
+
+ struct likewise_cell *cell_list_head(void)
+{
+ return _lw_cell_list;
+}
+
+
+/**********************************************************************
+ *********************************************************************/
+
+ void cell_destroy(struct likewise_cell *c)
+{
+ if (!c)
+ return;
+
+ if (c->conn)
+ ads_destroy(&c->conn);
+
+ talloc_destroy(c);
+}
+
+/**********************************************************************
+ Free all cell entries and reset the list head to NULL
+ *********************************************************************/
+
+ void cell_list_destroy(void)
+{
+ struct likewise_cell *p = _lw_cell_list;
+
+ while (p) {
+ struct likewise_cell *q = p->next;
+
+ cell_destroy(p);
+
+ p = q;
+ }
+
+ _lw_cell_list = NULL;
+
+ return;
+}
+
+/**********************************************************************
+ Add a new cell structure to the list
+ *********************************************************************/
+
+ struct likewise_cell* cell_new(void)
+{
+ struct likewise_cell *c;
+
+ /* Each cell struct is a TALLOC_CTX* */
+
+ c = TALLOC_ZERO_P(NULL, struct likewise_cell);
+ if (!c) {
+ DEBUG(0,("cell_new: memory allocation failure!\n"));
+ return NULL;
+ }
+
+ return c;
+}
+
+/**********************************************************************
+ Add a new cell structure to the list
+ *********************************************************************/
+
+ bool cell_list_add(struct likewise_cell * cell)
+{
+ if (!cell) {
+ return false;
+ }
+
+ /* Always add to the end */
+
+ DLIST_ADD_END(_lw_cell_list, cell, struct likewise_cell *);
+
+ return true;
+}
+
+/**********************************************************************
+ Add a new cell structure to the list
+ *********************************************************************/
+
+ bool cell_list_remove(struct likewise_cell * cell)
+{
+ if (!cell) {
+ return false;
+ }
+
+ /* Remove and drop the cell structure */
+
+ DLIST_REMOVE(_lw_cell_list, cell);
+ talloc_destroy(cell);
+
+ return true;
+}
+
+/**********************************************************************
+ Set the containing DNS domain for a cell
+ *********************************************************************/
+
+ void cell_set_dns_domain(struct likewise_cell *c, const char *dns_domain)
+{
+ c->dns_domain = talloc_strdup(c, dns_domain);
+}
+
+/**********************************************************************
+ Set ADS connection for a cell
+ *********************************************************************/
+
+ void cell_set_connection(struct likewise_cell *c, ADS_STRUCT *ads)
+{
+ c->conn = ads;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+ void cell_set_flags(struct likewise_cell *c, uint32_t flags)
+{
+ c->flags |= flags;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+ void cell_clear_flags(struct likewise_cell *c, uint32_t flags)
+{
+ c->flags &= ~flags;
+}
+
+/**********************************************************************
+ Set the Cell's DN
+ *********************************************************************/
+
+ void cell_set_dn(struct likewise_cell *c, const char *dn)
+{
+ if ( c->dn) {
+ talloc_free(c->dn);
+ c->dn = NULL;
+ }
+
+ c->dn = talloc_strdup(c, dn);
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+ void cell_set_domain_sid(struct likewise_cell *c, DOM_SID *sid)
+{
+ sid_copy(&c->domain_sid, sid);
+}
+
+/*
+ * Query Routines
+ */
+
+/**********************************************************************
+ *********************************************************************/
+
+ const char* cell_search_base(struct likewise_cell *c)
+{
+ if (!c)
+ return NULL;
+
+ return talloc_asprintf(c, "cn=%s,%s", ADEX_CELL_RDN, c->dn);
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+ bool cell_search_forest(struct likewise_cell *c)
+{
+ uint32_t test_flags = LWCELL_FLAG_SEARCH_FOREST;
+
+ return ((c->flags & test_flags) == test_flags);
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+ uint32_t cell_flags(struct likewise_cell *c)
+{
+ if (!c)
+ return 0;
+
+ return c->flags;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+ const char *cell_dns_domain(struct likewise_cell *c)
+{
+ if (!c)
+ return NULL;
+
+ return c->dns_domain;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+ ADS_STRUCT *cell_connection(struct likewise_cell *c)
+{
+ if (!c)
+ return NULL;
+
+ return c->conn;
+}
+
+/*
+ * Connection functions
+ */
+
+/********************************************************************
+ *******************************************************************/
+
+ NTSTATUS cell_connect(struct likewise_cell *c)
+{
+ ADS_STRUCT *ads = NULL;
+ ADS_STATUS ads_status;
+ fstring dc_name;
+ struct sockaddr_storage dcip;
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+
+ /* have to at least have the AD domain name */
+
+ if (!c->dns_domain) {
+ nt_status = NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ /* clear out any old information */
+
+ if (c->conn) {
+ ads_destroy(&c->conn);
+ c->conn = NULL;
+ }
+
+ /* now setup the new connection */
+
+ ads = ads_init(c->dns_domain, NULL, NULL);
+ BAIL_ON_PTR_ERROR(ads, nt_status);
+
+ ads->auth.password =
+ secrets_fetch_machine_password(lp_workgroup(), NULL, NULL);
+ ads->auth.realm = SMB_STRDUP(lp_realm());
+
+ /* Make the connection. We should already have an initial
+ TGT using the machine creds */
+
+ if (cell_flags(c) & LWCELL_FLAG_GC_CELL) {
+ ads_status = ads_connect_gc(ads);
+ } else {
+ /* Set up server affinity for normal cells and the client
+ site name cache */
+
+ if (!get_dc_name("", c->dns_domain, dc_name, &dcip)) {
+ nt_status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ ads_status = ads_connect(ads);
+ }
+
+
+ c->conn = ads;
+
+ nt_status = ads_ntstatus(ads_status);
+
+done:
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ ads_destroy(&ads);
+ c->conn = NULL;
+ }
+
+ return nt_status;
+}
+
+/********************************************************************
+ *******************************************************************/
+
+ NTSTATUS cell_connect_dn(struct likewise_cell **c, const char *dn)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ struct likewise_cell *new_cell = NULL;
+ char *dns_domain = NULL;
+
+ if (*c || !dn) {
+ nt_status = NT_STATUS_INVALID_PARAMETER;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ if ((new_cell = cell_new()) == NULL) {
+ nt_status = NT_STATUS_NO_MEMORY;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ /* Set the DNS domain, dn, etc ... and add it to the list */
+
+ dns_domain = cell_dn_to_dns(dn);
+ cell_set_dns_domain(new_cell, dns_domain);
+ SAFE_FREE(dns_domain);
+
+ cell_set_dn(new_cell, dn);
+
+ nt_status = cell_connect(new_cell);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ *c = new_cell;
+
+done:
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ DEBUG(1,("LWI: Failled to connect to cell \"%s\" (%s)\n",
+ dn ? dn : "NULL", nt_errstr(nt_status)));
+ talloc_destroy(new_cell);
+ }
+
+ return nt_status;
+}
+
+
+/********************************************************************
+ *******************************************************************/
+
+#define MAX_SEARCH_COUNT 2
+
+ ADS_STATUS cell_do_search(struct likewise_cell *c,
+ const char *search_base,
+ int scope,
+ const char *expr,
+ const char **attrs,
+ LDAPMessage ** msg)
+{
+ int search_count = 0;
+ ADS_STATUS status;
+ NTSTATUS nt_status;
+
+ /* check for a NULL connection */
+
+ if (!c->conn) {
+ nt_status = cell_connect(c);
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ status = ADS_ERROR_NT(nt_status);
+ return status;
+ }
+ }
+
+ DEBUG(10, ("cell_do_search: Base = %s, Filter = %s, Scope = %d, GC = %s\n",
+ search_base, expr, scope,
+ c->conn->server.gc ? "yes" : "no"));
+
+ /* we try multiple times in case the ADS_STRUCT is bad
+ and we need to reconnect */
+
+ while (search_count < MAX_SEARCH_COUNT) {
+ *msg = NULL;
+ status = ads_do_search(c->conn, search_base,
+ scope, expr, attrs, msg);
+ if (ADS_ERR_OK(status)) {
+ if (DEBUGLEVEL >= 10) {
+ LDAPMessage *e = NULL;
+
+ int n = ads_count_replies(c->conn, *msg);
+
+ DEBUG(10,("cell_do_search: Located %d entries\n", n));
+
+ for (e=ads_first_entry(c->conn, *msg);
+ e!=NULL;
+ e = ads_next_entry(c->conn, e))
+ {
+ char *dn = ads_get_dn(c->conn, e);
+
+ DEBUGADD(10,(" dn: %s\n", dn ? dn : "<NULL>"));
+ SAFE_FREE(dn);
+ }
+ }
+
+ return status;
+ }
+
+
+ DEBUG(5, ("cell_do_search: search[%d] failed (%s)\n",
+ search_count, ads_errstr(status)));
+
+ search_count++;
+
+ /* Houston, we have a problem */
+
+ if (status.error_type == ENUM_ADS_ERROR_LDAP) {
+ switch (status.err.rc) {
+ case LDAP_TIMELIMIT_EXCEEDED:
+ case LDAP_TIMEOUT:
+ case -1: /* we get this error if we cannot contact
+ the LDAP server */
+ nt_status = cell_connect(c);
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ status = ADS_ERROR_NT(nt_status);
+ return status;
+ }
+ break;
+ default:
+ /* we're all done here */
+ return status;
+ }
+ }
+ }
+
+ DEBUG(5, ("cell_do_search: exceeded maximum search count!\n"));
+
+ return ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL);
+}
diff --git a/source3/winbindd/idmap_adex/provider_unified.c b/source3/winbindd/idmap_adex/provider_unified.c
new file mode 100644
index 0000000000..f18534797e
--- /dev/null
+++ b/source3/winbindd/idmap_adex/provider_unified.c
@@ -0,0 +1,1180 @@
+/*
+ * idmap_adex
+ *
+ * Provider for RFC2307 and SFU AD Forests
+ *
+ * Copyright (C) Gerald (Jerry) Carter 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 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 "idmap_adex.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_IDMAP
+
+/* Information needed by the LDAP search filters */
+
+enum filterType { SidFilter, IdFilter, AliasFilter };
+
+struct lwcell_filter
+{
+ enum filterType ftype;
+ bool use2307;
+ union {
+ DOM_SID sid;
+ struct {
+ uint32_t id;
+ enum id_type type;
+ } id;
+ fstring alias;
+ } filter;
+};
+
+/********************************************************************
+ *******************************************************************/
+
+static char* build_id_filter(uint32_t id,
+ enum id_type type,
+ uint32_t search_flags)
+{
+ char *filter = NULL;
+ char *oc_filter, *attr_filter;
+ NTSTATUS nt_status;
+ TALLOC_CTX *frame = talloc_stackframe();
+ bool use2307 = ((search_flags & LWCELL_FLAG_USE_RFC2307_ATTRS)
+ == LWCELL_FLAG_USE_RFC2307_ATTRS);
+ bool use_gc = ((search_flags & LWCELL_FLAG_SEARCH_FOREST)
+ == LWCELL_FLAG_SEARCH_FOREST);
+ const char *oc;
+
+ /* Construct search filter for objectclass and attributes */
+
+ switch (type) {
+ case ID_TYPE_UID:
+ oc = ADEX_OC_USER;
+ if (use2307) {
+ oc = ADEX_OC_POSIX_USER;
+ if (use_gc) {
+ oc = AD_USER;
+ }
+ }
+ oc_filter = talloc_asprintf(frame, "objectclass=%s", oc);
+ attr_filter = talloc_asprintf(frame, "%s=%u",
+ ADEX_ATTR_UIDNUM, id);
+ break;
+
+ case ID_TYPE_GID:
+ oc = ADEX_OC_GROUP;
+ if (use2307) {
+ oc = ADEX_OC_POSIX_GROUP;
+ if (use_gc) {
+ oc = AD_GROUP;
+ }
+ }
+ oc_filter = talloc_asprintf(frame, "objectclass=%s", oc);
+ attr_filter = talloc_asprintf(frame, "%s=%u",
+ ADEX_ATTR_GIDNUM, id);
+ break;
+ default:
+ return NULL;
+ }
+
+ BAIL_ON_PTR_ERROR(oc_filter, nt_status);
+ BAIL_ON_PTR_ERROR(attr_filter, nt_status);
+
+ /* Use "keywords=%s" for non-schema cells */
+
+ if (use2307) {
+ filter = talloc_asprintf(frame, "(&(%s)(%s))",
+ oc_filter, attr_filter);
+ } else {
+ filter = talloc_asprintf(frame, "(&(keywords=%s)(keywords=%s))",
+ oc_filter, attr_filter);
+ }
+
+ talloc_destroy(oc_filter);
+ talloc_destroy(attr_filter);
+
+done:
+ /* Don't destroy the stackframe CTX since we are returning
+ memory from it */
+
+ return filter;
+}
+
+/********************************************************************
+ *******************************************************************/
+
+static char* build_alias_filter(const char *alias, uint32_t search_flags)
+{
+ char *filter = NULL;
+ char *user_attr_filter, *group_attr_filter;
+ NTSTATUS nt_status;
+ TALLOC_CTX *frame = talloc_stackframe();
+ bool use2307 = ((search_flags & LWCELL_FLAG_USE_RFC2307_ATTRS)
+ == LWCELL_FLAG_USE_RFC2307_ATTRS);
+ bool search_forest = ((search_flags & LWCELL_FLAG_SEARCH_FOREST)
+ == LWCELL_FLAG_SEARCH_FOREST);
+
+ /* Construct search filter for objectclass and attributes */
+
+ user_attr_filter = talloc_asprintf(frame, "%s=%s",
+ ADEX_ATTR_UID, alias);
+ group_attr_filter = talloc_asprintf(frame, "%s=%s",
+ ADEX_ATTR_DISPLAYNAME, alias);
+ BAIL_ON_PTR_ERROR(user_attr_filter, nt_status);
+ BAIL_ON_PTR_ERROR(group_attr_filter, nt_status);
+
+ /* Use "keywords=%s" for non-schema cells */
+
+ if (use2307) {
+ filter = talloc_asprintf(frame,
+ "(|(&(%s)(objectclass=%s))(&(%s)(objectclass=%s)))",
+ user_attr_filter,
+ search_forest ? AD_USER : ADEX_OC_POSIX_USER,
+ group_attr_filter,
+ search_forest ? AD_GROUP : ADEX_OC_POSIX_GROUP);
+ } else {
+ filter = talloc_asprintf(frame,
+ "(|(keywords=%s)(keywords=%s))",
+ user_attr_filter,
+ group_attr_filter);
+ }
+
+ talloc_destroy(user_attr_filter);
+ talloc_destroy(group_attr_filter);
+
+done:
+ /* Don't destroy the stackframe CTX since we are returning
+ memory from it */
+
+ return filter;
+}
+
+
+/********************************************************************
+ *******************************************************************/
+
+static NTSTATUS search_cell(struct likewise_cell *c,
+ LDAPMessage **msg,
+ const struct lwcell_filter *fdata)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ TALLOC_CTX* frame = talloc_stackframe();
+ char *filter = NULL;
+ const char *base = NULL;
+ ADS_STATUS ads_status = ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL);
+ const char *attrs[] = { "*", NULL };
+ int count;
+ char *sid_str;
+
+ /* get the filter and other search parameters */
+
+ switch (fdata->ftype) {
+ case SidFilter:
+ sid_str = sid_string_talloc(frame, &fdata->filter.sid);
+ BAIL_ON_PTR_ERROR(sid_str, nt_status);
+
+ filter = talloc_asprintf(frame, "(keywords=backLink=%s)",
+ sid_str);
+ break;
+ case IdFilter:
+ filter = build_id_filter(fdata->filter.id.id,
+ fdata->filter.id.type,
+ cell_flags(c));
+ break;
+ case AliasFilter:
+ filter = build_alias_filter(fdata->filter.alias,
+ cell_flags(c));
+ break;
+ default:
+ nt_status = NT_STATUS_INVALID_PARAMETER;
+ break;
+ }
+ BAIL_ON_PTR_ERROR(filter, nt_status);
+
+ base = cell_search_base(c);
+ BAIL_ON_PTR_ERROR(base, nt_status);
+
+ ads_status = cell_do_search(c, base, LDAP_SCOPE_SUBTREE,
+ filter, attrs, msg);
+
+ nt_status = ads_ntstatus(ads_status);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ /* Now check that we got only one reply */
+
+ count = ads_count_replies(c->conn, *msg);
+ if (count < 1) {
+ nt_status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ if ( count > 1) {
+ nt_status = NT_STATUS_DUPLICATE_NAME;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+done:
+ PRINT_NTSTATUS_ERROR(nt_status, "search_cell", 4);
+
+ talloc_destroy(CONST_DISCARD(char*, base));
+ talloc_destroy(frame);
+
+ return nt_status;
+}
+
+/********************************************************************
+ *******************************************************************/
+
+static NTSTATUS search_domain(struct likewise_cell **cell,
+ LDAPMessage **msg,
+ const char *dn,
+ const DOM_SID *sid)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ TALLOC_CTX* frame = talloc_stackframe();
+ int count;
+
+ nt_status = dc_search_domains(cell, msg, dn, sid);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ /* Now check that we got only one reply */
+
+ count = ads_count_replies(cell_connection(*cell), *msg);
+ if (count < 1) {
+ nt_status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ if ( count > 1) {
+ nt_status = NT_STATUS_DUPLICATE_NAME;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+done:
+ PRINT_NTSTATUS_ERROR(nt_status, "search_domain", 4);
+ talloc_destroy(frame);
+
+ return nt_status;
+}
+
+
+/********************************************************************
+ Check that a DN is within the forest scope.
+ *******************************************************************/
+
+static bool check_forest_scope(const char *dn)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ TALLOC_CTX *frame = talloc_stackframe();
+ char *p = NULL;
+ char *q = NULL;
+ char *dns_domain = NULL;
+ struct winbindd_tdc_domain *domain;
+
+ /* If the DN does *not* contain "$LikewiseIdentityCell",
+ assume this is a schema mode forest and it is in the
+ forest scope by definition. */
+
+ if ((p = strstr_m(dn, ADEX_CELL_RDN)) == NULL) {
+ nt_status = NT_STATUS_OK;
+ goto done;
+ }
+
+ /* If this is a non-schema forest, then make sure that the DN
+ is in the form "...,cn=$LikewiseIdentityCell,DC=..." */
+
+ if ((q = strchr_m(p, ',')) == NULL) {
+ nt_status = NT_STATUS_OBJECT_NAME_INVALID;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ q++;
+ if (StrnCaseCmp(q, "dc=", 3) != 0) {
+ nt_status = NT_STATUS_OBJECT_PATH_NOT_FOUND;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+
+ dns_domain = cell_dn_to_dns(q);
+ BAIL_ON_PTR_ERROR(dns_domain, nt_status);
+
+ domain = wcache_tdc_fetch_domain(frame, dns_domain);
+ if (!domain) {
+ nt_status = NT_STATUS_TRUSTED_DOMAIN_FAILURE;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ nt_status = NT_STATUS_OK;
+
+done:
+ talloc_destroy(frame);
+ SAFE_FREE(dns_domain);
+
+ return NT_STATUS_IS_OK(nt_status);
+}
+
+
+
+/********************************************************************
+ Check that only one result was returned within the forest cell
+ scope.
+ *******************************************************************/
+
+static NTSTATUS check_result_unique_scoped(ADS_STRUCT **ads_list,
+ LDAPMessage **msg_list,
+ int num_resp,
+ char **dn,
+ DOM_SID *user_sid)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ int i;
+ ADS_STRUCT *ads = NULL;
+ LDAPMessage *msg = NULL;
+ int count = 0;
+ char *entry_dn = NULL;
+ TALLOC_CTX *frame = talloc_stackframe();
+
+ if (!dn || !user_sid) {
+ nt_status = NT_STATUS_INVALID_PARAMETER;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ *dn = NULL;
+
+ if (!ads_list || !msg_list || (num_resp == 0)) {
+ nt_status = NT_STATUS_NO_SUCH_FILE;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ /* Loop over all msgs */
+
+ for (i=0; i<num_resp; i++) {
+ LDAPMessage *e = ads_first_entry(ads_list[i], msg_list[i]);
+
+ while (e) {
+ entry_dn = ads_get_dn(ads_list[i], e);
+ BAIL_ON_PTR_ERROR(entry_dn, nt_status);
+
+ if (check_forest_scope(entry_dn)) {
+ count++;
+
+ /* If we've already broken the condition, no
+ need to continue */
+
+ if (count > 1) {
+ nt_status = NT_STATUS_DUPLICATE_NAME;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ ads = ads_list[i];
+ msg = e;
+ *dn = SMB_STRDUP(entry_dn);
+ BAIL_ON_PTR_ERROR((*dn), nt_status);
+ }
+
+ e = ads_next_entry(ads_list[i], e);
+ SAFE_FREE(entry_dn);
+ }
+ }
+
+ if (!ads || !msg) {
+ nt_status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ /* If we made is through the loop, then grab the user_sid and
+ run home to base */
+
+ /*
+ Try and get the SID from either objectSid or keywords.
+ We cannot use pull_sid() here since we want to try
+ both methods and not only one or the other (and we
+ have no full likewise_cell struct.
+
+ Fail if both are unavailable
+ */
+
+ if (!ads_pull_sid(ads, msg, "objectSid", user_sid)) {
+ char **keywords;
+ char *s;
+ size_t num_lines = 0;
+
+ keywords = ads_pull_strings(ads, frame, msg, "keywords",
+ &num_lines);
+ BAIL_ON_PTR_ERROR(keywords, nt_status);
+
+ s = find_attr_string(keywords, num_lines, "backLink");
+ if (!s) {
+ nt_status = NT_STATUS_INTERNAL_DB_CORRUPTION;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ if (!string_to_sid(user_sid, s)) {
+ nt_status = NT_STATUS_INVALID_SID;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+ }
+
+ nt_status = NT_STATUS_OK;
+
+done:
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ SAFE_FREE(*dn);
+ }
+
+ talloc_destroy(frame);
+ SAFE_FREE(entry_dn);
+
+ return nt_status;
+}
+
+/********************************************************************
+ Search all forests. Each forest can have it's own forest-cell
+ settings so we have to generate the filter for each search.
+ We don't use gc_search_all_forests() since we may have a different
+ schema model in each forest and need to construct the search
+ filter for each GC search.
+ *******************************************************************/
+
+static NTSTATUS search_forest(struct likewise_cell *forest_cell,
+ LDAPMessage **msg,
+ const struct lwcell_filter *fdata)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ TALLOC_CTX *frame = talloc_stackframe();
+ char *filter = NULL;
+ char *dn = NULL;
+ struct gc_info *gc = NULL;
+ ADS_STRUCT **ads_list = NULL;
+ LDAPMessage **msg_list = NULL;
+ int num_resp = 0;
+ LDAPMessage *m;
+ DOM_SID user_sid;
+ struct likewise_cell *domain_cell = NULL;
+
+ if ((gc = gc_search_start()) == NULL) {
+ nt_status = NT_STATUS_INVALID_DOMAIN_STATE;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ while (gc) {
+ char *sid_binstr = NULL;
+ uint32_t flags = LWCELL_FLAG_SEARCH_FOREST;
+
+ m = NULL;
+
+ flags |= cell_flags(gc->forest_cell);
+
+ switch (fdata->ftype) {
+ case SidFilter:
+ sid_binstr = sid_binstring(&fdata->filter.sid);
+ BAIL_ON_PTR_ERROR(sid_binstr, nt_status);
+
+ filter = talloc_asprintf(frame, "(objectSid=%s)", sid_binstr);
+ SAFE_FREE(sid_binstr);
+ break;
+ case IdFilter:
+ filter = build_id_filter(fdata->filter.id.id,
+ fdata->filter.id.type, flags);
+ break;
+ case AliasFilter:
+ filter = build_alias_filter(fdata->filter.alias, flags);
+ break;
+ }
+
+ /* First find the sparse object in GC */
+ nt_status = gc_search_forest(gc, &m, filter);
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ gc = gc->next;
+ continue;
+ }
+
+ nt_status = add_ads_result_to_array(cell_connection(gc->forest_cell),
+ m, &ads_list, &msg_list,
+ &num_resp);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ gc = gc->next;
+ }
+
+ /* Uniqueness check across forests */
+
+ nt_status = check_result_unique_scoped(ads_list, msg_list, num_resp,
+ &dn, &user_sid);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ nt_status = search_domain(&domain_cell, &m, dn, &user_sid);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ /* Save the connection and results in the return parameters */
+
+ forest_cell->gc_search_cell = domain_cell;
+ *msg = m;
+
+done:
+ PRINT_NTSTATUS_ERROR(nt_status, "search_forest", 4);
+
+ SAFE_FREE(dn);
+
+ free_result_array(ads_list, msg_list, num_resp);
+ talloc_destroy(frame);
+
+ return nt_status;
+}
+
+/********************************************************************
+ *******************************************************************/
+
+static NTSTATUS search_cell_list(struct likewise_cell **c,
+ LDAPMessage **m,
+ const struct lwcell_filter *fdata)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ struct likewise_cell *cell = NULL;
+ LDAPMessage *msg = NULL;
+ struct likewise_cell *result_cell = NULL;
+
+ if ((cell = cell_list_head()) == NULL) {
+ nt_status = NT_STATUS_INVALID_SERVER_STATE;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ while (cell) {
+ /* Clear any previous GC search results */
+
+ cell->gc_search_cell = NULL;
+
+ if (cell_search_forest(cell)) {
+ nt_status = search_forest(cell, &msg, fdata);
+ } else {
+ nt_status = search_cell(cell, &msg, fdata);
+ }
+
+ /* Always point to the search result cell.
+ In forests this might be for another domain
+ which means the schema model may be different */
+
+ result_cell = cell->gc_search_cell ?
+ cell->gc_search_cell : cell;
+
+ /* Check if we are done */
+
+ if (NT_STATUS_IS_OK(nt_status)) {
+ break;
+ }
+
+ /* No luck. Free memory and hit the next cell.
+ Forest searches always set the gc_search_cell
+ so give preference to that connection if possible. */
+
+ ads_msgfree(cell_connection(result_cell), msg);
+ msg = NULL;
+
+ cell = cell->next;
+ }
+
+ /* This might be assigning NULL but that is ok as long as we
+ give back the proper error code */
+
+ *c = result_cell;
+ *m = msg;
+
+done:
+ PRINT_NTSTATUS_ERROR(nt_status, "search_cell_list", 3);
+
+ return nt_status;
+}
+
+/********************************************************************
+ Pull the SID from an object which is always stored in the keywords
+ attribute as "backLink=S-1-5-21-..."
+ *******************************************************************/
+
+static NTSTATUS pull_sid(struct likewise_cell *c,
+ LDAPMessage *msg,
+ DOM_SID *sid)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ TALLOC_CTX *frame = talloc_stackframe();
+ ADS_STRUCT *ads = NULL;
+
+ ads = cell_connection(c);
+
+ /*
+ We have two ways of getting the sid:
+ (a) from the objectSID in case of a GC search,
+ (b) from backLink in the case of a cell search.
+ Pull the keywords attributes and grab the backLink.
+ */
+
+ if (!ads_pull_sid(ads, msg, "objectSid", sid)) {
+ char **keywords;
+ char *s;
+ size_t num_lines = 0;
+
+ keywords = ads_pull_strings(ads, frame, msg,
+ "keywords", &num_lines);
+ BAIL_ON_PTR_ERROR(keywords, nt_status);
+
+ s = find_attr_string(keywords, num_lines, "backLink");
+ if (!s) {
+ nt_status = NT_STATUS_INTERNAL_DB_CORRUPTION;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ if (!string_to_sid(sid, s)) {
+ nt_status = NT_STATUS_INVALID_SID;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+ }
+
+ nt_status = NT_STATUS_OK;
+
+done:
+ talloc_destroy(frame);
+
+ return nt_status;
+}
+
+/********************************************************************
+ *******************************************************************/
+
+static NTSTATUS get_object_type(struct likewise_cell *c,
+ LDAPMessage *msg,
+ enum id_type *type)
+{
+ TALLOC_CTX *ctx = talloc_stackframe();
+ char **oc_list = NULL;
+ NTSTATUS nt_status = NT_STATUS_OK;
+ size_t list_size = 0;
+ char *s = NULL;
+ ADS_STRUCT *ads = NULL;
+
+ ads = cell_connection(c);
+
+ /* Deal with RFC 2307 support first */
+
+ if (cell_flags(c) & LWCELL_FLAG_USE_RFC2307_ATTRS) {
+ oc_list = ads_pull_strings(ads, ctx, msg,
+ "objectClass", &list_size);
+ if (!oc_list) {
+ nt_status = NT_STATUS_INTERNAL_DB_CORRUPTION;
+ goto done;
+ }
+
+ /* Check for posix classes and AD classes */
+
+ if (is_object_class(oc_list, list_size, ADEX_OC_POSIX_USER)
+ || is_object_class(oc_list, list_size, AD_USER)) {
+ *type = ID_TYPE_UID;
+ } else if (is_object_class(oc_list, list_size, ADEX_OC_POSIX_GROUP)
+ || is_object_class(oc_list, list_size, AD_GROUP)) {
+ *type = ID_TYPE_GID;
+ } else {
+ *type = ID_TYPE_NOT_SPECIFIED;
+ nt_status = NT_STATUS_INVALID_PARAMETER;
+ }
+ } else {
+ /* Default to non-schema mode */
+
+ oc_list = ads_pull_strings(ads, ctx, msg,
+ "keywords", &list_size);
+ if (!oc_list) {
+ nt_status = NT_STATUS_INTERNAL_DB_CORRUPTION;
+ goto done;
+ }
+
+ s = find_attr_string(oc_list, list_size, "objectClass");
+ if (!s) {
+ nt_status = NT_STATUS_INTERNAL_DB_CORRUPTION;
+ goto done;
+ }
+
+ if (strequal(s, ADEX_OC_USER)) {
+ *type = ID_TYPE_UID;
+ } else if (strequal(s, ADEX_OC_GROUP)) {
+ *type = ID_TYPE_GID;
+ } else {
+ *type = ID_TYPE_NOT_SPECIFIED;
+ nt_status = NT_STATUS_INVALID_PARAMETER;
+ }
+ }
+
+ nt_status = NT_STATUS_OK;
+
+done:
+ talloc_destroy(ctx);
+
+ return nt_status;
+}
+
+/********************************************************************
+ Pull an attribute uint32_t value
+ *******************************************************************/
+
+static NTSTATUS get_object_uint32(struct likewise_cell *c,
+ LDAPMessage *msg,
+ const char *attrib,
+ uint32_t *x)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ char **keywords = NULL;
+ size_t list_size = 0;
+ TALLOC_CTX *frame = talloc_stackframe();
+ ADS_STRUCT *ads = NULL;
+
+ ads = cell_connection(c);
+
+ /* Deal with RFC2307 schema */
+
+ if (cell_flags(c) & LWCELL_FLAG_USE_RFC2307_ATTRS) {
+ if (!ads_pull_uint32(ads, msg, attrib, x)) {
+ nt_status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+ } else {
+ /* Non-schema mode */
+ char *s = NULL;
+ uint32_t num;
+
+ keywords = ads_pull_strings(ads, frame, msg, "keywords",
+ &list_size);
+ BAIL_ON_PTR_ERROR(keywords, nt_status);
+
+ s = find_attr_string(keywords, list_size, attrib);
+ if (!s) {
+ nt_status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ num = strtoll(s, NULL, 10);
+ if (errno == ERANGE) {
+ nt_status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+ *x = num;
+ }
+
+ nt_status = NT_STATUS_OK;
+
+done:
+ talloc_destroy(frame);
+
+ return nt_status;
+}
+
+/********************************************************************
+ *******************************************************************/
+
+static NTSTATUS get_object_id(struct likewise_cell *c,
+ LDAPMessage *msg,
+ enum id_type type,
+ uint32_t *id)
+{
+ NTSTATUS nt_status = NT_STATUS_OK;
+ const char *id_attr;
+
+ /* Figure out which attribute we need to pull */
+
+ switch (type) {
+ case ID_TYPE_UID:
+ id_attr = ADEX_ATTR_UIDNUM;
+ break;
+ case ID_TYPE_GID:
+ id_attr = ADEX_ATTR_GIDNUM;
+ break;
+ default:
+ nt_status = NT_STATUS_INVALID_PARAMETER;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ break;
+ }
+
+ nt_status = get_object_uint32(c, msg, id_attr, id);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+done:
+ return nt_status;
+}
+
+/********************************************************************
+ Pull the uid/gid and type from an object. This differs depending on
+ the cell flags.
+ *******************************************************************/
+
+static NTSTATUS pull_id(struct likewise_cell *c,
+ LDAPMessage *msg,
+ uint32_t *id,
+ enum id_type *type)
+{
+ NTSTATUS nt_status;
+
+ nt_status = get_object_type(c, msg, type);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ nt_status = get_object_id(c, msg, *type, id);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+done:
+ return nt_status;
+}
+
+/********************************************************************
+ Pull an attribute string value
+ *******************************************************************/
+
+static NTSTATUS get_object_string(struct likewise_cell *c,
+ LDAPMessage *msg,
+ TALLOC_CTX *ctx,
+ const char *attrib,
+ char **string)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ char **keywords = NULL;
+ size_t list_size = 0;
+ TALLOC_CTX *frame = talloc_stackframe();
+ ADS_STRUCT *ads = NULL;
+
+ *string = NULL;
+
+ ads = cell_connection(c);
+
+ /* Deal with RFC2307 schema */
+
+ if (cell_flags(c) & LWCELL_FLAG_USE_RFC2307_ATTRS) {
+ *string = ads_pull_string(ads, ctx, msg, attrib);
+ } else {
+ /* Non-schema mode */
+
+ char *s = NULL;
+
+ keywords = ads_pull_strings(ads, frame, msg,
+ "keywords", &list_size);
+ if (!keywords) {
+ nt_status = NT_STATUS_NO_MEMORY;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+ s = find_attr_string(keywords, list_size, attrib);
+ if (s) {
+ *string = talloc_strdup(ctx, s);
+ }
+ }
+
+ if (!*string) {
+ nt_status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ nt_status = NT_STATUS_OK;
+
+done:
+ talloc_destroy(frame);
+
+ return nt_status;
+}
+
+/********************************************************************
+ Pull the struct passwd fields for a user
+ *******************************************************************/
+
+static NTSTATUS pull_nss_info(struct likewise_cell *c,
+ LDAPMessage *msg,
+ TALLOC_CTX *ctx,
+ char **homedir,
+ char **shell,
+ char **gecos,
+ gid_t *p_gid)
+{
+ NTSTATUS nt_status;
+
+ nt_status = get_object_string(c, msg, ctx, ADEX_ATTR_HOMEDIR, homedir);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ nt_status = get_object_string(c, msg, ctx, ADEX_ATTR_SHELL, shell);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ nt_status = get_object_string(c, msg, ctx, ADEX_ATTR_GECOS, gecos);
+ /* Gecos is often not set so ignore failures */
+
+ nt_status = get_object_uint32(c, msg, ADEX_ATTR_GIDNUM, p_gid);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+done:
+ return nt_status;
+}
+
+/********************************************************************
+ Pull the struct passwd fields for a user
+ *******************************************************************/
+
+static NTSTATUS pull_alias(struct likewise_cell *c,
+ LDAPMessage *msg,
+ TALLOC_CTX *ctx,
+ char **alias)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ enum id_type type;
+ const char *attr = NULL;
+
+ /* Figure out if this is a user or a group */
+
+ nt_status = get_object_type(c, msg, &type);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ switch (type) {
+ case ID_TYPE_UID:
+ attr = ADEX_ATTR_UID;
+ break;
+ case ID_TYPE_GID:
+ /* What is the group attr for RFC2307 Forests? */
+ attr = ADEX_ATTR_DISPLAYNAME;
+ break;
+ default:
+ nt_status = NT_STATUS_INVALID_PARAMETER;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ break;
+ }
+
+ nt_status = get_object_string(c, msg, ctx, attr, alias);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+done:
+ return nt_status;
+}
+
+/********************************************************************
+ *******************************************************************/
+
+static NTSTATUS _ccp_get_sid_from_id(DOM_SID * sid,
+ uint32_t id, enum id_type type)
+{
+ struct likewise_cell *cell = NULL;
+ LDAPMessage *msg = NULL;
+ NTSTATUS nt_status;
+ struct lwcell_filter filter;
+
+ filter.ftype = IdFilter;
+ filter.filter.id.id = id;
+ filter.filter.id.type = type;
+
+ nt_status = search_cell_list(&cell, &msg, &filter);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ nt_status = pull_sid(cell, msg, sid);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+done:
+ ads_msgfree(cell->conn, msg);
+
+ return nt_status;
+}
+
+/********************************************************************
+ *******************************************************************/
+
+static NTSTATUS _ccp_get_id_from_sid(uint32_t * id,
+ enum id_type *type,
+ const DOM_SID * sid)
+{
+ struct likewise_cell *cell = NULL;
+ LDAPMessage *msg = NULL;
+ NTSTATUS nt_status;
+ struct lwcell_filter filter;
+
+ filter.ftype = SidFilter;
+ sid_copy(&filter.filter.sid, sid);
+
+ nt_status = search_cell_list(&cell, &msg, &filter);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ nt_status = pull_id(cell, msg, id, type);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ if (*id < min_id_value()) {
+ nt_status = NT_STATUS_INVALID_PARAMETER;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+done:
+ ads_msgfree(cell->conn, msg);
+
+ return nt_status;
+}
+
+/********************************************************************
+ *******************************************************************/
+
+static NTSTATUS _ccp_nss_get_info(const DOM_SID * sid,
+ TALLOC_CTX * ctx,
+ char **homedir,
+ char **shell,
+ char **gecos, gid_t * p_gid)
+{
+ struct likewise_cell *cell = NULL;
+ LDAPMessage *msg = NULL;
+ NTSTATUS nt_status;
+ struct lwcell_filter filter;
+ enum id_type type;
+
+ filter.ftype = SidFilter;
+ sid_copy(&filter.filter.sid, sid);
+
+ nt_status = search_cell_list(&cell, &msg, &filter);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ nt_status = get_object_type(cell, msg, &type);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ if (type != ID_TYPE_UID) {
+ nt_status = NT_STATUS_NO_SUCH_USER;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ nt_status = pull_nss_info(cell, msg, ctx, homedir, shell, gecos,
+ (uint32_t*) p_gid);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+done:
+ ads_msgfree(cell->conn, msg);
+
+ return nt_status;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS _ccp_map_to_alias(TALLOC_CTX *ctx,
+ const char *domain,
+ const char *name, char **alias)
+{
+ TALLOC_CTX *frame = talloc_stackframe();
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ DOM_SID sid;
+ struct likewise_cell *cell = NULL;
+ LDAPMessage *msg = NULL;
+ struct lwcell_filter filter;
+ enum lsa_SidType sid_type;
+
+ /* Convert the name to a SID */
+
+ nt_status = gc_name_to_sid(domain, name, &sid, &sid_type);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ /* Find the user/group */
+
+ filter.ftype = SidFilter;
+ sid_copy(&filter.filter.sid, &sid);
+
+ nt_status = search_cell_list(&cell, &msg, &filter);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ /* Pull the alias and return */
+
+ nt_status = pull_alias(cell, msg, ctx, alias);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+done:
+ PRINT_NTSTATUS_ERROR(nt_status, "map_to_alias", 3);
+
+ talloc_destroy(frame);
+ ads_msgfree(cell_connection(cell), msg);
+
+ return nt_status;
+}
+
+/**********************************************************************
+ Map from an alias name to the canonical, qualified name.
+ Ensure that the alias is only pull from the closest in which
+ the user or gorup is enabled in
+ *********************************************************************/
+
+static NTSTATUS _ccp_map_from_alias(TALLOC_CTX *mem_ctx,
+ const char *domain,
+ const char *alias, char **name)
+{
+ TALLOC_CTX *frame = talloc_stackframe();
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ DOM_SID sid;
+ struct likewise_cell *cell_alias = NULL;
+ LDAPMessage *msg_alias = NULL;
+ struct likewise_cell *cell_sid = NULL;
+ LDAPMessage *msg_sid = NULL;
+ struct lwcell_filter filter;
+ char *canonical_name = NULL;
+ enum lsa_SidType type;
+
+ /* Find the user/group */
+
+ filter.ftype = AliasFilter;
+ fstrcpy(filter.filter.alias, alias);
+
+ nt_status = search_cell_list(&cell_alias, &msg_alias, &filter);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ nt_status = pull_sid(cell_alias, msg_alias, &sid);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ /* Now search again for the SID according to the cell list.
+ Verify that the cell of both search results is the same
+ so that we only match an alias from the closest cell
+ in which a user/group has been instantied. */
+
+ filter.ftype = SidFilter;
+ sid_copy(&filter.filter.sid, &sid);
+
+ nt_status = search_cell_list(&cell_sid, &msg_sid, &filter);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ if (cell_alias != cell_sid) {
+ nt_status = NT_STATUS_OBJECT_PATH_NOT_FOUND;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ /* Finally do the GC sid/name conversion */
+
+ nt_status = gc_sid_to_name(&sid, &canonical_name, &type);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ *name = talloc_strdup(mem_ctx, canonical_name);
+ BAIL_ON_PTR_ERROR((*name), nt_status);
+
+ nt_status = NT_STATUS_OK;
+
+done:
+ PRINT_NTSTATUS_ERROR(nt_status, "map_from_alias", 3);
+
+ ads_msgfree(cell_connection(cell_alias), msg_alias);
+ ads_msgfree(cell_connection(cell_sid), msg_sid);
+
+ SAFE_FREE(canonical_name);
+
+ talloc_destroy(frame);
+
+ return nt_status;
+}
+
+/********************************************************************
+ *******************************************************************/
+
+struct cell_provider_api ccp_unified = {
+ .get_sid_from_id = _ccp_get_sid_from_id,
+ .get_id_from_sid = _ccp_get_id_from_sid,
+ .get_nss_info = _ccp_nss_get_info,
+ .map_to_alias = _ccp_map_to_alias,
+ .map_from_alias = _ccp_map_from_alias
+};
diff --git a/source3/winbindd/idmap_hash/idmap_hash.c b/source3/winbindd/idmap_hash/idmap_hash.c
new file mode 100644
index 0000000000..a050f99bc8
--- /dev/null
+++ b/source3/winbindd/idmap_hash/idmap_hash.c
@@ -0,0 +1,393 @@
+/*
+ * idmap_hash.c
+ *
+ * Copyright (C) Gerald Carter <jerry@samba.org> 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 "winbindd/winbindd.h"
+#include "idmap_hash.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_IDMAP
+
+struct sid_hash_table {
+ DOM_SID *sid;
+};
+
+struct sid_hash_table *hashed_domains = NULL;
+
+/*********************************************************************
+ Hash a domain SID (S-1-5-12-aaa-bbb-ccc) to a 12bit number
+ ********************************************************************/
+
+static uint32_t hash_domain_sid(const DOM_SID *sid)
+{
+ uint32_t hash;
+
+ if (sid->num_auths != 4)
+ return 0;
+
+ /* XOR the last three subauths */
+
+ hash = ((sid->sub_auths[1] ^ sid->sub_auths[2]) ^ sid->sub_auths[3]);
+
+ /* Take all 32-bits into account when generating the 12-bit
+ hash value */
+ hash = (((hash & 0xFFF00000) >> 20)
+ + ((hash & 0x000FFF00) >> 8)
+ + (hash & 0x000000FF)) & 0x0000FFF;
+
+ /* return a 12-bit hash value */
+
+ return hash;
+}
+
+/*********************************************************************
+ Hash a Relative ID to a 20 bit number
+ ********************************************************************/
+
+static uint32_t hash_rid(uint32_t rid)
+{
+ /* 20 bits for the rid which allows us to support
+ the first 100K users/groups in a domain */
+
+ return (rid & 0x0007FFFF);
+}
+
+/*********************************************************************
+ ********************************************************************/
+
+static uint32_t combine_hashes(uint32_t h_domain,
+ uint32_t h_rid)
+{
+ uint32_t return_id = 0;
+
+ /* shift the hash_domain 19 bits to the left and OR with the
+ hash_rid */
+
+ return_id = ((h_domain<<19) | h_rid);
+
+ return return_id;
+}
+
+/*********************************************************************
+ ********************************************************************/
+
+static void separate_hashes(uint32_t id,
+ uint32_t *h_domain,
+ uint32_t *h_rid)
+{
+ *h_rid = id & 0x0007FFFF;
+ *h_domain = (id & 0x7FF80000) >> 19;
+
+ return;
+}
+
+
+/*********************************************************************
+ ********************************************************************/
+
+static NTSTATUS be_init(struct idmap_domain *dom,
+ const char *params)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ struct winbindd_tdc_domain *dom_list = NULL;
+ size_t num_domains = 0;
+ int i;
+
+ /* If the domain SID hash talbe has been initialized, assume
+ that we completed this function previously */
+
+ if ( hashed_domains ) {
+ nt_status = NT_STATUS_OK;
+ goto done;
+ }
+
+ if (!wcache_tdc_fetch_list(&dom_list, &num_domains)) {
+ nt_status = NT_STATUS_TRUSTED_DOMAIN_FAILURE;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ /* Create the hash table of domain SIDs */
+
+ hashed_domains = TALLOC_ZERO_ARRAY(NULL, struct sid_hash_table, 4096);
+ BAIL_ON_PTR_NT_ERROR(hashed_domains, nt_status);
+
+ /* create the hash table of domain SIDs */
+
+ for (i=0; i<num_domains; i++) {
+ uint32_t hash;
+
+ if (is_null_sid(&dom_list[i].sid))
+ continue;
+ if ((hash = hash_domain_sid(&dom_list[i].sid)) == 0)
+ continue;
+
+ DEBUG(5,("hash:be_init() Adding %s (%s) -> %d\n",
+ dom_list[i].domain_name,
+ sid_string_dbg(&dom_list[i].sid),
+ hash));
+
+ hashed_domains[hash].sid = talloc(hashed_domains, DOM_SID);
+ sid_copy(hashed_domains[hash].sid, &dom_list[i].sid);
+ }
+
+done:
+ return nt_status;
+}
+
+/*********************************************************************
+ ********************************************************************/
+
+static NTSTATUS unixids_to_sids(struct idmap_domain *dom,
+ struct id_map **ids)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ int i;
+
+ nt_status = be_init(dom, NULL);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ if (!ids) {
+ nt_status = NT_STATUS_INVALID_PARAMETER;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ for (i=0; ids[i]; i++) {
+ uint32_t h_domain, h_rid;
+
+ ids[i]->status = ID_UNMAPPED;
+
+ separate_hashes(ids[i]->xid.id, &h_domain, &h_rid);
+
+ /* Make sure the caller allocated memor for us */
+
+ if (!ids[i]->sid) {
+ nt_status = NT_STATUS_INVALID_PARAMETER;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ /* If the domain hash doesn't find a SID in the table,
+ skip it */
+
+ if (!hashed_domains[h_domain].sid)
+ continue;
+
+ sid_copy(ids[i]->sid, hashed_domains[h_domain].sid);
+ sid_append_rid(ids[i]->sid, h_rid);
+ ids[i]->status = ID_MAPPED;
+ }
+
+done:
+ return nt_status;
+}
+
+/*********************************************************************
+ ********************************************************************/
+
+static NTSTATUS sids_to_unixids(struct idmap_domain *dom,
+ struct id_map **ids)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ int i;
+
+ nt_status = be_init(dom, NULL);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ if (!ids) {
+ nt_status = NT_STATUS_INVALID_PARAMETER;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ for (i=0; ids[i]; i++) {
+ DOM_SID sid;
+ uint32_t rid;
+ uint32_t h_domain, h_rid;
+
+ ids[i]->status = ID_UNMAPPED;
+
+ sid_copy(&sid, ids[i]->sid);
+ sid_split_rid(&sid, &rid);
+
+ h_domain = hash_domain_sid(&sid);
+ h_rid = hash_rid(rid);
+
+ /* Check that both hashes are non-zero*/
+
+ if (h_domain && h_rid) {
+ ids[i]->xid.id = combine_hashes(h_domain, h_rid);
+ ids[i]->status = ID_MAPPED;
+ }
+ }
+
+done:
+ return nt_status;
+}
+
+/*********************************************************************
+ ********************************************************************/
+
+static NTSTATUS be_close(struct idmap_domain *dom)
+{
+ if (hashed_domains)
+ talloc_free(hashed_domains);
+
+ return NT_STATUS_OK;
+}
+
+/*********************************************************************
+ ********************************************************************/
+
+static NTSTATUS nss_hash_init(struct nss_domain_entry *e )
+{
+ return be_init(NULL, NULL);
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS nss_hash_get_info(struct nss_domain_entry *e,
+ const DOM_SID *sid,
+ TALLOC_CTX *ctx,
+ ADS_STRUCT *ads,
+ LDAPMessage *msg,
+ char **homedir,
+ char **shell,
+ char **gecos,
+ gid_t *p_gid )
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+
+ nt_status = nss_hash_init(e);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+ if (!homedir || !shell || !gecos) {
+ nt_status = NT_STATUS_INVALID_PARAMETER;
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+ }
+
+ *homedir = talloc_strdup(ctx, lp_template_homedir());
+ BAIL_ON_PTR_NT_ERROR(*homedir, nt_status);
+
+ *shell = talloc_strdup(ctx, lp_template_shell());
+ BAIL_ON_PTR_NT_ERROR(*shell, nt_status);
+
+ *gecos = NULL;
+
+ /* Initialize the gid so that the upper layer fills
+ in the proper Windows primary group */
+
+ if (*p_gid) {
+ *p_gid = (gid_t)-1;
+ }
+
+done:
+ return nt_status;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS nss_hash_map_to_alias(TALLOC_CTX *mem_ctx,
+ const char *domain,
+ const char *name,
+ char **alias)
+{
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ const char *value;
+
+ value = talloc_asprintf(mem_ctx, "%s\\%s", domain, name);
+ BAIL_ON_PTR_NT_ERROR(value, nt_status);
+
+ nt_status = mapfile_lookup_key(mem_ctx, value, alias);
+ BAIL_ON_NTSTATUS_ERROR(nt_status);
+
+done:
+ return nt_status;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS nss_hash_map_from_alias(TALLOC_CTX *mem_ctx,
+ const char *domain,
+ const char *alias,
+ char **name)
+{
+ return mapfile_lookup_value(mem_ctx, alias, name);
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS nss_hash_close(void)
+{
+ return NT_STATUS_OK;
+}
+
+/*********************************************************************
+ Dispatch Tables for IDMap and NssInfo Methods
+********************************************************************/
+
+static struct idmap_methods hash_idmap_methods = {
+ .init = be_init,
+ .unixids_to_sids = unixids_to_sids,
+ .sids_to_unixids = sids_to_unixids,
+ .close_fn = be_close
+};
+
+static struct nss_info_methods hash_nss_methods = {
+ .init = nss_hash_init,
+ .get_nss_info = nss_hash_get_info,
+ .map_to_alias = nss_hash_map_to_alias,
+ .map_from_alias = nss_hash_map_from_alias,
+ .close_fn = nss_hash_close
+};
+
+/**********************************************************************
+ Register with the idmap and idmap_nss subsystems. We have to protect
+ against the idmap and nss_info interfaces being in a half-registered
+ state.
+ **********************************************************************/
+
+NTSTATUS idmap_hash_init(void)
+{
+ static NTSTATUS idmap_status = NT_STATUS_UNSUCCESSFUL;
+ static NTSTATUS nss_status = NT_STATUS_UNSUCCESSFUL;
+
+ if ( !NT_STATUS_IS_OK(idmap_status) ) {
+ idmap_status = smb_register_idmap(SMB_IDMAP_INTERFACE_VERSION,
+ "hash", &hash_idmap_methods);
+
+ if ( !NT_STATUS_IS_OK(idmap_status) ) {
+ DEBUG(0,("Failed to register hash idmap plugin.\n"));
+ return idmap_status;
+ }
+ }
+
+ if ( !NT_STATUS_IS_OK(nss_status) ) {
+ nss_status = smb_register_idmap_nss(SMB_NSS_INFO_INTERFACE_VERSION,
+ "hash", &hash_nss_methods);
+ if ( !NT_STATUS_IS_OK(nss_status) ) {
+ DEBUG(0,("Failed to register hash idmap nss plugin.\n"));
+ return nss_status;
+ }
+ }
+
+ return NT_STATUS_OK;
+}
diff --git a/source3/winbindd/idmap_hash/idmap_hash.h b/source3/winbindd/idmap_hash/idmap_hash.h
new file mode 100644
index 0000000000..621520e950
--- /dev/null
+++ b/source3/winbindd/idmap_hash/idmap_hash.h
@@ -0,0 +1,60 @@
+/*
+ * lwopen.h
+ *
+ * Copyright (C) Gerald Carter <jerry@samba.org>
+ *
+ * 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 _LWOPEN_H
+#define _LWOPEN_H
+
+#define BAIL_ON_NTSTATUS_ERROR(x) \
+ do { \
+ if (!NT_STATUS_IS_OK(x)) { \
+ DEBUG(10,("Failed! (%s)\n", nt_errstr(x))); \
+ goto done; \
+ } \
+ } \
+ while (0); \
+
+#define BAIL_ON_PTR_NT_ERROR(p, x) \
+ do { \
+ if ((p) == NULL ) { \
+ DEBUG(10,("NULL pointer!\n")); \
+ x = NT_STATUS_NO_MEMORY; \
+ goto done; \
+ } else { \
+ x = NT_STATUS_OK; \
+ } \
+ } while (0);
+
+#define PRINT_NTSTATUS_ERROR(x, hdr, level) \
+ do { \
+ if (!NT_STATUS_IS_OK(x)) { \
+ DEBUG(level,("Likewise Open ("hdr"): %s\n", nt_errstr(x))); \
+ } \
+ } while(0);
+
+
+NTSTATUS mapfile_lookup_key(TALLOC_CTX *ctx,
+ const char *value,
+ char **key);
+
+NTSTATUS mapfile_lookup_value(TALLOC_CTX *ctx,
+ const char *key,
+ char **value);
+
+#endif /* _LWOPEN_H */
diff --git a/source3/winbindd/idmap_hash/mapfile.c b/source3/winbindd/idmap_hash/mapfile.c
new file mode 100644
index 0000000000..5ab1142ffe
--- /dev/null
+++ b/source3/winbindd/idmap_hash/mapfile.c
@@ -0,0 +1,175 @@
+/*
+ * mapfile.c
+ *
+ * Copyright (C) Gerald Carter <jerry@samba.org>
+ *
+ * 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/winbindd.h"
+#include "idmap_hash.h"
+#include <stdio.h>
+
+XFILE *lw_map_file = NULL;
+
+/*********************************************************************
+ ********************************************************************/
+
+static bool mapfile_open(void)
+{
+ const char *mapfile_name = NULL;
+
+ /* If we have an open handle, just reset it */
+
+ if (lw_map_file) {
+ return (x_tseek(lw_map_file, 0, SEEK_SET) == 0);
+ }
+
+ mapfile_name = lp_parm_const_string(-1, "idmap_hash", "name_map", NULL);
+ if (!mapfile_name) {
+ return false;
+ }
+
+ lw_map_file = x_fopen(mapfile_name, O_RDONLY, 0);
+ if (!lw_map_file) {
+ DEBUG(0,("can't open idmap_hash:name_map (%s). Error %s\n",
+ mapfile_name, strerror(errno) ));
+ return false;
+ }
+
+ return true;
+}
+
+/*********************************************************************
+ ********************************************************************/
+
+static bool mapfile_read_line(fstring key, fstring value)
+{
+ char buffer[1024];
+ char *p;
+ int len;
+
+ if (!lw_map_file)
+ return false;
+
+ if ((p = x_fgets(buffer, sizeof(buffer)-1, lw_map_file)) == NULL) {
+ return false;
+ }
+
+ /* Strip newlines and carriage returns */
+
+ len = strlen_m(buffer) - 1;
+ while ((buffer[len] == '\n') || (buffer[len] == '\r')) {
+ buffer[len--] = '\0';
+ }
+
+
+ if ((p = strchr_m(buffer, '=')) == NULL ) {
+ DEBUG(0,("idmap_hash: Bad line in name_map (%s)\n", buffer));
+ return false;
+ }
+
+ *p = '\0';
+ p++;
+
+ fstrcpy(key, buffer);
+ fstrcpy(value, p);
+
+ /* Eat whitespace */
+
+ if (!trim_char(key, ' ', ' '))
+ return false;
+
+ if (!trim_char(value, ' ', ' '))
+ return false;
+
+ return true;
+}
+
+/*********************************************************************
+ ********************************************************************/
+
+static bool mapfile_close(void)
+{
+ int ret = 0;
+ if (lw_map_file) {
+ ret = x_fclose(lw_map_file);
+ lw_map_file = NULL;
+ }
+
+ return (ret == 0);
+}
+
+
+/*********************************************************************
+ ********************************************************************/
+
+NTSTATUS mapfile_lookup_key(TALLOC_CTX *ctx, const char *value, char **key)
+{
+ fstring r_key, r_value;
+ NTSTATUS ret = NT_STATUS_NOT_FOUND;
+
+ if (!mapfile_open())
+ return NT_STATUS_OBJECT_PATH_NOT_FOUND;
+
+ while (mapfile_read_line(r_key, r_value))
+ {
+ if (strequal(r_value, value)) {
+ ret = NT_STATUS_OK;
+
+ /* We're done once finishing this block */
+ *key = talloc_strdup(ctx, r_key);
+ if (!*key) {
+ ret = NT_STATUS_NO_MEMORY;
+ }
+ break;
+ }
+ }
+
+ mapfile_close();
+
+ return ret;
+}
+
+/*********************************************************************
+ ********************************************************************/
+
+NTSTATUS mapfile_lookup_value(TALLOC_CTX *ctx, const char *key, char **value)
+{
+ fstring r_key, r_value;
+ NTSTATUS ret = NT_STATUS_NOT_FOUND;
+
+ if (!mapfile_open())
+ return NT_STATUS_OBJECT_PATH_NOT_FOUND;
+
+ while (mapfile_read_line(r_key, r_value))
+ {
+ if (strequal(r_key, key)) {
+ ret = NT_STATUS_OK;
+
+ /* We're done once finishing this block */
+ *value = talloc_strdup(ctx, r_value);
+ if (!*key) {
+ ret = NT_STATUS_NO_MEMORY;
+ }
+ break;
+ }
+ }
+
+ mapfile_close();
+
+ return ret;
+}
diff --git a/source3/winbindd/idmap_tdb.c b/source3/winbindd/idmap_tdb.c
index 9e66eed0c8..f9d3a9fbff 100644
--- a/source3/winbindd/idmap_tdb.c
+++ b/source3/winbindd/idmap_tdb.c
@@ -228,7 +228,7 @@ static NTSTATUS idmap_tdb_open_db(TALLOC_CTX *memctx, TDB_CONTEXT **tdbctx)
goto done;
}
- if (!file_exist(tdbfile, &stbuf)) {
+ if (!file_exist_stat(tdbfile, &stbuf)) {
tdb_is_new = True;
}
diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c
index 3066db6f3b..8bde963c60 100644
--- a/source3/winbindd/idmap_tdb2.c
+++ b/source3/winbindd/idmap_tdb2.c
@@ -94,12 +94,11 @@ static NTSTATUS idmap_tdb2_open_db(void)
*/
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;
- uint32 low_id, high_id;
+ uint32 low_id;
/* see if a idmap script is configured */
idmap_tdb2_state.idmap_script = lp_parm_const_string(-1, "idmap",
@@ -187,6 +186,10 @@ static NTSTATUS idmap_tdb2_allocate_id(struct unixid *xid)
uint32_t high_hwm;
uint32_t hwm;
int res;
+ NTSTATUS status;
+
+ status = idmap_tdb2_open_db();
+ NT_STATUS_NOT_OK_RETURN(status);
/* Get current high water mark */
switch (xid->type) {
@@ -264,6 +267,10 @@ static NTSTATUS idmap_tdb2_get_hwm(struct unixid *xid)
const char *hwmtype;
uint32_t hwm;
uint32_t high_hwm;
+ NTSTATUS status;
+
+ status = idmap_tdb2_open_db();
+ NT_STATUS_NOT_OK_RETURN(status);
/* Get current high water mark */
switch (xid->type) {
@@ -451,6 +458,10 @@ static NTSTATUS idmap_tdb2_id_to_sid(struct idmap_tdb2_context *ctx, struct id_m
NTSTATUS ret;
TDB_DATA data;
char *keystr;
+ NTSTATUS status;
+
+ status = idmap_tdb2_open_db();
+ NT_STATUS_NOT_OK_RETURN(status);
if (!ctx || !map) {
return NT_STATUS_INVALID_PARAMETER;
@@ -546,6 +557,10 @@ static NTSTATUS idmap_tdb2_sid_to_id(struct idmap_tdb2_context *ctx, struct id_m
TDB_DATA data;
char *keystr;
unsigned long rec_id = 0;
+ NTSTATUS status;
+
+ status = idmap_tdb2_open_db();
+ NT_STATUS_NOT_OK_RETURN(status);
if ((keystr = sid_string_talloc(ctx, map->sid)) == NULL) {
DEBUG(0, ("Out of memory!\n"));
diff --git a/source3/winbindd/idmap_util.c b/source3/winbindd/idmap_util.c
index b10a1a4ba9..9f876618be 100644
--- a/source3/winbindd/idmap_util.c
+++ b/source3/winbindd/idmap_util.c
@@ -121,7 +121,7 @@ backend:
return NT_STATUS_NONE_MAPPED;
}
- idmap_cache_set_sid2uid(sid, gid);
+ idmap_cache_set_sid2gid(sid, gid);
return NT_STATUS_OK;
}
diff --git a/source3/winbindd/nss_info.c b/source3/winbindd/nss_info.c
index daa3dd037d..0e8cb60257 100644
--- a/source3/winbindd/nss_info.c
+++ b/source3/winbindd/nss_info.c
@@ -281,6 +281,47 @@ static struct nss_domain_entry *find_nss_domain( const char *domain )
/********************************************************************
*******************************************************************/
+ NTSTATUS nss_map_to_alias( TALLOC_CTX *mem_ctx, const char *domain,
+ const char *name, char **alias )
+{
+ struct nss_domain_entry *p;
+ struct nss_info_methods *m;
+
+ if ( (p = find_nss_domain( domain )) == NULL ) {
+ DEBUG(4,("nss_map_to_alias: Failed to find nss domain pointer for %s\n",
+ domain ));
+ return NT_STATUS_NOT_FOUND;
+ }
+
+ m = p->backend->methods;
+
+ return m->map_to_alias( mem_ctx, domain, name, alias );
+}
+
+
+/********************************************************************
+ *******************************************************************/
+
+ NTSTATUS nss_map_from_alias( TALLOC_CTX *mem_ctx, const char *domain,
+ const char *alias, char **name )
+{
+ struct nss_domain_entry *p;
+ struct nss_info_methods *m;
+
+ if ( (p = find_nss_domain( domain )) == NULL ) {
+ DEBUG(4,("nss_map_from_alias: Failed to find nss domain pointer for %s\n",
+ domain ));
+ return NT_STATUS_NOT_FOUND;
+ }
+
+ m = p->backend->methods;
+
+ return m->map_from_alias( mem_ctx, domain, alias, name );
+}
+
+/********************************************************************
+ *******************************************************************/
+
NTSTATUS nss_close( const char *parameters )
{
struct nss_domain_entry *p = nss_domain_list;
diff --git a/source3/winbindd/nss_info_template.c b/source3/winbindd/nss_info_template.c
index aaf02e4abe..d8f903ddd0 100644
--- a/source3/winbindd/nss_info_template.c
+++ b/source3/winbindd/nss_info_template.c
@@ -45,6 +45,8 @@ static NTSTATUS nss_template_get_info( struct nss_domain_entry *e,
if ( !homedir || !shell || !gecos )
return NT_STATUS_INVALID_PARAMETER;
+ /* protect against home directories using whitespace in the
+ username */
*homedir = talloc_strdup( ctx, lp_template_homedir() );
*shell = talloc_strdup( ctx, lp_template_shell() );
*gecos = NULL;
@@ -56,6 +58,28 @@ static NTSTATUS nss_template_get_info( struct nss_domain_entry *e,
return NT_STATUS_OK;
}
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS nss_template_map_to_alias( TALLOC_CTX *mem_ctx,
+ const char *domain,
+ const char *name,
+ char **alias )
+{
+ return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+/**********************************************************************
+ *********************************************************************/
+
+static NTSTATUS nss_template_map_from_alias( TALLOC_CTX *mem_ctx,
+ const char *domain,
+ const char *alias,
+ char **name )
+{
+ return NT_STATUS_NOT_IMPLEMENTED;
+}
+
/************************************************************************
***********************************************************************/
@@ -69,9 +93,11 @@ static NTSTATUS nss_template_close( void )
***********************************************************************/
static struct nss_info_methods nss_template_methods = {
- .init = nss_template_init,
- .get_nss_info = nss_template_get_info,
- .close_fn = nss_template_close
+ .init = nss_template_init,
+ .get_nss_info = nss_template_get_info,
+ .map_to_alias = nss_template_map_to_alias,
+ .map_from_alias = nss_template_map_from_alias,
+ .close_fn = nss_template_close
};
NTSTATUS nss_info_template_init( void )
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 44b5415726..5d4f21a820 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -66,7 +66,7 @@ static bool reload_services_file(const char *logfile)
if (lp_loaded()) {
const char *fname = lp_configfile();
- if (file_exist(fname,NULL) && !strcsequal(fname,get_dyn_CONFIGFILE())) {
+ if (file_exist(fname) && !strcsequal(fname,get_dyn_CONFIGFILE())) {
set_dyn_CONFIGFILE(fname);
}
}
@@ -1120,7 +1120,7 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
- if (!directory_exist(lp_lockdir(), NULL)) {
+ if (!directory_exist(lp_lockdir())) {
mkdir(lp_lockdir(), 0755);
}
diff --git a/source3/winbindd/winbindd_ads.c b/source3/winbindd/winbindd_ads.c
index 894e7866b3..1febddf110 100644
--- a/source3/winbindd/winbindd_ads.c
+++ b/source3/winbindd/winbindd_ads.c
@@ -1023,10 +1023,11 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
DEBUG(10,("ads: lookup_groupmem: got sid %s from "
"cache\n", sid_string_dbg(&sid)));
sid_copy(&(*sid_mem)[*num_names], &sid);
- (*names)[*num_names] = talloc_asprintf(*names, "%s%c%s",
- domain_name,
- *lp_winbind_separator(),
- name );
+ (*names)[*num_names] = fill_domain_username_talloc(
+ *names,
+ domain_name,
+ name,
+ true);
(*name_types)[*num_names] = name_type;
(*num_names)++;
@@ -1071,11 +1072,12 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
{
sid_copy(&(*sid_mem)[*num_names],
&sid_mem_nocache[i]);
- (*names)[*num_names] = talloc_asprintf( *names,
- "%s%c%s",
- domains_nocache[i],
- *lp_winbind_separator(),
- names_nocache[i] );
+ (*names)[*num_names] =
+ fill_domain_username_talloc(
+ *names,
+ domains_nocache[i],
+ names_nocache[i],
+ true);
(*name_types)[*num_names] = name_types_nocache[i];
(*num_names)++;
}
diff --git a/source3/winbindd/winbindd_async.c b/source3/winbindd/winbindd_async.c
index 1481aed8e1..7500bcbe5b 100644
--- a/source3/winbindd/winbindd_async.c
+++ b/source3/winbindd/winbindd_async.c
@@ -366,7 +366,7 @@ static void lookupname_recv(TALLOC_CTX *mem_ctx, bool success,
/********************************************************************
The lookup name call first contacts a DC in its own domain
- and fallbacks to contact a DC in the forest in our domain doesn't
+ and fallbacks to contact a DC if the forest in our domain doesn't
know the name.
********************************************************************/
diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
index 2fbb01b623..360e915bc4 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -934,6 +934,8 @@ static void wcache_save_lockout_policy(struct winbindd_domain *domain,
centry_free(centry);
}
+
+
static void wcache_save_password_policy(struct winbindd_domain *domain,
NTSTATUS status,
struct samr_DomInfo1 *policy)
@@ -957,6 +959,209 @@ static void wcache_save_password_policy(struct winbindd_domain *domain,
centry_free(centry);
}
+/***************************************************************************
+ ***************************************************************************/
+
+static void wcache_save_username_alias(struct winbindd_domain *domain,
+ NTSTATUS status,
+ const char *name, const char *alias)
+{
+ struct cache_entry *centry;
+ fstring uname;
+
+ if ( (centry = centry_start(domain, status)) == NULL )
+ return;
+
+ centry_put_string( centry, alias );
+
+ fstrcpy(uname, name);
+ strupper_m(uname);
+ centry_end(centry, "NSS/NA/%s", uname);
+
+ DEBUG(10,("wcache_save_username_alias: %s -> %s\n", name, alias ));
+
+ centry_free(centry);
+}
+
+static void wcache_save_alias_username(struct winbindd_domain *domain,
+ NTSTATUS status,
+ const char *alias, const char *name)
+{
+ struct cache_entry *centry;
+ fstring uname;
+
+ if ( (centry = centry_start(domain, status)) == NULL )
+ return;
+
+ centry_put_string( centry, name );
+
+ fstrcpy(uname, alias);
+ strupper_m(uname);
+ centry_end(centry, "NSS/AN/%s", uname);
+
+ DEBUG(10,("wcache_save_alias_username: %s -> %s\n", alias, name ));
+
+ centry_free(centry);
+}
+
+/***************************************************************************
+ ***************************************************************************/
+
+NTSTATUS resolve_username_to_alias( TALLOC_CTX *mem_ctx,
+ struct winbindd_domain *domain,
+ const char *name, char **alias )
+{
+ struct winbind_cache *cache = get_cache(domain);
+ struct cache_entry *centry = NULL;
+ NTSTATUS status;
+ char *upper_name;
+
+ if ( domain->internal )
+ return NT_STATUS_NOT_SUPPORTED;
+
+ if (!cache->tdb)
+ goto do_query;
+
+ if ( (upper_name = SMB_STRDUP(name)) == NULL )
+ return NT_STATUS_NO_MEMORY;
+ strupper_m(upper_name);
+
+ centry = wcache_fetch(cache, domain, "NSS/NA/%s", upper_name);
+
+ SAFE_FREE( upper_name );
+
+ if (!centry)
+ goto do_query;
+
+ status = centry->status;
+
+ if (!NT_STATUS_IS_OK(status)) {
+ centry_free(centry);
+ return status;
+ }
+
+ *alias = centry_string( centry, mem_ctx );
+
+ centry_free(centry);
+
+ DEBUG(10,("resolve_username_to_alias: [Cached] - mapped %s to %s\n",
+ name, *alias ? *alias : "(none)"));
+
+ return (*alias) ? NT_STATUS_OK : NT_STATUS_OBJECT_NAME_NOT_FOUND;
+
+do_query:
+
+ /* If its not in cache and we are offline, then fail */
+
+ if ( get_global_winbindd_state_offline() || !domain->online ) {
+ DEBUG(8,("resolve_username_to_alias: rejecting query "
+ "in offline mode\n"));
+ return NT_STATUS_NOT_FOUND;
+ }
+
+ status = nss_map_to_alias( mem_ctx, domain->name, name, alias );
+
+ if ( NT_STATUS_IS_OK( status ) ) {
+ wcache_save_username_alias(domain, status, name, *alias);
+ }
+
+ if ( NT_STATUS_EQUAL( status, NT_STATUS_NONE_MAPPED ) ) {
+ wcache_save_username_alias(domain, status, name, "(NULL)");
+ }
+
+ DEBUG(5,("resolve_username_to_alias: backend query returned %s\n",
+ nt_errstr(status)));
+
+ if ( NT_STATUS_EQUAL(status, NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND) ) {
+ set_domain_offline( domain );
+ }
+
+ return status;
+}
+
+/***************************************************************************
+ ***************************************************************************/
+
+NTSTATUS resolve_alias_to_username( TALLOC_CTX *mem_ctx,
+ struct winbindd_domain *domain,
+ const char *alias, char **name )
+{
+ struct winbind_cache *cache = get_cache(domain);
+ struct cache_entry *centry = NULL;
+ NTSTATUS status;
+ char *upper_name;
+
+ if ( domain->internal )
+ return NT_STATUS_NOT_SUPPORTED;
+
+ if (!cache->tdb)
+ goto do_query;
+
+ if ( (upper_name = SMB_STRDUP(alias)) == NULL )
+ return NT_STATUS_NO_MEMORY;
+ strupper_m(upper_name);
+
+ centry = wcache_fetch(cache, domain, "NSS/AN/%s", upper_name);
+
+ SAFE_FREE( upper_name );
+
+ if (!centry)
+ goto do_query;
+
+ status = centry->status;
+
+ if (!NT_STATUS_IS_OK(status)) {
+ centry_free(centry);
+ return status;
+ }
+
+ *name = centry_string( centry, mem_ctx );
+
+ centry_free(centry);
+
+ DEBUG(10,("resolve_alias_to_username: [Cached] - mapped %s to %s\n",
+ alias, *name ? *name : "(none)"));
+
+ return (*name) ? NT_STATUS_OK : NT_STATUS_OBJECT_NAME_NOT_FOUND;
+
+do_query:
+
+ /* If its not in cache and we are offline, then fail */
+
+ if ( get_global_winbindd_state_offline() || !domain->online ) {
+ DEBUG(8,("resolve_alias_to_username: rejecting query "
+ "in offline mode\n"));
+ return NT_STATUS_NOT_FOUND;
+ }
+
+ /* an alias cannot contain a domain prefix or '@' */
+
+ if (strchr(alias, '\\') || strchr(alias, '@')) {
+ DEBUG(10,("resolve_alias_to_username: skipping fully "
+ "qualified name %s\n", alias));
+ return NT_STATUS_OBJECT_NAME_INVALID;
+ }
+
+ status = nss_map_from_alias( mem_ctx, domain->name, alias, name );
+
+ if ( NT_STATUS_IS_OK( status ) ) {
+ wcache_save_alias_username( domain, status, alias, *name );
+ }
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NONE_MAPPED)) {
+ wcache_save_alias_username(domain, status, alias, "(NULL)");
+ }
+
+ DEBUG(5,("resolve_alias_to_username: backend query returned %s\n",
+ nt_errstr(status)));
+
+ if ( NT_STATUS_EQUAL(status, NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND) ) {
+ set_domain_offline( domain );
+ }
+
+ return status;
+}
+
NTSTATUS wcache_cached_creds_exist(struct winbindd_domain *domain, const DOM_SID *sid)
{
struct winbind_cache *cache = get_cache(domain);
@@ -3257,6 +3462,48 @@ static int validate_pwinfo(TALLOC_CTX *mem_ctx, const char *keystr,
return 0;
}
+static int validate_nss_an(TALLOC_CTX *mem_ctx, const char *keystr,
+ TDB_DATA dbuf,
+ struct tdb_validation_status *state)
+{
+ struct cache_entry *centry = create_centry_validate(keystr, dbuf, state);
+
+ if (!centry) {
+ return 1;
+ }
+
+ (void)centry_string( centry, mem_ctx );
+
+ centry_free(centry);
+
+ if (!(state->success)) {
+ return 1;
+ }
+ DEBUG(10,("validate_pwinfo: %s ok\n", keystr));
+ return 0;
+}
+
+static int validate_nss_na(TALLOC_CTX *mem_ctx, const char *keystr,
+ TDB_DATA dbuf,
+ struct tdb_validation_status *state)
+{
+ struct cache_entry *centry = create_centry_validate(keystr, dbuf, state);
+
+ if (!centry) {
+ return 1;
+ }
+
+ (void)centry_string( centry, mem_ctx );
+
+ centry_free(centry);
+
+ if (!(state->success)) {
+ return 1;
+ }
+ DEBUG(10,("validate_pwinfo: %s ok\n", keystr));
+ return 0;
+}
+
static int validate_trustdoms(TALLOC_CTX *mem_ctx, const char *keystr, TDB_DATA dbuf,
struct tdb_validation_status *state)
{
@@ -3358,6 +3605,8 @@ struct key_val_struct {
{"NSS/PWINFO/", validate_pwinfo},
{"TRUSTDOMS/", validate_trustdoms},
{"TRUSTDOMCACHE/", validate_trustdomcache},
+ {"NSS/NA/", validate_nss_na},
+ {"NSS/AN/", validate_nss_an},
{"WINBINDD_OFFLINE", validate_offline},
{WINBINDD_CACHE_VERSION_KEYSTR, validate_cache_version},
{NULL, NULL}
diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c
index ce851649ba..db43101a34 100644
--- a/source3/winbindd/winbindd_cm.c
+++ b/source3/winbindd/winbindd_cm.c
@@ -1080,7 +1080,7 @@ static bool dcip_to_name(TALLOC_CTX *mem_ctx,
fstring name )
{
struct ip_service ip_list;
- uint32_t nt_version = NETLOGON_VERSION_1;
+ uint32_t nt_version = NETLOGON_NT_VERSION_1;
ip_list.ss = *pss;
ip_list.port = 0;
diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c
index 63ce0e8d7f..994c94b5be 100644
--- a/source3/winbindd/winbindd_dual.c
+++ b/source3/winbindd/winbindd_dual.c
@@ -120,6 +120,10 @@ void async_request(TALLOC_CTX *mem_ctx, struct winbindd_child *child,
SMB_ASSERT(continuation != NULL);
+ DEBUG(10, ("Sending request to child pid %d (domain=%s)\n",
+ (int)child->pid,
+ (child->domain != NULL) ? child->domain->name : "''"));
+
state = TALLOC_P(mem_ctx, struct winbindd_async_request);
if (state == NULL) {
@@ -196,10 +200,12 @@ static void async_request_fail(struct winbindd_async_request *state)
TALLOC_FREE(state->reply_timeout_event);
- SMB_ASSERT(state->child_pid != (pid_t)0);
+ /* If child exists and is not already reaped,
+ send kill signal to child. */
- /* If not already reaped, send kill signal to child. */
- if (state->child->pid == state->child_pid) {
+ if ((state->child->pid != (pid_t)0) &&
+ (state->child->pid != (pid_t)-1) &&
+ (state->child->pid == state->child_pid)) {
kill(state->child_pid, SIGTERM);
/*
@@ -294,13 +300,27 @@ static void schedule_async_request(struct winbindd_child *child)
return; /* Busy */
}
+ /*
+ * This may be a reschedule, so we might
+ * have an existing timeout event pending on
+ * the first entry in the child->requests list
+ * (we only send one request at a time).
+ * Ensure we free it before we reschedule.
+ * Bug #5814, from hargagan <shargagan@novell.com>.
+ * JRA.
+ */
+
+ TALLOC_FREE(request->reply_timeout_event);
+
if ((child->pid == 0) && (!fork_domain_child(child))) {
- /* Cancel all outstanding requests */
+ /* fork_domain_child failed.
+ Cancel all outstanding requests */
while (request != NULL) {
/* request might be free'd in the continuation */
struct winbindd_async_request *next = request->next;
- request->continuation(request->private_data, False);
+
+ async_request_fail(request);
request = next;
}
return;
@@ -487,6 +507,17 @@ void winbind_child_died(pid_t pid)
child->event.flags = 0;
child->pid = 0;
+ if (child->requests) {
+ /*
+ * schedule_async_request() will also
+ * clear this event but the call is
+ * idempotent so it doesn't hurt to
+ * cover all possible future code
+ * paths. JRA.
+ */
+ TALLOC_FREE(child->requests->reply_timeout_event);
+ }
+
schedule_async_request(child);
}
@@ -874,7 +905,7 @@ static bool calculate_next_machine_pwd_change(const char *domain,
if (time(NULL) < (pass_last_set_time + timeout)) {
next_change = pass_last_set_time + timeout;
DEBUG(10,("machine password still valid until: %s\n",
- http_timestring(next_change)));
+ http_timestring(talloc_tos(), next_change)));
*t = timeval_set(next_change, 0);
return true;
}
diff --git a/source3/winbindd/winbindd_group.c b/source3/winbindd/winbindd_group.c
index 4d5026d158..f2b6fbefb5 100644
--- a/source3/winbindd/winbindd_group.c
+++ b/source3/winbindd/winbindd_group.c
@@ -35,7 +35,11 @@ static void add_member(const char *domain, const char *user,
{
fstring name;
- fill_domain_username(name, domain, user, True);
+ if (domain != NULL) {
+ fill_domain_username(name, domain, user, True);
+ } else {
+ fstrcpy(name, user);
+ }
safe_strcat(name, ",", sizeof(name)-1);
string_append(pp_members, name);
*p_num_members += 1;
@@ -136,7 +140,7 @@ static void add_expanded_sid(const DOM_SID *sid,
continue;
}
- add_member(domain->name, names[i], pp_members, p_num_members);
+ add_member(NULL, names[i], pp_members, p_num_members);
}
done:
@@ -179,12 +183,32 @@ static bool fill_passdb_alias_grmem(struct winbindd_domain *domain,
/* Fill a grent structure from various other information */
-static bool fill_grent(struct winbindd_gr *gr, const char *dom_name,
- const char *gr_name, gid_t unix_gid)
+static bool fill_grent(TALLOC_CTX *mem_ctx, struct winbindd_gr *gr,
+ const char *dom_name,
+ char *gr_name, gid_t unix_gid)
{
fstring full_group_name;
+ char *mapped_name = NULL;
+ struct winbindd_domain *domain = find_domain_from_name_noinit(dom_name);
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+
+ nt_status = normalize_name_map(mem_ctx, domain, gr_name,
+ &mapped_name);
- fill_domain_username( full_group_name, dom_name, gr_name, True );
+ /* Basic whitespace replacement */
+ if (NT_STATUS_IS_OK(nt_status)) {
+ fill_domain_username(full_group_name, dom_name,
+ mapped_name, true);
+ }
+ /* Mapped to an aliase */
+ else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_FILE_RENAMED)) {
+ fstrcpy(full_group_name, mapped_name);
+ }
+ /* no change */
+ else {
+ fill_domain_username( full_group_name, dom_name,
+ gr_name, True );
+ }
gr->gr_gid = unix_gid;
@@ -280,7 +304,10 @@ static bool fill_grent_mem_domusers( TALLOC_CTX *mem_ctx,
char *domainname = NULL;
char *username = NULL;
fstring name;
+ char *mapped_name = NULL;
enum lsa_SidType type;
+ struct winbindd_domain *target_domain = NULL;
+ NTSTATUS name_map_status = NT_STATUS_UNSUCCESSFUL;
DEBUG(10,("fill_grent_mem_domain_users: "
"sid %s in 'Domain Users' in domain %s\n",
@@ -300,7 +327,24 @@ static bool fill_grent_mem_domusers( TALLOC_CTX *mem_ctx,
nt_errstr(status)));
return False;
}
- fill_domain_username(name, domain->name, username, True);
+
+ target_domain = find_domain_from_name_noinit(domainname);
+ name_map_status = normalize_name_map(mem_ctx, target_domain,
+ username, &mapped_name);
+
+ /* Basic whitespace replacement */
+ if (NT_STATUS_IS_OK(name_map_status)) {
+ fill_domain_username(name, domainname, mapped_name, true);
+ }
+ /* Mapped to an alias */
+ else if (NT_STATUS_EQUAL(name_map_status, NT_STATUS_FILE_RENAMED)) {
+ fstrcpy(name, mapped_name);
+ }
+ /* no mapping done...use original name */
+ else {
+ fill_domain_username(name, domainname, username, true);
+ }
+
len = strlen(name);
buf_len = len + 1;
if (!(buf = (char *)SMB_MALLOC(buf_len))) {
@@ -552,6 +596,7 @@ static bool fill_grent_mem(struct winbindd_domain *domain,
uint32 n_members = 0;
char **members = NULL;
NTSTATUS nt_status;
+ int j;
nt_status = expand_groups( mem_ctx, domain,
glist, n_glist,
@@ -562,13 +607,45 @@ static bool fill_grent_mem(struct winbindd_domain *domain,
goto done;
}
- /* Add new group members to list */
+ /* Add new group members to list. Pass through the
+ alias mapping function */
- nt_status = add_names_to_list( mem_ctx, &names, &num_names,
- members, n_members );
- if ( !NT_STATUS_IS_OK(nt_status) ) {
- result = False;
- goto done;
+ for (j=0; j<n_members; j++) {
+ fstring name_domain, name_acct;
+ fstring qualified_name;
+ char *mapped_name = NULL;
+ NTSTATUS name_map_status = NT_STATUS_UNSUCCESSFUL;
+ struct winbindd_domain *target_domain = NULL;
+
+ if (parse_domain_user(members[j], name_domain, name_acct)) {
+ target_domain = find_domain_from_name_noinit(name_domain);
+ /* NOW WHAT ? */
+ }
+ if (!target_domain) {
+ target_domain = domain;
+ }
+
+ name_map_status = normalize_name_map(members, target_domain,
+ name_acct, &mapped_name);
+
+ /* Basic whitespace replacement */
+ if (NT_STATUS_IS_OK(name_map_status)) {
+ fill_domain_username(qualified_name, name_domain,
+ mapped_name, true);
+ mapped_name = qualified_name;
+ }
+ /* no mapping at all */
+ else if (!NT_STATUS_EQUAL(name_map_status, NT_STATUS_FILE_RENAMED)) {
+ mapped_name = members[j];
+ }
+
+ nt_status = add_names_to_list( mem_ctx, &names,
+ &num_names,
+ &mapped_name, 1);
+ if ( !NT_STATUS_IS_OK(nt_status) ) {
+ result = False;
+ goto done;
+ }
}
TALLOC_FREE( members );
@@ -679,6 +756,7 @@ void winbindd_getgrnam(struct winbindd_cli_state *state)
struct winbindd_domain *domain;
fstring name_domain, name_group;
char *tmp;
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
/* Ensure null termination */
state->request.data.groupname[sizeof(state->request.data.groupname)-1]='\0';
@@ -686,11 +764,20 @@ void winbindd_getgrnam(struct winbindd_cli_state *state)
DEBUG(3, ("[%5lu]: getgrnam %s\n", (unsigned long)state->pid,
state->request.data.groupname));
- /* Parse domain and groupname */
+ nt_status = normalize_name_unmap(state->mem_ctx,
+ state->request.data.groupname,
+ &tmp);
+ /* If we didn't map anything in the above call, just reset the
+ tmp pointer to the original string */
+ if (!NT_STATUS_IS_OK(nt_status) &&
+ !NT_STATUS_EQUAL(nt_status, NT_STATUS_FILE_RENAMED))
+ {
+ tmp = state->request.data.groupname;
+ }
- memset(name_group, 0, sizeof(fstring));
+ /* Parse domain and groupname */
- tmp = state->request.data.groupname;
+ memset(name_group, 0, sizeof(name_group));
name_domain[0] = '\0';
name_group[0] = '\0';
@@ -723,7 +810,7 @@ void winbindd_getgrnam(struct winbindd_cli_state *state)
/* Get rid and name type from name */
- ws_name_replace( name_group, WB_REPLACE_CHAR );
+ fstrcpy( name_group, tmp );
winbindd_lookupname_async( state->mem_ctx, domain->name, name_group,
getgrnam_recv, WINBINDD_GETGRNAM, state );
@@ -771,7 +858,8 @@ static void getgrsid_sid2gid_recv(void *private_data, bool success, gid_t gid)
return;
}
- if (!fill_grent(&s->state->response.data.gr, dom_name, group_name, gid) ||
+ if (!fill_grent(s->state->mem_ctx, &s->state->response.data.gr,
+ dom_name, group_name, gid) ||
!fill_grent_mem(domain, s->state, &s->group_sid, s->group_type,
&num_gr_mem, &gr_mem, &gr_mem_len))
{
@@ -796,6 +884,9 @@ static void getgrsid_lookupsid_recv( void *private_data, bool success,
enum lsa_SidType name_type )
{
struct getgrsid_state *s = (struct getgrsid_state *)private_data;
+ char *mapped_name = NULL;
+ fstring raw_name;
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
if (!success) {
DEBUG(5,("getgrsid_lookupsid_recv: lookupsid failed!\n"));
@@ -814,15 +905,39 @@ static void getgrsid_lookupsid_recv( void *private_data, bool success,
dom_name, name, name_type));
request_error(s->state);
return;
-}
+ }
- if ( (s->group_name = talloc_asprintf( s->state->mem_ctx,
- "%s%c%s",
- dom_name,
- *lp_winbind_separator(),
- name)) == NULL )
-{
- DEBUG(1, ("getgrsid_lookupsid_recv: talloc_asprintf() Failed!\n"));
+ /* normalize the name and ensure that we have the DOM\name
+ coming out of here */
+
+ fstrcpy(raw_name, name);
+
+ nt_status = normalize_name_unmap(s->state->mem_ctx, raw_name,
+ &mapped_name);
+
+ /* basiuc whitespace reversal */
+ if (NT_STATUS_IS_OK(nt_status)) {
+ s->group_name = talloc_asprintf(s->state->mem_ctx,
+ "%s%c%s",
+ dom_name,
+ *lp_winbind_separator(),
+ mapped_name);
+ }
+ /* mapped from alias */
+ else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_FILE_RENAMED)) {
+ s->group_name = mapped_name;
+ }
+ /* no mapping at all. use original string */
+ else {
+ s->group_name = talloc_asprintf(s->state->mem_ctx,
+ "%s%c%s",
+ dom_name,
+ *lp_winbind_separator(),
+ raw_name);
+ }
+
+ if (s->group_name == NULL) {
+ DEBUG(1, ("getgrsid_lookupsid_recv: group_name is NULL!\n"));
request_error(s->state);
return;
}
@@ -831,10 +946,10 @@ static void getgrsid_lookupsid_recv( void *private_data, bool success,
winbindd_sid2gid_async(s->state->mem_ctx, &s->group_sid,
getgrsid_sid2gid_recv, s);
- }
+}
static void winbindd_getgrsid( struct winbindd_cli_state *state, const DOM_SID group_sid )
- {
+{
struct getgrsid_state *s;
if ( (s = TALLOC_ZERO_P(state->mem_ctx, struct getgrsid_state)) == NULL ) {
@@ -1261,7 +1376,7 @@ void winbindd_getgrent(struct winbindd_cli_state *state)
fill_domain_username(domain_group_name, ent->domain_name,
name_list[ent->sam_entry_index].acct_name, True);
- result = fill_grent(&group_list[group_list_ndx],
+ result = fill_grent(state->mem_ctx, &group_list[group_list_ndx],
ent->domain_name,
name_list[ent->sam_entry_index].acct_name,
group_gid);
@@ -1413,6 +1528,8 @@ static void getgroups_sid2gid_recv(void *private_data, bool success, gid_t gid);
void winbindd_getgroups(struct winbindd_cli_state *state)
{
struct getgroups_state *s;
+ char *real_name = NULL;
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
/* Ensure null termination */
state->request.data.username
@@ -1432,13 +1549,22 @@ void winbindd_getgroups(struct winbindd_cli_state *state)
s->state = state;
- ws_name_return( state->request.data.username, WB_REPLACE_CHAR );
+ nt_status = normalize_name_unmap(state->mem_ctx,
+ state->request.data.username,
+ &real_name);
+
+ /* Reset the real_name pointer if we didn't do anything
+ productive in the above call */
+ if (!NT_STATUS_IS_OK(nt_status) &&
+ !NT_STATUS_EQUAL(nt_status, NT_STATUS_FILE_RENAMED))
+ {
+ real_name = state->request.data.username;
+ }
- if (!parse_domain_user_talloc(state->mem_ctx,
- state->request.data.username,
+ if (!parse_domain_user_talloc(state->mem_ctx, real_name,
&s->domname, &s->username)) {
DEBUG(5, ("Could not parse domain user: %s\n",
- state->request.data.username));
+ real_name));
/* error out if we do not have nested group support */
diff --git a/source3/winbindd/winbindd_locator.c b/source3/winbindd/winbindd_locator.c
index b2a8bd7e30..b60d235f70 100644
--- a/source3/winbindd/winbindd_locator.c
+++ b/source3/winbindd/winbindd_locator.c
@@ -45,11 +45,15 @@ struct winbindd_child *locator_child(void)
void winbindd_dsgetdcname(struct winbindd_cli_state *state)
{
- state->request.domain_name
- [sizeof(state->request.domain_name)-1] = '\0';
+ state->request.data.dsgetdcname.domain_name
+ [sizeof(state->request.data.dsgetdcname.domain_name)-1] = '\0';
+ state->request.data.dsgetdcname.site_name
+ [sizeof(state->request.data.dsgetdcname.site_name)-1] = '\0';
+ state->request.data.dsgetdcname.domain_guid
+ [sizeof(state->request.data.dsgetdcname.domain_guid)-1] = '\0';
DEBUG(3, ("[%5lu]: dsgetdcname for %s\n", (unsigned long)state->pid,
- state->request.domain_name));
+ state->request.data.dsgetdcname.domain_name));
sendto_child(state, locator_child());
}
@@ -94,44 +98,59 @@ static uint32_t get_dsgetdc_flags(uint32_t wbc_flags)
return ds_flags;
}
-
static enum winbindd_result dual_dsgetdcname(struct winbindd_domain *domain,
struct winbindd_cli_state *state)
{
NTSTATUS result;
struct netr_DsRGetDCNameInfo *info = NULL;
- const char *dc = NULL;
uint32_t ds_flags = 0;
+ struct GUID guid, *guid_ptr = NULL;
+ const char *guid_str = NULL;
- state->request.domain_name
- [sizeof(state->request.domain_name)-1] = '\0';
+ state->request.data.dsgetdcname.domain_name
+ [sizeof(state->request.data.dsgetdcname.domain_name)-1] = '\0';
+ state->request.data.dsgetdcname.site_name
+ [sizeof(state->request.data.dsgetdcname.site_name)-1] = '\0';
+ state->request.data.dsgetdcname.domain_guid
+ [sizeof(state->request.data.dsgetdcname.domain_guid)-1] = '\0';
DEBUG(3, ("[%5lu]: dsgetdcname for %s\n", (unsigned long)state->pid,
- state->request.domain_name));
+ state->request.data.dsgetdcname.domain_name));
ds_flags = get_dsgetdc_flags(state->request.flags);
- result = dsgetdcname(state->mem_ctx, winbind_messaging_context(),
- state->request.domain_name,
- NULL, NULL, ds_flags, &info);
-
- if (!NT_STATUS_IS_OK(result)) {
- return WINBINDD_ERROR;
+ result = GUID_from_string(state->request.data.dsgetdcname.domain_guid,
+ &guid);
+ if (NT_STATUS_IS_OK(result) && !GUID_all_zero(&guid)) {
+ guid_ptr = &guid;
}
- if (info->dc_address) {
- dc = strip_hostname(info->dc_address);
- }
+ result = dsgetdcname(state->mem_ctx,
+ winbind_messaging_context(),
+ state->request.data.dsgetdcname.domain_name,
+ guid_ptr,
+ state->request.data.dsgetdcname.site_name,
+ ds_flags,
+ &info);
- if ((!dc || !is_ipaddress_v4(dc)) && info->dc_unc) {
- dc = strip_hostname(info->dc_unc);
+ if (!NT_STATUS_IS_OK(result)) {
+ return WINBINDD_ERROR;
}
- if (!dc || !*dc) {
+ guid_str = GUID_string(state->mem_ctx, &info->domain_guid);
+ if (!guid_str) {
return WINBINDD_ERROR;
}
- fstrcpy(state->response.data.dc_name, dc);
+ fstrcpy(state->response.data.dsgetdcname.dc_unc, info->dc_unc);
+ fstrcpy(state->response.data.dsgetdcname.dc_address, info->dc_address);
+ state->response.data.dsgetdcname.dc_address_type = info->dc_address_type;
+ fstrcpy(state->response.data.dsgetdcname.domain_guid, guid_str);
+ fstrcpy(state->response.data.dsgetdcname.domain_name, info->domain_name);
+ fstrcpy(state->response.data.dsgetdcname.forest_name, info->forest_name);
+ state->response.data.dsgetdcname.dc_flags = info->dc_flags;
+ fstrcpy(state->response.data.dsgetdcname.dc_site_name, info->dc_site_name);
+ fstrcpy(state->response.data.dsgetdcname.client_site_name, info->client_site_name);
return WINBINDD_OK;
}
diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c
index d4a2e3ed79..9ff3899661 100644
--- a/source3/winbindd/winbindd_pam.c
+++ b/source3/winbindd/winbindd_pam.c
@@ -127,7 +127,7 @@ static NTSTATUS append_info3_as_ndr(TALLOC_CTX *mem_ctx,
DATA_BLOB blob;
enum ndr_err_code ndr_err;
- ndr_err = ndr_push_struct_blob(&blob, mem_ctx, info3,
+ ndr_err = ndr_push_struct_blob(&blob, mem_ctx, NULL, info3,
(ndr_push_flags_fn_t)ndr_push_netr_SamInfo3);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
DEBUG(0,("append_info3_as_ndr: failed to append\n"));
@@ -811,7 +811,9 @@ void winbindd_pam_auth(struct winbindd_cli_state *state)
{
struct winbindd_domain *domain;
fstring name_domain, name_user;
+ char *mapped_user = NULL;
NTSTATUS result;
+ NTSTATUS name_map_status = NT_STATUS_UNSUCCESSFUL;
/* Ensure null termination */
state->request.data.auth.user
@@ -831,10 +833,20 @@ void winbindd_pam_auth(struct winbindd_cli_state *state)
/* Parse domain and username */
- ws_name_return( state->request.data.auth.user, WB_REPLACE_CHAR );
+ name_map_status = normalize_name_unmap(state->mem_ctx,
+ state->request.data.auth.user,
+ &mapped_user);
- if (!canonicalize_username(state->request.data.auth.user,
- name_domain, name_user)) {
+ /* If the name normalization didnt' actually do anything,
+ just use the original name */
+
+ if (!NT_STATUS_IS_OK(name_map_status) &&
+ !NT_STATUS_EQUAL(name_map_status, NT_STATUS_FILE_RENAMED))
+ {
+ mapped_user = state->request.data.auth.user;
+ }
+
+ if (!canonicalize_username(mapped_user, name_domain, name_user)) {
result = NT_STATUS_NO_SUCH_USER;
goto done;
}
@@ -1447,7 +1459,10 @@ enum winbindd_result winbindd_dual_pam_auth(struct winbindd_domain *domain,
NTSTATUS result = NT_STATUS_LOGON_FAILURE;
NTSTATUS krb5_result = NT_STATUS_OK;
fstring name_domain, name_user;
+ char *mapped_user;
+ fstring domain_user;
struct netr_SamInfo3 *info3 = NULL;
+ NTSTATUS name_map_status = NT_STATUS_UNSUCCESSFUL;
/* Ensure null termination */
state->request.data.auth.user[sizeof(state->request.data.auth.user)-1]='\0';
@@ -1465,9 +1480,26 @@ enum winbindd_result winbindd_dual_pam_auth(struct winbindd_domain *domain,
/* Parse domain and username */
- ws_name_return( state->request.data.auth.user, WB_REPLACE_CHAR );
+ name_map_status = normalize_name_unmap(state->mem_ctx,
+ state->request.data.auth.user,
+ &mapped_user);
- parse_domain_user(state->request.data.auth.user, name_domain, name_user);
+ /* If the name normalization didnt' actually do anything,
+ just use the original name */
+
+ if (!NT_STATUS_IS_OK(name_map_status) &&
+ !NT_STATUS_EQUAL(name_map_status, NT_STATUS_FILE_RENAMED))
+ {
+ mapped_user = state->request.data.auth.user;
+ }
+
+ parse_domain_user(mapped_user, name_domain, name_user);
+
+ if ( mapped_user != state->request.data.auth.user ) {
+ fstr_sprintf( domain_user, "%s\\%s", name_domain, name_user );
+ safe_strcpy( state->request.data.auth.user, domain_user,
+ sizeof(state->request.data.auth.user)-1 );
+ }
if (domain->online == false) {
result = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND;
@@ -1970,14 +2002,30 @@ done:
void winbindd_pam_chauthtok(struct winbindd_cli_state *state)
{
fstring domain, user;
+ char *mapped_user;
struct winbindd_domain *contact_domain;
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
DEBUG(3, ("[%5lu]: pam chauthtok %s\n", (unsigned long)state->pid,
state->request.data.chauthtok.user));
/* Setup crap */
- ws_name_return( state->request.data.auth.user, WB_REPLACE_CHAR );
+ nt_status = normalize_name_unmap(state->mem_ctx,
+ state->request.data.chauthtok.user,
+ &mapped_user);
+
+ /* Update the chauthtok name if we did any mapping */
+
+ if (NT_STATUS_IS_OK(nt_status) ||
+ NT_STATUS_EQUAL(nt_status, NT_STATUS_FILE_RENAMED))
+ {
+ fstrcpy(state->request.data.chauthtok.user, mapped_user);
+ }
+
+ /* Must pass in state->...chauthtok.user because
+ canonicalize_username() assumes an fstring(). Since
+ we have already copied it (if necessary), this is ok. */
if (!canonicalize_username(state->request.data.chauthtok.user, domain, user)) {
set_auth_errors(&state->response, NT_STATUS_NO_SUCH_USER);
diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h
index e0fc073a0a..95ccf30cfe 100644
--- a/source3/winbindd/winbindd_proto.h
+++ b/source3/winbindd/winbindd_proto.h
@@ -48,8 +48,6 @@ int count_all_current_connections(void);
bool claim_connection(connection_struct *conn, const char *name,
uint32 msg_flags);
bool register_message_flags(bool doreg, uint32 msg_flags);
-bool store_pipe_opendb( smb_np_struct *p );
-bool delete_pipe_opendb( smb_np_struct *p );
/* The following definitions come from winbindd/winbindd.c */
@@ -569,6 +567,10 @@ bool parse_domain_user_talloc(TALLOC_CTX *mem_ctx, const char *domuser,
void parse_add_domuser(void *buf, char *domuser, int *len);
bool canonicalize_username(fstring username_inout, fstring domain, fstring user);
void fill_domain_username(fstring name, const char *domain, const char *user, bool can_assume);
+char *fill_domain_username_talloc(TALLOC_CTX *ctx,
+ const char *domain,
+ const char *user,
+ bool can_assume);
const char *get_winbind_pipe_dir(void) ;
char *get_winbind_priv_pipe_dir(void) ;
int open_winbindd_socket(void);
@@ -583,8 +585,22 @@ NTSTATUS lookup_usergroups_cached(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
const DOM_SID *user_sid,
uint32 *p_num_groups, DOM_SID **user_sids);
-void ws_name_replace( char *name, char replace );
-void ws_name_return( char *name, char replace );
+
+NTSTATUS normalize_name_map(TALLOC_CTX *mem_ctx,
+ struct winbindd_domain *domain,
+ char *name,
+ char **normalized);
+NTSTATUS normalize_name_unmap(TALLOC_CTX *mem_ctx,
+ char *name,
+ char **normalized);
+
+NTSTATUS resolve_username_to_alias(TALLOC_CTX *mem_ctx,
+ struct winbindd_domain *domain,
+ const char *name, char **alias);
+NTSTATUS resolve_alias_to_username(TALLOC_CTX *mem_ctx,
+ struct winbindd_domain *domain,
+ const char *alias, char **name);
+
bool winbindd_can_contact_domain(struct winbindd_domain *domain);
bool winbindd_internal_child(struct winbindd_child *child);
void winbindd_set_locator_kdc_envs(const struct winbindd_domain *domain);
diff --git a/source3/winbindd/winbindd_rpc.c b/source3/winbindd/winbindd_rpc.c
index bb79d7ec12..d966e50159 100644
--- a/source3/winbindd/winbindd_rpc.c
+++ b/source3/winbindd/winbindd_rpc.c
@@ -279,6 +279,8 @@ NTSTATUS msrpc_name_to_sid(struct winbindd_domain *domain,
char *full_name = NULL;
struct rpc_pipe_client *cli;
POLICY_HND lsa_policy;
+ NTSTATUS name_map_status = NT_STATUS_UNSUCCESSFUL;
+ char *mapped_name = NULL;
if (name == NULL || *name=='\0') {
full_name = talloc_asprintf(mem_ctx, "%s", domain_name);
@@ -294,9 +296,19 @@ NTSTATUS msrpc_name_to_sid(struct winbindd_domain *domain,
DEBUG(3,("rpc: name_to_sid name=%s\n", full_name));
- ws_name_return( full_name, WB_REPLACE_CHAR );
+ name_map_status = normalize_name_unmap(mem_ctx, full_name,
+ &mapped_name);
- DEBUG(3,("name_to_sid [rpc] %s for domain %s\n", full_name?full_name:"", domain_name ));
+ /* Reset the full_name pointer if we mapped anytthing */
+
+ if (NT_STATUS_IS_OK(name_map_status) ||
+ NT_STATUS_EQUAL(name_map_status, NT_STATUS_FILE_RENAMED))
+ {
+ full_name = mapped_name;
+ }
+
+ DEBUG(3,("name_to_sid [rpc] %s for domain %s\n",
+ full_name?full_name:"", domain_name ));
result = cm_connect_lsa(domain, mem_ctx, &cli, &lsa_policy);
if (!NT_STATUS_IS_OK(result))
@@ -332,6 +344,8 @@ NTSTATUS msrpc_sid_to_name(struct winbindd_domain *domain,
NTSTATUS result;
struct rpc_pipe_client *cli;
POLICY_HND lsa_policy;
+ NTSTATUS name_map_status = NT_STATUS_UNSUCCESSFUL;
+ char *mapped_name = NULL;
DEBUG(3,("sid_to_name [rpc] %s for domain %s\n", sid_string_dbg(sid),
domain->name ));
@@ -356,9 +370,17 @@ NTSTATUS msrpc_sid_to_name(struct winbindd_domain *domain,
*domain_name = domains[0];
*name = names[0];
- ws_name_replace( *name, WB_REPLACE_CHAR );
-
DEBUG(5,("Mapped sid to [%s]\\[%s]\n", domains[0], *name));
+
+ name_map_status = normalize_name_map(mem_ctx, domain, *name,
+ &mapped_name);
+ if (NT_STATUS_IS_OK(name_map_status) ||
+ NT_STATUS_EQUAL(name_map_status, NT_STATUS_FILE_RENAMED))
+ {
+ *name = mapped_name;
+ DEBUG(5,("returning mapped name -- %s\n", *name));
+ }
+
return NT_STATUS_OK;
}
@@ -411,8 +433,20 @@ NTSTATUS msrpc_rids_to_names(struct winbindd_domain *domain,
ret_names = *names;
for (i=0; i<num_rids; i++) {
+ NTSTATUS name_map_status = NT_STATUS_UNSUCCESSFUL;
+ char *mapped_name = NULL;
+
if ((*types)[i] != SID_NAME_UNKNOWN) {
- ws_name_replace( ret_names[i], WB_REPLACE_CHAR );
+ name_map_status = normalize_name_map(mem_ctx,
+ domain,
+ ret_names[i],
+ &mapped_name);
+ if (NT_STATUS_IS_OK(name_map_status) ||
+ NT_STATUS_EQUAL(name_map_status, NT_STATUS_FILE_RENAMED))
+ {
+ ret_names[i] = mapped_name;
+ }
+
*domain_name = domains[i];
}
}
@@ -820,7 +854,10 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
}
for (r=0; r<tmp_names.count; r++) {
- (*names)[i+r] = CONST_DISCARD(char *, tmp_names.names[r].string);
+ (*names)[i+r] = fill_domain_username_talloc(mem_ctx,
+ domain->name,
+ tmp_names.names[r].string,
+ true);
(*name_types)[i+r] = tmp_types.ids[r];
}
@@ -981,7 +1018,7 @@ static NTSTATUS sequence_number(struct winbindd_domain *domain, uint32 *seq)
&info);
if (NT_STATUS_IS_OK(result)) {
- *seq = info->info2.sequence_num;
+ *seq = info->general.sequence_num;
got_seq_num = True;
}
diff --git a/source3/winbindd/winbindd_user.c b/source3/winbindd/winbindd_user.c
index 3b6dfdda1c..e5d0a22a73 100644
--- a/source3/winbindd/winbindd_user.c
+++ b/source3/winbindd/winbindd_user.c
@@ -67,12 +67,15 @@ static bool fillup_pw_field(const char *lp_template,
}
/* Fill a pwent structure with information we have obtained */
-static bool winbindd_fill_pwent(char *dom_name, char *user_name,
+static bool winbindd_fill_pwent(TALLOC_CTX *ctx, char *dom_name, char *user_name,
DOM_SID *user_sid, DOM_SID *group_sid,
char *full_name, char *homedir, char *shell,
struct winbindd_pw *pw)
{
fstring output_username;
+ char *mapped_name = NULL;
+ struct winbindd_domain *domain = NULL;
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
if (!pw || !dom_name || !user_name)
return False;
@@ -99,7 +102,28 @@ static bool winbindd_fill_pwent(char *dom_name, char *user_name,
/* Username */
- fill_domain_username(output_username, dom_name, user_name, True);
+ domain = find_domain_from_name_noinit(dom_name);
+ if (domain) {
+ nt_status = normalize_name_map(ctx, domain, user_name,
+ &mapped_name);
+ } else {
+ DEBUG(5,("winbindd_fill_pwent: Failed to find domain for %s. "
+ "Disabling name alias support\n", dom_name));
+ nt_status = NT_STATUS_NO_SUCH_DOMAIN;
+ }
+
+ /* Basic removal of whitespace */
+ if (NT_STATUS_IS_OK(nt_status)) {
+ fill_domain_username(output_username, dom_name, mapped_name, True);
+ }
+ /* Complete name replacement */
+ else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_FILE_RENAMED)) {
+ fstrcpy(output_username, mapped_name);
+ }
+ /* No change at all */
+ else {
+ fill_domain_username(output_username, dom_name, user_name, True);
+ }
safe_strcpy(pw->pw_name, output_username, sizeof(pw->pw_name) - 1);
@@ -179,6 +203,7 @@ struct getpwsid_state {
uid_t uid;
DOM_SID group_sid;
gid_t gid;
+ bool username_mapped;
};
static void getpwsid_queryuser_recv(void *private_data, bool success,
@@ -231,6 +256,8 @@ static void getpwsid_queryuser_recv(void *private_data, bool success,
fstring username;
struct getpwsid_state *s =
talloc_get_type_abort(private_data, struct getpwsid_state);
+ char *mapped_name;
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
if (!success) {
DEBUG(5, ("Could not query domain %s SID %s\n",
@@ -272,7 +299,23 @@ static void getpwsid_queryuser_recv(void *private_data, bool success,
strlower_m( username );
s->username = talloc_strdup(s->state->mem_ctx, username);
- ws_name_replace( s->username, WB_REPLACE_CHAR );
+ nt_status = normalize_name_map(s->state->mem_ctx, s->domain,
+ s->username, &mapped_name);
+
+ /* Basic removal of whitespace */
+ if (NT_STATUS_IS_OK(nt_status)) {
+ s->username = mapped_name;
+ s->username_mapped = false;
+ }
+ /* Complete name replacement */
+ else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_FILE_RENAMED)) {
+ s->username = mapped_name;
+ s->username_mapped = true;
+ }
+ /* No change at all */
+ else {
+ s->username_mapped = false;
+ }
s->fullname = talloc_strdup(s->state->mem_ctx, full_name);
s->homedir = talloc_strdup(s->state->mem_ctx, homedir);
@@ -330,8 +373,16 @@ static void getpwsid_sid2gid_recv(void *private_data, bool success, gid_t gid)
pw = &s->state->response.data.pw;
pw->pw_uid = s->uid;
pw->pw_gid = s->gid;
+
+ /* allow username to be overridden by the alias mapping */
+
+ if ( s->username_mapped ) {
+ fstrcpy( output_username, s->username );
+ } else {
fill_domain_username(output_username, s->domain->name,
s->username, True);
+ }
+
safe_strcpy(pw->pw_name, output_username, sizeof(pw->pw_name) - 1);
safe_strcpy(pw->pw_gecos, s->fullname, sizeof(pw->pw_gecos) - 1);
@@ -370,8 +421,10 @@ void winbindd_getpwnam(struct winbindd_cli_state *state)
{
struct winbindd_domain *domain;
fstring domname, username;
+ char *mapped_user = NULL;
char *domuser;
size_t dusize;
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
domuser = state->request.data.username;
dusize = sizeof(state->request.data.username);
@@ -383,9 +436,19 @@ void winbindd_getpwnam(struct winbindd_cli_state *state)
(unsigned long)state->pid,
domuser));
- ws_name_return(domuser, WB_REPLACE_CHAR);
+ nt_status = normalize_name_unmap(state->mem_ctx, domuser,
+ &mapped_user);
+
+ /* If we could not convert from an aliased name or a
+ normalized name, then just use the original name */
+
+ if (!NT_STATUS_IS_OK(nt_status) &&
+ !NT_STATUS_EQUAL(nt_status, NT_STATUS_FILE_RENAMED))
+ {
+ mapped_user = domuser;
+ }
- if (!parse_domain_user(domuser, domname, username)) {
+ if (!parse_domain_user(mapped_user, domname, username)) {
DEBUG(5, ("Could not parse domain user: %s\n", domuser));
request_error(state);
return;
@@ -743,6 +806,7 @@ void winbindd_getpwent(struct winbindd_cli_state *state)
/* Lookup user info */
result = winbindd_fill_pwent(
+ state->mem_ctx,
ent->domain_name,
name_list[ent->sam_entry_index].name,
&name_list[ent->sam_entry_index].user_sid,
diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c
index 132c96f1ee..fdfc8ed9d1 100644
--- a/source3/winbindd/winbindd_util.c
+++ b/source3/winbindd/winbindd_util.c
@@ -111,7 +111,16 @@ static struct winbindd_domain *add_trusted_domain(const char *domain_name, const
const char *alternative_name = NULL;
char *idmap_config_option;
const char *param;
+ const char **ignored_domains, **dom;
+ ignored_domains = lp_parm_string_list(-1, "winbind", "ignore domains", NULL);
+ for (dom=ignored_domains; dom && *dom; dom++) {
+ if (gen_fnmatch(*dom, domain_name) == 0) {
+ DEBUG(2,("Ignoring domain '%s'\n", domain_name));
+ return NULL;
+ }
+ }
+
/* ignore alt_name if we are not in an AD domain */
if ( (lp_security() == SEC_ADS) && alt_name && *alt_name) {
@@ -436,6 +445,10 @@ static void rescan_forest_root_trusts( void )
&dom_list[i].sid );
}
+ if (d == NULL) {
+ continue;
+ }
+
DEBUG(10,("rescan_forest_root_trusts: Following trust path "
"for domain tree root %s (%s)\n",
d->name, d->alt_name ));
@@ -500,6 +513,10 @@ static void rescan_forest_trusts( void )
&cache_methods,
&dom_list[i].sid );
}
+
+ if (d == NULL) {
+ continue;
+ }
DEBUG(10,("Following trust path for domain %s (%s)\n",
d->name, d->alt_name ));
@@ -1058,13 +1075,12 @@ void free_getent_state(struct getent_state *state)
temp = state;
while(temp != NULL) {
- struct getent_state *next;
+ struct getent_state *next = temp->next;
/* Free sam entries then list entry */
SAFE_FREE(state->sam_entries);
DLIST_REMOVE(state, state);
- next = temp->next;
SAFE_FREE(temp);
temp = next;
@@ -1160,7 +1176,7 @@ void parse_add_domuser(void *buf, char *domuser, int *len)
}
}
- safe_strcpy(buf, user, *len);
+ safe_strcpy((char *)buf, user, *len);
}
/* Ensure an incoming username from NSS is fully qualified. Replace the
@@ -1213,6 +1229,33 @@ void fill_domain_username(fstring name, const char *domain, const char *user, bo
}
}
+/**
+ * talloc version of fill_domain_username()
+ * return NULL on talloc failure.
+ */
+char *fill_domain_username_talloc(TALLOC_CTX *mem_ctx,
+ const char *domain,
+ const char *user,
+ bool can_assume)
+{
+ char *tmp_user, *name;
+
+ tmp_user = talloc_strdup(mem_ctx, user);
+ strlower_m(tmp_user);
+
+ if (can_assume && assume_domain(domain)) {
+ name = tmp_user;
+ } else {
+ name = talloc_asprintf(mem_ctx, "%s%c%s",
+ domain,
+ *lp_winbind_separator(),
+ tmp_user);
+ TALLOC_FREE(tmp_user);
+ }
+
+ return name;
+}
+
/*
* Winbindd socket accessor functions
*/
@@ -1378,34 +1421,107 @@ NTSTATUS lookup_usergroups_cached(struct winbindd_domain *domain,
We use this to remove spaces from user and group names
********************************************************************/
-void ws_name_replace( char *name, char replace )
+NTSTATUS normalize_name_map(TALLOC_CTX *mem_ctx,
+ struct winbindd_domain *domain,
+ char *name,
+ char **normalized)
{
- char replace_char[2] = { 0x0, 0x0 };
-
- if ( !lp_winbind_normalize_names() || (replace == '\0') )
- return;
+ NTSTATUS nt_status;
- replace_char[0] = replace;
- all_string_sub( name, " ", replace_char, 0 );
+ if (!name || !normalized) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
- return;
+ if (!lp_winbind_normalize_names()) {
+ return NT_STATUS_PROCEDURE_NOT_FOUND;
+ }
+
+ /* Alias support and whitespace replacement are mutually
+ exclusive */
+
+ nt_status = resolve_username_to_alias(mem_ctx, domain,
+ name, normalized );
+ if (NT_STATUS_IS_OK(nt_status)) {
+ /* special return code to let the caller know we
+ mapped to an alias */
+ return NT_STATUS_FILE_RENAMED;
+ }
+
+ /* check for an unreachable domain */
+
+ if (NT_STATUS_EQUAL(nt_status, NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND)) {
+ DEBUG(5,("normalize_name_map: Setting domain %s offline\n",
+ domain->name));
+ set_domain_offline(domain);
+ return nt_status;
+ }
+
+ /* deal with whitespace */
+
+ *normalized = talloc_strdup(mem_ctx, name);
+ if (!(*normalized)) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ all_string_sub( *normalized, " ", "_", 0 );
+
+ return NT_STATUS_OK;
}
/*********************************************************************
- We use this to do the inverse of ws_name_replace()
+ We use this to do the inverse of normalize_name_map()
********************************************************************/
-void ws_name_return( char *name, char replace )
+NTSTATUS normalize_name_unmap(TALLOC_CTX *mem_ctx,
+ char *name,
+ char **normalized)
{
- char replace_char[2] = { 0x0, 0x0 };
-
- if ( !lp_winbind_normalize_names() || (replace == '\0') )
- return;
+ NTSTATUS nt_status;
+ struct winbindd_domain *domain = find_our_domain();
+
+ if (!name || !normalized) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
- replace_char[0] = replace;
- all_string_sub( name, replace_char, " ", 0 );
+ if (!lp_winbind_normalize_names()) {
+ return NT_STATUS_PROCEDURE_NOT_FOUND;
+ }
- return;
+ /* Alias support and whitespace replacement are mutally
+ exclusive */
+
+ /* When mapping from an alias to a username, we don't know the
+ domain. But we only need a domain structure to cache
+ a successful lookup , so just our own domain structure for
+ the seqnum. */
+
+ nt_status = resolve_alias_to_username(mem_ctx, domain,
+ name, normalized);
+ if (NT_STATUS_IS_OK(nt_status)) {
+ /* Special return code to let the caller know we mapped
+ from an alias */
+ return NT_STATUS_FILE_RENAMED;
+ }
+
+ /* check for an unreachable domain */
+
+ if (NT_STATUS_EQUAL(nt_status, NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND)) {
+ DEBUG(5,("normalize_name_unmap: Setting domain %s offline\n",
+ domain->name));
+ set_domain_offline(domain);
+ return nt_status;
+ }
+
+ /* deal with whitespace */
+
+ *normalized = talloc_strdup(mem_ctx, name);
+ if (!(*normalized)) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ all_string_sub(*normalized, "_", " ", 0);
+
+ return NT_STATUS_OK;
}
/*********************************************************************