Merge ~ahasenack/ubuntu/+source/samba:cosmic-samba-nochange-rebuild into ubuntu/+source/samba:ubuntu/devel

Proposed by Andreas Hasenack
Status: Merged
Approved by: Robie Basak
Approved revision: 583606c931dcabae7a6389e05dddbc73b9e742b2
Merge reported by: Andreas Hasenack
Merged at revision: 583606c931dcabae7a6389e05dddbc73b9e742b2
Proposed branch: ~ahasenack/ubuntu/+source/samba:cosmic-samba-nochange-rebuild
Merge into: ubuntu/+source/samba:ubuntu/devel
Diff against target: 820243 lines (+809181/-0)
1833 files modified
debian/changelog (+6/-0)
source4/ldap_server/ldap_backend.c (+1338/-0)
source4/ldap_server/ldap_bind.c (+759/-0)
source4/ldap_server/ldap_extended.c (+215/-0)
source4/ldap_server/ldap_server.c (+1259/-0)
source4/ldap_server/ldap_server.h (+105/-0)
source4/ldap_server/wscript_build (+13/-0)
source4/lib/cmdline/credentials.c (+54/-0)
source4/lib/cmdline/popt_common.c (+235/-0)
source4/lib/cmdline/popt_common.h (+47/-0)
source4/lib/cmdline/popt_credentials.c (+190/-0)
source4/lib/cmdline/wscript_build (+23/-0)
source4/lib/com/README (+9/-0)
source4/lib/com/classes/simple.c (+124/-0)
source4/lib/com/com.h (+53/-0)
source4/lib/com/dcom/dcom.h (+85/-0)
source4/lib/com/dcom/main.c (+704/-0)
source4/lib/com/dcom/tables.c (+94/-0)
source4/lib/com/main.c (+90/-0)
source4/lib/com/rot.c (+35/-0)
source4/lib/com/tables.c (+112/-0)
source4/lib/com/wscript_build (+28/-0)
source4/lib/events/events.h (+6/-0)
source4/lib/events/tevent_s4.c (+41/-0)
source4/lib/events/wscript_build (+9/-0)
source4/lib/http/gensec/basic.c (+204/-0)
source4/lib/http/gensec/ntlm.c (+185/-0)
source4/lib/http/http.c (+825/-0)
source4/lib/http/http.h (+120/-0)
source4/lib/http/http_auth.c (+364/-0)
source4/lib/http/http_internal.h (+62/-0)
source4/lib/http/wscript_build (+21/-0)
source4/lib/messaging/irpc.h (+86/-0)
source4/lib/messaging/messaging.c (+1190/-0)
source4/lib/messaging/messaging.h (+58/-0)
source4/lib/messaging/messaging_internal.h (+36/-0)
source4/lib/messaging/messaging_send.c (+115/-0)
source4/lib/messaging/pymessaging.c (+523/-0)
source4/lib/messaging/tests/irpc.c (+308/-0)
source4/lib/messaging/tests/messaging.c (+404/-0)
source4/lib/messaging/wscript_build (+21/-0)
source4/lib/policy/gp_filesys.c (+674/-0)
source4/lib/policy/gp_ini.c (+133/-0)
source4/lib/policy/gp_ldap.c (+1130/-0)
source4/lib/policy/gp_manage.c (+328/-0)
source4/lib/policy/policy.h (+125/-0)
source4/lib/policy/pypolicy.c (+150/-0)
source4/lib/policy/samba-policy.pc.in (+12/-0)
source4/lib/policy/wscript_build (+17/-0)
source4/lib/registry/Doxyfile (+24/-0)
source4/lib/registry/README (+42/-0)
source4/lib/registry/TODO (+5/-0)
source4/lib/registry/hive.c (+176/-0)
source4/lib/registry/interface.c (+297/-0)
source4/lib/registry/ldb.c (+991/-0)
source4/lib/registry/local.c (+408/-0)
source4/lib/registry/man/regdiff.1.xml (+100/-0)
source4/lib/registry/man/regpatch.1.xml (+89/-0)
source4/lib/registry/man/regshell.1.xml (+189/-0)
source4/lib/registry/man/regtree.1.xml (+101/-0)
source4/lib/registry/patchfile.c (+543/-0)
source4/lib/registry/patchfile_dotreg.c (+435/-0)
source4/lib/registry/patchfile_preg.c (+384/-0)
source4/lib/registry/pyregistry.c (+476/-0)
source4/lib/registry/regf.c (+2318/-0)
source4/lib/registry/regf.idl (+167/-0)
source4/lib/registry/registry.h (+532/-0)
source4/lib/registry/rpc.c (+579/-0)
source4/lib/registry/samba.c (+100/-0)
source4/lib/registry/tests/diff.c (+291/-0)
source4/lib/registry/tests/generic.c (+179/-0)
source4/lib/registry/tests/hive.c (+440/-0)
source4/lib/registry/tests/registry.c (+645/-0)
source4/lib/registry/tools/common.c (+88/-0)
source4/lib/registry/tools/regdiff.c (+151/-0)
source4/lib/registry/tools/regpatch.c (+76/-0)
source4/lib/registry/tools/regshell.c (+666/-0)
source4/lib/registry/tools/regtree.c (+171/-0)
source4/lib/registry/util.c (+302/-0)
source4/lib/registry/wine.c (+45/-0)
source4/lib/registry/wscript_build (+68/-0)
source4/lib/samba3/README (+5/-0)
source4/lib/samba3/samba3.h (+30/-0)
source4/lib/samba3/smbpasswd.c (+138/-0)
source4/lib/samba3/wscript_build (+9/-0)
source4/lib/socket/access.c (+129/-0)
source4/lib/socket/connect.c (+158/-0)
source4/lib/socket/connect_multi.c (+393/-0)
source4/lib/socket/interface.c (+524/-0)
source4/lib/socket/netif.h (+24/-0)
source4/lib/socket/socket.c (+640/-0)
source4/lib/socket/socket.h (+256/-0)
source4/lib/socket/socket_ip.c (+1036/-0)
source4/lib/socket/socket_unix.c (+442/-0)
source4/lib/socket/testsuite.c (+198/-0)
source4/lib/socket/wscript_build (+29/-0)
source4/lib/stream/packet.c (+626/-0)
source4/lib/stream/packet.h (+66/-0)
source4/lib/stream/wscript_build (+8/-0)
source4/lib/tls/tls.c (+647/-0)
source4/lib/tls/tls.h (+132/-0)
source4/lib/tls/tls_tstream.c (+1639/-0)
source4/lib/tls/tlscert.c (+179/-0)
source4/lib/tls/wscript (+87/-0)
source4/lib/wmi/tools/wmic.c (+221/-0)
source4/lib/wmi/tools/wmis.c (+222/-0)
source4/lib/wmi/wbemdata.c (+451/-0)
source4/lib/wmi/wmi.h (+48/-0)
source4/lib/wmi/wmi.i (+352/-0)
source4/lib/wmi/wmi.py (+95/-0)
source4/lib/wmi/wmi_wrap.c (+4304/-0)
source4/lib/wmi/wmicore.c (+253/-0)
source4/lib/wmi/wscript_build (+26/-0)
source4/libcli/cliconnect.c (+284/-0)
source4/libcli/clideltree.c (+146/-0)
source4/libcli/clifile.c (+675/-0)
source4/libcli/clilist.c (+354/-0)
source4/libcli/climessage.c (+104/-0)
source4/libcli/clireadwrite.c (+167/-0)
source4/libcli/clitrans2.c (+224/-0)
source4/libcli/composite/composite.c (+200/-0)
source4/libcli/composite/composite.h (+99/-0)
source4/libcli/dgram/browse.c (+114/-0)
source4/libcli/dgram/dgramsocket.c (+243/-0)
source4/libcli/dgram/libdgram.h (+155/-0)
source4/libcli/dgram/mailslot.c (+226/-0)
source4/libcli/dgram/netlogon.c (+142/-0)
source4/libcli/finddc.h (+41/-0)
source4/libcli/finddcs_cldap.c (+483/-0)
source4/libcli/finddcs_nbt.c (+311/-0)
source4/libcli/ldap/ldap_bind.c (+540/-0)
source4/libcli/ldap/ldap_client.c (+1047/-0)
source4/libcli/ldap/ldap_client.h (+149/-0)
source4/libcli/ldap/ldap_controls.c (+1282/-0)
source4/libcli/ldap/ldap_ildap.c (+133/-0)
source4/libcli/ldap/libcli_ldap.h (+31/-0)
source4/libcli/ldap/wscript_build (+11/-0)
source4/libcli/libcli.h (+357/-0)
source4/libcli/pysmb.c (+688/-0)
source4/libcli/rap/rap.c (+1689/-0)
source4/libcli/rap/rap.h (+76/-0)
source4/libcli/rap/wscript_build (+7/-0)
source4/libcli/raw/README (+5/-0)
source4/libcli/raw/clierror.c (+73/-0)
source4/libcli/raw/clioplock.c (+66/-0)
source4/libcli/raw/clisession.c (+310/-0)
source4/libcli/raw/clisocket.c (+459/-0)
source4/libcli/raw/clitransport.c (+611/-0)
source4/libcli/raw/clitree.c (+227/-0)
source4/libcli/raw/interfaces.h (+2876/-0)
source4/libcli/raw/libcliraw.h (+340/-0)
source4/libcli/raw/rawacl.c (+163/-0)
source4/libcli/raw/rawdate.c (+82/-0)
source4/libcli/raw/raweas.c (+367/-0)
source4/libcli/raw/rawfile.c (+1046/-0)
source4/libcli/raw/rawfileinfo.c (+778/-0)
source4/libcli/raw/rawfsinfo.c (+431/-0)
source4/libcli/raw/rawioctl.c (+173/-0)
source4/libcli/raw/rawlpq.c (+48/-0)
source4/libcli/raw/rawnegotiate.c (+163/-0)
source4/libcli/raw/rawnotify.c (+122/-0)
source4/libcli/raw/rawreadwrite.c (+345/-0)
source4/libcli/raw/rawrequest.c (+1050/-0)
source4/libcli/raw/rawsearch.c (+842/-0)
source4/libcli/raw/rawsetfileinfo.c (+492/-0)
source4/libcli/raw/rawshadow.c (+82/-0)
source4/libcli/raw/rawtrans.c (+437/-0)
source4/libcli/raw/request.h (+78/-0)
source4/libcli/raw/signing.h (+39/-0)
source4/libcli/raw/smb.h (+322/-0)
source4/libcli/raw/smb_signing.c (+231/-0)
source4/libcli/raw/trans2.h (+308/-0)
source4/libcli/resolve/bcast.c (+116/-0)
source4/libcli/resolve/dns_ex.c (+661/-0)
source4/libcli/resolve/host.c (+60/-0)
source4/libcli/resolve/lmhosts.c (+129/-0)
source4/libcli/resolve/nbtlist.c (+223/-0)
source4/libcli/resolve/resolve.c (+340/-0)
source4/libcli/resolve/resolve.h (+53/-0)
source4/libcli/resolve/resolve_lp.c (+52/-0)
source4/libcli/resolve/testsuite.c (+92/-0)
source4/libcli/resolve/wins.c (+83/-0)
source4/libcli/security/tests/sddl.c (+107/-0)
source4/libcli/smb2/break.c (+74/-0)
source4/libcli/smb2/cancel.c (+45/-0)
source4/libcli/smb2/close.c (+80/-0)
source4/libcli/smb2/connect.c (+354/-0)
source4/libcli/smb2/create.c (+450/-0)
source4/libcli/smb2/find.c (+180/-0)
source4/libcli/smb2/flush.c (+70/-0)
source4/libcli/smb2/getinfo.c (+220/-0)
source4/libcli/smb2/ioctl.c (+140/-0)
source4/libcli/smb2/keepalive.c (+68/-0)
source4/libcli/smb2/lease_break.c (+81/-0)
source4/libcli/smb2/lock.c (+82/-0)
source4/libcli/smb2/logoff.c (+67/-0)
source4/libcli/smb2/notify.c (+114/-0)
source4/libcli/smb2/read.c (+89/-0)
source4/libcli/smb2/request.c (+717/-0)
source4/libcli/smb2/session.c (+453/-0)
source4/libcli/smb2/setinfo.c (+122/-0)
source4/libcli/smb2/signing.c (+123/-0)
source4/libcli/smb2/smb2.h (+193/-0)
source4/libcli/smb2/smb2_calls.h (+99/-0)
source4/libcli/smb2/tcon.c (+52/-0)
source4/libcli/smb2/tdis.c (+65/-0)
source4/libcli/smb2/transport.c (+487/-0)
source4/libcli/smb2/util.c (+241/-0)
source4/libcli/smb2/write.c (+81/-0)
source4/libcli/smb2/wscript_build (+10/-0)
source4/libcli/smb_composite/appendacl.c (+313/-0)
source4/libcli/smb_composite/connect.c (+482/-0)
source4/libcli/smb_composite/fetchfile.c (+191/-0)
source4/libcli/smb_composite/fsinfo.c (+214/-0)
source4/libcli/smb_composite/loadfile.c (+293/-0)
source4/libcli/smb_composite/savefile.c (+288/-0)
source4/libcli/smb_composite/sesssetup.c (+846/-0)
source4/libcli/smb_composite/smb2.c (+447/-0)
source4/libcli/smb_composite/smb_composite.h (+260/-0)
source4/libcli/smbc/README (+1/-0)
source4/libcli/util/clilsa.c (+411/-0)
source4/libcli/util/pyerrors.h (+79/-0)
source4/libcli/wbclient/wbclient.c (+193/-0)
source4/libcli/wbclient/wbclient.h (+25/-0)
source4/libcli/wbclient/wscript_build (+10/-0)
source4/libcli/wrepl/winsrepl.c (+1172/-0)
source4/libcli/wrepl/winsrepl.h (+110/-0)
source4/libcli/wscript_build (+93/-0)
source4/libnet/composite.h (+56/-0)
source4/libnet/groupinfo.c (+384/-0)
source4/libnet/groupinfo.h (+54/-0)
source4/libnet/groupman.c (+139/-0)
source4/libnet/groupman.h (+35/-0)
source4/libnet/libnet.c (+61/-0)
source4/libnet/libnet.h (+86/-0)
source4/libnet/libnet_become_dc.c (+3281/-0)
source4/libnet/libnet_become_dc.h (+152/-0)
source4/libnet/libnet_domain.c (+1304/-0)
source4/libnet/libnet_domain.h (+70/-0)
source4/libnet/libnet_export_keytab.c (+214/-0)
source4/libnet/libnet_export_keytab.h (+32/-0)
source4/libnet/libnet_group.c (+764/-0)
source4/libnet/libnet_group.h (+74/-0)
source4/libnet/libnet_join.c (+1026/-0)
source4/libnet/libnet_join.h (+101/-0)
source4/libnet/libnet_lookup.c (+436/-0)
source4/libnet/libnet_lookup.h (+69/-0)
source4/libnet/libnet_passwd.c (+723/-0)
source4/libnet/libnet_passwd.h (+137/-0)
source4/libnet/libnet_rpc.c (+1031/-0)
source4/libnet/libnet_rpc.h (+73/-0)
source4/libnet/libnet_samdump.c (+206/-0)
source4/libnet/libnet_samsync.c (+281/-0)
source4/libnet/libnet_samsync.h (+83/-0)
source4/libnet/libnet_samsync_ldb.c (+1279/-0)
source4/libnet/libnet_share.c (+215/-0)
source4/libnet/libnet_share.h (+70/-0)
source4/libnet/libnet_site.c (+292/-0)
source4/libnet/libnet_site.h (+35/-0)
source4/libnet/libnet_time.c (+125/-0)
source4/libnet/libnet_time.h (+46/-0)
source4/libnet/libnet_unbecome_dc.c (+792/-0)
source4/libnet/libnet_unbecome_dc.h (+31/-0)
source4/libnet/libnet_user.c (+1241/-0)
source4/libnet/libnet_user.h (+156/-0)
source4/libnet/libnet_vampire.c (+810/-0)
source4/libnet/libnet_vampire.h (+58/-0)
source4/libnet/prereq_domain.c (+144/-0)
source4/libnet/py_net.c (+841/-0)
source4/libnet/py_net.h (+24/-0)
source4/libnet/py_net_dckeytab.c (+106/-0)
source4/libnet/userinfo.c (+382/-0)
source4/libnet/userinfo.h (+54/-0)
source4/libnet/userman.c (+922/-0)
source4/libnet/userman.h (+106/-0)
source4/libnet/wscript_build (+26/-0)
source4/librpc/dcerpc.pc.in (+11/-0)
source4/librpc/dcerpc_samr.pc.in (+11/-0)
source4/librpc/gen_ndr/README (+4/-0)
source4/librpc/idl/IDL_LICENSE.txt (+9/-0)
source4/librpc/idl/irpc.idl (+221/-0)
source4/librpc/idl/ntp_signd.idl (+46/-0)
source4/librpc/idl/opendb.idl (+46/-0)
source4/librpc/idl/sasl_helpers.idl (+24/-0)
source4/librpc/idl/winbind.idl (+35/-0)
source4/librpc/idl/winsif.idl (+342/-0)
source4/librpc/idl/winsrepl.idl (+179/-0)
source4/librpc/idl/winstation.idl (+13/-0)
source4/librpc/idl/wscript_build (+12/-0)
source4/librpc/ndr/py_auth.c (+71/-0)
source4/librpc/ndr/py_lsa.c (+77/-0)
source4/librpc/ndr/py_misc.c (+177/-0)
source4/librpc/ndr/py_security.c (+475/-0)
source4/librpc/ndr/py_xattr.c (+99/-0)
source4/librpc/rpc/dcerpc.c (+2621/-0)
source4/librpc/rpc/dcerpc.h (+275/-0)
source4/librpc/rpc/dcerpc.py (+18/-0)
source4/librpc/rpc/dcerpc_auth.c (+556/-0)
source4/librpc/rpc/dcerpc_connect.c (+1253/-0)
source4/librpc/rpc/dcerpc_roh.c (+800/-0)
source4/librpc/rpc/dcerpc_roh.h (+116/-0)
source4/librpc/rpc/dcerpc_roh_channel_in.c (+471/-0)
source4/librpc/rpc/dcerpc_roh_channel_out.c (+743/-0)
source4/librpc/rpc/dcerpc_schannel.c (+627/-0)
source4/librpc/rpc/dcerpc_secondary.c (+448/-0)
source4/librpc/rpc/dcerpc_smb.c (+297/-0)
source4/librpc/rpc/dcerpc_sock.c (+500/-0)
source4/librpc/rpc/dcerpc_util.c (+897/-0)
source4/librpc/rpc/pyrpc.c (+480/-0)
source4/librpc/rpc/pyrpc.h (+54/-0)
source4/librpc/rpc/pyrpc_util.c (+450/-0)
source4/librpc/rpc/pyrpc_util.h (+67/-0)
source4/librpc/scripts/build_idl.sh (+37/-0)
source4/librpc/tests/binding_string.c (+327/-0)
source4/librpc/tests/dns-decode_dns_name_packet-hex.dat (+7/-0)
source4/librpc/wscript_build (+416/-0)
source4/nbt_server/defense.c (+79/-0)
source4/nbt_server/dgram/browse.c (+85/-0)
source4/nbt_server/dgram/netlogon.c (+201/-0)
source4/nbt_server/dgram/ntlogon.c (+121/-0)
source4/nbt_server/dgram/request.c (+150/-0)
source4/nbt_server/interfaces.c (+426/-0)
source4/nbt_server/irpc.c (+210/-0)
source4/nbt_server/nbt_server.c (+104/-0)
source4/nbt_server/nbt_server.h (+94/-0)
source4/nbt_server/nodestatus.c (+126/-0)
source4/nbt_server/packet.c (+343/-0)
source4/nbt_server/query.c (+102/-0)
source4/nbt_server/register.c (+310/-0)
source4/nbt_server/wins/wins_dns_proxy.c (+99/-0)
source4/nbt_server/wins/wins_hook.c (+94/-0)
source4/nbt_server/wins/wins_ldb.c (+127/-0)
source4/nbt_server/wins/winsclient.c (+284/-0)
source4/nbt_server/wins/winsdb.c (+1014/-0)
source4/nbt_server/wins/winsdb.h (+81/-0)
source4/nbt_server/wins/winsserver.c (+1074/-0)
source4/nbt_server/wins/winsserver.h (+67/-0)
source4/nbt_server/wins/winswack.c (+387/-0)
source4/nbt_server/wscript_build (+54/-0)
source4/ntp_signd/README (+7/-0)
source4/ntp_signd/ntp-dev-4.2.5p125.diff (+579/-0)
source4/ntp_signd/ntp_signd.c (+558/-0)
source4/ntp_signd/wscript_build (+11/-0)
source4/ntvfs/README (+26/-0)
source4/ntvfs/cifs/README (+40/-0)
source4/ntvfs/cifs/vfs_cifs.c (+1259/-0)
source4/ntvfs/cifs_posix_cli/README (+12/-0)
source4/ntvfs/cifs_posix_cli/cifsposix.h (+38/-0)
source4/ntvfs/cifs_posix_cli/svfs_util.c (+195/-0)
source4/ntvfs/cifs_posix_cli/vfs_cifs_posix.c (+1112/-0)
source4/ntvfs/common/brlock.c (+136/-0)
source4/ntvfs/common/brlock.h (+55/-0)
source4/ntvfs/common/brlock_tdb.c (+773/-0)
source4/ntvfs/common/init.c (+34/-0)
source4/ntvfs/common/notify.c (+672/-0)
source4/ntvfs/common/ntvfs_common.h (+32/-0)
source4/ntvfs/common/opendb.c (+200/-0)
source4/ntvfs/common/opendb.h (+59/-0)
source4/ntvfs/common/opendb_tdb.c (+886/-0)
source4/ntvfs/common/wscript_build (+9/-0)
source4/ntvfs/ipc/README (+5/-0)
source4/ntvfs/ipc/ipc.h (+0/-0)
source4/ntvfs/ipc/ipc_rap.c (+511/-0)
source4/ntvfs/ipc/np_echo.c (+0/-0)
source4/ntvfs/ipc/rap_server.c (+91/-0)
source4/ntvfs/ipc/vfs_ipc.c (+1353/-0)
source4/ntvfs/nbench/README (+13/-0)
source4/ntvfs/nbench/vfs_nbench.c (+982/-0)
source4/ntvfs/ntvfs.h (+338/-0)
source4/ntvfs/ntvfs_base.c (+249/-0)
source4/ntvfs/ntvfs_generic.c (+1643/-0)
source4/ntvfs/ntvfs_interface.c (+713/-0)
source4/ntvfs/ntvfs_util.c (+202/-0)
source4/ntvfs/posix/posix_eadb.c (+295/-0)
source4/ntvfs/posix/posix_eadb.h (+20/-0)
source4/ntvfs/posix/pvfs_acl.c (+1083/-0)
source4/ntvfs/posix/pvfs_acl_nfs4.c (+199/-0)
source4/ntvfs/posix/pvfs_acl_xattr.c (+104/-0)
source4/ntvfs/posix/pvfs_aio.c (+166/-0)
source4/ntvfs/posix/pvfs_dirlist.c (+407/-0)
source4/ntvfs/posix/pvfs_fileinfo.c (+159/-0)
source4/ntvfs/posix/pvfs_flush.c (+80/-0)
source4/ntvfs/posix/pvfs_fsinfo.c (+223/-0)
source4/ntvfs/posix/pvfs_ioctl.c (+82/-0)
source4/ntvfs/posix/pvfs_lock.c (+411/-0)
source4/ntvfs/posix/pvfs_mkdir.c (+196/-0)
source4/ntvfs/posix/pvfs_notify.c (+300/-0)
source4/ntvfs/posix/pvfs_open.c (+2097/-0)
source4/ntvfs/posix/pvfs_oplock.c (+298/-0)
source4/ntvfs/posix/pvfs_qfileinfo.c (+465/-0)
source4/ntvfs/posix/pvfs_read.c (+113/-0)
source4/ntvfs/posix/pvfs_rename.c (+675/-0)
source4/ntvfs/posix/pvfs_resolve.c (+826/-0)
source4/ntvfs/posix/pvfs_search.c (+864/-0)
source4/ntvfs/posix/pvfs_seek.c (+65/-0)
source4/ntvfs/posix/pvfs_setfileinfo.c (+884/-0)
source4/ntvfs/posix/pvfs_shortname.c (+695/-0)
source4/ntvfs/posix/pvfs_streams.c (+556/-0)
source4/ntvfs/posix/pvfs_sys.c (+662/-0)
source4/ntvfs/posix/pvfs_unlink.c (+276/-0)
source4/ntvfs/posix/pvfs_util.c (+206/-0)
source4/ntvfs/posix/pvfs_wait.c (+203/-0)
source4/ntvfs/posix/pvfs_write.c (+155/-0)
source4/ntvfs/posix/pvfs_xattr.c (+488/-0)
source4/ntvfs/posix/python/pyposix_eadb.c (+130/-0)
source4/ntvfs/posix/python/pyxattr_native.c (+121/-0)
source4/ntvfs/posix/python/pyxattr_tdb.c (+167/-0)
source4/ntvfs/posix/vfs_posix.c (+427/-0)
source4/ntvfs/posix/vfs_posix.h (+297/-0)
source4/ntvfs/posix/wscript_build (+67/-0)
source4/ntvfs/posix/xattr_system.c (+145/-0)
source4/ntvfs/print/README (+3/-0)
source4/ntvfs/print/vfs_print.c (+132/-0)
source4/ntvfs/simple/README (+10/-0)
source4/ntvfs/simple/svfs.h (+38/-0)
source4/ntvfs/simple/svfs_util.c (+189/-0)
source4/ntvfs/simple/vfs_simple.c (+1112/-0)
source4/ntvfs/smb2/vfs_smb2.c (+904/-0)
source4/ntvfs/sysdep/README (+5/-0)
source4/ntvfs/sysdep/inotify.c (+398/-0)
source4/ntvfs/sysdep/sys_lease.c (+150/-0)
source4/ntvfs/sysdep/sys_lease.h (+66/-0)
source4/ntvfs/sysdep/sys_lease_linux.c (+215/-0)
source4/ntvfs/sysdep/sys_notify.c (+149/-0)
source4/ntvfs/sysdep/sys_notify.h (+54/-0)
source4/ntvfs/sysdep/wscript_build (+31/-0)
source4/ntvfs/sysdep/wscript_configure (+14/-0)
source4/ntvfs/unixuid/vfs_unixuid.c (+724/-0)
source4/ntvfs/unixuid/wscript_build (+9/-0)
source4/ntvfs/wscript_build (+75/-0)
source4/param/loadparm.c (+61/-0)
source4/param/provision.c (+394/-0)
source4/param/provision.h (+72/-0)
source4/param/pyparam.c (+581/-0)
source4/param/pyparam.h (+28/-0)
source4/param/pyparam_util.c (+81/-0)
source4/param/secrets.c (+142/-0)
source4/param/secrets.h (+49/-0)
source4/param/share.c (+157/-0)
source4/param/share.h (+151/-0)
source4/param/share_classic.c (+390/-0)
source4/param/share_ldb.c (+604/-0)
source4/param/tests/loadparm.c (+271/-0)
source4/param/tests/share.c (+216/-0)
source4/param/wscript_build (+65/-0)
source4/rpc_server/backupkey/dcesrv_backupkey.c (+1819/-0)
source4/rpc_server/backupkey/dcesrv_backupkey_heimdal.c (+1858/-0)
source4/rpc_server/browser/dcesrv_browser.c (+169/-0)
source4/rpc_server/common/common.h (+43/-0)
source4/rpc_server/common/forward.c (+129/-0)
source4/rpc_server/common/loadparm.c (+45/-0)
source4/rpc_server/common/reply.c (+287/-0)
source4/rpc_server/common/server_info.c (+182/-0)
source4/rpc_server/common/share_info.c (+121/-0)
source4/rpc_server/common/sid_helper.c (+134/-0)
source4/rpc_server/dcerpc_server.c (+3149/-0)
source4/rpc_server/dcerpc_server.h (+496/-0)
source4/rpc_server/dcerpc_server.pc.in (+12/-0)
source4/rpc_server/dcesrv_auth.c (+564/-0)
source4/rpc_server/dcesrv_mgmt.c (+125/-0)
source4/rpc_server/dnsserver/dcerpc_dnsserver.c (+2345/-0)
source4/rpc_server/dnsserver/dnsdata.c (+1203/-0)
source4/rpc_server/dnsserver/dnsdb.c (+1009/-0)
source4/rpc_server/dnsserver/dnsserver.h (+262/-0)
source4/rpc_server/dnsserver/dnsutils.c (+394/-0)
source4/rpc_server/drsuapi/addentry.c (+240/-0)
source4/rpc_server/drsuapi/dcesrv_drsuapi.c (+1073/-0)
source4/rpc_server/drsuapi/dcesrv_drsuapi.h (+84/-0)
source4/rpc_server/drsuapi/drsutil.c (+221/-0)
source4/rpc_server/drsuapi/getncchanges.c (+3015/-0)
source4/rpc_server/drsuapi/updaterefs.c (+387/-0)
source4/rpc_server/drsuapi/writespn.c (+253/-0)
source4/rpc_server/echo/rpc_echo.c (+211/-0)
source4/rpc_server/epmapper/rpc_epmapper.c (+285/-0)
source4/rpc_server/eventlog/dcesrv_eventlog6.c (+331/-0)
source4/rpc_server/handles.c (+124/-0)
source4/rpc_server/lsa/dcesrv_lsa.c (+4806/-0)
source4/rpc_server/lsa/lsa.h (+70/-0)
source4/rpc_server/lsa/lsa_init.c (+292/-0)
source4/rpc_server/lsa/lsa_lookup.c (+1155/-0)
source4/rpc_server/netlogon/dcerpc_netlogon.c (+3692/-0)
source4/rpc_server/remote/README (+38/-0)
source4/rpc_server/remote/dcesrv_remote.c (+431/-0)
source4/rpc_server/samr/dcesrv_samr.c (+4430/-0)
source4/rpc_server/samr/dcesrv_samr.h (+70/-0)
source4/rpc_server/samr/samr_password.c (+668/-0)
source4/rpc_server/service_rpc.c (+146/-0)
source4/rpc_server/srvsvc/dcesrv_srvsvc.c (+2286/-0)
source4/rpc_server/srvsvc/srvsvc_ntvfs.c (+134/-0)
source4/rpc_server/unixinfo/dcesrv_unixinfo.c (+191/-0)
source4/rpc_server/winreg/README (+3/-0)
source4/rpc_server/winreg/rpc_winreg.c (+737/-0)
source4/rpc_server/wkssvc/dcesrv_wkssvc.c (+403/-0)
source4/rpc_server/wscript_build (+178/-0)
source4/script/buildtree.pl (+40/-0)
source4/script/depfilter.py (+50/-0)
source4/script/extract_allparms.sh (+2/-0)
source4/script/find_unused_options.sh (+37/-0)
source4/script/minimal_includes.pl (+171/-0)
source4/script/mkproto.pl (+252/-0)
source4/script/update-proto.pl (+242/-0)
source4/scripting/bin/autoidl (+161/-0)
source4/scripting/bin/enablerecyclebin (+53/-0)
source4/scripting/bin/findprovisionusnranges (+80/-0)
source4/scripting/bin/fullschema (+183/-0)
source4/scripting/bin/gen_error_common.py (+82/-0)
source4/scripting/bin/gen_hresult.py (+228/-0)
source4/scripting/bin/gen_ntstatus.py (+148/-0)
source4/scripting/bin/gen_werror.py (+149/-0)
source4/scripting/bin/get-descriptors (+150/-0)
source4/scripting/bin/ktpass.sh (+97/-0)
source4/scripting/bin/machineaccountccache (+30/-0)
source4/scripting/bin/minschema (+566/-0)
source4/scripting/bin/mymachinepw (+59/-0)
source4/scripting/bin/nsupdate-gss (+352/-0)
source4/scripting/bin/rebuildextendeddn (+134/-0)
source4/scripting/bin/renamedc (+192/-0)
source4/scripting/bin/rpcclient (+305/-0)
source4/scripting/bin/samba-tool (+50/-0)
source4/scripting/bin/samba3dump (+180/-0)
source4/scripting/bin/samba_backup (+97/-0)
source4/scripting/bin/samba_dnsupdate (+945/-0)
source4/scripting/bin/samba_kcc (+342/-0)
source4/scripting/bin/samba_spnupdate (+252/-0)
source4/scripting/bin/samba_upgradedns (+528/-0)
source4/scripting/bin/samba_upgradeprovision (+1830/-0)
source4/scripting/bin/setup_dns.sh (+43/-0)
source4/scripting/bin/smbstatus (+89/-0)
source4/scripting/bin/subunitrun (+87/-0)
source4/scripting/bin/w32err_code.py (+362/-0)
source4/scripting/bin/wscript_build (+5/-0)
source4/scripting/devel/addlotscontacts (+96/-0)
source4/scripting/devel/chgkrbtgtpass (+63/-0)
source4/scripting/devel/chgtdcpass (+63/-0)
source4/scripting/devel/config_base (+40/-0)
source4/scripting/devel/crackname (+78/-0)
source4/scripting/devel/createtrust (+125/-0)
source4/scripting/devel/demodirsync.py (+156/-0)
source4/scripting/devel/drs/fsmo.ldif.template (+75/-0)
source4/scripting/devel/drs/named.conf.ad.template (+6/-0)
source4/scripting/devel/drs/revampire_ad.sh (+23/-0)
source4/scripting/devel/drs/unvampire_ad.sh (+14/-0)
source4/scripting/devel/drs/vampire_ad.sh (+28/-0)
source4/scripting/devel/drs/vars (+12/-0)
source4/scripting/devel/enumprivs (+58/-0)
source4/scripting/devel/getncchanges (+144/-0)
source4/scripting/devel/nmfind (+15/-0)
source4/scripting/devel/pfm_verify.py (+191/-0)
source4/scripting/devel/rebuild_zone.sh (+107/-0)
source4/scripting/devel/repl_cleartext_pwd.py (+409/-0)
source4/scripting/devel/rodcdns (+43/-0)
source4/scripting/devel/selftest-vars.sh (+49/-0)
source4/scripting/devel/speedtest.py (+231/-0)
source4/scripting/devel/tmpfs.sh (+16/-0)
source4/scripting/devel/watch_servers.sh (+14/-0)
source4/scripting/wscript_build (+19/-0)
source4/selftest/test_samba3dump.sh (+14/-0)
source4/selftest/test_w2k3.sh (+48/-0)
source4/selftest/test_w2k3_file.sh (+44/-0)
source4/selftest/test_win.sh (+42/-0)
source4/selftest/tests.py (+947/-0)
source4/selftest/tests_win.sh (+30/-0)
source4/selftest/tests_win2k3_dc.sh (+22/-0)
source4/selftest/win/README (+121/-0)
source4/selftest/win/VMHost.pm (+359/-0)
source4/selftest/win/common.exp (+521/-0)
source4/selftest/win/test_win.conf (+83/-0)
source4/selftest/win/vm_get_ip.pl (+48/-0)
source4/selftest/win/vm_load_snapshot.pl (+46/-0)
source4/selftest/win/wintest_2k3_dc.sh (+114/-0)
source4/selftest/win/wintest_base.sh (+67/-0)
source4/selftest/win/wintest_client.exp (+95/-0)
source4/selftest/win/wintest_client.sh (+26/-0)
source4/selftest/win/wintest_functions.sh (+54/-0)
source4/selftest/win/wintest_net.sh (+62/-0)
source4/selftest/win/wintest_raw.sh (+68/-0)
source4/selftest/win/wintest_remove.exp (+71/-0)
source4/selftest/win/wintest_rpc.sh (+66/-0)
source4/selftest/win/wintest_setup.exp (+104/-0)
source4/setup/DB_CONFIG (+14/-0)
source4/setup/ad-schema/MS-AD_Schema_2K8_Attributes.txt (+15638/-0)
source4/setup/ad-schema/MS-AD_Schema_2K8_Classes.txt (+3473/-0)
source4/setup/ad-schema/MS-AD_Schema_2K8_R2_Attributes.txt (+16060/-0)
source4/setup/ad-schema/MS-AD_Schema_2K8_R2_Classes.txt (+3577/-0)
source4/setup/ad-schema/licence.txt (+7/-0)
source4/setup/aggregate_schema.ldif (+5/-0)
source4/setup/cn=samba.ldif (+16/-0)
source4/setup/display-specifiers/DisplaySpecifiers-Win2k0.txt (+23573/-0)
source4/setup/display-specifiers/DisplaySpecifiers-Win2k3.txt (+29548/-0)
source4/setup/display-specifiers/DisplaySpecifiers-Win2k3R2.txt (+29549/-0)
source4/setup/display-specifiers/DisplaySpecifiers-Win2k8.txt (+32733/-0)
source4/setup/display-specifiers/DisplaySpecifiers-Win2k8R2.txt (+32758/-0)
source4/setup/dns_update_list (+56/-0)
source4/setup/fedora-ds-init.ldif (+27/-0)
source4/setup/fedorads-dna.ldif (+17/-0)
source4/setup/fedorads-index.ldif (+7/-0)
source4/setup/fedorads-linked-attributes.ldif (+7/-0)
source4/setup/fedorads-pam.ldif (+2/-0)
source4/setup/fedorads-partitions.ldif (+45/-0)
source4/setup/fedorads-refint-add.ldif (+6/-0)
source4/setup/fedorads-refint-delete.ldif (+20/-0)
source4/setup/fedorads-samba.ldif (+21/-0)
source4/setup/fedorads-sasl.ldif (+20/-0)
source4/setup/fedorads.inf (+36/-0)
source4/setup/idmap_init.ldif (+8/-0)
source4/setup/krb5.conf (+4/-0)
source4/setup/memberof.conf (+9/-0)
source4/setup/mmr_serverids.conf (+1/-0)
source4/setup/mmr_syncrepl.conf (+12/-0)
source4/setup/modules.conf (+1/-0)
source4/setup/named.conf (+39/-0)
source4/setup/named.conf.dlz (+25/-0)
source4/setup/named.conf.update (+4/-0)
source4/setup/named.txt (+49/-0)
source4/setup/olc_mmr.conf (+3/-0)
source4/setup/olc_seed.ldif (+16/-0)
source4/setup/olc_serverid.conf (+1/-0)
source4/setup/olc_syncrepl.conf (+13/-0)
source4/setup/olc_syncrepl_seed.conf (+5/-0)
source4/setup/prefixMap.txt (+41/-0)
source4/setup/provision.ldif (+853/-0)
source4/setup/provision.reg (+45/-0)
source4/setup/provision.zone (+50/-0)
source4/setup/provision_basedn.ldif (+10/-0)
source4/setup/provision_basedn_modify.ldif (+94/-0)
source4/setup/provision_basedn_options.ldif (+2/-0)
source4/setup/provision_basedn_references.ldif (+22/-0)
source4/setup/provision_computers_add.ldif (+4/-0)
source4/setup/provision_computers_modify.ldif (+13/-0)
source4/setup/provision_configuration.ldif (+1253/-0)
source4/setup/provision_configuration_basedn.ldif (+9/-0)
source4/setup/provision_configuration_modify.ldif (+6/-0)
source4/setup/provision_configuration_references.ldif (+14/-0)
source4/setup/provision_dns_accounts_add.ldif (+12/-0)
source4/setup/provision_dns_add_samba.ldif (+16/-0)
source4/setup/provision_dnszones_add.ldif (+42/-0)
source4/setup/provision_dnszones_modify.ldif (+21/-0)
source4/setup/provision_dnszones_partitions.ldif (+11/-0)
source4/setup/provision_group_policy.ldif (+57/-0)
source4/setup/provision_init.ldif (+33/-0)
source4/setup/provision_partitions.ldif (+6/-0)
source4/setup/provision_privilege.ldif (+78/-0)
source4/setup/provision_rootdse_add.ldif (+29/-0)
source4/setup/provision_rootdse_modify.ldif (+7/-0)
source4/setup/provision_schema_basedn.ldif (+9/-0)
source4/setup/provision_schema_basedn_modify.ldif (+10/-0)
source4/setup/provision_self_join.ldif (+29/-0)
source4/setup/provision_self_join_config.ldif (+33/-0)
source4/setup/provision_self_join_modify.ldif (+26/-0)
source4/setup/provision_self_join_modify_config.ldif (+14/-0)
source4/setup/provision_users.ldif (+434/-0)
source4/setup/provision_users_add.ldif (+4/-0)
source4/setup/provision_users_modify.ldif (+13/-0)
source4/setup/provision_well_known_sec_princ.ldif (+137/-0)
source4/setup/refint.conf (+3/-0)
source4/setup/schema-map-fedora-ds-1.0 (+86/-0)
source4/setup/schema-map-openldap-2.3 (+56/-0)
source4/setup/schema_samba4.ldif (+394/-0)
source4/setup/secrets.ldif (+10/-0)
source4/setup/secrets_dns.ldif (+12/-0)
source4/setup/secrets_init.ldif (+16/-0)
source4/setup/secrets_sasl_ldap.ldif (+7/-0)
source4/setup/secrets_simple_ldap.ldif (+6/-0)
source4/setup/share.ldif (+46/-0)
source4/setup/slapd.conf (+194/-0)
source4/setup/spn_update_list (+30/-0)
source4/setup/tests/blackbox_group.sh (+80/-0)
source4/setup/tests/blackbox_newuser.sh (+42/-0)
source4/setup/tests/blackbox_provision-backend.sh (+26/-0)
source4/setup/tests/blackbox_provision.sh (+48/-0)
source4/setup/tests/blackbox_s3upgrade.sh (+99/-0)
source4/setup/tests/blackbox_setpassword.sh (+30/-0)
source4/setup/tests/blackbox_spn.sh (+33/-0)
source4/setup/tests/blackbox_supported_features.sh (+88/-0)
source4/setup/tests/blackbox_upgradeprovision.sh (+80/-0)
source4/setup/wscript_build (+12/-0)
source4/setup/ypServ30.ldif (+507/-0)
source4/smb_server/blob.c (+810/-0)
source4/smb_server/handle.c (+142/-0)
source4/smb_server/management.c (+138/-0)
source4/smb_server/service_smb.c (+93/-0)
source4/smb_server/session.c (+162/-0)
source4/smb_server/smb/negprot.c (+565/-0)
source4/smb_server/smb/nttrans.c (+812/-0)
source4/smb_server/smb/receive.c (+679/-0)
source4/smb_server/smb/reply.c (+2379/-0)
source4/smb_server/smb/request.c (+779/-0)
source4/smb_server/smb/search.c (+283/-0)
source4/smb_server/smb/service.c (+200/-0)
source4/smb_server/smb/sesssetup.c (+646/-0)
source4/smb_server/smb/signing.c (+147/-0)
source4/smb_server/smb/srvtime.c (+82/-0)
source4/smb_server/smb/trans2.c (+1557/-0)
source4/smb_server/smb/wscript_build (+10/-0)
source4/smb_server/smb2/fileinfo.c (+377/-0)
source4/smb_server/smb2/fileio.c (+546/-0)
source4/smb_server/smb2/find.c (+167/-0)
source4/smb_server/smb2/keepalive.c (+71/-0)
source4/smb_server/smb2/negprot.c (+326/-0)
source4/smb_server/smb2/receive.c (+710/-0)
source4/smb_server/smb2/sesssetup.c (+326/-0)
source4/smb_server/smb2/smb2_server.h (+192/-0)
source4/smb_server/smb2/tcon.c (+446/-0)
source4/smb_server/smb2/wscript_build (+9/-0)
source4/smb_server/smb_server.c (+203/-0)
source4/smb_server/smb_server.h (+521/-0)
source4/smb_server/tcon.c (+194/-0)
source4/smb_server/wscript_build (+21/-0)
source4/smbd/process_model.c (+138/-0)
source4/smbd/process_model.h (+86/-0)
source4/smbd/process_single.c (+138/-0)
source4/smbd/process_standard.c (+511/-0)
source4/smbd/server.c (+648/-0)
source4/smbd/service.c (+105/-0)
source4/smbd/service.h (+30/-0)
source4/smbd/service_named_pipe.c (+260/-0)
source4/smbd/service_stream.c (+399/-0)
source4/smbd/service_stream.h (+79/-0)
source4/smbd/service_task.c (+125/-0)
source4/smbd/service_task.h (+38/-0)
source4/smbd/wscript_build (+46/-0)
source4/torture/auth/ntlmssp.c (+163/-0)
source4/torture/auth/pac.c (+741/-0)
source4/torture/auth/smbencrypt.c (+70/-0)
source4/torture/basic/aliases.c (+397/-0)
source4/torture/basic/attr.c (+433/-0)
source4/torture/basic/base.c (+2002/-0)
source4/torture/basic/charset.c (+209/-0)
source4/torture/basic/cxd_known.h (+8670/-0)
source4/torture/basic/delaywrite.c (+3095/-0)
source4/torture/basic/delete.c (+2246/-0)
source4/torture/basic/denytest.c (+2822/-0)
source4/torture/basic/dir.c (+171/-0)
source4/torture/basic/disconnect.c (+182/-0)
source4/torture/basic/locking.c (+811/-0)
source4/torture/basic/mangle_test.c (+206/-0)
source4/torture/basic/misc.c (+999/-0)
source4/torture/basic/properties.c (+118/-0)
source4/torture/basic/rename.c (+98/-0)
source4/torture/basic/scanner.c (+623/-0)
source4/torture/basic/secleak.c (+77/-0)
source4/torture/basic/unlink.c (+91/-0)
source4/torture/basic/utable.c (+202/-0)
source4/torture/dfs/common.c (+71/-0)
source4/torture/dfs/domaindfs.c (+540/-0)
source4/torture/dns/dlz_bind9.c (+1100/-0)
source4/torture/dns/internal_dns.c (+189/-0)
source4/torture/dns/wscript_build (+19/-0)
source4/torture/drs/drs_init.c (+80/-0)
source4/torture/drs/drs_util.c (+168/-0)
source4/torture/drs/python/cracknames.py (+166/-0)
source4/torture/drs/python/delete_object.py (+378/-0)
source4/torture/drs/python/drs_base.py (+469/-0)
source4/torture/drs/python/fsmo.py (+145/-0)
source4/torture/drs/python/getnc_exop.py (+1077/-0)
source4/torture/drs/python/getnc_unpriv.py (+116/-0)
source4/torture/drs/python/linked_attributes_drs.py (+178/-0)
source4/torture/drs/python/repl_move.py (+2586/-0)
source4/torture/drs/python/repl_rodc.py (+645/-0)
source4/torture/drs/python/repl_schema.py (+450/-0)
source4/torture/drs/python/replica_sync.py (+580/-0)
source4/torture/drs/python/ridalloc_exop.py (+676/-0)
source4/torture/drs/python/samba_tool_drs.py (+436/-0)
source4/torture/drs/rpc/dssync.c (+1074/-0)
source4/torture/drs/rpc/msds_intid.c (+792/-0)
source4/torture/drs/unit/prefixmap_tests.c (+900/-0)
source4/torture/drs/unit/schemainfo_tests.c (+740/-0)
source4/torture/drs/wscript_build (+12/-0)
source4/torture/gentest.c (+3311/-0)
source4/torture/krb5/kdc-canon-heimdal.c (+2255/-0)
source4/torture/krb5/kdc-heimdal.c (+728/-0)
source4/torture/krb5/kdc-mit.c (+795/-0)
source4/torture/krb5/wscript_build (+19/-0)
source4/torture/ldap/basic.c (+1005/-0)
source4/torture/ldap/cldap.c (+179/-0)
source4/torture/ldap/cldapbench.c (+233/-0)
source4/torture/ldap/common.c (+150/-0)
source4/torture/ldap/ldap_sort.c (+158/-0)
source4/torture/ldap/nested_search.c (+206/-0)
source4/torture/ldap/netlogon.c (+662/-0)
source4/torture/ldap/schema.c (+408/-0)
source4/torture/ldap/uptodatevector.c (+173/-0)
source4/torture/ldb/ldb.c (+1344/-0)
source4/torture/libnet/domain.c (+117/-0)
source4/torture/libnet/groupinfo.c (+128/-0)
source4/torture/libnet/groupman.c (+97/-0)
source4/torture/libnet/grouptest.h (+20/-0)
source4/torture/libnet/libnet.c (+70/-0)
source4/torture/libnet/libnet_BecomeDC.c (+186/-0)
source4/torture/libnet/libnet_domain.c (+440/-0)
source4/torture/libnet/libnet_group.c (+210/-0)
source4/torture/libnet/libnet_lookup.c (+191/-0)
source4/torture/libnet/libnet_rpc.c (+230/-0)
source4/torture/libnet/libnet_share.c (+243/-0)
source4/torture/libnet/libnet_user.c (+520/-0)
source4/torture/libnet/python/samr-test.py (+59/-0)
source4/torture/libnet/userinfo.c (+192/-0)
source4/torture/libnet/userman.c (+473/-0)
source4/torture/libnet/usertest.h (+42/-0)
source4/torture/libnet/utils.c (+556/-0)
source4/torture/libnetapi/libnetapi.c (+99/-0)
source4/torture/libnetapi/libnetapi_group.c (+520/-0)
source4/torture/libnetapi/libnetapi_server.c (+76/-0)
source4/torture/libnetapi/libnetapi_user.c (+485/-0)
source4/torture/libnetapi/wscript_build (+11/-0)
source4/torture/libsmbclient/libsmbclient.c (+222/-0)
source4/torture/libsmbclient/wscript_build (+14/-0)
source4/torture/local/dbspeed.c (+268/-0)
source4/torture/local/fsrvp_state.c (+492/-0)
source4/torture/local/local.c (+114/-0)
source4/torture/local/nss_tests.c (+1001/-0)
source4/torture/local/torture.c (+85/-0)
source4/torture/local/verif_trailer.c (+99/-0)
source4/torture/local/wscript_build (+39/-0)
source4/torture/locktest.c (+666/-0)
source4/torture/man/gentest.1.xml (+162/-0)
source4/torture/man/locktest.1.xml (+160/-0)
source4/torture/man/masktest.1.xml (+142/-0)
source4/torture/man/smbtorture.1.xml (+258/-0)
source4/torture/masktest.c (+392/-0)
source4/torture/nbench/nbench.c (+298/-0)
source4/torture/nbench/nbio.c (+994/-0)
source4/torture/nbt/dgram.c (+698/-0)
source4/torture/nbt/nbt.c (+69/-0)
source4/torture/nbt/query.c (+115/-0)
source4/torture/nbt/register.c (+176/-0)
source4/torture/nbt/wins.c (+545/-0)
source4/torture/nbt/winsbench.c (+300/-0)
source4/torture/nbt/winsreplication.c (+9878/-0)
source4/torture/ndr/README (+21/-0)
source4/torture/ndr/atsvc.c (+215/-0)
source4/torture/ndr/backupkey.c (+163/-0)
source4/torture/ndr/cabinet.c (+4323/-0)
source4/torture/ndr/charset.c (+91/-0)
source4/torture/ndr/clusapi.c (+383/-0)
source4/torture/ndr/dfs.c (+115/-0)
source4/torture/ndr/dfsblob.c (+85/-0)
source4/torture/ndr/drsblobs.c (+558/-0)
source4/torture/ndr/drsuapi.c (+309/-0)
source4/torture/ndr/epmap.c (+80/-0)
source4/torture/ndr/krb5pac.c (+705/-0)
source4/torture/ndr/lsa.c (+2230/-0)
source4/torture/ndr/nbt.c (+253/-0)
source4/torture/ndr/ndr.c (+610/-0)
source4/torture/ndr/ndr.h (+108/-0)
source4/torture/ndr/negoex.c (+100/-0)
source4/torture/ndr/netlogon.c (+213/-0)
source4/torture/ndr/ntlmssp.c (+296/-0)
source4/torture/ndr/ntprinting.c (+657/-0)
source4/torture/ndr/samr.c (+355/-0)
source4/torture/ndr/spoolss.c (+2064/-0)
source4/torture/ndr/string.c (+198/-0)
source4/torture/ndr/winreg.c (+620/-0)
source4/torture/ndr/winspool.c (+173/-0)
source4/torture/ndr/witness.c (+368/-0)
source4/torture/ntp/ntp_signd.c (+303/-0)
source4/torture/rap/printing.c (+711/-0)
source4/torture/rap/rap.c (+275/-0)
source4/torture/rap/rpc.c (+100/-0)
source4/torture/rap/sam.c (+361/-0)
source4/torture/raw/acls.c (+2483/-0)
source4/torture/raw/chkpath.c (+390/-0)
source4/torture/raw/close.c (+178/-0)
source4/torture/raw/composite.c (+417/-0)
source4/torture/raw/context.c (+893/-0)
source4/torture/raw/eas.c (+593/-0)
source4/torture/raw/ioctl.c (+191/-0)
source4/torture/raw/lock.c (+2519/-0)
source4/torture/raw/lockbench.c (+447/-0)
source4/torture/raw/lookuprate.c (+317/-0)
source4/torture/raw/missing.txt (+160/-0)
source4/torture/raw/mkdir.c (+171/-0)
source4/torture/raw/mux.c (+342/-0)
source4/torture/raw/notify.c (+2005/-0)
source4/torture/raw/offline.c (+514/-0)
source4/torture/raw/open.c (+2254/-0)
source4/torture/raw/openbench.c (+502/-0)
source4/torture/raw/oplock.c (+4659/-0)
source4/torture/raw/pingpong.c (+248/-0)
source4/torture/raw/qfileinfo.c (+923/-0)
source4/torture/raw/qfsinfo.c (+296/-0)
source4/torture/raw/raw.c (+85/-0)
source4/torture/raw/read.c (+1039/-0)
source4/torture/raw/rename.c (+725/-0)
source4/torture/raw/samba3hide.c (+326/-0)
source4/torture/raw/samba3misc.c (+1063/-0)
source4/torture/raw/search.c (+1515/-0)
source4/torture/raw/seek.c (+242/-0)
source4/torture/raw/session.c (+440/-0)
source4/torture/raw/setfileinfo.c (+1152/-0)
source4/torture/raw/streams.c (+2091/-0)
source4/torture/raw/tconrate.c (+208/-0)
source4/torture/raw/unlink.c (+542/-0)
source4/torture/raw/write.c (+710/-0)
source4/torture/rpc/alter_context.c (+111/-0)
source4/torture/rpc/async_bind.c (+86/-0)
source4/torture/rpc/atsvc.c (+138/-0)
source4/torture/rpc/autoidl.c (+312/-0)
source4/torture/rpc/backupkey.c (+2438/-0)
source4/torture/rpc/backupkey_heimdal.c (+2160/-0)
source4/torture/rpc/bench.c (+152/-0)
source4/torture/rpc/bind.c (+119/-0)
source4/torture/rpc/browser.c (+124/-0)
source4/torture/rpc/clusapi.c (+3998/-0)
source4/torture/rpc/countcalls.c (+131/-0)
source4/torture/rpc/dfs.c (+651/-0)
source4/torture/rpc/drsuapi.c (+875/-0)
source4/torture/rpc/drsuapi.h (+93/-0)
source4/torture/rpc/drsuapi_cracknames.c (+1084/-0)
source4/torture/rpc/drsuapi_w2k8.c (+334/-0)
source4/torture/rpc/dsgetinfo.c (+456/-0)
source4/torture/rpc/dssetup.c (+64/-0)
source4/torture/rpc/echo.c (+474/-0)
source4/torture/rpc/epmapper.c (+689/-0)
source4/torture/rpc/eventlog.c (+502/-0)
source4/torture/rpc/forest_trust.c (+897/-0)
source4/torture/rpc/frsapi.c (+276/-0)
source4/torture/rpc/fsrvp.c (+968/-0)
source4/torture/rpc/handles.c (+620/-0)
source4/torture/rpc/initshutdown.c (+116/-0)
source4/torture/rpc/iremotewinspool.c (+941/-0)
source4/torture/rpc/join.c (+86/-0)
source4/torture/rpc/lsa.c (+5295/-0)
source4/torture/rpc/lsa_lookup.c (+424/-0)
source4/torture/rpc/mgmt.c (+322/-0)
source4/torture/rpc/netlogon.c (+4870/-0)
source4/torture/rpc/netlogon.h (+37/-0)
source4/torture/rpc/ntsvcs.c (+189/-0)
source4/torture/rpc/object_uuid.c (+85/-0)
source4/torture/rpc/oxidresolve.c (+263/-0)
source4/torture/rpc/remact.c (+104/-0)
source4/torture/rpc/remote_pac.c (+978/-0)
source4/torture/rpc/rpc.c (+577/-0)
source4/torture/rpc/samba3rpc.c (+4579/-0)
source4/torture/rpc/samlogon.c (+2063/-0)
source4/torture/rpc/samr.c (+8867/-0)
source4/torture/rpc/samr_accessmask.c (+1197/-0)
source4/torture/rpc/samr_priv.c (+580/-0)
source4/torture/rpc/samsync.c (+1789/-0)
source4/torture/rpc/scanner.c (+187/-0)
source4/torture/rpc/schannel.c (+1127/-0)
source4/torture/rpc/session_key.c (+250/-0)
source4/torture/rpc/spoolss.c (+11489/-0)
source4/torture/rpc/spoolss_access.c (+904/-0)
source4/torture/rpc/spoolss_notify.c (+614/-0)
source4/torture/rpc/spoolss_win.c (+612/-0)
source4/torture/rpc/srvsvc.c (+1199/-0)
source4/torture/rpc/svcctl.c (+657/-0)
source4/torture/rpc/testjoin.c (+921/-0)
source4/torture/rpc/torture_rpc.h (+104/-0)
source4/torture/rpc/unixinfo.c (+149/-0)
source4/torture/rpc/winreg.c (+3145/-0)
source4/torture/rpc/witness.c (+911/-0)
source4/torture/rpc/wkssvc.c (+1447/-0)
source4/torture/shell.c (+326/-0)
source4/torture/smb2/acls.c (+2111/-0)
source4/torture/smb2/compound.c (+1322/-0)
source4/torture/smb2/connect.c (+257/-0)
source4/torture/smb2/create.c (+1760/-0)
source4/torture/smb2/credits.c (+268/-0)
source4/torture/smb2/delete-on-close.c (+602/-0)
source4/torture/smb2/dir.c (+1399/-0)
source4/torture/smb2/dosmode.c (+183/-0)
source4/torture/smb2/durable_open.c (+2809/-0)
source4/torture/smb2/durable_v2_open.c (+2030/-0)
source4/torture/smb2/getinfo.c (+493/-0)
source4/torture/smb2/ioctl.c (+6837/-0)
source4/torture/smb2/lease.c (+4102/-0)
source4/torture/smb2/lock.c (+3155/-0)
source4/torture/smb2/maxfid.c (+151/-0)
source4/torture/smb2/maxwrite.c (+137/-0)
source4/torture/smb2/notify.c (+2553/-0)
source4/torture/smb2/notify_disabled.c (+120/-0)
source4/torture/smb2/oplock.c (+5045/-0)
source4/torture/smb2/read.c (+319/-0)
source4/torture/smb2/rename.c (+1467/-0)
source4/torture/smb2/replay.c (+2452/-0)
source4/torture/smb2/scan.c (+265/-0)
source4/torture/smb2/session.c (+1691/-0)
source4/torture/smb2/setinfo.c (+410/-0)
source4/torture/smb2/smb2.c (+190/-0)
source4/torture/smb2/streams.c (+1857/-0)
source4/torture/smb2/util.c (+883/-0)
source4/torture/smb2/wscript_build (+40/-0)
source4/torture/smbtorture.c (+712/-0)
source4/torture/smbtorture.h (+154/-0)
source4/torture/tests/test_gentest.sh (+35/-0)
source4/torture/tests/test_locktest.sh (+28/-0)
source4/torture/tests/test_masktest.sh (+28/-0)
source4/torture/torture.c (+60/-0)
source4/torture/unix/unix.c (+40/-0)
source4/torture/unix/unix_info2.c (+465/-0)
source4/torture/unix/whoami.c (+421/-0)
source4/torture/util.h (+111/-0)
source4/torture/util_smb.c (+968/-0)
source4/torture/vfs/acl_xattr.c (+315/-0)
source4/torture/vfs/fruit.c (+4564/-0)
source4/torture/vfs/vfs.c (+119/-0)
source4/torture/winbind/struct_based.c (+1103/-0)
source4/torture/winbind/winbind.c (+318/-0)
source4/torture/winbind/wscript_build (+10/-0)
source4/torture/wscript_build (+336/-0)
source4/utils/man/ad2oLschema.1.xml (+87/-0)
source4/utils/man/oLschema2ldif.1.xml (+82/-0)
source4/utils/oLschema2ldif.c (+696/-0)
source4/utils/tests/test_demote.sh (+38/-0)
source4/utils/tests/test_nmblookup.sh (+37/-0)
source4/utils/tests/test_samba_tool.sh (+45/-0)
source4/utils/tests/test_smbclient.sh (+34/-0)
source4/utils/wscript_build (+8/-0)
source4/web_server/web_server.c (+376/-0)
source4/web_server/web_server.h (+73/-0)
source4/web_server/wscript_build (+20/-0)
source4/web_server/wsgi.c (+523/-0)
source4/winbind/idmap.c (+859/-0)
source4/winbind/idmap.h (+38/-0)
source4/winbind/wb_utils.c (+51/-0)
source4/winbind/winbindd.c (+98/-0)
source4/winbind/wscript_build (+25/-0)
source4/wrepl_server/wrepl_apply_records.c (+1503/-0)
source4/wrepl_server/wrepl_in_call.c (+589/-0)
source4/wrepl_server/wrepl_in_connection.c (+485/-0)
source4/wrepl_server/wrepl_out_helpers.c (+1144/-0)
source4/wrepl_server/wrepl_out_helpers.h (+37/-0)
source4/wrepl_server/wrepl_out_pull.c (+142/-0)
source4/wrepl_server/wrepl_out_push.c (+144/-0)
source4/wrepl_server/wrepl_periodic.c (+118/-0)
source4/wrepl_server/wrepl_scavenging.c (+570/-0)
source4/wrepl_server/wrepl_server.c (+512/-0)
source4/wrepl_server/wrepl_server.h (+321/-0)
source4/wrepl_server/wscript_build (+11/-0)
source4/wscript_build (+13/-0)
testdata/ldif-utils-test-multisite.ldif (+1007/-0)
testdata/minschema_classes.txt (+41/-0)
testdata/samba3/provision_samba3sam.ldif (+78/-0)
testdata/samba3/provision_samba3sam_templates.ldif (+118/-0)
testdata/samba3/samba3.ldif (+206/-0)
testdata/samba3/smb.conf (+24/-0)
testdata/samba3/smbpasswd (+3/-0)
testdata/samba3/wins.dat (+23/-0)
testdata/samba3/wins.dat2 (+23/-0)
testdata/unconnected-intrasite.ldif (+606/-0)
testprogs/blackbox/bogus.sh (+28/-0)
testprogs/blackbox/common-links.sh (+215/-0)
testprogs/blackbox/common_test_fns.inc (+106/-0)
testprogs/blackbox/dbcheck-links.sh (+307/-0)
testprogs/blackbox/dbcheck-oldrelease.sh (+499/-0)
testprogs/blackbox/dbcheck.sh (+55/-0)
testprogs/blackbox/demote-saveddb.sh (+67/-0)
testprogs/blackbox/dfree.sh (+8/-0)
testprogs/blackbox/dom_parse.sh (+27/-0)
testprogs/blackbox/nsstest.sh (+22/-0)
testprogs/blackbox/renamedc.sh (+96/-0)
testprogs/blackbox/runtime-links.sh (+74/-0)
testprogs/blackbox/subunit.sh (+121/-0)
testprogs/blackbox/test_chgdcpass.sh (+114/-0)
testprogs/blackbox/test_client_etypes.sh (+83/-0)
testprogs/blackbox/test_export_keytab_heimdal.sh (+103/-0)
testprogs/blackbox/test_export_keytab_mit.sh (+127/-0)
testprogs/blackbox/test_kinit_heimdal.sh (+259/-0)
testprogs/blackbox/test_kinit_mit.sh (+310/-0)
testprogs/blackbox/test_kinit_trusts_heimdal.sh (+98/-0)
testprogs/blackbox/test_kinit_trusts_mit.sh (+139/-0)
testprogs/blackbox/test_kpasswd_heimdal.sh (+217/-0)
testprogs/blackbox/test_kpasswd_mit.sh (+231/-0)
testprogs/blackbox/test_ktpass.sh (+41/-0)
testprogs/blackbox/test_ldb.sh (+231/-0)
testprogs/blackbox/test_ldb_simple.sh (+41/-0)
testprogs/blackbox/test_net_ads.sh (+91/-0)
testprogs/blackbox/test_net_ads_dns.sh (+102/-0)
testprogs/blackbox/test_net_rpc_user.sh (+56/-0)
testprogs/blackbox/test_password_settings.sh (+223/-0)
testprogs/blackbox/test_pdbtest.sh (+98/-0)
testprogs/blackbox/test_pkinit_heimdal.sh (+166/-0)
testprogs/blackbox/test_pkinit_pac_heimdal.sh (+53/-0)
testprogs/blackbox/test_samba_upgradedns.sh (+41/-0)
testprogs/blackbox/test_trust_ntlm.sh (+164/-0)
testprogs/blackbox/test_trust_utils.sh (+138/-0)
testprogs/blackbox/test_wintest.sh (+45/-0)
testprogs/blackbox/tfork.sh (+15/-0)
testprogs/blackbox/tombstones-expunge.sh (+239/-0)
testprogs/blackbox/upgradeprovision-oldrelease.sh (+227/-0)
testprogs/blackbox/wintest/wintest.conf (+7/-0)
testprogs/win32/midltests/Makefile (+16/-0)
testprogs/win32/midltests/Makefile.simple (+27/-0)
testprogs/win32/midltests/Makefile.tcp (+22/-0)
testprogs/win32/midltests/invalid/README.txt (+3/-0)
testprogs/win32/midltests/invalid/midltests_pipe_struct_union_01.idl (+279/-0)
testprogs/win32/midltests/invalid/midltests_pipe_struct_union_01.txt (+17/-0)
testprogs/win32/midltests/midltests.acf (+6/-0)
testprogs/win32/midltests/midltests.idl (+51/-0)
testprogs/win32/midltests/midltests_c_m.c (+2/-0)
testprogs/win32/midltests/midltests_marshall.c (+125/-0)
testprogs/win32/midltests/midltests_marshall.h (+19/-0)
testprogs/win32/midltests/midltests_s_m.c (+2/-0)
testprogs/win32/midltests/midltests_simple.c (+42/-0)
testprogs/win32/midltests/midltests_tcp.c (+646/-0)
testprogs/win32/midltests/todo/midltests-array-range.idl (+39/-0)
testprogs/win32/midltests/todo/midltests-pipe-02.idl (+153/-0)
testprogs/win32/midltests/todo/midltests-pipe-03-hyper.idl (+205/-0)
testprogs/win32/midltests/todo/midltests-pipe-04-struct.idl (+272/-0)
testprogs/win32/midltests/todo/midltests-pipe-first.idl (+233/-0)
testprogs/win32/midltests/todo/midltests-pipe-sync-ndr32-downgrade-02.idl (+296/-0)
testprogs/win32/midltests/todo/midltests-string-in-out-ref.idl (+33/-0)
testprogs/win32/midltests/todo/midltests-transmit-as.idl (+59/-0)
testprogs/win32/midltests/todo/midltests_pointer_default.idl (+20/-0)
testprogs/win32/midltests/utils.c (+32/-0)
testprogs/win32/midltests/valid/README.txt (+6/-0)
testprogs/win32/midltests/valid/midltests-pipe-sync-ndr32-downgrade-01.idl (+296/-0)
testprogs/win32/midltests/valid/midltests-pipe-sync-ndr32-downgrade-01.txt (+138/-0)
testprogs/win32/midltests/valid/midltests-pipe-sync-ndr32-downgrade-02.idl (+300/-0)
testprogs/win32/midltests/valid/midltests-pipe-sync-ndr32-downgrade-02.txt (+3266/-0)
testprogs/win32/midltests/valid/midltests_DRS_EXTENSIONS.idl (+64/-0)
testprogs/win32/midltests/valid/midltests_DRS_EXTENSIONS.out (+43/-0)
testprogs/win32/midltests/valid/midltests_fixed_size_in_array_01.idl (+29/-0)
testprogs/win32/midltests/valid/midltests_fixed_size_in_array_01.txt (+6/-0)
testprogs/win32/midltests/valid/midltests_strings_array_01.err.txt (+13/-0)
testprogs/win32/midltests/valid/midltests_strings_array_01.idl (+44/-0)
testprogs/win32/midltests/valid/midltests_strings_array_02.idl (+44/-0)
testprogs/win32/midltests/valid/midltests_strings_array_02.txt (+9/-0)
testprogs/win32/midltests/valid/midltests_union_align_01.idl (+42/-0)
testprogs/win32/midltests/valid/midltests_union_align_01.txt (+24/-0)
testprogs/win32/midltests/valid/midltests_union_align_02.idl (+61/-0)
testprogs/win32/midltests/valid/midltests_union_align_02.txt (+37/-0)
testprogs/win32/midltests/valid/midltests_union_align_03.idl (+64/-0)
testprogs/win32/midltests/valid/midltests_union_align_03.txt (+37/-0)
testprogs/win32/midltests/valid/midltests_union_align_04.idl (+64/-0)
testprogs/win32/midltests/valid/midltests_union_align_04.txt (+37/-0)
testprogs/win32/midltests/valid/midltests_union_align_05.idl (+61/-0)
testprogs/win32/midltests/valid/midltests_union_align_05.txt (+37/-0)
testprogs/win32/midltests/valid/midltests_union_align_06.idl (+61/-0)
testprogs/win32/midltests/valid/midltests_union_align_06.txt (+37/-0)
testprogs/win32/midltests/valid/midltests_union_align_07.idl (+61/-0)
testprogs/win32/midltests/valid/midltests_union_align_07.txt (+38/-0)
testprogs/win32/midltests/valid/midltests_union_align_08.idl (+68/-0)
testprogs/win32/midltests/valid/midltests_union_align_08.txt (+129/-0)
testprogs/win32/midltests/valid/midltests_union_align_09.idl (+69/-0)
testprogs/win32/midltests/valid/midltests_union_align_09.txt (+129/-0)
testprogs/win32/midltests/valid/midltests_union_align_10.idl (+71/-0)
testprogs/win32/midltests/valid/midltests_union_align_10.txt (+129/-0)
testprogs/win32/midltests/valid/midltests_union_align_11.idl (+70/-0)
testprogs/win32/midltests/valid/midltests_union_align_11.txt (+129/-0)
testprogs/win32/midltests/valid/midltests_union_align_12.idl (+70/-0)
testprogs/win32/midltests/valid/midltests_union_align_12.txt (+129/-0)
testprogs/win32/midltests/valid/midltests_union_align_13.idl (+71/-0)
testprogs/win32/midltests/valid/midltests_union_align_13.txt (+129/-0)
testprogs/win32/midltests/valid/midltests_union_align_14.idl (+71/-0)
testprogs/win32/midltests/valid/midltests_union_align_14.txt (+131/-0)
testprogs/win32/midltests/valid/midltests_union_align_15.idl (+72/-0)
testprogs/win32/midltests/valid/midltests_union_align_15.txt (+131/-0)
testprogs/win32/midltests/valid/midltests_union_align_16.idl (+93/-0)
testprogs/win32/midltests/valid/midltests_union_align_16.txt (+137/-0)
testprogs/win32/midltests/valid/midltests_union_align_17.idl (+94/-0)
testprogs/win32/midltests/valid/midltests_union_align_17.txt (+137/-0)
testprogs/win32/midltests/valid/midltests_union_align_18.idl (+93/-0)
testprogs/win32/midltests/valid/midltests_union_align_18.txt (+137/-0)
testprogs/win32/midltests/valid/midltests_union_align_19.idl (+90/-0)
testprogs/win32/midltests/valid/midltests_union_align_19.txt (+137/-0)
testprogs/win32/midltests/valid/midltests_union_align_20.idl (+91/-0)
testprogs/win32/midltests/valid/midltests_union_align_20.txt (+137/-0)
testprogs/win32/midltests/valid/midltests_v1_enum_01.idl (+56/-0)
testprogs/win32/midltests/valid/midltests_v1_enum_01.txt (+37/-0)
testprogs/win32/npecho/GNUmakefile (+24/-0)
testprogs/win32/npecho/NMakefile (+26/-0)
testprogs/win32/npecho/npecho_client.c (+50/-0)
testprogs/win32/npecho/npecho_client2.c (+117/-0)
testprogs/win32/npecho/npecho_server2.c (+76/-0)
testprogs/win32/prepare_dcpromo/GNUmakefile (+21/-0)
testprogs/win32/prepare_dcpromo/NMakefile (+16/-0)
testprogs/win32/prepare_dcpromo/prepare_dcpromo.c (+1074/-0)
testprogs/win32/rpcecho/Makefile (+23/-0)
testprogs/win32/rpcecho/README (+46/-0)
testprogs/win32/rpcecho/client.c (+367/-0)
testprogs/win32/rpcecho/rpcecho.acf (+26/-0)
testprogs/win32/rpcecho/rpcecho.idl (+146/-0)
testprogs/win32/rpcecho/server.c (+208/-0)
testprogs/win32/rpcecho/utils.c (+32/-0)
testprogs/win32/spoolss/GNUmakefile (+23/-0)
testprogs/win32/spoolss/NMakefile (+43/-0)
testprogs/win32/spoolss/README.win32 (+65/-0)
testprogs/win32/spoolss/error.c (+137/-0)
testprogs/win32/spoolss/error.h (+36/-0)
testprogs/win32/spoolss/printlib.c (+1386/-0)
testprogs/win32/spoolss/printlib_proto.h (+67/-0)
testprogs/win32/spoolss/string.h (+15/-0)
testprogs/win32/spoolss/testspoolss.c (+1842/-0)
testprogs/win32/spoolss/testspoolss.h (+51/-0)
testprogs/win32/spoolss/testspoolss.sln (+20/-0)
testprogs/win32/spoolss/testspoolss.vcproj (+224/-0)
testprogs/win32/spoolss/torture.c (+106/-0)
testprogs/win32/spoolss/torture.h (+92/-0)
testprogs/win32/spoolss/torture_proto.h (+32/-0)
testprogs/win32/testmailslot/GNUmakefile (+16/-0)
testprogs/win32/testmailslot/NMakefile (+13/-0)
testprogs/win32/testmailslot/testmailslot.c (+80/-0)
testprogs/win32/vs2010-metze.cmd (+24/-0)
testprogs/win32/wmi/echoprocessor.vbs (+10/-0)
tests/README (+10/-0)
tests/fcntl_lock.c (+132/-0)
tests/fcntl_lock_thread.c (+117/-0)
tests/ftruncate.c (+31/-0)
tests/getgroups.c (+66/-0)
tests/oldquotas.c (+115/-0)
tests/readlink.c (+33/-0)
tests/shared_mmap.c (+70/-0)
tests/shlib.c (+8/-0)
tests/summary.c (+28/-0)
tests/sysquotas.c (+90/-0)
tests/trivial.c (+7/-0)
testsuite/README (+15/-0)
testsuite/build_farm/backtrace (+15/-0)
testsuite/build_farm/basicsmb-domainsec-nt4.test (+28/-0)
testsuite/build_farm/basicsmb-domainsec.test (+27/-0)
testsuite/build_farm/basicsmb-hostsdeny.test (+18/-0)
testsuite/build_farm/basicsmb-hostsequiv.test (+26/-0)
testsuite/build_farm/basicsmb-invalidusers.test (+10/-0)
testsuite/build_farm/basicsmb-local-pass-change.test (+10/-0)
testsuite/build_farm/basicsmb-preexec.test (+28/-0)
testsuite/build_farm/basicsmb-remote-pass-change.test (+10/-0)
testsuite/build_farm/basicsmb-serversec.test (+9/-0)
testsuite/build_farm/basicsmb-shareguest.test (+20/-0)
testsuite/build_farm/basicsmb-sharelist.test (+22/-0)
testsuite/build_farm/basicsmb-sharesec.test (+9/-0)
testsuite/build_farm/basicsmb-usersec.test (+9/-0)
testsuite/build_farm/basicsmb.fns (+204/-0)
testsuite/build_farm/runlist (+18/-0)
testsuite/build_farm/template/basicsmb.smb.conf (+49/-0)
testsuite/build_farm/template/basicsmb.smb.conf.domain (+2/-0)
testsuite/build_farm/template/basicsmb.smb.conf.hostsdeny (+1/-0)
testsuite/build_farm/template/basicsmb.smb.conf.hostsequiv (+3/-0)
testsuite/build_farm/template/basicsmb.smb.conf.invalidusers (+1/-0)
testsuite/build_farm/template/basicsmb.smb.conf.preexec (+1/-0)
testsuite/build_farm/template/basicsmb.smb.conf.preexec_cl_fl (+2/-0)
testsuite/build_farm/template/basicsmb.smb.conf.preexec_close (+2/-0)
testsuite/build_farm/template/basicsmb.smb.conf.server (+3/-0)
testsuite/build_farm/template/basicsmb.smb.conf.share (+1/-0)
testsuite/build_farm/template/basicsmb.smb.conf.user (+1/-0)
testsuite/build_farm/template/basicsmb.smb.conf.validusers (+1/-0)
testsuite/build_farm/template/preexec (+3/-0)
testsuite/build_farm/torture-ATTR.test (+2/-0)
testsuite/build_farm/torture-BROWSE.test (+2/-0)
testsuite/build_farm/torture-DELETE.test (+2/-0)
testsuite/build_farm/torture-DENY1.test (+2/-0)
testsuite/build_farm/torture-DENY2.test (+2/-0)
testsuite/build_farm/torture-DIR.test (+2/-0)
testsuite/build_farm/torture-DIR1.test (+2/-0)
testsuite/build_farm/torture-FDPASS.test (+2/-0)
testsuite/build_farm/torture-FDSESS.test (+2/-0)
testsuite/build_farm/torture-LOCK1.test (+2/-0)
testsuite/build_farm/torture-LOCK2.test (+2/-0)
testsuite/build_farm/torture-LOCK3.test (+2/-0)
testsuite/build_farm/torture-LOCK4.test (+2/-0)
testsuite/build_farm/torture-LOCK5.test (+2/-0)
testsuite/build_farm/torture-LOCK6.test (+2/-0)
testsuite/build_farm/torture-LOCK7.test (+2/-0)
testsuite/build_farm/torture-MANGLE.test (+2/-0)
testsuite/build_farm/torture-OPEN.test (+2/-0)
testsuite/build_farm/torture-OPLOCK1.test (+2/-0)
testsuite/build_farm/torture-PROPERTIES.test (+2/-0)
testsuite/build_farm/torture-RANDOMIPC.test (+2/-0)
testsuite/build_farm/torture-RENAME.test (+2/-0)
testsuite/build_farm/torture-RW1.test (+2/-0)
testsuite/build_farm/torture-RW2.test (+2/-0)
testsuite/build_farm/torture-TCON.test (+2/-0)
testsuite/build_farm/torture-TCON1.test (+2/-0)
testsuite/build_farm/torture-TCON2.test (+2/-0)
testsuite/build_farm/torture-TCONDEV.test (+2/-0)
testsuite/build_farm/torture-TORTURE.test (+2/-0)
testsuite/build_farm/torture-TRANS2.test (+2/-0)
testsuite/build_farm/torture-UNLINK.test (+2/-0)
testsuite/build_farm/torture-XCOPY.test (+2/-0)
testsuite/build_farm/torture_setup.fns (+19/-0)
testsuite/headers/test_headers.c (+45/-0)
testsuite/headers/wscript_build (+36/-0)
testsuite/nsswitch/Makefile.longarg (+5/-0)
testsuite/nsswitch/bigfd.c (+38/-0)
testsuite/nsswitch/bigfd.exp (+28/-0)
testsuite/nsswitch/domusers.exp (+38/-0)
testsuite/nsswitch/envvar.exp (+282/-0)
testsuite/nsswitch/finger.exp (+39/-0)
testsuite/nsswitch/getent.c (+150/-0)
testsuite/nsswitch/getent.exp (+148/-0)
testsuite/nsswitch/getent_grent.c (+100/-0)
testsuite/nsswitch/getent_pwent.c (+112/-0)
testsuite/nsswitch/getent_r.sh (+35/-0)
testsuite/nsswitch/getgrent_r.c (+84/-0)
testsuite/nsswitch/getgrent_r.exp (+41/-0)
testsuite/nsswitch/getgrgid.c (+57/-0)
testsuite/nsswitch/getgrgid.exp (+50/-0)
testsuite/nsswitch/getgrnam.c (+51/-0)
testsuite/nsswitch/getgrnam.exp (+28/-0)
testsuite/nsswitch/getpwent_r.c (+85/-0)
testsuite/nsswitch/getpwent_r.exp (+41/-0)
testsuite/nsswitch/getpwnam.c (+37/-0)
testsuite/nsswitch/getpwnam.exp (+28/-0)
testsuite/nsswitch/getpwuid.c (+43/-0)
testsuite/nsswitch/getpwuid.exp (+59/-0)
testsuite/nsswitch/groupmem_dom.exp (+33/-0)
testsuite/nsswitch/initgroups.c (+42/-0)
testsuite/nsswitch/initgroups.exp (+37/-0)
testsuite/nsswitch/login.exp (+102/-0)
testsuite/nsswitch/longarg.exp (+29/-0)
testsuite/nsswitch/longarg_getgrnam.c (+41/-0)
testsuite/nsswitch/longarg_getpwnam.c (+41/-0)
testsuite/nsswitch/longarg_utils.h (+26/-0)
testsuite/nsswitch/nss_winbind_syms.c (+63/-0)
testsuite/nsswitch/nss_winbind_syms.exp (+42/-0)
testsuite/nsswitch/pam_winbind_syms.c (+55/-0)
testsuite/nsswitch/pam_winbind_syms.exp (+44/-0)
testsuite/nsswitch/wbinfo.exp (+360/-0)
testsuite/smbd/Makefile.se_access_check (+24/-0)
testsuite/smbd/Makefile.sec_ctx (+57/-0)
testsuite/smbd/se_access_check.exp (+53/-0)
testsuite/smbd/se_access_check_allowall.c (+86/-0)
testsuite/smbd/se_access_check_allowsome.c (+103/-0)
testsuite/smbd/se_access_check_denyall.c (+85/-0)
testsuite/smbd/se_access_check_denysome.c (+105/-0)
testsuite/smbd/se_access_check_empty.c (+108/-0)
testsuite/smbd/se_access_check_nullsd.c (+73/-0)
testsuite/smbd/se_access_check_printer.c (+211/-0)
testsuite/smbd/se_access_check_utils.c (+157/-0)
testsuite/smbd/se_access_check_utils.h (+45/-0)
testsuite/smbd/sec_ctx.exp (+66/-0)
testsuite/smbd/sec_ctx1.c (+39/-0)
testsuite/smbd/sec_ctx_current_user.c (+113/-0)
testsuite/smbd/sec_ctx_flow.c (+72/-0)
testsuite/smbd/sec_ctx_groups.c (+130/-0)
testsuite/smbd/sec_ctx_nonroot.c (+41/-0)
testsuite/smbd/sec_ctx_root.c (+60/-0)
testsuite/smbd/sec_ctx_stack.c (+85/-0)
testsuite/smbd/sec_ctx_torture.c (+102/-0)
testsuite/smbd/sec_ctx_utils.c (+64/-0)
testsuite/smbd/sec_ctx_utils.h (+29/-0)
testsuite/smbd/sighup.exp (+107/-0)
testsuite/unittests/rpc_test_dummy_module.c (+20/-0)
testsuite/unittests/test_krb5_samba.c (+145/-0)
testsuite/unittests/test_lib_util_modules.c (+76/-0)
testsuite/unittests/test_sambafs_srv_pipe.c (+77/-0)
testsuite/unittests/wscript (+38/-0)
third_party/aesni-intel/aesni-intel_asm.c (+2812/-0)
third_party/aesni-intel/inst-intel.h (+306/-0)
third_party/aesni-intel/wscript (+26/-0)
third_party/cmocka/cmocka.c (+3306/-0)
third_party/cmocka/cmocka.h (+2284/-0)
third_party/cmocka/cmocka_private.h (+163/-0)
third_party/cmocka/wscript (+19/-0)
third_party/dnspython/.gitignore (+7/-0)
third_party/dnspython/ChangeLog (+1194/-0)
third_party/dnspython/LICENSE (+14/-0)
third_party/dnspython/MANIFEST.in (+3/-0)
third_party/dnspython/Makefile (+56/-0)
third_party/dnspython/README (+442/-0)
third_party/dnspython/TODO (+17/-0)
third_party/dnspython/dns/__init__.py (+54/-0)
third_party/dnspython/dns/dnssec.py (+372/-0)
third_party/dnspython/dns/e164.py (+79/-0)
third_party/dnspython/dns/edns.py (+142/-0)
third_party/dnspython/dns/entropy.py (+123/-0)
third_party/dnspython/dns/exception.py (+40/-0)
third_party/dnspython/dns/flags.py (+106/-0)
third_party/dnspython/dns/hash.py (+67/-0)
third_party/dnspython/dns/inet.py (+108/-0)
third_party/dnspython/dns/ipv4.py (+42/-0)
third_party/dnspython/dns/ipv6.py (+163/-0)
third_party/dnspython/dns/message.py (+1088/-0)
third_party/dnspython/dns/name.py (+702/-0)
third_party/dnspython/dns/namedict.py (+59/-0)
third_party/dnspython/dns/node.py (+172/-0)
third_party/dnspython/dns/opcode.py (+104/-0)
third_party/dnspython/dns/query.py (+492/-0)
third_party/dnspython/dns/rcode.py (+119/-0)
third_party/dnspython/dns/rdata.py (+478/-0)
third_party/dnspython/dns/rdataclass.py (+114/-0)
third_party/dnspython/dns/rdataset.py (+329/-0)
third_party/dnspython/dns/rdatatype.py (+232/-0)
third_party/dnspython/dns/rdtypes/ANY/AFSDB.py (+51/-0)
third_party/dnspython/dns/rdtypes/ANY/CERT.py (+131/-0)
third_party/dnspython/dns/rdtypes/ANY/CNAME.py (+24/-0)
third_party/dnspython/dns/rdtypes/ANY/DLV.py (+20/-0)
third_party/dnspython/dns/rdtypes/ANY/DNAME.py (+21/-0)
third_party/dnspython/dns/rdtypes/ANY/DNSKEY.py (+94/-0)
third_party/dnspython/dns/rdtypes/ANY/DS.py (+20/-0)
third_party/dnspython/dns/rdtypes/ANY/GPOS.py (+156/-0)
third_party/dnspython/dns/rdtypes/ANY/HINFO.py (+83/-0)
third_party/dnspython/dns/rdtypes/ANY/HIP.py (+140/-0)
third_party/dnspython/dns/rdtypes/ANY/ISDN.py (+96/-0)
third_party/dnspython/dns/rdtypes/ANY/LOC.py (+334/-0)
third_party/dnspython/dns/rdtypes/ANY/MX.py (+20/-0)
third_party/dnspython/dns/rdtypes/ANY/NS.py (+20/-0)
third_party/dnspython/dns/rdtypes/ANY/NSEC.py (+128/-0)
third_party/dnspython/dns/rdtypes/ANY/NSEC3.py (+182/-0)
third_party/dnspython/dns/rdtypes/ANY/NSEC3PARAM.py (+88/-0)
third_party/dnspython/dns/rdtypes/ANY/PTR.py (+20/-0)
third_party/dnspython/dns/rdtypes/ANY/RP.py (+86/-0)
third_party/dnspython/dns/rdtypes/ANY/RRSIG.py (+155/-0)
third_party/dnspython/dns/rdtypes/ANY/RT.py (+20/-0)
third_party/dnspython/dns/rdtypes/ANY/SOA.py (+127/-0)
third_party/dnspython/dns/rdtypes/ANY/SPF.py (+22/-0)
third_party/dnspython/dns/rdtypes/ANY/SSHFP.py (+77/-0)
third_party/dnspython/dns/rdtypes/ANY/TXT.py (+20/-0)
third_party/dnspython/dns/rdtypes/ANY/X25.py (+62/-0)
third_party/dnspython/dns/rdtypes/ANY/__init__.py (+45/-0)
third_party/dnspython/dns/rdtypes/IN/A.py (+57/-0)
third_party/dnspython/dns/rdtypes/IN/AAAA.py (+58/-0)
third_party/dnspython/dns/rdtypes/IN/APL.py (+170/-0)
third_party/dnspython/dns/rdtypes/IN/DHCID.py (+60/-0)
third_party/dnspython/dns/rdtypes/IN/IPSECKEY.py (+159/-0)
third_party/dnspython/dns/rdtypes/IN/KX.py (+20/-0)
third_party/dnspython/dns/rdtypes/IN/NAPTR.py (+132/-0)
third_party/dnspython/dns/rdtypes/IN/NSAP.py (+59/-0)
third_party/dnspython/dns/rdtypes/IN/NSAP_PTR.py (+20/-0)
third_party/dnspython/dns/rdtypes/IN/PX.py (+97/-0)
third_party/dnspython/dns/rdtypes/IN/SRV.py (+89/-0)
third_party/dnspython/dns/rdtypes/IN/WKS.py (+113/-0)
third_party/dnspython/dns/rdtypes/IN/__init__.py (+30/-0)
third_party/dnspython/dns/rdtypes/__init__.py (+23/-0)
third_party/dnspython/dns/rdtypes/dsbase.py (+92/-0)
third_party/dnspython/dns/rdtypes/mxbase.py (+105/-0)
third_party/dnspython/dns/rdtypes/nsbase.py (+82/-0)
third_party/dnspython/dns/rdtypes/txtbase.py (+87/-0)
third_party/dnspython/dns/renderer.py (+325/-0)
third_party/dnspython/dns/resolver.py (+1161/-0)
third_party/dnspython/dns/reversename.py (+75/-0)
third_party/dnspython/dns/rrset.py (+175/-0)
third_party/dnspython/dns/set.py (+263/-0)
third_party/dnspython/dns/tokenizer.py (+547/-0)
third_party/dnspython/dns/tsig.py (+223/-0)
third_party/dnspython/dns/tsigkeyring.py (+44/-0)
third_party/dnspython/dns/ttl.py (+64/-0)
third_party/dnspython/dns/update.py (+245/-0)
third_party/dnspython/dns/version.py (+34/-0)
third_party/dnspython/dns/wiredata.py (+59/-0)
third_party/dnspython/dns/zone.py (+855/-0)
third_party/dnspython/examples/ddns.py (+51/-0)
third_party/dnspython/examples/e164.py (+6/-0)
third_party/dnspython/examples/mx.py (+7/-0)
third_party/dnspython/examples/name.py (+13/-0)
third_party/dnspython/examples/reverse.py (+40/-0)
third_party/dnspython/examples/reverse_name.py (+6/-0)
third_party/dnspython/examples/xfr.py (+14/-0)
third_party/dnspython/examples/zonediff.py (+270/-0)
third_party/dnspython/setup.py (+60/-0)
third_party/dnspython/tests/Makefile (+26/-0)
third_party/dnspython/tests/bugs.py (+44/-0)
third_party/dnspython/tests/dnssec.py (+146/-0)
third_party/dnspython/tests/example (+226/-0)
third_party/dnspython/tests/example1.good (+114/-0)
third_party/dnspython/tests/example2.good (+114/-0)
third_party/dnspython/tests/flags.py (+59/-0)
third_party/dnspython/tests/message.py (+179/-0)
third_party/dnspython/tests/name.py (+697/-0)
third_party/dnspython/tests/namedict.py (+102/-0)
third_party/dnspython/tests/ntoaaton.py (+197/-0)
third_party/dnspython/tests/rdtypeandclass.py (+123/-0)
third_party/dnspython/tests/resolver.py (+127/-0)
third_party/dnspython/tests/rrset.py (+54/-0)
third_party/dnspython/tests/set.py (+208/-0)
third_party/dnspython/tests/tokenizer.py (+190/-0)
third_party/dnspython/tests/update.py (+114/-0)
third_party/dnspython/tests/zone.py (+389/-0)
third_party/dnspython/util/COPYRIGHT (+14/-0)
third_party/dnspython/util/copyrights (+116/-0)
third_party/pep8/.gitignore (+7/-0)
third_party/pep8/.travis.yml (+25/-0)
third_party/pep8/CHANGES.txt (+651/-0)
third_party/pep8/LICENSE (+24/-0)
third_party/pep8/MANIFEST.in (+9/-0)
third_party/pep8/Makefile (+13/-0)
third_party/pep8/README.rst (+91/-0)
third_party/pep8/docs/Makefile (+153/-0)
third_party/pep8/docs/advanced.rst (+77/-0)
third_party/pep8/docs/api.rst (+88/-0)
third_party/pep8/docs/conf.py (+251/-0)
third_party/pep8/docs/developer.rst (+96/-0)
third_party/pep8/docs/index.rst (+69/-0)
third_party/pep8/docs/intro.rst (+435/-0)
third_party/pep8/docs/make.bat (+190/-0)
third_party/pep8/setup.cfg (+7/-0)
third_party/pep8/setup.py (+56/-0)
third_party/pep8/testsuite/E10.py (+41/-0)
third_party/pep8/testsuite/E11.py (+36/-0)
third_party/pep8/testsuite/E12.py (+376/-0)
third_party/pep8/testsuite/E12not.py (+644/-0)
third_party/pep8/testsuite/E20.py (+55/-0)
third_party/pep8/testsuite/E21.py (+14/-0)
third_party/pep8/testsuite/E22.py (+157/-0)
third_party/pep8/testsuite/E23.py (+15/-0)
third_party/pep8/testsuite/E24.py (+13/-0)
third_party/pep8/testsuite/E25.py (+36/-0)
third_party/pep8/testsuite/E26.py (+59/-0)
third_party/pep8/testsuite/E27.py (+30/-0)
third_party/pep8/testsuite/E30.py (+90/-0)
third_party/pep8/testsuite/E30not.py (+134/-0)
third_party/pep8/testsuite/E40.py (+38/-0)
third_party/pep8/testsuite/E50.py (+118/-0)
third_party/pep8/testsuite/E70.py (+20/-0)
third_party/pep8/testsuite/E71.py (+73/-0)
third_party/pep8/testsuite/E72.py (+51/-0)
third_party/pep8/testsuite/E73.py (+18/-0)
third_party/pep8/testsuite/E90.py (+26/-0)
third_party/pep8/testsuite/W19.py (+145/-0)
third_party/pep8/testsuite/W29.py (+21/-0)
third_party/pep8/testsuite/W39.py (+18/-0)
third_party/pep8/testsuite/W60.py (+15/-0)
third_party/pep8/testsuite/__init__.py (+0/-0)
third_party/pep8/testsuite/latin-1.py (+6/-0)
third_party/pep8/testsuite/noqa.py (+15/-0)
third_party/pep8/testsuite/python3.py (+6/-0)
third_party/pep8/testsuite/support.py (+197/-0)
third_party/pep8/testsuite/test_all.py (+63/-0)
third_party/pep8/testsuite/test_api.py (+389/-0)
third_party/pep8/testsuite/test_shell.py (+189/-0)
third_party/pep8/testsuite/test_util.py (+23/-0)
third_party/pep8/testsuite/utf-8-bom.py (+6/-0)
third_party/pep8/testsuite/utf-8.py (+52/-0)
third_party/pep8/tox.ini (+15/-0)
third_party/popt/CHANGES (+46/-0)
third_party/popt/COPYING (+22/-0)
third_party/popt/README (+18/-0)
third_party/popt/dummy.in (+0/-0)
third_party/popt/findme.c (+50/-0)
third_party/popt/findme.h (+20/-0)
third_party/popt/popt.c (+1249/-0)
third_party/popt/popt.h (+545/-0)
third_party/popt/poptconfig.c (+190/-0)
third_party/popt/popthelp.c (+741/-0)
third_party/popt/poptint.h (+116/-0)
third_party/popt/poptparse.c (+227/-0)
third_party/popt/system.h (+78/-0)
third_party/popt/wscript (+19/-0)
third_party/pyiso8601/.hgignore (+8/-0)
third_party/pyiso8601/.hgtags (+6/-0)
third_party/pyiso8601/LICENSE (+20/-0)
third_party/pyiso8601/MANIFEST.in (+2/-0)
third_party/pyiso8601/README.rst (+180/-0)
third_party/pyiso8601/dev-requirements.txt (+5/-0)
third_party/pyiso8601/docs/Makefile (+177/-0)
third_party/pyiso8601/docs/conf.py (+266/-0)
third_party/pyiso8601/docs/index.rst (+80/-0)
third_party/pyiso8601/docs/make.bat (+242/-0)
third_party/pyiso8601/iso8601/__init__.py (+1/-0)
third_party/pyiso8601/iso8601/iso8601.py (+214/-0)
third_party/pyiso8601/iso8601/test_iso8601.py (+97/-0)
third_party/pyiso8601/setup.py (+25/-0)
third_party/pyiso8601/tox.ini (+8/-0)
third_party/update.sh (+36/-0)
third_party/waf/wafadmin/3rdparty/ParallelDebug.py (+297/-0)
third_party/waf/wafadmin/3rdparty/batched_cc.py (+182/-0)
third_party/waf/wafadmin/3rdparty/boost.py (+342/-0)
third_party/waf/wafadmin/3rdparty/build_file_tracker.py (+53/-0)
third_party/waf/wafadmin/3rdparty/fluid.py (+26/-0)
third_party/waf/wafadmin/3rdparty/gccdeps.py (+127/-0)
third_party/waf/wafadmin/3rdparty/go.py (+110/-0)
third_party/waf/wafadmin/3rdparty/lru_cache.py (+96/-0)
third_party/waf/wafadmin/3rdparty/paranoid.py (+34/-0)
third_party/waf/wafadmin/3rdparty/prefork.py (+275/-0)
third_party/waf/wafadmin/3rdparty/print_commands.py (+25/-0)
third_party/waf/wafadmin/3rdparty/swig.py (+189/-0)
third_party/waf/wafadmin/3rdparty/valadoc.py (+112/-0)
third_party/waf/wafadmin/Build.py (+1036/-0)
third_party/waf/wafadmin/Configure.py (+442/-0)
third_party/waf/wafadmin/Constants.py (+75/-0)
third_party/waf/wafadmin/Environment.py (+209/-0)
third_party/waf/wafadmin/Logs.py (+133/-0)
third_party/waf/wafadmin/Node.py (+701/-0)
third_party/waf/wafadmin/Options.py (+287/-0)
third_party/waf/wafadmin/Runner.py (+235/-0)
third_party/waf/wafadmin/Scripting.py (+585/-0)
third_party/waf/wafadmin/Task.py (+1199/-0)
third_party/waf/wafadmin/TaskGen.py (+614/-0)
third_party/waf/wafadmin/Tools/__init__.py (+3/-0)
third_party/waf/wafadmin/Tools/ar.py (+34/-0)
third_party/waf/wafadmin/Tools/bison.py (+37/-0)
third_party/waf/wafadmin/Tools/cc.py (+99/-0)
third_party/waf/wafadmin/Tools/ccroot.py (+639/-0)
third_party/waf/wafadmin/Tools/compiler_cc.py (+66/-0)
third_party/waf/wafadmin/Tools/compiler_cxx.py (+61/-0)
third_party/waf/wafadmin/Tools/compiler_d.py (+32/-0)
third_party/waf/wafadmin/Tools/config_c.py (+754/-0)
third_party/waf/wafadmin/Tools/cs.py (+67/-0)
third_party/waf/wafadmin/Tools/cxx.py (+103/-0)
third_party/waf/wafadmin/Tools/d.py (+534/-0)
third_party/waf/wafadmin/Tools/dbus.py (+33/-0)
third_party/waf/wafadmin/Tools/dmd.py (+63/-0)
third_party/waf/wafadmin/Tools/flex.py (+24/-0)
third_party/waf/wafadmin/Tools/gas.py (+37/-0)
third_party/waf/wafadmin/Tools/gcc.py (+138/-0)
third_party/waf/wafadmin/Tools/gdc.py (+51/-0)
third_party/waf/wafadmin/Tools/glib2.py (+163/-0)
third_party/waf/wafadmin/Tools/gnome.py (+222/-0)
third_party/waf/wafadmin/Tools/gnu_dirs.py (+110/-0)
third_party/waf/wafadmin/Tools/gob2.py (+17/-0)
third_party/waf/wafadmin/Tools/gxx.py (+136/-0)
third_party/waf/wafadmin/Tools/icc.py (+37/-0)
third_party/waf/wafadmin/Tools/icpc.py (+35/-0)
third_party/waf/wafadmin/Tools/intltool.py (+138/-0)
third_party/waf/wafadmin/Tools/javaw.py (+254/-0)
third_party/waf/wafadmin/Tools/kde4.py (+73/-0)
third_party/waf/wafadmin/Tools/libtool.py (+329/-0)
third_party/waf/wafadmin/Tools/lua.py (+24/-0)
third_party/waf/wafadmin/Tools/misc.py (+429/-0)
third_party/waf/wafadmin/Tools/msvc.py (+796/-0)
third_party/waf/wafadmin/Tools/nasm.py (+48/-0)
third_party/waf/wafadmin/Tools/ocaml.py (+297/-0)
third_party/waf/wafadmin/Tools/osx.py (+187/-0)
third_party/waf/wafadmin/Tools/perl.py (+108/-0)
third_party/waf/wafadmin/Tools/preproc.py (+837/-0)
third_party/waf/wafadmin/Tools/python.py (+432/-0)
third_party/waf/wafadmin/Tools/qt4.py (+504/-0)
third_party/waf/wafadmin/Tools/ruby.py (+119/-0)
third_party/waf/wafadmin/Tools/suncc.py (+76/-0)
third_party/waf/wafadmin/Tools/suncxx.py (+75/-0)
third_party/waf/wafadmin/Tools/tex.py (+250/-0)
third_party/waf/wafadmin/Tools/unittestw.py (+308/-0)
third_party/waf/wafadmin/Tools/vala.py (+307/-0)
third_party/waf/wafadmin/Tools/winres.py (+44/-0)
third_party/waf/wafadmin/Tools/xlc.py (+78/-0)
third_party/waf/wafadmin/Tools/xlcxx.py (+78/-0)
third_party/waf/wafadmin/Utils.py (+747/-0)
third_party/waf/wafadmin/__init__.py (+3/-0)
third_party/waf/wafadmin/ansiterm.py (+235/-0)
third_party/waf/wafadmin/pproc.py (+619/-0)
third_party/waf/wafadmin/py3kfixes.py (+129/-0)
third_party/wscript (+77/-0)
third_party/zlib/ChangeLog (+855/-0)
third_party/zlib/FAQ (+339/-0)
third_party/zlib/INDEX (+51/-0)
third_party/zlib/Makefile (+154/-0)
third_party/zlib/Makefile.in (+154/-0)
third_party/zlib/README (+125/-0)
third_party/zlib/adler32.c (+148/-0)
third_party/zlib/algorithm.txt (+209/-0)
third_party/zlib/amiga/Makefile.pup (+66/-0)
third_party/zlib/amiga/Makefile.sas (+65/-0)
third_party/zlib/as400/bndsrc (+132/-0)
third_party/zlib/as400/compile.clp (+123/-0)
third_party/zlib/as400/readme.txt (+111/-0)
third_party/zlib/as400/zlib.inc (+331/-0)
third_party/zlib/compress.c (+78/-0)
third_party/zlib/contrib/README.contrib (+71/-0)
third_party/zlib/contrib/ada/buffer_demo.adb (+106/-0)
third_party/zlib/contrib/ada/mtest.adb (+156/-0)
third_party/zlib/contrib/ada/read.adb (+156/-0)
third_party/zlib/contrib/ada/readme.txt (+65/-0)
third_party/zlib/contrib/ada/test.adb (+463/-0)
third_party/zlib/contrib/ada/zlib-streams.adb (+225/-0)
third_party/zlib/contrib/ada/zlib-streams.ads (+114/-0)
third_party/zlib/contrib/ada/zlib-thin.adb (+141/-0)
third_party/zlib/contrib/ada/zlib-thin.ads (+450/-0)
third_party/zlib/contrib/ada/zlib.adb (+701/-0)
third_party/zlib/contrib/ada/zlib.ads (+328/-0)
third_party/zlib/contrib/ada/zlib.gpr (+20/-0)
third_party/zlib/contrib/asm586/README.586 (+43/-0)
third_party/zlib/contrib/asm586/match.S (+364/-0)
third_party/zlib/contrib/asm686/README.686 (+34/-0)
third_party/zlib/contrib/asm686/match.S (+329/-0)
third_party/zlib/contrib/blast/Makefile (+8/-0)
third_party/zlib/contrib/blast/README (+4/-0)
third_party/zlib/contrib/blast/blast.c (+444/-0)
third_party/zlib/contrib/blast/blast.h (+71/-0)
third_party/zlib/contrib/blast/test.txt (+1/-0)
third_party/zlib/contrib/delphi/ZLib.pas (+557/-0)
third_party/zlib/contrib/delphi/ZLibConst.pas (+11/-0)
third_party/zlib/contrib/delphi/readme.txt (+76/-0)
third_party/zlib/contrib/delphi/zlibd32.mak (+93/-0)
third_party/zlib/contrib/dotzlib/DotZLib.build (+33/-0)
third_party/zlib/contrib/dotzlib/DotZLib.sln (+21/-0)
third_party/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs (+58/-0)
third_party/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs (+202/-0)
third_party/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs (+83/-0)
third_party/zlib/contrib/dotzlib/DotZLib/CodecBase.cs (+198/-0)
third_party/zlib/contrib/dotzlib/DotZLib/Deflater.cs (+106/-0)
third_party/zlib/contrib/dotzlib/DotZLib/DotZLib.cs (+288/-0)
third_party/zlib/contrib/dotzlib/DotZLib/DotZLib.csproj (+141/-0)
third_party/zlib/contrib/dotzlib/DotZLib/GZipStream.cs (+301/-0)
third_party/zlib/contrib/dotzlib/DotZLib/Inflater.cs (+105/-0)
third_party/zlib/contrib/dotzlib/DotZLib/UnitTests.cs (+274/-0)
third_party/zlib/contrib/dotzlib/LICENSE_1_0.txt (+23/-0)
third_party/zlib/contrib/dotzlib/readme.txt (+58/-0)
third_party/zlib/contrib/infback9/README (+1/-0)
third_party/zlib/contrib/infback9/infback9.c (+608/-0)
third_party/zlib/contrib/infback9/infback9.h (+37/-0)
third_party/zlib/contrib/infback9/inffix9.h (+107/-0)
third_party/zlib/contrib/infback9/inflate9.h (+47/-0)
third_party/zlib/contrib/infback9/inftree9.c (+323/-0)
third_party/zlib/contrib/infback9/inftree9.h (+55/-0)
third_party/zlib/contrib/inflate86/inffas86.c (+1157/-0)
third_party/zlib/contrib/inflate86/inffast.S (+1368/-0)
third_party/zlib/contrib/iostream/test.cpp (+24/-0)
third_party/zlib/contrib/iostream/zfstream.cpp (+329/-0)
third_party/zlib/contrib/iostream/zfstream.h (+128/-0)
third_party/zlib/contrib/iostream2/zstream.h (+307/-0)
third_party/zlib/contrib/iostream2/zstream_test.cpp (+25/-0)
third_party/zlib/contrib/iostream3/README (+35/-0)
third_party/zlib/contrib/iostream3/TODO (+17/-0)
third_party/zlib/contrib/iostream3/test.cc (+50/-0)
third_party/zlib/contrib/iostream3/zfstream.cc (+479/-0)
third_party/zlib/contrib/iostream3/zfstream.h (+466/-0)
third_party/zlib/contrib/masm686/match.asm (+413/-0)
third_party/zlib/contrib/masmx64/bld_ml64.bat (+2/-0)
third_party/zlib/contrib/masmx64/gvmat64.asm (+513/-0)
third_party/zlib/contrib/masmx64/inffas8664.c (+186/-0)
third_party/zlib/contrib/masmx64/inffasx64.asm (+392/-0)
third_party/zlib/contrib/masmx64/readme.txt (+28/-0)
third_party/zlib/contrib/masmx86/bld_ml32.bat (+2/-0)
third_party/zlib/contrib/masmx86/gvmat32.asm (+972/-0)
third_party/zlib/contrib/masmx86/gvmat32c.c (+62/-0)
third_party/zlib/contrib/masmx86/inffas32.asm (+1083/-0)
third_party/zlib/contrib/masmx86/mkasm.bat (+3/-0)
third_party/zlib/contrib/masmx86/readme.txt (+21/-0)
third_party/zlib/contrib/minizip/ChangeLogUnzip (+67/-0)
third_party/zlib/contrib/minizip/Makefile (+25/-0)
third_party/zlib/contrib/minizip/crypt.h (+132/-0)
third_party/zlib/contrib/minizip/ioapi.c (+177/-0)
third_party/zlib/contrib/minizip/ioapi.h (+75/-0)
third_party/zlib/contrib/minizip/iowin32.c (+270/-0)
third_party/zlib/contrib/minizip/iowin32.h (+21/-0)
third_party/zlib/contrib/minizip/miniunz.c (+585/-0)
third_party/zlib/contrib/minizip/minizip.c (+420/-0)
third_party/zlib/contrib/minizip/mztools.c (+281/-0)
third_party/zlib/contrib/minizip/mztools.h (+31/-0)
third_party/zlib/contrib/minizip/unzip.c (+1598/-0)
third_party/zlib/contrib/minizip/unzip.h (+354/-0)
third_party/zlib/contrib/minizip/zip.c (+1219/-0)
third_party/zlib/contrib/minizip/zip.h (+235/-0)
third_party/zlib/contrib/pascal/example.pas (+599/-0)
third_party/zlib/contrib/pascal/readme.txt (+76/-0)
third_party/zlib/contrib/pascal/zlibd32.mak (+93/-0)
third_party/zlib/contrib/pascal/zlibpas.pas (+236/-0)
third_party/zlib/contrib/puff/Makefile (+8/-0)
third_party/zlib/contrib/puff/README (+63/-0)
third_party/zlib/contrib/puff/puff.c (+837/-0)
third_party/zlib/contrib/puff/puff.h (+31/-0)
third_party/zlib/contrib/testzlib/testzlib.c (+275/-0)
third_party/zlib/contrib/testzlib/testzlib.txt (+10/-0)
third_party/zlib/contrib/untgz/Makefile (+14/-0)
third_party/zlib/contrib/untgz/Makefile.msc (+17/-0)
third_party/zlib/contrib/untgz/untgz.c (+674/-0)
third_party/zlib/contrib/vstudio/readme.txt (+73/-0)
third_party/zlib/contrib/vstudio/vc7/miniunz.vcproj (+126/-0)
third_party/zlib/contrib/vstudio/vc7/minizip.vcproj (+126/-0)
third_party/zlib/contrib/vstudio/vc7/testzlib.vcproj (+126/-0)
third_party/zlib/contrib/vstudio/vc7/zlib.rc (+32/-0)
third_party/zlib/contrib/vstudio/vc7/zlibstat.vcproj (+246/-0)
third_party/zlib/contrib/vstudio/vc7/zlibvc.def (+92/-0)
third_party/zlib/contrib/vstudio/vc7/zlibvc.sln (+78/-0)
third_party/zlib/contrib/vstudio/vc7/zlibvc.vcproj (+445/-0)
third_party/zlib/contrib/vstudio/vc8/miniunz.vcproj (+566/-0)
third_party/zlib/contrib/vstudio/vc8/minizip.vcproj (+563/-0)
third_party/zlib/contrib/vstudio/vc8/testzlib.vcproj (+948/-0)
third_party/zlib/contrib/vstudio/vc8/testzlibdll.vcproj (+567/-0)
third_party/zlib/contrib/vstudio/vc8/zlib.rc (+32/-0)
third_party/zlib/contrib/vstudio/vc8/zlibstat.vcproj (+870/-0)
third_party/zlib/contrib/vstudio/vc8/zlibvc.def (+92/-0)
third_party/zlib/contrib/vstudio/vc8/zlibvc.sln (+144/-0)
third_party/zlib/contrib/vstudio/vc8/zlibvc.vcproj (+1219/-0)
third_party/zlib/crc32.c (+423/-0)
third_party/zlib/crc32.h (+441/-0)
third_party/zlib/deflate.c (+1736/-0)
third_party/zlib/deflate.h (+331/-0)
third_party/zlib/example.c (+565/-0)
third_party/zlib/examples/README.examples (+42/-0)
third_party/zlib/examples/fitblk.c (+233/-0)
third_party/zlib/examples/gun.c (+693/-0)
third_party/zlib/examples/gzappend.c (+500/-0)
third_party/zlib/examples/gzjoin.c (+448/-0)
third_party/zlib/examples/gzlog.c (+413/-0)
third_party/zlib/examples/gzlog.h (+58/-0)
third_party/zlib/examples/zlib_how.html (+523/-0)
third_party/zlib/examples/zpipe.c (+191/-0)
third_party/zlib/examples/zran.c (+404/-0)
third_party/zlib/gzio.c (+1024/-0)
third_party/zlib/infback.c (+623/-0)
third_party/zlib/inffast.c (+318/-0)
third_party/zlib/inffast.h (+11/-0)
third_party/zlib/inffixed.h (+94/-0)
third_party/zlib/inflate.c (+1368/-0)
third_party/zlib/inflate.h (+115/-0)
third_party/zlib/inftrees.c (+329/-0)
third_party/zlib/inftrees.h (+55/-0)
third_party/zlib/make_vms.com (+461/-0)
third_party/zlib/minigzip.c (+322/-0)
third_party/zlib/msdos/Makefile.bor (+109/-0)
third_party/zlib/msdos/Makefile.dj2 (+104/-0)
third_party/zlib/msdos/Makefile.emx (+69/-0)
third_party/zlib/msdos/Makefile.msc (+106/-0)
third_party/zlib/msdos/Makefile.tc (+94/-0)
third_party/zlib/old/Makefile.riscos (+151/-0)
third_party/zlib/old/README (+3/-0)
third_party/zlib/old/descrip.mms (+48/-0)
third_party/zlib/old/os2/Makefile.os2 (+136/-0)
third_party/zlib/old/os2/zlib.def (+51/-0)
third_party/zlib/old/visual-basic.txt (+160/-0)
third_party/zlib/old/zlib.html (+971/-0)
third_party/zlib/projects/README.projects (+41/-0)
third_party/zlib/projects/visualc6/README.txt (+73/-0)
third_party/zlib/projects/visualc6/example.dsp (+278/-0)
third_party/zlib/projects/visualc6/minigzip.dsp (+278/-0)
third_party/zlib/projects/visualc6/zlib.dsp (+609/-0)
third_party/zlib/projects/visualc6/zlib.dsw (+59/-0)
third_party/zlib/qnx/package.qpg (+141/-0)
third_party/zlib/trees.c (+1219/-0)
third_party/zlib/trees.h (+128/-0)
third_party/zlib/uncompr.c (+60/-0)
third_party/zlib/win32/DLL_FAQ.txt (+397/-0)
third_party/zlib/win32/Makefile.bor (+107/-0)
third_party/zlib/win32/Makefile.emx (+69/-0)
third_party/zlib/win32/Makefile.gcc (+141/-0)
third_party/zlib/win32/Makefile.msc (+126/-0)
third_party/zlib/win32/VisualC.txt (+3/-0)
third_party/zlib/win32/zlib.def (+60/-0)
third_party/zlib/win32/zlib1.rc (+39/-0)
third_party/zlib/wscript (+17/-0)
third_party/zlib/zconf.h (+335/-0)
third_party/zlib/zconf.in.h (+332/-0)
third_party/zlib/zlib.h (+1374/-0)
third_party/zlib/zutil.c (+318/-0)
third_party/zlib/zutil.h (+269/-0)
wintest/README (+5/-0)
wintest/conf/abartlet-jesse.conf (+104/-0)
wintest/conf/abartlet.conf (+104/-0)
wintest/conf/bbaumbach.conf (+97/-0)
wintest/conf/tridge.conf (+95/-0)
wintest/conf/zahari-esxi.conf (+46/-0)
wintest/test-s3.py (+286/-0)
wintest/test-s4-howto.py (+719/-0)
wintest/wintest.py (+1000/-0)
wscript (+395/-0)
wscript_build (+161/-0)
wscript_build_embedded_heimdal (+4/-0)
wscript_build_system_heimdal (+4/-0)
wscript_build_system_mitkrb5 (+4/-0)
wscript_configure_system_mitkrb5 (+312/-0)
Reviewer Review Type Date Requested Status
Robie Basak Approve
Canonical Server Pending
Review via email: mp+348888@code.launchpad.net

Description of the change

Please use git to review this MP, as launchpad's diff is incorrect.

This is a no-change rebuild to link with the new libldb that is in cosmic-proposed (1.3.3), blocked because it requires a samba rebuild due to dsdb-modules:

ldb (2:1.2.3-1 to 2:1.3.3-1)
Maintainer: Debian Samba Maintainers
47 days old
autopkgtest for samba/2:4.7.6+dfsg~ubuntu-0ubuntu2: amd64: Pass, arm64: Pass, armhf: Pass, i386: Pass, ppc64el: Pass, s390x: Pass
Valid candidate

trying: ldb
skipped: ldb (0, 1, 47)
    got: 7+0: a-1:a-2:a-1:i-1:p-1:s-1
    * arm64: samba-dsdb-modules

I have an MP for samba 4.8 (https://code.launchpad.net/~ahasenack/ubuntu/+source/samba/+git/samba/+merge/348424) but that is on hold due to a regression detected in the security team's regression test suite (https://bugzilla.samba.org/show_bug.cgi?id=13486). So far upstream hasn't commented on the bug.

Since ldb is a library, and has been stuck for a while, I believe it's best to migrate it sooner rather than later, since we don't know when the 4.8 bug will get some attention.

To post a comment you must log in.
Revision history for this message
Robie Basak (racb) wrote :

Tagged and uploaded.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index bf75b4e..539294e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
1samba (2:4.7.6+dfsg~ubuntu-0ubuntu3) cosmic; urgency=medium
2
3 * No change rebuild to link with new ldb 1.3.3
4
5 -- Andreas Hasenack <andreas@canonical.com> Tue, 03 Jul 2018 09:57:24 -0300
6
1samba (2:4.7.6+dfsg~ubuntu-0ubuntu2) bionic; urgency=medium7samba (2:4.7.6+dfsg~ubuntu-0ubuntu2) bionic; urgency=medium
28
3 * debian/patches/passdb_dont_return_ok_if_pinfo_not_filled.patch:9 * debian/patches/passdb_dont_return_ok_if_pinfo_not_filled.patch:
diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c
4new file mode 10064410new file mode 100644
index 0000000..d4e9030
--- /dev/null
+++ b/source4/ldap_server/ldap_backend.c
@@ -0,0 +1,1338 @@
1/*
2 Unix SMB/CIFS implementation.
3 LDAP server
4 Copyright (C) Stefan Metzmacher 2004
5 Copyright (C) Matthias Dieter Wallnöfer 2009
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#include "includes.h"
22#include "ldap_server/ldap_server.h"
23#include "../lib/util/dlinklist.h"
24#include "auth/credentials/credentials.h"
25#include "auth/gensec/gensec.h"
26#include "auth/gensec/gensec_internal.h" /* TODO: remove this */
27#include "auth/common_auth.h"
28#include "param/param.h"
29#include "smbd/service_stream.h"
30#include "dsdb/samdb/samdb.h"
31#include <ldb_errors.h>
32#include <ldb_module.h>
33#include "ldb_wrap.h"
34
35static int map_ldb_error(TALLOC_CTX *mem_ctx, int ldb_err,
36 const char *add_err_string, const char **errstring)
37{
38 WERROR err;
39
40 /* Certain LDB modules need to return very special WERROR codes. Proof
41 * for them here and if they exist skip the rest of the mapping. */
42 if (add_err_string != NULL) {
43 char *endptr;
44 strtol(add_err_string, &endptr, 16);
45 if (endptr != add_err_string) {
46 *errstring = add_err_string;
47 return ldb_err;
48 }
49 }
50
51 /* Otherwise we calculate here a generic, but appropriate WERROR. */
52
53 switch (ldb_err) {
54 case LDB_SUCCESS:
55 err = WERR_OK;
56 break;
57 case LDB_ERR_OPERATIONS_ERROR:
58 err = WERR_DS_OPERATIONS_ERROR;
59 break;
60 case LDB_ERR_PROTOCOL_ERROR:
61 err = WERR_DS_PROTOCOL_ERROR;
62 break;
63 case LDB_ERR_TIME_LIMIT_EXCEEDED:
64 err = WERR_DS_TIMELIMIT_EXCEEDED;
65 break;
66 case LDB_ERR_SIZE_LIMIT_EXCEEDED:
67 err = WERR_DS_SIZELIMIT_EXCEEDED;
68 break;
69 case LDB_ERR_COMPARE_FALSE:
70 err = WERR_DS_COMPARE_FALSE;
71 break;
72 case LDB_ERR_COMPARE_TRUE:
73 err = WERR_DS_COMPARE_TRUE;
74 break;
75 case LDB_ERR_AUTH_METHOD_NOT_SUPPORTED:
76 err = WERR_DS_AUTH_METHOD_NOT_SUPPORTED;
77 break;
78 case LDB_ERR_STRONG_AUTH_REQUIRED:
79 err = WERR_DS_STRONG_AUTH_REQUIRED;
80 break;
81 case LDB_ERR_REFERRAL:
82 err = WERR_DS_REFERRAL;
83 break;
84 case LDB_ERR_ADMIN_LIMIT_EXCEEDED:
85 err = WERR_DS_ADMIN_LIMIT_EXCEEDED;
86 break;
87 case LDB_ERR_UNSUPPORTED_CRITICAL_EXTENSION:
88 err = WERR_DS_UNAVAILABLE_CRIT_EXTENSION;
89 break;
90 case LDB_ERR_CONFIDENTIALITY_REQUIRED:
91 err = WERR_DS_CONFIDENTIALITY_REQUIRED;
92 break;
93 case LDB_ERR_SASL_BIND_IN_PROGRESS:
94 err = WERR_DS_BUSY;
95 break;
96 case LDB_ERR_NO_SUCH_ATTRIBUTE:
97 err = WERR_DS_NO_ATTRIBUTE_OR_VALUE;
98 break;
99 case LDB_ERR_UNDEFINED_ATTRIBUTE_TYPE:
100 err = WERR_DS_ATTRIBUTE_TYPE_UNDEFINED;
101 break;
102 case LDB_ERR_INAPPROPRIATE_MATCHING:
103 err = WERR_DS_INAPPROPRIATE_MATCHING;
104 break;
105 case LDB_ERR_CONSTRAINT_VIOLATION:
106 err = WERR_DS_CONSTRAINT_VIOLATION;
107 break;
108 case LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS:
109 err = WERR_DS_ATTRIBUTE_OR_VALUE_EXISTS;
110 break;
111 case LDB_ERR_INVALID_ATTRIBUTE_SYNTAX:
112 err = WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
113 break;
114 case LDB_ERR_NO_SUCH_OBJECT:
115 err = WERR_DS_NO_SUCH_OBJECT;
116 break;
117 case LDB_ERR_ALIAS_PROBLEM:
118 err = WERR_DS_ALIAS_PROBLEM;
119 break;
120 case LDB_ERR_INVALID_DN_SYNTAX:
121 err = WERR_DS_INVALID_DN_SYNTAX;
122 break;
123 case LDB_ERR_ALIAS_DEREFERENCING_PROBLEM:
124 err = WERR_DS_ALIAS_DEREF_PROBLEM;
125 break;
126 case LDB_ERR_INAPPROPRIATE_AUTHENTICATION:
127 err = WERR_DS_INAPPROPRIATE_AUTH;
128 break;
129 case LDB_ERR_INVALID_CREDENTIALS:
130 err = WERR_ACCESS_DENIED;
131 break;
132 case LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS:
133 err = WERR_DS_INSUFF_ACCESS_RIGHTS;
134 break;
135 case LDB_ERR_BUSY:
136 err = WERR_DS_BUSY;
137 break;
138 case LDB_ERR_UNAVAILABLE:
139 err = WERR_DS_UNAVAILABLE;
140 break;
141 case LDB_ERR_UNWILLING_TO_PERFORM:
142 err = WERR_DS_UNWILLING_TO_PERFORM;
143 break;
144 case LDB_ERR_LOOP_DETECT:
145 err = WERR_DS_LOOP_DETECT;
146 break;
147 case LDB_ERR_NAMING_VIOLATION:
148 err = WERR_DS_NAMING_VIOLATION;
149 break;
150 case LDB_ERR_OBJECT_CLASS_VIOLATION:
151 err = WERR_DS_OBJ_CLASS_VIOLATION;
152 break;
153 case LDB_ERR_NOT_ALLOWED_ON_NON_LEAF:
154 err = WERR_DS_CANT_ON_NON_LEAF;
155 break;
156 case LDB_ERR_NOT_ALLOWED_ON_RDN:
157 err = WERR_DS_CANT_ON_RDN;
158 break;
159 case LDB_ERR_ENTRY_ALREADY_EXISTS:
160 err = WERR_DS_OBJ_STRING_NAME_EXISTS;
161 break;
162 case LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED:
163 err = WERR_DS_CANT_MOD_OBJ_CLASS;
164 break;
165 case LDB_ERR_AFFECTS_MULTIPLE_DSAS:
166 err = WERR_DS_AFFECTS_MULTIPLE_DSAS;
167 break;
168 default:
169 err = WERR_DS_GENERIC_ERROR;
170 break;
171 }
172
173 *errstring = talloc_asprintf(mem_ctx, "%08X: %s", W_ERROR_V(err),
174 add_err_string != NULL ? add_err_string : ldb_strerror(ldb_err));
175
176 /* result is 1:1 for now */
177 return ldb_err;
178}
179
180/*
181 connect to the sam database
182*/
183NTSTATUS ldapsrv_backend_Init(struct ldapsrv_connection *conn)
184{
185 conn->ldb = samdb_connect(conn,
186 conn->connection->event.ctx,
187 conn->lp_ctx,
188 conn->session_info,
189 conn->global_catalog ? LDB_FLG_RDONLY : 0);
190 if (conn->ldb == NULL) {
191 return NT_STATUS_INTERNAL_DB_CORRUPTION;
192 }
193
194 if (conn->server_credentials) {
195 char **sasl_mechs = NULL;
196 const struct gensec_security_ops * const *backends = gensec_security_all();
197 const struct gensec_security_ops **ops
198 = gensec_use_kerberos_mechs(conn, backends, conn->server_credentials);
199 unsigned int i, j = 0;
200 for (i = 0; ops && ops[i]; i++) {
201 if (!lpcfg_parm_bool(conn->lp_ctx, NULL, "gensec", ops[i]->name, ops[i]->enabled))
202 continue;
203
204 if (ops[i]->sasl_name && ops[i]->server_start) {
205 char *sasl_name = talloc_strdup(conn, ops[i]->sasl_name);
206
207 if (!sasl_name) {
208 return NT_STATUS_NO_MEMORY;
209 }
210 sasl_mechs = talloc_realloc(conn, sasl_mechs, char *, j + 2);
211 if (!sasl_mechs) {
212 return NT_STATUS_NO_MEMORY;
213 }
214 sasl_mechs[j] = sasl_name;
215 talloc_steal(sasl_mechs, sasl_name);
216 sasl_mechs[j+1] = NULL;
217 j++;
218 }
219 }
220 talloc_unlink(conn, ops);
221
222 /* ldb can have a different lifetime to conn, so we
223 need to ensure that sasl_mechs lives as long as the
224 ldb does */
225 talloc_steal(conn->ldb, sasl_mechs);
226
227 ldb_set_opaque(conn->ldb, "supportedSASLMechanisms", sasl_mechs);
228 }
229
230 ldb_set_opaque(conn->ldb, "remoteAddress",
231 conn->connection->remote_address);
232
233 return NT_STATUS_OK;
234}
235
236struct ldapsrv_reply *ldapsrv_init_reply(struct ldapsrv_call *call, uint8_t type)
237{
238 struct ldapsrv_reply *reply;
239
240 reply = talloc_zero(call, struct ldapsrv_reply);
241 if (!reply) {
242 return NULL;
243 }
244 reply->msg = talloc_zero(reply, struct ldap_message);
245 if (reply->msg == NULL) {
246 talloc_free(reply);
247 return NULL;
248 }
249
250 reply->msg->messageid = call->request->messageid;
251 reply->msg->type = type;
252 reply->msg->controls = NULL;
253
254 return reply;
255}
256
257void ldapsrv_queue_reply(struct ldapsrv_call *call, struct ldapsrv_reply *reply)
258{
259 DLIST_ADD_END(call->replies, reply);
260}
261
262static NTSTATUS ldapsrv_unwilling(struct ldapsrv_call *call, int error)
263{
264 struct ldapsrv_reply *reply;
265 struct ldap_ExtendedResponse *r;
266
267 DEBUG(10,("Unwilling type[%d] id[%d]\n", call->request->type, call->request->messageid));
268
269 reply = ldapsrv_init_reply(call, LDAP_TAG_ExtendedResponse);
270 if (!reply) {
271 return NT_STATUS_NO_MEMORY;
272 }
273
274 r = &reply->msg->r.ExtendedResponse;
275 r->response.resultcode = error;
276 r->response.dn = NULL;
277 r->response.errormessage = NULL;
278 r->response.referral = NULL;
279 r->oid = NULL;
280 r->value = NULL;
281
282 ldapsrv_queue_reply(call, reply);
283 return NT_STATUS_OK;
284}
285
286static int ldapsrv_add_with_controls(struct ldapsrv_call *call,
287 const struct ldb_message *message,
288 struct ldb_control **controls,
289 struct ldb_result *res)
290{
291 struct ldb_context *ldb = call->conn->ldb;
292 struct ldb_request *req;
293 int ret;
294
295 ret = ldb_msg_sanity_check(ldb, message);
296 if (ret != LDB_SUCCESS) {
297 return ret;
298 }
299
300 ret = ldb_build_add_req(&req, ldb, ldb,
301 message,
302 controls,
303 res,
304 ldb_modify_default_callback,
305 NULL);
306
307 if (ret != LDB_SUCCESS) return ret;
308
309 if (call->conn->global_catalog) {
310 return ldb_error(ldb, LDB_ERR_UNWILLING_TO_PERFORM, "modify forbidden on global catalog port");
311 }
312 ldb_request_add_control(req, DSDB_CONTROL_NO_GLOBAL_CATALOG, false, NULL);
313
314 ret = ldb_transaction_start(ldb);
315 if (ret != LDB_SUCCESS) {
316 return ret;
317 }
318
319 if (!call->conn->is_privileged) {
320 ldb_req_mark_untrusted(req);
321 }
322
323 LDB_REQ_SET_LOCATION(req);
324
325 ret = ldb_request(ldb, req);
326 if (ret == LDB_SUCCESS) {
327 ret = ldb_wait(req->handle, LDB_WAIT_ALL);
328 }
329
330 if (ret == LDB_SUCCESS) {
331 ret = ldb_transaction_commit(ldb);
332 }
333 else {
334 ldb_transaction_cancel(ldb);
335 }
336
337 talloc_free(req);
338 return ret;
339}
340
341/* create and execute a modify request */
342static int ldapsrv_mod_with_controls(struct ldapsrv_call *call,
343 const struct ldb_message *message,
344 struct ldb_control **controls,
345 struct ldb_result *res)
346{
347 struct ldb_context *ldb = call->conn->ldb;
348 struct ldb_request *req;
349 int ret;
350
351 ret = ldb_msg_sanity_check(ldb, message);
352 if (ret != LDB_SUCCESS) {
353 return ret;
354 }
355
356 ret = ldb_build_mod_req(&req, ldb, ldb,
357 message,
358 controls,
359 res,
360 ldb_modify_default_callback,
361 NULL);
362
363 if (ret != LDB_SUCCESS) {
364 return ret;
365 }
366
367 if (call->conn->global_catalog) {
368 return ldb_error(ldb, LDB_ERR_UNWILLING_TO_PERFORM, "modify forbidden on global catalog port");
369 }
370 ldb_request_add_control(req, DSDB_CONTROL_NO_GLOBAL_CATALOG, false, NULL);
371
372 ret = ldb_transaction_start(ldb);
373 if (ret != LDB_SUCCESS) {
374 return ret;
375 }
376
377 if (!call->conn->is_privileged) {
378 ldb_req_mark_untrusted(req);
379 }
380
381 LDB_REQ_SET_LOCATION(req);
382
383 ret = ldb_request(ldb, req);
384 if (ret == LDB_SUCCESS) {
385 ret = ldb_wait(req->handle, LDB_WAIT_ALL);
386 }
387
388 if (ret == LDB_SUCCESS) {
389 ret = ldb_transaction_commit(ldb);
390 }
391 else {
392 ldb_transaction_cancel(ldb);
393 }
394
395 talloc_free(req);
396 return ret;
397}
398
399/* create and execute a delete request */
400static int ldapsrv_del_with_controls(struct ldapsrv_call *call,
401 struct ldb_dn *dn,
402 struct ldb_control **controls,
403 struct ldb_result *res)
404{
405 struct ldb_context *ldb = call->conn->ldb;
406 struct ldb_request *req;
407 int ret;
408
409 ret = ldb_build_del_req(&req, ldb, ldb,
410 dn,
411 controls,
412 res,
413 ldb_modify_default_callback,
414 NULL);
415
416 if (ret != LDB_SUCCESS) return ret;
417
418 if (call->conn->global_catalog) {
419 return ldb_error(ldb, LDB_ERR_UNWILLING_TO_PERFORM, "modify forbidden on global catalog port");
420 }
421 ldb_request_add_control(req, DSDB_CONTROL_NO_GLOBAL_CATALOG, false, NULL);
422
423 ret = ldb_transaction_start(ldb);
424 if (ret != LDB_SUCCESS) {
425 return ret;
426 }
427
428 if (!call->conn->is_privileged) {
429 ldb_req_mark_untrusted(req);
430 }
431
432 LDB_REQ_SET_LOCATION(req);
433
434 ret = ldb_request(ldb, req);
435 if (ret == LDB_SUCCESS) {
436 ret = ldb_wait(req->handle, LDB_WAIT_ALL);
437 }
438
439 if (ret == LDB_SUCCESS) {
440 ret = ldb_transaction_commit(ldb);
441 }
442 else {
443 ldb_transaction_cancel(ldb);
444 }
445
446 talloc_free(req);
447 return ret;
448}
449
450static int ldapsrv_rename_with_controls(struct ldapsrv_call *call,
451 struct ldb_dn *olddn,
452 struct ldb_dn *newdn,
453 struct ldb_control **controls,
454 struct ldb_result *res)
455{
456 struct ldb_context *ldb = call->conn->ldb;
457 struct ldb_request *req;
458 int ret;
459
460 ret = ldb_build_rename_req(&req, ldb, ldb,
461 olddn,
462 newdn,
463 controls,
464 res,
465 ldb_modify_default_callback,
466 NULL);
467
468 if (ret != LDB_SUCCESS) return ret;
469
470 if (call->conn->global_catalog) {
471 return ldb_error(ldb, LDB_ERR_UNWILLING_TO_PERFORM, "modify forbidden on global catalog port");
472 }
473 ldb_request_add_control(req, DSDB_CONTROL_NO_GLOBAL_CATALOG, false, NULL);
474
475 ret = ldb_transaction_start(ldb);
476 if (ret != LDB_SUCCESS) {
477 return ret;
478 }
479
480 if (!call->conn->is_privileged) {
481 ldb_req_mark_untrusted(req);
482 }
483
484 LDB_REQ_SET_LOCATION(req);
485
486 ret = ldb_request(ldb, req);
487 if (ret == LDB_SUCCESS) {
488 ret = ldb_wait(req->handle, LDB_WAIT_ALL);
489 }
490
491 if (ret == LDB_SUCCESS) {
492 ret = ldb_transaction_commit(ldb);
493 }
494 else {
495 ldb_transaction_cancel(ldb);
496 }
497
498 talloc_free(req);
499 return ret;
500}
501
502static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call)
503{
504 struct ldap_SearchRequest *req = &call->request->r.SearchRequest;
505 struct ldap_SearchResEntry *ent;
506 struct ldap_Result *done;
507 struct ldapsrv_reply *ent_r, *done_r;
508 TALLOC_CTX *local_ctx;
509 struct ldb_context *samdb = talloc_get_type(call->conn->ldb, struct ldb_context);
510 struct ldb_dn *basedn;
511 struct ldb_result *res = NULL;
512 struct ldb_request *lreq;
513 struct ldb_control *search_control;
514 struct ldb_search_options_control *search_options;
515 struct ldb_control *extended_dn_control;
516 struct ldb_extended_dn_control *extended_dn_decoded = NULL;
517 struct ldb_control *notification_control = NULL;
518 enum ldb_scope scope = LDB_SCOPE_DEFAULT;
519 const char **attrs = NULL;
520 const char *scope_str, *errstr = NULL;
521 int success_limit = 1;
522 int result = -1;
523 int ldb_ret = -1;
524 unsigned int i, j;
525 int extended_type = 1;
526
527 DEBUG(10, ("SearchRequest"));
528 DEBUGADD(10, (" basedn: %s", req->basedn));
529 DEBUGADD(10, (" filter: %s\n", ldb_filter_from_tree(call, req->tree)));
530
531 local_ctx = talloc_new(call);
532 NT_STATUS_HAVE_NO_MEMORY(local_ctx);
533
534 basedn = ldb_dn_new(local_ctx, samdb, req->basedn);
535 NT_STATUS_HAVE_NO_MEMORY(basedn);
536
537 DEBUG(10, ("SearchRequest: basedn: [%s]\n", req->basedn));
538 DEBUG(10, ("SearchRequest: filter: [%s]\n", ldb_filter_from_tree(call, req->tree)));
539
540 switch (req->scope) {
541 case LDAP_SEARCH_SCOPE_BASE:
542 scope_str = "BASE";
543 scope = LDB_SCOPE_BASE;
544 success_limit = 0;
545 break;
546 case LDAP_SEARCH_SCOPE_SINGLE:
547 scope_str = "ONE";
548 scope = LDB_SCOPE_ONELEVEL;
549 success_limit = 0;
550 break;
551 case LDAP_SEARCH_SCOPE_SUB:
552 scope_str = "SUB";
553 scope = LDB_SCOPE_SUBTREE;
554 success_limit = 0;
555 break;
556 default:
557 result = LDAP_PROTOCOL_ERROR;
558 map_ldb_error(local_ctx, LDB_ERR_PROTOCOL_ERROR, NULL,
559 &errstr);
560 errstr = talloc_asprintf(local_ctx,
561 "%s. Invalid scope", errstr);
562 goto reply;
563 }
564 DEBUG(10,("SearchRequest: scope: [%s]\n", scope_str));
565
566 if (req->num_attributes >= 1) {
567 attrs = talloc_array(local_ctx, const char *, req->num_attributes+1);
568 NT_STATUS_HAVE_NO_MEMORY(attrs);
569
570 for (i=0; i < req->num_attributes; i++) {
571 DEBUG(10,("SearchRequest: attrs: [%s]\n",req->attributes[i]));
572 attrs[i] = req->attributes[i];
573 }
574 attrs[i] = NULL;
575 }
576
577 DEBUG(5,("ldb_request %s dn=%s filter=%s\n",
578 scope_str, req->basedn, ldb_filter_from_tree(call, req->tree)));
579
580 res = talloc_zero(local_ctx, struct ldb_result);
581 NT_STATUS_HAVE_NO_MEMORY(res);
582
583 ldb_ret = ldb_build_search_req_ex(&lreq, samdb, local_ctx,
584 basedn, scope,
585 req->tree, attrs,
586 call->request->controls,
587 res, ldb_search_default_callback,
588 NULL);
589
590 if (ldb_ret != LDB_SUCCESS) {
591 goto reply;
592 }
593
594 if (call->conn->global_catalog) {
595 search_control = ldb_request_get_control(lreq, LDB_CONTROL_SEARCH_OPTIONS_OID);
596
597 search_options = NULL;
598 if (search_control) {
599 search_options = talloc_get_type(search_control->data, struct ldb_search_options_control);
600 search_options->search_options |= LDB_SEARCH_OPTION_PHANTOM_ROOT;
601 } else {
602 search_options = talloc(lreq, struct ldb_search_options_control);
603 NT_STATUS_HAVE_NO_MEMORY(search_options);
604 search_options->search_options = LDB_SEARCH_OPTION_PHANTOM_ROOT;
605 ldb_request_add_control(lreq, LDB_CONTROL_SEARCH_OPTIONS_OID, false, search_options);
606 }
607 } else {
608 ldb_request_add_control(lreq, DSDB_CONTROL_NO_GLOBAL_CATALOG, false, NULL);
609 }
610
611 extended_dn_control = ldb_request_get_control(lreq, LDB_CONTROL_EXTENDED_DN_OID);
612
613 if (extended_dn_control) {
614 if (extended_dn_control->data) {
615 extended_dn_decoded = talloc_get_type(extended_dn_control->data, struct ldb_extended_dn_control);
616 extended_type = extended_dn_decoded->type;
617 } else {
618 extended_type = 0;
619 }
620 }
621
622 notification_control = ldb_request_get_control(lreq, LDB_CONTROL_NOTIFICATION_OID);
623 if (notification_control != NULL) {
624 const struct ldapsrv_call *pc = NULL;
625 size_t count = 0;
626
627 for (pc = call->conn->pending_calls; pc != NULL; pc = pc->next) {
628 count += 1;
629 }
630
631 if (count >= call->conn->limits.max_notifications) {
632 DEBUG(10,("SearchRequest: error MaxNotificationPerConn\n"));
633 result = map_ldb_error(local_ctx,
634 LDB_ERR_ADMIN_LIMIT_EXCEEDED,
635 "MaxNotificationPerConn reached",
636 &errstr);
637 goto reply;
638 }
639
640 /*
641 * For now we need to do periodic retries on our own.
642 * As the dsdb_notification module will return after each run.
643 */
644 call->notification.busy = true;
645 }
646
647 ldb_set_timeout(samdb, lreq, req->timelimit);
648
649 if (!call->conn->is_privileged) {
650 ldb_req_mark_untrusted(lreq);
651 }
652
653 LDB_REQ_SET_LOCATION(lreq);
654
655 ldb_ret = ldb_request(samdb, lreq);
656
657 if (ldb_ret != LDB_SUCCESS) {
658 goto reply;
659 }
660
661 ldb_ret = ldb_wait(lreq->handle, LDB_WAIT_ALL);
662
663 if (ldb_ret == LDB_SUCCESS) {
664 for (i = 0; i < res->count; i++) {
665 ent_r = ldapsrv_init_reply(call, LDAP_TAG_SearchResultEntry);
666 NT_STATUS_HAVE_NO_MEMORY(ent_r);
667
668 /* Better to have the whole message kept here,
669 * than to find someone further up didn't put
670 * a value in the right spot in the talloc tree */
671 talloc_steal(ent_r, res->msgs[i]);
672
673 ent = &ent_r->msg->r.SearchResultEntry;
674 ent->dn = ldb_dn_get_extended_linearized(ent_r, res->msgs[i]->dn, extended_type);
675 ent->num_attributes = 0;
676 ent->attributes = NULL;
677 if (res->msgs[i]->num_elements == 0) {
678 goto queue_reply;
679 }
680 ent->num_attributes = res->msgs[i]->num_elements;
681 ent->attributes = talloc_array(ent_r, struct ldb_message_element, ent->num_attributes);
682 NT_STATUS_HAVE_NO_MEMORY(ent->attributes);
683 for (j=0; j < ent->num_attributes; j++) {
684 ent->attributes[j].name = res->msgs[i]->elements[j].name;
685 ent->attributes[j].num_values = 0;
686 ent->attributes[j].values = NULL;
687 if (req->attributesonly && (res->msgs[i]->elements[j].num_values == 0)) {
688 continue;
689 }
690 ent->attributes[j].num_values = res->msgs[i]->elements[j].num_values;
691 ent->attributes[j].values = res->msgs[i]->elements[j].values;
692 }
693queue_reply:
694 ldapsrv_queue_reply(call, ent_r);
695 }
696
697 if (call->notification.busy) {
698 /* Move/Add it to the end */
699 DLIST_DEMOTE(call->conn->pending_calls, call);
700 call->notification.generation =
701 call->conn->service->notification.generation;
702
703 if (res->count != 0) {
704 call->notification.generation += 1;
705 ldapsrv_notification_retry_setup(call->conn->service,
706 true);
707 }
708
709 talloc_free(local_ctx);
710 return NT_STATUS_OK;
711 }
712
713 /* Send back referrals if they do exist (search operations) */
714 if (res->refs != NULL) {
715 char **ref;
716 struct ldap_SearchResRef *ent_ref;
717
718 for (ref = res->refs; *ref != NULL; ++ref) {
719 ent_r = ldapsrv_init_reply(call, LDAP_TAG_SearchResultReference);
720 NT_STATUS_HAVE_NO_MEMORY(ent_r);
721
722 /* Better to have the whole referrals kept here,
723 * than to find someone further up didn't put
724 * a value in the right spot in the talloc tree
725 */
726 talloc_steal(ent_r, *ref);
727
728 ent_ref = &ent_r->msg->r.SearchResultReference;
729 ent_ref->referral = *ref;
730
731 ldapsrv_queue_reply(call, ent_r);
732 }
733 }
734 }
735
736reply:
737 DLIST_REMOVE(call->conn->pending_calls, call);
738 call->notification.busy = false;
739
740 done_r = ldapsrv_init_reply(call, LDAP_TAG_SearchResultDone);
741 NT_STATUS_HAVE_NO_MEMORY(done_r);
742
743 done = &done_r->msg->r.SearchResultDone;
744 done->dn = NULL;
745 done->referral = NULL;
746
747 if (result != -1) {
748 } else if (ldb_ret == LDB_SUCCESS) {
749 if (res->count >= success_limit) {
750 DEBUG(10,("SearchRequest: results: [%d]\n", res->count));
751 result = LDAP_SUCCESS;
752 errstr = NULL;
753 }
754 if (res->controls) {
755 done_r->msg->controls = res->controls;
756 talloc_steal(done_r, res->controls);
757 }
758 } else {
759 DEBUG(10,("SearchRequest: error\n"));
760 result = map_ldb_error(local_ctx, ldb_ret, ldb_errstring(samdb),
761 &errstr);
762 }
763
764 done->resultcode = result;
765 done->errormessage = (errstr?talloc_strdup(done_r, errstr):NULL);
766
767 talloc_free(local_ctx);
768
769 ldapsrv_queue_reply(call, done_r);
770 return NT_STATUS_OK;
771}
772
773static NTSTATUS ldapsrv_ModifyRequest(struct ldapsrv_call *call)
774{
775 struct ldap_ModifyRequest *req = &call->request->r.ModifyRequest;
776 struct ldap_Result *modify_result;
777 struct ldapsrv_reply *modify_reply;
778 TALLOC_CTX *local_ctx;
779 struct ldb_context *samdb = call->conn->ldb;
780 struct ldb_message *msg = NULL;
781 struct ldb_dn *dn;
782 const char *errstr = NULL;
783 int result = LDAP_SUCCESS;
784 int ldb_ret;
785 unsigned int i,j;
786 struct ldb_result *res = NULL;
787
788 DEBUG(10, ("ModifyRequest"));
789 DEBUGADD(10, (" dn: %s\n", req->dn));
790
791 local_ctx = talloc_named(call, 0, "ModifyRequest local memory context");
792 NT_STATUS_HAVE_NO_MEMORY(local_ctx);
793
794 dn = ldb_dn_new(local_ctx, samdb, req->dn);
795 NT_STATUS_HAVE_NO_MEMORY(dn);
796
797 DEBUG(10, ("ModifyRequest: dn: [%s]\n", req->dn));
798
799 msg = talloc(local_ctx, struct ldb_message);
800 NT_STATUS_HAVE_NO_MEMORY(msg);
801
802 msg->dn = dn;
803 msg->num_elements = 0;
804 msg->elements = NULL;
805
806 if (req->num_mods > 0) {
807 msg->num_elements = req->num_mods;
808 msg->elements = talloc_array(msg, struct ldb_message_element, req->num_mods);
809 NT_STATUS_HAVE_NO_MEMORY(msg->elements);
810
811 for (i=0; i < msg->num_elements; i++) {
812 msg->elements[i].name = discard_const_p(char, req->mods[i].attrib.name);
813 msg->elements[i].num_values = 0;
814 msg->elements[i].values = NULL;
815
816 switch (req->mods[i].type) {
817 default:
818 result = LDAP_PROTOCOL_ERROR;
819 map_ldb_error(local_ctx,
820 LDB_ERR_PROTOCOL_ERROR, NULL, &errstr);
821 errstr = talloc_asprintf(local_ctx,
822 "%s. Invalid LDAP_MODIFY_* type", errstr);
823 goto reply;
824 case LDAP_MODIFY_ADD:
825 msg->elements[i].flags = LDB_FLAG_MOD_ADD;
826 break;
827 case LDAP_MODIFY_DELETE:
828 msg->elements[i].flags = LDB_FLAG_MOD_DELETE;
829 break;
830 case LDAP_MODIFY_REPLACE:
831 msg->elements[i].flags = LDB_FLAG_MOD_REPLACE;
832 break;
833 }
834
835 msg->elements[i].num_values = req->mods[i].attrib.num_values;
836 if (msg->elements[i].num_values > 0) {
837 msg->elements[i].values = talloc_array(msg->elements, struct ldb_val,
838 msg->elements[i].num_values);
839 NT_STATUS_HAVE_NO_MEMORY(msg->elements[i].values);
840
841 for (j=0; j < msg->elements[i].num_values; j++) {
842 msg->elements[i].values[j].length = req->mods[i].attrib.values[j].length;
843 msg->elements[i].values[j].data = req->mods[i].attrib.values[j].data;
844 }
845 }
846 }
847 }
848
849reply:
850 modify_reply = ldapsrv_init_reply(call, LDAP_TAG_ModifyResponse);
851 NT_STATUS_HAVE_NO_MEMORY(modify_reply);
852
853 if (result == LDAP_SUCCESS) {
854 res = talloc_zero(local_ctx, struct ldb_result);
855 NT_STATUS_HAVE_NO_MEMORY(res);
856 ldb_ret = ldapsrv_mod_with_controls(call, msg, call->request->controls, res);
857 result = map_ldb_error(local_ctx, ldb_ret, ldb_errstring(samdb),
858 &errstr);
859 }
860
861 modify_result = &modify_reply->msg->r.ModifyResponse;
862 modify_result->dn = NULL;
863 if ((res != NULL) && (res->refs != NULL)) {
864 modify_result->resultcode = map_ldb_error(local_ctx,
865 LDB_ERR_REFERRAL,
866 NULL, &errstr);
867 modify_result->errormessage = (errstr?talloc_strdup(modify_reply, errstr):NULL);
868 modify_result->referral = talloc_strdup(call, *res->refs);
869 } else {
870 modify_result->resultcode = result;
871 modify_result->errormessage = (errstr?talloc_strdup(modify_reply, errstr):NULL);
872 modify_result->referral = NULL;
873 }
874 talloc_free(local_ctx);
875
876 ldapsrv_queue_reply(call, modify_reply);
877 return NT_STATUS_OK;
878
879}
880
881static NTSTATUS ldapsrv_AddRequest(struct ldapsrv_call *call)
882{
883 struct ldap_AddRequest *req = &call->request->r.AddRequest;
884 struct ldap_Result *add_result;
885 struct ldapsrv_reply *add_reply;
886 TALLOC_CTX *local_ctx;
887 struct ldb_context *samdb = call->conn->ldb;
888 struct ldb_message *msg = NULL;
889 struct ldb_dn *dn;
890 const char *errstr = NULL;
891 int result = LDAP_SUCCESS;
892 int ldb_ret;
893 unsigned int i,j;
894 struct ldb_result *res = NULL;
895
896 DEBUG(10, ("AddRequest"));
897 DEBUGADD(10, (" dn: %s\n", req->dn));
898
899 local_ctx = talloc_named(call, 0, "AddRequest local memory context");
900 NT_STATUS_HAVE_NO_MEMORY(local_ctx);
901
902 dn = ldb_dn_new(local_ctx, samdb, req->dn);
903 NT_STATUS_HAVE_NO_MEMORY(dn);
904
905 DEBUG(10, ("AddRequest: dn: [%s]\n", req->dn));
906
907 msg = talloc(local_ctx, struct ldb_message);
908 NT_STATUS_HAVE_NO_MEMORY(msg);
909
910 msg->dn = dn;
911 msg->num_elements = 0;
912 msg->elements = NULL;
913
914 if (req->num_attributes > 0) {
915 msg->num_elements = req->num_attributes;
916 msg->elements = talloc_array(msg, struct ldb_message_element, msg->num_elements);
917 NT_STATUS_HAVE_NO_MEMORY(msg->elements);
918
919 for (i=0; i < msg->num_elements; i++) {
920 msg->elements[i].name = discard_const_p(char, req->attributes[i].name);
921 msg->elements[i].flags = 0;
922 msg->elements[i].num_values = 0;
923 msg->elements[i].values = NULL;
924
925 if (req->attributes[i].num_values > 0) {
926 msg->elements[i].num_values = req->attributes[i].num_values;
927 msg->elements[i].values = talloc_array(msg->elements, struct ldb_val,
928 msg->elements[i].num_values);
929 NT_STATUS_HAVE_NO_MEMORY(msg->elements[i].values);
930
931 for (j=0; j < msg->elements[i].num_values; j++) {
932 msg->elements[i].values[j].length = req->attributes[i].values[j].length;
933 msg->elements[i].values[j].data = req->attributes[i].values[j].data;
934 }
935 }
936 }
937 }
938
939 add_reply = ldapsrv_init_reply(call, LDAP_TAG_AddResponse);
940 NT_STATUS_HAVE_NO_MEMORY(add_reply);
941
942 if (result == LDAP_SUCCESS) {
943 res = talloc_zero(local_ctx, struct ldb_result);
944 NT_STATUS_HAVE_NO_MEMORY(res);
945 ldb_ret = ldapsrv_add_with_controls(call, msg, call->request->controls, res);
946 result = map_ldb_error(local_ctx, ldb_ret, ldb_errstring(samdb),
947 &errstr);
948 }
949
950 add_result = &add_reply->msg->r.AddResponse;
951 add_result->dn = NULL;
952 if ((res != NULL) && (res->refs != NULL)) {
953 add_result->resultcode = map_ldb_error(local_ctx,
954 LDB_ERR_REFERRAL, NULL,
955 &errstr);
956 add_result->errormessage = (errstr?talloc_strdup(add_reply,errstr):NULL);
957 add_result->referral = talloc_strdup(call, *res->refs);
958 } else {
959 add_result->resultcode = result;
960 add_result->errormessage = (errstr?talloc_strdup(add_reply,errstr):NULL);
961 add_result->referral = NULL;
962 }
963 talloc_free(local_ctx);
964
965 ldapsrv_queue_reply(call, add_reply);
966 return NT_STATUS_OK;
967
968}
969
970static NTSTATUS ldapsrv_DelRequest(struct ldapsrv_call *call)
971{
972 struct ldap_DelRequest *req = &call->request->r.DelRequest;
973 struct ldap_Result *del_result;
974 struct ldapsrv_reply *del_reply;
975 TALLOC_CTX *local_ctx;
976 struct ldb_context *samdb = call->conn->ldb;
977 struct ldb_dn *dn;
978 const char *errstr = NULL;
979 int result = LDAP_SUCCESS;
980 int ldb_ret;
981 struct ldb_result *res = NULL;
982
983 DEBUG(10, ("DelRequest"));
984 DEBUGADD(10, (" dn: %s\n", req->dn));
985
986 local_ctx = talloc_named(call, 0, "DelRequest local memory context");
987 NT_STATUS_HAVE_NO_MEMORY(local_ctx);
988
989 dn = ldb_dn_new(local_ctx, samdb, req->dn);
990 NT_STATUS_HAVE_NO_MEMORY(dn);
991
992 DEBUG(10, ("DelRequest: dn: [%s]\n", req->dn));
993
994 del_reply = ldapsrv_init_reply(call, LDAP_TAG_DelResponse);
995 NT_STATUS_HAVE_NO_MEMORY(del_reply);
996
997 if (result == LDAP_SUCCESS) {
998 res = talloc_zero(local_ctx, struct ldb_result);
999 NT_STATUS_HAVE_NO_MEMORY(res);
1000 ldb_ret = ldapsrv_del_with_controls(call, dn, call->request->controls, res);
1001 result = map_ldb_error(local_ctx, ldb_ret, ldb_errstring(samdb),
1002 &errstr);
1003 }
1004
1005 del_result = &del_reply->msg->r.DelResponse;
1006 del_result->dn = NULL;
1007 if ((res != NULL) && (res->refs != NULL)) {
1008 del_result->resultcode = map_ldb_error(local_ctx,
1009 LDB_ERR_REFERRAL, NULL,
1010 &errstr);
1011 del_result->errormessage = (errstr?talloc_strdup(del_reply,errstr):NULL);
1012 del_result->referral = talloc_strdup(call, *res->refs);
1013 } else {
1014 del_result->resultcode = result;
1015 del_result->errormessage = (errstr?talloc_strdup(del_reply,errstr):NULL);
1016 del_result->referral = NULL;
1017 }
1018
1019 talloc_free(local_ctx);
1020
1021 ldapsrv_queue_reply(call, del_reply);
1022 return NT_STATUS_OK;
1023}
1024
1025static NTSTATUS ldapsrv_ModifyDNRequest(struct ldapsrv_call *call)
1026{
1027 struct ldap_ModifyDNRequest *req = &call->request->r.ModifyDNRequest;
1028 struct ldap_Result *modifydn;
1029 struct ldapsrv_reply *modifydn_r;
1030 TALLOC_CTX *local_ctx;
1031 struct ldb_context *samdb = call->conn->ldb;
1032 struct ldb_dn *olddn, *newdn=NULL, *newrdn;
1033 struct ldb_dn *parentdn = NULL;
1034 const char *errstr = NULL;
1035 int result = LDAP_SUCCESS;
1036 int ldb_ret;
1037 struct ldb_result *res = NULL;
1038
1039 DEBUG(10, ("ModifyDNRequest"));
1040 DEBUGADD(10, (" dn: %s", req->dn));
1041 DEBUGADD(10, (" newrdn: %s\n", req->newrdn));
1042
1043 local_ctx = talloc_named(call, 0, "ModifyDNRequest local memory context");
1044 NT_STATUS_HAVE_NO_MEMORY(local_ctx);
1045
1046 olddn = ldb_dn_new(local_ctx, samdb, req->dn);
1047 NT_STATUS_HAVE_NO_MEMORY(olddn);
1048
1049 newrdn = ldb_dn_new(local_ctx, samdb, req->newrdn);
1050 NT_STATUS_HAVE_NO_MEMORY(newrdn);
1051
1052 DEBUG(10, ("ModifyDNRequest: olddn: [%s]\n", req->dn));
1053 DEBUG(10, ("ModifyDNRequest: newrdn: [%s]\n", req->newrdn));
1054
1055 if (ldb_dn_get_comp_num(newrdn) == 0) {
1056 result = LDAP_PROTOCOL_ERROR;
1057 map_ldb_error(local_ctx, LDB_ERR_PROTOCOL_ERROR, NULL,
1058 &errstr);
1059 goto reply;
1060 }
1061
1062 if (ldb_dn_get_comp_num(newrdn) > 1) {
1063 result = LDAP_NAMING_VIOLATION;
1064 map_ldb_error(local_ctx, LDB_ERR_NAMING_VIOLATION, NULL,
1065 &errstr);
1066 goto reply;
1067 }
1068
1069 /* we can't handle the rename if we should not remove the old dn */
1070 if (!req->deleteolddn) {
1071 result = LDAP_UNWILLING_TO_PERFORM;
1072 map_ldb_error(local_ctx, LDB_ERR_UNWILLING_TO_PERFORM, NULL,
1073 &errstr);
1074 errstr = talloc_asprintf(local_ctx,
1075 "%s. Old RDN must be deleted", errstr);
1076 goto reply;
1077 }
1078
1079 if (req->newsuperior) {
1080 DEBUG(10, ("ModifyDNRequest: newsuperior: [%s]\n", req->newsuperior));
1081 parentdn = ldb_dn_new(local_ctx, samdb, req->newsuperior);
1082 }
1083
1084 if (!parentdn) {
1085 parentdn = ldb_dn_get_parent(local_ctx, olddn);
1086 }
1087 if (!parentdn) {
1088 result = LDAP_NO_SUCH_OBJECT;
1089 map_ldb_error(local_ctx, LDB_ERR_NO_SUCH_OBJECT, NULL, &errstr);
1090 goto reply;
1091 }
1092
1093 if ( ! ldb_dn_add_child(parentdn, newrdn)) {
1094 result = LDAP_OTHER;
1095 map_ldb_error(local_ctx, LDB_ERR_OTHER, NULL, &errstr);
1096 goto reply;
1097 }
1098 newdn = parentdn;
1099
1100reply:
1101 modifydn_r = ldapsrv_init_reply(call, LDAP_TAG_ModifyDNResponse);
1102 NT_STATUS_HAVE_NO_MEMORY(modifydn_r);
1103
1104 if (result == LDAP_SUCCESS) {
1105 res = talloc_zero(local_ctx, struct ldb_result);
1106 NT_STATUS_HAVE_NO_MEMORY(res);
1107 ldb_ret = ldapsrv_rename_with_controls(call, olddn, newdn, call->request->controls, res);
1108 result = map_ldb_error(local_ctx, ldb_ret, ldb_errstring(samdb),
1109 &errstr);
1110 }
1111
1112 modifydn = &modifydn_r->msg->r.ModifyDNResponse;
1113 modifydn->dn = NULL;
1114 if ((res != NULL) && (res->refs != NULL)) {
1115 modifydn->resultcode = map_ldb_error(local_ctx,
1116 LDB_ERR_REFERRAL, NULL,
1117 &errstr);;
1118 modifydn->errormessage = (errstr?talloc_strdup(modifydn_r,errstr):NULL);
1119 modifydn->referral = talloc_strdup(call, *res->refs);
1120 } else {
1121 modifydn->resultcode = result;
1122 modifydn->errormessage = (errstr?talloc_strdup(modifydn_r,errstr):NULL);
1123 modifydn->referral = NULL;
1124 }
1125
1126 talloc_free(local_ctx);
1127
1128 ldapsrv_queue_reply(call, modifydn_r);
1129 return NT_STATUS_OK;
1130}
1131
1132static NTSTATUS ldapsrv_CompareRequest(struct ldapsrv_call *call)
1133{
1134 struct ldap_CompareRequest *req = &call->request->r.CompareRequest;
1135 struct ldap_Result *compare;
1136 struct ldapsrv_reply *compare_r;
1137 TALLOC_CTX *local_ctx;
1138 struct ldb_context *samdb = call->conn->ldb;
1139 struct ldb_result *res = NULL;
1140 struct ldb_dn *dn;
1141 const char *attrs[1];
1142 const char *errstr = NULL;
1143 const char *filter = NULL;
1144 int result = LDAP_SUCCESS;
1145 int ldb_ret;
1146
1147 DEBUG(10, ("CompareRequest"));
1148 DEBUGADD(10, (" dn: %s\n", req->dn));
1149
1150 local_ctx = talloc_named(call, 0, "CompareRequest local_memory_context");
1151 NT_STATUS_HAVE_NO_MEMORY(local_ctx);
1152
1153 dn = ldb_dn_new(local_ctx, samdb, req->dn);
1154 NT_STATUS_HAVE_NO_MEMORY(dn);
1155
1156 DEBUG(10, ("CompareRequest: dn: [%s]\n", req->dn));
1157 filter = talloc_asprintf(local_ctx, "(%s=%*s)", req->attribute,
1158 (int)req->value.length, req->value.data);
1159 NT_STATUS_HAVE_NO_MEMORY(filter);
1160
1161 DEBUGADD(10, ("CompareRequest: attribute: [%s]\n", filter));
1162
1163 attrs[0] = NULL;
1164
1165 compare_r = ldapsrv_init_reply(call, LDAP_TAG_CompareResponse);
1166 NT_STATUS_HAVE_NO_MEMORY(compare_r);
1167
1168 if (result == LDAP_SUCCESS) {
1169 ldb_ret = ldb_search(samdb, local_ctx, &res,
1170 dn, LDB_SCOPE_BASE, attrs, "%s", filter);
1171 if (ldb_ret != LDB_SUCCESS) {
1172 result = map_ldb_error(local_ctx, ldb_ret,
1173 ldb_errstring(samdb), &errstr);
1174 DEBUG(10,("CompareRequest: error: %s\n", errstr));
1175 } else if (res->count == 0) {
1176 DEBUG(10,("CompareRequest: doesn't matched\n"));
1177 result = LDAP_COMPARE_FALSE;
1178 errstr = NULL;
1179 } else if (res->count == 1) {
1180 DEBUG(10,("CompareRequest: matched\n"));
1181 result = LDAP_COMPARE_TRUE;
1182 errstr = NULL;
1183 } else if (res->count > 1) {
1184 result = LDAP_OTHER;
1185 map_ldb_error(local_ctx, LDB_ERR_OTHER, NULL, &errstr);
1186 errstr = talloc_asprintf(local_ctx,
1187 "%s. Too many objects match!", errstr);
1188 DEBUG(10,("CompareRequest: %d results: %s\n", res->count, errstr));
1189 }
1190 }
1191
1192 compare = &compare_r->msg->r.CompareResponse;
1193 compare->dn = NULL;
1194 compare->resultcode = result;
1195 compare->errormessage = (errstr?talloc_strdup(compare_r,errstr):NULL);
1196 compare->referral = NULL;
1197
1198 talloc_free(local_ctx);
1199
1200 ldapsrv_queue_reply(call, compare_r);
1201 return NT_STATUS_OK;
1202}
1203
1204static NTSTATUS ldapsrv_AbandonRequest(struct ldapsrv_call *call)
1205{
1206 struct ldap_AbandonRequest *req = &call->request->r.AbandonRequest;
1207 struct ldapsrv_call *c = NULL;
1208 struct ldapsrv_call *n = NULL;
1209
1210 DEBUG(10, ("AbandonRequest\n"));
1211
1212 for (c = call->conn->pending_calls; c != NULL; c = n) {
1213 n = c->next;
1214
1215 if (c->request->messageid != req->messageid) {
1216 continue;
1217 }
1218
1219 DLIST_REMOVE(call->conn->pending_calls, c);
1220 TALLOC_FREE(c);
1221 }
1222
1223 return NT_STATUS_OK;
1224}
1225
1226NTSTATUS ldapsrv_do_call(struct ldapsrv_call *call)
1227{
1228 unsigned int i;
1229 struct ldap_message *msg = call->request;
1230 NTSTATUS status;
1231
1232 /* Check for undecoded critical extensions */
1233 for (i=0; msg->controls && msg->controls[i]; i++) {
1234 if (!msg->controls_decoded[i] &&
1235 msg->controls[i]->critical) {
1236 DEBUG(3, ("ldapsrv_do_call: Critical extension %s is not known to this server\n",
1237 msg->controls[i]->oid));
1238 return ldapsrv_unwilling(call, LDAP_UNAVAILABLE_CRITICAL_EXTENSION);
1239 }
1240 }
1241
1242 if (call->conn->authz_logged == false) {
1243 bool log = true;
1244
1245 /*
1246 * We do not want to log anonymous access if the query
1247 * is just for the rootDSE, or it is a startTLS or a
1248 * Bind.
1249 *
1250 * A rootDSE search could also be done over
1251 * CLDAP anonymously for example, so these don't
1252 * really count.
1253 * Essentially we want to know about
1254 * access beyond that normally done prior to a
1255 * bind.
1256 */
1257
1258 switch(call->request->type) {
1259 case LDAP_TAG_BindRequest:
1260 case LDAP_TAG_UnbindRequest:
1261 case LDAP_TAG_AbandonRequest:
1262 log = false;
1263 break;
1264 case LDAP_TAG_ExtendedResponse: {
1265 struct ldap_ExtendedRequest *req = &call->request->r.ExtendedRequest;
1266 if (strcmp(req->oid, LDB_EXTENDED_START_TLS_OID) == 0) {
1267 log = false;
1268 }
1269 break;
1270 }
1271 case LDAP_TAG_SearchRequest: {
1272 struct ldap_SearchRequest *req = &call->request->r.SearchRequest;
1273 if (req->scope == LDAP_SEARCH_SCOPE_BASE) {
1274 if (req->basedn[0] == '\0') {
1275 log = false;
1276 }
1277 }
1278 break;
1279 }
1280 default:
1281 break;
1282 }
1283
1284 if (log) {
1285 const char *transport_protection = AUTHZ_TRANSPORT_PROTECTION_NONE;
1286 if (call->conn->sockets.active == call->conn->sockets.tls) {
1287 transport_protection = AUTHZ_TRANSPORT_PROTECTION_TLS;
1288 }
1289
1290 log_successful_authz_event(call->conn->connection->msg_ctx,
1291 call->conn->connection->lp_ctx,
1292 call->conn->connection->remote_address,
1293 call->conn->connection->local_address,
1294 "LDAP",
1295 "no bind",
1296 transport_protection,
1297 call->conn->session_info);
1298
1299 call->conn->authz_logged = true;
1300 }
1301 }
1302
1303 switch(call->request->type) {
1304 case LDAP_TAG_BindRequest:
1305 return ldapsrv_BindRequest(call);
1306 case LDAP_TAG_UnbindRequest:
1307 return ldapsrv_UnbindRequest(call);
1308 case LDAP_TAG_SearchRequest:
1309 return ldapsrv_SearchRequest(call);
1310 case LDAP_TAG_ModifyRequest:
1311 status = ldapsrv_ModifyRequest(call);
1312 break;
1313 case LDAP_TAG_AddRequest:
1314 status = ldapsrv_AddRequest(call);
1315 break;
1316 case LDAP_TAG_DelRequest:
1317 status = ldapsrv_DelRequest(call);
1318 break;
1319 case LDAP_TAG_ModifyDNRequest:
1320 status = ldapsrv_ModifyDNRequest(call);
1321 break;
1322 case LDAP_TAG_CompareRequest:
1323 return ldapsrv_CompareRequest(call);
1324 case LDAP_TAG_AbandonRequest:
1325 return ldapsrv_AbandonRequest(call);
1326 case LDAP_TAG_ExtendedRequest:
1327 status = ldapsrv_ExtendedRequest(call);
1328 break;
1329 default:
1330 return ldapsrv_unwilling(call, LDAP_PROTOCOL_ERROR);
1331 }
1332
1333 if (NT_STATUS_IS_OK(status)) {
1334 ldapsrv_notification_retry_setup(call->conn->service, true);
1335 }
1336
1337 return status;
1338}
diff --git a/source4/ldap_server/ldap_bind.c b/source4/ldap_server/ldap_bind.c
0new file mode 1006441339new file mode 100644
index 0000000..21cbb7b
--- /dev/null
+++ b/source4/ldap_server/ldap_bind.c
@@ -0,0 +1,759 @@
1/*
2 Unix SMB/CIFS implementation.
3 LDAP server
4 Copyright (C) Stefan Metzmacher 2004
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#include "includes.h"
21#include "ldap_server/ldap_server.h"
22#include "auth/auth.h"
23#include "smbd/service.h"
24#include <ldb.h>
25#include <ldb_errors.h>
26#include "../lib/util/dlinklist.h"
27#include "dsdb/samdb/samdb.h"
28#include "auth/gensec/gensec.h"
29#include "auth/gensec/gensec_tstream.h"
30#include "param/param.h"
31#include "../lib/util/tevent_ntstatus.h"
32
33static char *ldapsrv_bind_error_msg(TALLOC_CTX *mem_ctx,
34 HRESULT hresult,
35 uint32_t DSID,
36 NTSTATUS status)
37{
38 WERROR werr;
39 char *msg = NULL;
40
41 status = nt_status_squash(status);
42 werr = ntstatus_to_werror(status);
43
44 /*
45 * There are 4 lower case hex digits following 'v' at the end,
46 * but different Windows Versions return different values:
47 *
48 * Windows 2008R2 uses 'v1db1'
49 * Windows 2012R2 uses 'v2580'
50 *
51 * We just match Windows 2008R2 as that's what was referenced
52 * in https://bugzilla.samba.org/show_bug.cgi?id=9048
53 */
54 msg = talloc_asprintf(mem_ctx, "%08X: LdapErr: DSID-%08X, comment: "
55 "AcceptSecurityContext error, data %x, v1db1",
56 (unsigned)HRES_ERROR_V(hresult),
57 (unsigned)DSID,
58 (unsigned)W_ERROR_V(werr));
59
60 return msg;
61}
62
63struct ldapsrv_bind_wait_context {
64 struct ldapsrv_reply *reply;
65 struct tevent_req *req;
66 NTSTATUS status;
67 bool done;
68};
69
70struct ldapsrv_bind_wait_state {
71 uint8_t dummy;
72};
73
74static struct tevent_req *ldapsrv_bind_wait_send(TALLOC_CTX *mem_ctx,
75 struct tevent_context *ev,
76 void *private_data)
77{
78 struct ldapsrv_bind_wait_context *bind_wait =
79 talloc_get_type_abort(private_data,
80 struct ldapsrv_bind_wait_context);
81 struct tevent_req *req;
82 struct ldapsrv_bind_wait_state *state;
83
84 req = tevent_req_create(mem_ctx, &state,
85 struct ldapsrv_bind_wait_state);
86 if (req == NULL) {
87 return NULL;
88 }
89 bind_wait->req = req;
90
91 tevent_req_defer_callback(req, ev);
92
93 if (!bind_wait->done) {
94 return req;
95 }
96
97 if (tevent_req_nterror(req, bind_wait->status)) {
98 return tevent_req_post(req, ev);
99 }
100
101 tevent_req_done(req);
102 return tevent_req_post(req, ev);
103}
104
105static NTSTATUS ldapsrv_bind_wait_recv(struct tevent_req *req)
106{
107 return tevent_req_simple_recv_ntstatus(req);
108}
109
110static NTSTATUS ldapsrv_bind_wait_setup(struct ldapsrv_call *call,
111 struct ldapsrv_reply *reply)
112{
113 struct ldapsrv_bind_wait_context *bind_wait = NULL;
114
115 if (call->wait_private != NULL) {
116 return NT_STATUS_INTERNAL_ERROR;
117 }
118
119 bind_wait = talloc_zero(call, struct ldapsrv_bind_wait_context);
120 if (bind_wait == NULL) {
121 return NT_STATUS_NO_MEMORY;
122 }
123 bind_wait->reply = reply;
124
125 call->wait_private = bind_wait;
126 call->wait_send = ldapsrv_bind_wait_send;
127 call->wait_recv = ldapsrv_bind_wait_recv;
128 return NT_STATUS_OK;
129}
130
131static void ldapsrv_bind_wait_finished(struct ldapsrv_call *call,
132 NTSTATUS status)
133{
134 struct ldapsrv_bind_wait_context *bind_wait =
135 talloc_get_type_abort(call->wait_private,
136 struct ldapsrv_bind_wait_context);
137
138 bind_wait->done = true;
139 bind_wait->status = status;
140
141 if (bind_wait->req == NULL) {
142 return;
143 }
144
145 if (tevent_req_nterror(bind_wait->req, status)) {
146 return;
147 }
148
149 tevent_req_done(bind_wait->req);
150}
151
152static void ldapsrv_BindSimple_done(struct tevent_req *subreq);
153
154static NTSTATUS ldapsrv_BindSimple(struct ldapsrv_call *call)
155{
156 struct ldap_BindRequest *req = &call->request->r.BindRequest;
157 struct ldapsrv_reply *reply = NULL;
158 struct ldap_BindResponse *resp = NULL;
159 int result;
160 const char *errstr = NULL;
161 NTSTATUS status;
162 bool using_tls = call->conn->sockets.active == call->conn->sockets.tls;
163 struct tevent_req *subreq = NULL;
164
165 DEBUG(10, ("BindSimple dn: %s\n",req->dn));
166
167 reply = ldapsrv_init_reply(call, LDAP_TAG_BindResponse);
168 if (!reply) {
169 return NT_STATUS_NO_MEMORY;
170 }
171
172 if (req->dn != NULL &&
173 strlen(req->dn) != 0 &&
174 call->conn->require_strong_auth > LDAP_SERVER_REQUIRE_STRONG_AUTH_NO &&
175 !using_tls)
176 {
177 status = NT_STATUS_NETWORK_ACCESS_DENIED;
178 result = LDAP_STRONG_AUTH_REQUIRED;
179 errstr = talloc_asprintf(reply,
180 "BindSimple: Transport encryption required.");
181 goto do_reply;
182 }
183
184 subreq = authenticate_ldap_simple_bind_send(call,
185 call->conn->connection->event.ctx,
186 call->conn->connection->msg_ctx,
187 call->conn->lp_ctx,
188 call->conn->connection->remote_address,
189 call->conn->connection->local_address,
190 using_tls,
191 req->dn,
192 req->creds.password);
193 if (subreq == NULL) {
194 return NT_STATUS_NO_MEMORY;
195 }
196 tevent_req_set_callback(subreq, ldapsrv_BindSimple_done, call);
197
198 status = ldapsrv_bind_wait_setup(call, reply);
199 if (!NT_STATUS_IS_OK(status)) {
200 TALLOC_FREE(subreq);
201 return status;
202 }
203
204 /*
205 * The rest will be async.
206 */
207 return NT_STATUS_OK;
208
209do_reply:
210 resp = &reply->msg->r.BindResponse;
211 resp->response.resultcode = result;
212 resp->response.errormessage = errstr;
213 resp->response.dn = NULL;
214 resp->response.referral = NULL;
215 resp->SASL.secblob = NULL;
216
217 ldapsrv_queue_reply(call, reply);
218 return NT_STATUS_OK;
219}
220
221static void ldapsrv_BindSimple_done(struct tevent_req *subreq)
222{
223 struct ldapsrv_call *call =
224 tevent_req_callback_data(subreq,
225 struct ldapsrv_call);
226 struct ldapsrv_bind_wait_context *bind_wait =
227 talloc_get_type_abort(call->wait_private,
228 struct ldapsrv_bind_wait_context);
229 struct ldapsrv_reply *reply = bind_wait->reply;
230 struct auth_session_info *session_info = NULL;
231 NTSTATUS status;
232 struct ldap_BindResponse *resp = NULL;
233 int result;
234 const char *errstr = NULL;
235
236 status = authenticate_ldap_simple_bind_recv(subreq,
237 call,
238 &session_info);
239 if (NT_STATUS_IS_OK(status)) {
240 result = LDAP_SUCCESS;
241 errstr = NULL;
242
243 talloc_unlink(call->conn, call->conn->session_info);
244 call->conn->session_info = talloc_steal(call->conn, session_info);
245
246 call->conn->authz_logged = true;
247
248 /* don't leak the old LDB */
249 talloc_unlink(call->conn, call->conn->ldb);
250
251 status = ldapsrv_backend_Init(call->conn);
252
253 if (!NT_STATUS_IS_OK(status)) {
254 result = LDAP_OPERATIONS_ERROR;
255 errstr = talloc_asprintf(reply, "Simple Bind: Failed to advise ldb new credentials: %s", nt_errstr(status));
256 }
257 } else {
258 status = nt_status_squash(status);
259
260 result = LDAP_INVALID_CREDENTIALS;
261 errstr = ldapsrv_bind_error_msg(reply, HRES_SEC_E_INVALID_TOKEN,
262 0x0C0903A9, status);
263 }
264
265 resp = &reply->msg->r.BindResponse;
266 resp->response.resultcode = result;
267 resp->response.errormessage = errstr;
268 resp->response.dn = NULL;
269 resp->response.referral = NULL;
270 resp->SASL.secblob = NULL;
271
272 ldapsrv_queue_reply(call, reply);
273 ldapsrv_bind_wait_finished(call, NT_STATUS_OK);
274}
275
276struct ldapsrv_sasl_postprocess_context {
277 struct ldapsrv_connection *conn;
278 struct tstream_context *sasl;
279};
280
281struct ldapsrv_sasl_postprocess_state {
282 uint8_t dummy;
283};
284
285static struct tevent_req *ldapsrv_sasl_postprocess_send(TALLOC_CTX *mem_ctx,
286 struct tevent_context *ev,
287 void *private_data)
288{
289 struct ldapsrv_sasl_postprocess_context *context =
290 talloc_get_type_abort(private_data,
291 struct ldapsrv_sasl_postprocess_context);
292 struct tevent_req *req;
293 struct ldapsrv_sasl_postprocess_state *state;
294
295 req = tevent_req_create(mem_ctx, &state,
296 struct ldapsrv_sasl_postprocess_state);
297 if (req == NULL) {
298 return NULL;
299 }
300
301 TALLOC_FREE(context->conn->sockets.sasl);
302 context->conn->sockets.sasl = talloc_move(context->conn, &context->sasl);
303 context->conn->sockets.active = context->conn->sockets.sasl;
304
305 tevent_req_done(req);
306 return tevent_req_post(req, ev);
307}
308
309static NTSTATUS ldapsrv_sasl_postprocess_recv(struct tevent_req *req)
310{
311 return tevent_req_simple_recv_ntstatus(req);
312}
313
314static NTSTATUS ldapsrv_setup_gensec(struct ldapsrv_connection *conn,
315 const char *sasl_mech,
316 struct gensec_security **_gensec_security)
317{
318 NTSTATUS status;
319
320 struct gensec_security *gensec_security;
321
322 status = samba_server_gensec_start(conn,
323 conn->connection->event.ctx,
324 conn->connection->msg_ctx,
325 conn->lp_ctx,
326 conn->server_credentials,
327 "ldap",
328 &gensec_security);
329 if (!NT_STATUS_IS_OK(status)) {
330 return status;
331 }
332
333 status = gensec_set_target_service_description(gensec_security,
334 "LDAP");
335 if (!NT_STATUS_IS_OK(status)) {
336 return status;
337 }
338
339 status = gensec_set_remote_address(gensec_security,
340 conn->connection->remote_address);
341 if (!NT_STATUS_IS_OK(status)) {
342 return status;
343 }
344
345 status = gensec_set_local_address(gensec_security,
346 conn->connection->local_address);
347 if (!NT_STATUS_IS_OK(status)) {
348 return status;
349 }
350
351 gensec_want_feature(gensec_security, GENSEC_FEATURE_ASYNC_REPLIES);
352 gensec_want_feature(gensec_security, GENSEC_FEATURE_LDAP_STYLE);
353
354 if (conn->sockets.active == conn->sockets.tls) {
355 gensec_want_feature(gensec_security, GENSEC_FEATURE_LDAPS_TRANSPORT);
356 }
357
358 status = gensec_start_mech_by_sasl_name(gensec_security, sasl_mech);
359
360 if (!NT_STATUS_IS_OK(status)) {
361 return status;
362 }
363
364 *_gensec_security = gensec_security;
365 return status;
366}
367
368static void ldapsrv_BindSASL_done(struct tevent_req *subreq);
369
370static NTSTATUS ldapsrv_BindSASL(struct ldapsrv_call *call)
371{
372 struct ldap_BindRequest *req = &call->request->r.BindRequest;
373 struct ldapsrv_reply *reply;
374 struct ldap_BindResponse *resp;
375 struct ldapsrv_connection *conn;
376 int result = 0;
377 const char *errstr=NULL;
378 NTSTATUS status = NT_STATUS_OK;
379 DATA_BLOB input = data_blob_null;
380 struct tevent_req *subreq = NULL;
381
382 DEBUG(10, ("BindSASL dn: %s\n",req->dn));
383
384 reply = ldapsrv_init_reply(call, LDAP_TAG_BindResponse);
385 if (!reply) {
386 return NT_STATUS_NO_MEMORY;
387 }
388 resp = &reply->msg->r.BindResponse;
389 /* Windows 2000 mmc doesn't like secblob == NULL and reports a decoding error */
390 resp->SASL.secblob = talloc_zero(reply, DATA_BLOB);
391 if (resp->SASL.secblob == NULL) {
392 return NT_STATUS_NO_MEMORY;
393 }
394
395 conn = call->conn;
396
397 /*
398 * TODO: a SASL bind with a different mechanism
399 * should cancel an inprogress SASL bind.
400 * (see RFC 4513)
401 */
402
403 if (!conn->gensec) {
404 status = ldapsrv_setup_gensec(conn, req->creds.SASL.mechanism,
405 &conn->gensec);
406 if (!NT_STATUS_IS_OK(status)) {
407 DEBUG(1, ("Failed to start GENSEC server for [%s] code: %s\n",
408 ldb_binary_encode_string(call, req->creds.SASL.mechanism),
409 nt_errstr(status)));
410 result = LDAP_OPERATIONS_ERROR;
411 errstr = talloc_asprintf(reply, "SASL: Failed to start authentication system: %s",
412 nt_errstr(status));
413 goto do_reply;
414 }
415 }
416
417 if (req->creds.SASL.secblob) {
418 input = *req->creds.SASL.secblob;
419 }
420
421 subreq = gensec_update_send(call, conn->connection->event.ctx,
422 conn->gensec, input);
423 if (subreq == NULL) {
424 return NT_STATUS_NO_MEMORY;
425 }
426 tevent_req_set_callback(subreq, ldapsrv_BindSASL_done, call);
427
428 status = ldapsrv_bind_wait_setup(call, reply);
429 if (!NT_STATUS_IS_OK(status)) {
430 TALLOC_FREE(subreq);
431 return status;
432 }
433
434 /*
435 * The rest will be async.
436 */
437 return NT_STATUS_OK;
438
439do_reply:
440 if (result != LDAP_SASL_BIND_IN_PROGRESS) {
441 /*
442 * We should destroy the gensec context
443 * when we hit a fatal error.
444 *
445 * Note: conn->gensec is already cleared
446 * for the LDAP_SUCCESS case.
447 */
448 talloc_unlink(conn, conn->gensec);
449 conn->gensec = NULL;
450 }
451
452 resp->response.resultcode = result;
453 resp->response.dn = NULL;
454 resp->response.errormessage = errstr;
455 resp->response.referral = NULL;
456
457 ldapsrv_queue_reply(call, reply);
458 return NT_STATUS_OK;
459}
460
461static void ldapsrv_BindSASL_done(struct tevent_req *subreq)
462{
463 struct ldapsrv_call *call =
464 tevent_req_callback_data(subreq,
465 struct ldapsrv_call);
466 struct ldapsrv_bind_wait_context *bind_wait =
467 talloc_get_type_abort(call->wait_private,
468 struct ldapsrv_bind_wait_context);
469 struct ldap_BindRequest *req = &call->request->r.BindRequest;
470 struct ldapsrv_reply *reply = bind_wait->reply;
471 struct ldap_BindResponse *resp = &reply->msg->r.BindResponse;
472 struct ldapsrv_connection *conn = call->conn;
473 struct auth_session_info *session_info = NULL;
474 struct ldapsrv_sasl_postprocess_context *context = NULL;
475 NTSTATUS status;
476 int result;
477 const char *errstr = NULL;
478 DATA_BLOB output = data_blob_null;
479
480 status = gensec_update_recv(subreq, call, &output);
481 TALLOC_FREE(subreq);
482
483 if (NT_STATUS_EQUAL(NT_STATUS_MORE_PROCESSING_REQUIRED, status)) {
484 *resp->SASL.secblob = output;
485 result = LDAP_SASL_BIND_IN_PROGRESS;
486 errstr = NULL;
487 goto do_reply;
488 }
489
490 if (!NT_STATUS_IS_OK(status)) {
491 status = nt_status_squash(status);
492 result = LDAP_INVALID_CREDENTIALS;
493 errstr = ldapsrv_bind_error_msg(reply, HRES_SEC_E_LOGON_DENIED,
494 0x0C0904DC, status);
495 goto do_reply;
496 }
497
498 if (gensec_have_feature(conn->gensec, GENSEC_FEATURE_SIGN) ||
499 gensec_have_feature(conn->gensec, GENSEC_FEATURE_SEAL)) {
500
501 context = talloc_zero(call, struct ldapsrv_sasl_postprocess_context);
502 if (context == NULL) {
503 ldapsrv_bind_wait_finished(call, NT_STATUS_NO_MEMORY);
504 return;
505 }
506 }
507
508 if (context && conn->sockets.tls) {
509 TALLOC_FREE(context);
510 status = NT_STATUS_NOT_SUPPORTED;
511 result = LDAP_UNWILLING_TO_PERFORM;
512 errstr = talloc_asprintf(reply,
513 "SASL:[%s]: Sign or Seal are not allowed if TLS is used",
514 req->creds.SASL.mechanism);
515 goto do_reply;
516 }
517
518 if (context && conn->sockets.sasl) {
519 TALLOC_FREE(context);
520 status = NT_STATUS_NOT_SUPPORTED;
521 result = LDAP_UNWILLING_TO_PERFORM;
522 errstr = talloc_asprintf(reply,
523 "SASL:[%s]: Sign or Seal are not allowed if SASL encryption has already been set up",
524 req->creds.SASL.mechanism);
525 goto do_reply;
526 }
527
528 if (context == NULL) {
529 switch (call->conn->require_strong_auth) {
530 case LDAP_SERVER_REQUIRE_STRONG_AUTH_NO:
531 break;
532 case LDAP_SERVER_REQUIRE_STRONG_AUTH_ALLOW_SASL_OVER_TLS:
533 if (call->conn->sockets.active == call->conn->sockets.tls) {
534 break;
535 }
536 status = NT_STATUS_NETWORK_ACCESS_DENIED;
537 result = LDAP_STRONG_AUTH_REQUIRED;
538 errstr = talloc_asprintf(reply,
539 "SASL:[%s]: not allowed if TLS is used.",
540 req->creds.SASL.mechanism);
541 goto do_reply;
542
543 case LDAP_SERVER_REQUIRE_STRONG_AUTH_YES:
544 status = NT_STATUS_NETWORK_ACCESS_DENIED;
545 result = LDAP_STRONG_AUTH_REQUIRED;
546 errstr = talloc_asprintf(reply,
547 "SASL:[%s]: Sign or Seal are required.",
548 req->creds.SASL.mechanism);
549 goto do_reply;
550 }
551 }
552
553 if (context != NULL) {
554 context->conn = conn;
555 status = gensec_create_tstream(context,
556 context->conn->gensec,
557 context->conn->sockets.raw,
558 &context->sasl);
559 if (!NT_STATUS_IS_OK(status)) {
560 result = LDAP_OPERATIONS_ERROR;
561 errstr = talloc_asprintf(reply,
562 "SASL:[%s]: Failed to setup SASL socket: %s",
563 req->creds.SASL.mechanism, nt_errstr(status));
564 goto do_reply;
565 }
566 }
567
568 status = gensec_session_info(conn->gensec, call, &session_info);
569 if (!NT_STATUS_IS_OK(status)) {
570 result = LDAP_OPERATIONS_ERROR;
571 errstr = talloc_asprintf(reply,
572 "SASL:[%s]: Failed to get session info: %s",
573 req->creds.SASL.mechanism, nt_errstr(status));
574 goto do_reply;
575 }
576
577 talloc_unlink(conn, conn->session_info);
578 conn->session_info = talloc_steal(conn, session_info);
579
580 /* don't leak the old LDB */
581 talloc_unlink(conn, conn->ldb);
582
583 call->conn->authz_logged = true;
584
585 status = ldapsrv_backend_Init(conn);
586
587 if (!NT_STATUS_IS_OK(status)) {
588 result = LDAP_OPERATIONS_ERROR;
589 errstr = talloc_asprintf(reply,
590 "SASL:[%s]: Failed to advise samdb of new credentials: %s",
591 req->creds.SASL.mechanism,
592 nt_errstr(status));
593 goto do_reply;
594 }
595
596 if (context != NULL) {
597 const void *ptr = NULL;
598
599 ptr = talloc_reparent(conn, context->sasl, conn->gensec);
600 if (ptr == NULL) {
601 ldapsrv_bind_wait_finished(call, NT_STATUS_NO_MEMORY);
602 return;
603 }
604
605 call->postprocess_send = ldapsrv_sasl_postprocess_send;
606 call->postprocess_recv = ldapsrv_sasl_postprocess_recv;
607 call->postprocess_private = context;
608 } else {
609 talloc_unlink(conn, conn->gensec);
610 }
611 conn->gensec = NULL;
612
613 *resp->SASL.secblob = output;
614 result = LDAP_SUCCESS;
615 errstr = NULL;
616
617do_reply:
618 if (result != LDAP_SASL_BIND_IN_PROGRESS) {
619 /*
620 * We should destroy the gensec context
621 * when we hit a fatal error.
622 *
623 * Note: conn->gensec is already cleared
624 * for the LDAP_SUCCESS case.
625 */
626 talloc_unlink(conn, conn->gensec);
627 conn->gensec = NULL;
628 }
629
630 resp->response.resultcode = result;
631 resp->response.dn = NULL;
632 resp->response.errormessage = errstr;
633 resp->response.referral = NULL;
634
635 ldapsrv_queue_reply(call, reply);
636 ldapsrv_bind_wait_finished(call, NT_STATUS_OK);
637}
638
639NTSTATUS ldapsrv_BindRequest(struct ldapsrv_call *call)
640{
641 struct ldap_BindRequest *req = &call->request->r.BindRequest;
642 struct ldapsrv_reply *reply;
643 struct ldap_BindResponse *resp;
644
645 if (call->conn->pending_calls != NULL) {
646 reply = ldapsrv_init_reply(call, LDAP_TAG_BindResponse);
647 if (!reply) {
648 return NT_STATUS_NO_MEMORY;
649 }
650
651 resp = &reply->msg->r.BindResponse;
652 resp->response.resultcode = LDAP_BUSY;
653 resp->response.dn = NULL;
654 resp->response.errormessage = talloc_asprintf(reply, "Pending requests on this LDAP session");
655 resp->response.referral = NULL;
656 resp->SASL.secblob = NULL;
657
658 ldapsrv_queue_reply(call, reply);
659 return NT_STATUS_OK;
660 }
661
662 /*
663 * TODO: a simple bind should cancel an
664 * inprogress SASL bind.
665 * (see RFC 4513)
666 */
667 switch (req->mechanism) {
668 case LDAP_AUTH_MECH_SIMPLE:
669 return ldapsrv_BindSimple(call);
670 case LDAP_AUTH_MECH_SASL:
671 return ldapsrv_BindSASL(call);
672 }
673
674 reply = ldapsrv_init_reply(call, LDAP_TAG_BindResponse);
675 if (!reply) {
676 return NT_STATUS_NO_MEMORY;
677 }
678
679 resp = &reply->msg->r.BindResponse;
680 resp->response.resultcode = LDAP_AUTH_METHOD_NOT_SUPPORTED;
681 resp->response.dn = NULL;
682 resp->response.errormessage = talloc_asprintf(reply, "Bad AuthenticationChoice [%d]", req->mechanism);
683 resp->response.referral = NULL;
684 resp->SASL.secblob = NULL;
685
686 ldapsrv_queue_reply(call, reply);
687 return NT_STATUS_OK;
688}
689
690struct ldapsrv_unbind_wait_context {
691 uint8_t dummy;
692};
693
694struct ldapsrv_unbind_wait_state {
695 uint8_t dummy;
696};
697
698static struct tevent_req *ldapsrv_unbind_wait_send(TALLOC_CTX *mem_ctx,
699 struct tevent_context *ev,
700 void *private_data)
701{
702 struct ldapsrv_unbind_wait_context *unbind_wait =
703 talloc_get_type_abort(private_data,
704 struct ldapsrv_unbind_wait_context);
705 struct tevent_req *req;
706 struct ldapsrv_unbind_wait_state *state;
707
708 req = tevent_req_create(mem_ctx, &state,
709 struct ldapsrv_unbind_wait_state);
710 if (req == NULL) {
711 return NULL;
712 }
713
714 (void)unbind_wait;
715
716 tevent_req_nterror(req, NT_STATUS_LOCAL_DISCONNECT);
717 return tevent_req_post(req, ev);
718}
719
720static NTSTATUS ldapsrv_unbind_wait_recv(struct tevent_req *req)
721{
722 return tevent_req_simple_recv_ntstatus(req);
723}
724
725static NTSTATUS ldapsrv_unbind_wait_setup(struct ldapsrv_call *call)
726{
727 struct ldapsrv_unbind_wait_context *unbind_wait = NULL;
728
729 if (call->wait_private != NULL) {
730 return NT_STATUS_INTERNAL_ERROR;
731 }
732
733 unbind_wait = talloc_zero(call, struct ldapsrv_unbind_wait_context);
734 if (unbind_wait == NULL) {
735 return NT_STATUS_NO_MEMORY;
736 }
737
738 call->wait_private = unbind_wait;
739 call->wait_send = ldapsrv_unbind_wait_send;
740 call->wait_recv = ldapsrv_unbind_wait_recv;
741 return NT_STATUS_OK;
742}
743
744NTSTATUS ldapsrv_UnbindRequest(struct ldapsrv_call *call)
745{
746 struct ldapsrv_call *c = NULL;
747 struct ldapsrv_call *n = NULL;
748
749 DEBUG(10, ("UnbindRequest\n"));
750
751 for (c = call->conn->pending_calls; c != NULL; c = n) {
752 n = c->next;
753
754 DLIST_REMOVE(call->conn->pending_calls, c);
755 TALLOC_FREE(c);
756 }
757
758 return ldapsrv_unbind_wait_setup(call);
759}
diff --git a/source4/ldap_server/ldap_extended.c b/source4/ldap_server/ldap_extended.c
0new file mode 100644760new file mode 100644
index 0000000..2d4a534
--- /dev/null
+++ b/source4/ldap_server/ldap_extended.c
@@ -0,0 +1,215 @@
1/*
2 Unix SMB/CIFS implementation.
3 LDAP server
4 Copyright (C) Stefan Metzmacher 2004
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#include "includes.h"
21#include "ldap_server/ldap_server.h"
22#include "../lib/util/dlinklist.h"
23#include "lib/tls/tls.h"
24#include "smbd/service_stream.h"
25#include "../lib/util/tevent_ntstatus.h"
26
27struct ldapsrv_starttls_postprocess_context {
28 struct ldapsrv_connection *conn;
29};
30
31struct ldapsrv_starttls_postprocess_state {
32 struct ldapsrv_connection *conn;
33};
34
35static void ldapsrv_starttls_postprocess_done(struct tevent_req *subreq);
36
37static struct tevent_req *ldapsrv_starttls_postprocess_send(TALLOC_CTX *mem_ctx,
38 struct tevent_context *ev,
39 void *private_data)
40{
41 struct ldapsrv_starttls_postprocess_context *context =
42 talloc_get_type_abort(private_data,
43 struct ldapsrv_starttls_postprocess_context);
44 struct ldapsrv_connection *conn = context->conn;
45 struct tevent_req *req;
46 struct ldapsrv_starttls_postprocess_state *state;
47 struct tevent_req *subreq;
48
49 req = tevent_req_create(mem_ctx, &state,
50 struct ldapsrv_starttls_postprocess_state);
51 if (req == NULL) {
52 return NULL;
53 }
54
55 state->conn = conn;
56
57 subreq = tstream_tls_accept_send(conn,
58 conn->connection->event.ctx,
59 conn->sockets.raw,
60 conn->service->tls_params);
61 if (tevent_req_nomem(subreq, req)) {
62 return tevent_req_post(req, ev);
63 }
64 tevent_req_set_callback(subreq, ldapsrv_starttls_postprocess_done, req);
65
66 return req;
67}
68
69static void ldapsrv_starttls_postprocess_done(struct tevent_req *subreq)
70{
71 struct tevent_req *req =
72 tevent_req_callback_data(subreq,
73 struct tevent_req);
74 struct ldapsrv_starttls_postprocess_state *state =
75 tevent_req_data(req,
76 struct ldapsrv_starttls_postprocess_state);
77 struct ldapsrv_connection *conn = state->conn;
78 int ret;
79 int sys_errno;
80
81 ret = tstream_tls_accept_recv(subreq, &sys_errno,
82 conn, &conn->sockets.tls);
83 TALLOC_FREE(subreq);
84 if (ret == -1) {
85 NTSTATUS status = map_nt_error_from_unix_common(sys_errno);
86
87 DEBUG(1,("ldapsrv_starttls_postprocess_done: accept_tls_loop: "
88 "tstream_tls_accept_recv() - %d:%s => %s",
89 sys_errno, strerror(sys_errno), nt_errstr(status)));
90
91 tevent_req_nterror(req, status);
92 return;
93 }
94
95 conn->sockets.active = conn->sockets.tls;
96
97 tevent_req_done(req);
98}
99
100static NTSTATUS ldapsrv_starttls_postprocess_recv(struct tevent_req *req)
101{
102 return tevent_req_simple_recv_ntstatus(req);
103}
104
105static NTSTATUS ldapsrv_StartTLS(struct ldapsrv_call *call,
106 struct ldapsrv_reply *reply,
107 const char **errstr)
108{
109 struct ldapsrv_starttls_postprocess_context *context;
110
111 (*errstr) = NULL;
112
113 /*
114 * TODO: give LDAP_OPERATIONS_ERROR also when
115 * there's a SASL bind in progress
116 * (see rfc4513 section 3.1.1)
117 */
118 if (call->conn->sockets.tls) {
119 (*errstr) = talloc_asprintf(reply, "START-TLS: TLS is already enabled on this LDAP session");
120 return NT_STATUS_LDAP(LDAP_OPERATIONS_ERROR);
121 }
122
123 if (call->conn->sockets.sasl) {
124 (*errstr) = talloc_asprintf(reply, "START-TLS: SASL is already enabled on this LDAP session");
125 return NT_STATUS_LDAP(LDAP_OPERATIONS_ERROR);
126 }
127
128 if (call->conn->pending_calls != NULL) {
129 (*errstr) = talloc_asprintf(reply, "START-TLS: pending requests on this LDAP session");
130 return NT_STATUS_LDAP(LDAP_BUSY);
131 }
132
133 context = talloc(call, struct ldapsrv_starttls_postprocess_context);
134 NT_STATUS_HAVE_NO_MEMORY(context);
135
136 context->conn = call->conn;
137
138 call->postprocess_send = ldapsrv_starttls_postprocess_send;
139 call->postprocess_recv = ldapsrv_starttls_postprocess_recv;
140 call->postprocess_private = context;
141
142 reply->msg->r.ExtendedResponse.response.resultcode = LDAP_SUCCESS;
143 reply->msg->r.ExtendedResponse.response.errormessage = NULL;
144
145 ldapsrv_queue_reply(call, reply);
146 return NT_STATUS_OK;
147}
148
149struct ldapsrv_extended_operation {
150 const char *oid;
151 NTSTATUS (*fn)(struct ldapsrv_call *call, struct ldapsrv_reply *reply, const char **errorstr);
152};
153
154static struct ldapsrv_extended_operation extended_ops[] = {
155 {
156 .oid = LDB_EXTENDED_START_TLS_OID,
157 .fn = ldapsrv_StartTLS,
158 },{
159 .oid = NULL,
160 .fn = NULL,
161 }
162};
163
164NTSTATUS ldapsrv_ExtendedRequest(struct ldapsrv_call *call)
165{
166 struct ldap_ExtendedRequest *req = &call->request->r.ExtendedRequest;
167 struct ldapsrv_reply *reply;
168 int result = LDAP_PROTOCOL_ERROR;
169 const char *error_str = NULL;
170 NTSTATUS status = NT_STATUS_OK;
171 unsigned int i;
172
173 DEBUG(10, ("Extended\n"));
174
175 reply = ldapsrv_init_reply(call, LDAP_TAG_ExtendedResponse);
176 NT_STATUS_HAVE_NO_MEMORY(reply);
177
178 ZERO_STRUCT(reply->msg->r);
179 reply->msg->r.ExtendedResponse.oid = talloc_steal(reply, req->oid);
180 reply->msg->r.ExtendedResponse.response.resultcode = LDAP_PROTOCOL_ERROR;
181 reply->msg->r.ExtendedResponse.response.errormessage = NULL;
182
183 for (i=0; extended_ops[i].oid; i++) {
184 if (strcmp(extended_ops[i].oid,req->oid) != 0) continue;
185
186 /*
187 * if the backend function returns an error we
188 * need to send the reply otherwise the reply is already
189 * send and we need to return directly
190 */
191 status = extended_ops[i].fn(call, reply, &error_str);
192 if (NT_STATUS_IS_OK(status)) {
193 return status;
194 }
195
196 if (NT_STATUS_IS_LDAP(status)) {
197 result = NT_STATUS_LDAP_CODE(status);
198 } else {
199 result = LDAP_OPERATIONS_ERROR;
200 error_str = talloc_asprintf(reply, "Extended Operation(%s) failed: %s",
201 req->oid, nt_errstr(status));
202 }
203 }
204 /* if we haven't found the oid, then status is still NT_STATUS_OK */
205 if (NT_STATUS_IS_OK(status)) {
206 error_str = talloc_asprintf(reply, "Extended Operation(%s) not supported",
207 req->oid);
208 }
209
210 reply->msg->r.ExtendedResponse.response.resultcode = result;
211 reply->msg->r.ExtendedResponse.response.errormessage = error_str;
212
213 ldapsrv_queue_reply(call, reply);
214 return NT_STATUS_OK;
215}
diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c
0new file mode 100644216new file mode 100644
index 0000000..d9f24e0
--- /dev/null
+++ b/source4/ldap_server/ldap_server.c
@@ -0,0 +1,1259 @@
1/*
2 Unix SMB/CIFS implementation.
3
4 LDAP server
5
6 Copyright (C) Andrew Tridgell 2005
7 Copyright (C) Volker Lendecke 2004
8 Copyright (C) Stefan Metzmacher 2004
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
22*/
23
24#include "includes.h"
25#include "system/network.h"
26#include "lib/events/events.h"
27#include "auth/auth.h"
28#include "auth/credentials/credentials.h"
29#include "librpc/gen_ndr/ndr_samr.h"
30#include "../lib/util/dlinklist.h"
31#include "../lib/util/asn1.h"
32#include "ldap_server/ldap_server.h"
33#include "smbd/service_task.h"
34#include "smbd/service_stream.h"
35#include "smbd/service.h"
36#include "smbd/process_model.h"
37#include "lib/tls/tls.h"
38#include "lib/messaging/irpc.h"
39#include <ldb.h>
40#include <ldb_errors.h>
41#include "libcli/ldap/ldap_proto.h"
42#include "system/network.h"
43#include "lib/socket/netif.h"
44#include "dsdb/samdb/samdb.h"
45#include "param/param.h"
46#include "../lib/tsocket/tsocket.h"
47#include "../lib/util/tevent_ntstatus.h"
48#include "../libcli/util/tstream.h"
49#include "libds/common/roles.h"
50
51static void ldapsrv_terminate_connection_done(struct tevent_req *subreq);
52
53/*
54 close the socket and shutdown a server_context
55*/
56static void ldapsrv_terminate_connection(struct ldapsrv_connection *conn,
57 const char *reason)
58{
59 struct tevent_req *subreq;
60
61 if (conn->limits.reason) {
62 return;
63 }
64
65 DLIST_REMOVE(conn->service->connections, conn);
66
67 conn->limits.endtime = timeval_current_ofs(0, 500);
68
69 tevent_queue_stop(conn->sockets.send_queue);
70 TALLOC_FREE(conn->sockets.read_req);
71 if (conn->active_call) {
72 tevent_req_cancel(conn->active_call);
73 conn->active_call = NULL;
74 }
75
76 conn->limits.reason = talloc_strdup(conn, reason);
77 if (conn->limits.reason == NULL) {
78 TALLOC_FREE(conn->sockets.tls);
79 TALLOC_FREE(conn->sockets.sasl);
80 TALLOC_FREE(conn->sockets.raw);
81 stream_terminate_connection(conn->connection, reason);
82 return;
83 }
84
85 subreq = tstream_disconnect_send(conn,
86 conn->connection->event.ctx,
87 conn->sockets.active);
88 if (subreq == NULL) {
89 TALLOC_FREE(conn->sockets.tls);
90 TALLOC_FREE(conn->sockets.sasl);
91 TALLOC_FREE(conn->sockets.raw);
92 stream_terminate_connection(conn->connection, reason);
93 return;
94 }
95 tevent_req_set_endtime(subreq,
96 conn->connection->event.ctx,
97 conn->limits.endtime);
98 tevent_req_set_callback(subreq, ldapsrv_terminate_connection_done, conn);
99}
100
101static void ldapsrv_terminate_connection_done(struct tevent_req *subreq)
102{
103 struct ldapsrv_connection *conn =
104 tevent_req_callback_data(subreq,
105 struct ldapsrv_connection);
106 int sys_errno;
107
108 tstream_disconnect_recv(subreq, &sys_errno);
109 TALLOC_FREE(subreq);
110
111 if (conn->sockets.active == conn->sockets.raw) {
112 TALLOC_FREE(conn->sockets.tls);
113 TALLOC_FREE(conn->sockets.sasl);
114 TALLOC_FREE(conn->sockets.raw);
115 stream_terminate_connection(conn->connection,
116 conn->limits.reason);
117 return;
118 }
119
120 TALLOC_FREE(conn->sockets.tls);
121 TALLOC_FREE(conn->sockets.sasl);
122 conn->sockets.active = conn->sockets.raw;
123
124 subreq = tstream_disconnect_send(conn,
125 conn->connection->event.ctx,
126 conn->sockets.active);
127 if (subreq == NULL) {
128 TALLOC_FREE(conn->sockets.raw);
129 stream_terminate_connection(conn->connection,
130 conn->limits.reason);
131 return;
132 }
133 tevent_req_set_endtime(subreq,
134 conn->connection->event.ctx,
135 conn->limits.endtime);
136 tevent_req_set_callback(subreq, ldapsrv_terminate_connection_done, conn);
137}
138
139/*
140 called when a LDAP socket becomes readable
141*/
142void ldapsrv_recv(struct stream_connection *c, uint16_t flags)
143{
144 smb_panic(__location__);
145}
146
147/*
148 called when a LDAP socket becomes writable
149*/
150static void ldapsrv_send(struct stream_connection *c, uint16_t flags)
151{
152 smb_panic(__location__);
153}
154
155static int ldapsrv_load_limits(struct ldapsrv_connection *conn)
156{
157 TALLOC_CTX *tmp_ctx;
158 const char *attrs[] = { "configurationNamingContext", NULL };
159 const char *attrs2[] = { "lDAPAdminLimits", NULL };
160 struct ldb_message_element *el;
161 struct ldb_result *res = NULL;
162 struct ldb_dn *basedn;
163 struct ldb_dn *conf_dn;
164 struct ldb_dn *policy_dn;
165 unsigned int i;
166 int ret;
167
168 /* set defaults limits in case of failure */
169 conn->limits.initial_timeout = 120;
170 conn->limits.conn_idle_time = 900;
171 conn->limits.max_page_size = 1000;
172 conn->limits.max_notifications = 5;
173 conn->limits.search_timeout = 120;
174
175
176 tmp_ctx = talloc_new(conn);
177 if (tmp_ctx == NULL) {
178 return -1;
179 }
180
181 basedn = ldb_dn_new(tmp_ctx, conn->ldb, NULL);
182 if (basedn == NULL) {
183 goto failed;
184 }
185
186 ret = ldb_search(conn->ldb, tmp_ctx, &res, basedn, LDB_SCOPE_BASE, attrs, NULL);
187 if (ret != LDB_SUCCESS) {
188 goto failed;
189 }
190
191 if (res->count != 1) {
192 goto failed;
193 }
194
195 conf_dn = ldb_msg_find_attr_as_dn(conn->ldb, tmp_ctx, res->msgs[0], "configurationNamingContext");
196 if (conf_dn == NULL) {
197 goto failed;
198 }
199
200 policy_dn = ldb_dn_copy(tmp_ctx, conf_dn);
201 ldb_dn_add_child_fmt(policy_dn, "CN=Default Query Policy,CN=Query-Policies,CN=Directory Service,CN=Windows NT,CN=Services");
202 if (policy_dn == NULL) {
203 goto failed;
204 }
205
206 ret = ldb_search(conn->ldb, tmp_ctx, &res, policy_dn, LDB_SCOPE_BASE, attrs2, NULL);
207 if (ret != LDB_SUCCESS) {
208 goto failed;
209 }
210
211 if (res->count != 1) {
212 goto failed;
213 }
214
215 el = ldb_msg_find_element(res->msgs[0], "lDAPAdminLimits");
216 if (el == NULL) {
217 goto failed;
218 }
219
220 for (i = 0; i < el->num_values; i++) {
221 char policy_name[256];
222 int policy_value, s;
223
224 s = sscanf((const char *)el->values[i].data, "%255[^=]=%d", policy_name, &policy_value);
225 if (s != 2 || policy_value == 0)
226 continue;
227 if (strcasecmp("InitRecvTimeout", policy_name) == 0) {
228 conn->limits.initial_timeout = policy_value;
229 continue;
230 }
231 if (strcasecmp("MaxConnIdleTime", policy_name) == 0) {
232 conn->limits.conn_idle_time = policy_value;
233 continue;
234 }
235 if (strcasecmp("MaxPageSize", policy_name) == 0) {
236 conn->limits.max_page_size = policy_value;
237 continue;
238 }
239 if (strcasecmp("MaxNotificationPerConn", policy_name) == 0) {
240 conn->limits.max_notifications = policy_value;
241 continue;
242 }
243 if (strcasecmp("MaxQueryDuration", policy_name) == 0) {
244 conn->limits.search_timeout = policy_value;
245 continue;
246 }
247 }
248
249 return 0;
250
251failed:
252 DEBUG(0, ("Failed to load ldap server query policies\n"));
253 talloc_free(tmp_ctx);
254 return -1;
255}
256
257static int ldapsrv_call_destructor(struct ldapsrv_call *call)
258{
259 if (call->conn == NULL) {
260 return 0;
261 }
262
263 DLIST_REMOVE(call->conn->pending_calls, call);
264
265 call->conn = NULL;
266 return 0;
267}
268
269static struct tevent_req *ldapsrv_process_call_send(TALLOC_CTX *mem_ctx,
270 struct tevent_context *ev,
271 struct tevent_queue *call_queue,
272 struct ldapsrv_call *call);
273static NTSTATUS ldapsrv_process_call_recv(struct tevent_req *req);
274
275static bool ldapsrv_call_read_next(struct ldapsrv_connection *conn);
276static void ldapsrv_accept_tls_done(struct tevent_req *subreq);
277
278/*
279 initialise a server_context from a open socket and register a event handler
280 for reading from that socket
281*/
282static void ldapsrv_accept(struct stream_connection *c,
283 struct auth_session_info *session_info,
284 bool is_privileged)
285{
286 struct ldapsrv_service *ldapsrv_service =
287 talloc_get_type(c->private_data, struct ldapsrv_service);
288 struct ldapsrv_connection *conn;
289 struct cli_credentials *server_credentials;
290 struct socket_address *socket_address;
291 NTSTATUS status;
292 int port;
293 int ret;
294 struct tevent_req *subreq;
295 struct timeval endtime;
296
297 conn = talloc_zero(c, struct ldapsrv_connection);
298 if (!conn) {
299 stream_terminate_connection(c, "ldapsrv_accept: out of memory");
300 return;
301 }
302 conn->is_privileged = is_privileged;
303
304 conn->sockets.send_queue = tevent_queue_create(conn, "ldapsev send queue");
305 if (conn->sockets.send_queue == NULL) {
306 stream_terminate_connection(c,
307 "ldapsrv_accept: tevent_queue_create failed");
308 return;
309 }
310
311 TALLOC_FREE(c->event.fde);
312
313 ret = tstream_bsd_existing_socket(conn,
314 socket_get_fd(c->socket),
315 &conn->sockets.raw);
316 if (ret == -1) {
317 stream_terminate_connection(c,
318 "ldapsrv_accept: out of memory");
319 return;
320 }
321 socket_set_flags(c->socket, SOCKET_FLAG_NOCLOSE);
322
323 conn->connection = c;
324 conn->service = ldapsrv_service;
325 conn->lp_ctx = ldapsrv_service->task->lp_ctx;
326
327 c->private_data = conn;
328
329 socket_address = socket_get_my_addr(c->socket, conn);
330 if (!socket_address) {
331 ldapsrv_terminate_connection(conn, "ldapsrv_accept: failed to obtain local socket address!");
332 return;
333 }
334 port = socket_address->port;
335 talloc_free(socket_address);
336 if (port == 3268 || port == 3269) /* Global catalog */ {
337 conn->global_catalog = true;
338 }
339
340 server_credentials = cli_credentials_init(conn);
341 if (!server_credentials) {
342 stream_terminate_connection(c, "Failed to init server credentials\n");
343 return;
344 }
345
346 cli_credentials_set_conf(server_credentials, conn->lp_ctx);
347 status = cli_credentials_set_machine_account(server_credentials, conn->lp_ctx);
348 if (!NT_STATUS_IS_OK(status)) {
349 stream_terminate_connection(c, talloc_asprintf(conn, "Failed to obtain server credentials, perhaps a standalone server?: %s\n", nt_errstr(status)));
350 return;
351 }
352 conn->server_credentials = server_credentials;
353
354 conn->session_info = session_info;
355
356 conn->sockets.active = conn->sockets.raw;
357
358 if (conn->is_privileged) {
359 conn->require_strong_auth = LDAP_SERVER_REQUIRE_STRONG_AUTH_NO;
360 } else {
361 conn->require_strong_auth = lpcfg_ldap_server_require_strong_auth(conn->lp_ctx);
362 }
363
364 if (!NT_STATUS_IS_OK(ldapsrv_backend_Init(conn))) {
365 ldapsrv_terminate_connection(conn, "backend Init failed");
366 return;
367 }
368
369 /* load limits from the conf partition */
370 ldapsrv_load_limits(conn); /* should we fail on error ? */
371
372 /* register the server */
373 irpc_add_name(c->msg_ctx, "ldap_server");
374
375 DLIST_ADD_END(ldapsrv_service->connections, conn);
376
377 if (port != 636 && port != 3269) {
378 ldapsrv_call_read_next(conn);
379 return;
380 }
381
382 endtime = timeval_current_ofs(conn->limits.conn_idle_time, 0);
383
384 subreq = tstream_tls_accept_send(conn,
385 conn->connection->event.ctx,
386 conn->sockets.raw,
387 conn->service->tls_params);
388 if (subreq == NULL) {
389 ldapsrv_terminate_connection(conn, "ldapsrv_accept: "
390 "no memory for tstream_tls_accept_send");
391 return;
392 }
393 tevent_req_set_endtime(subreq,
394 conn->connection->event.ctx,
395 endtime);
396 tevent_req_set_callback(subreq, ldapsrv_accept_tls_done, conn);
397}
398
399static void ldapsrv_accept_tls_done(struct tevent_req *subreq)
400{
401 struct ldapsrv_connection *conn =
402 tevent_req_callback_data(subreq,
403 struct ldapsrv_connection);
404 int ret;
405 int sys_errno;
406
407 ret = tstream_tls_accept_recv(subreq, &sys_errno,
408 conn, &conn->sockets.tls);
409 TALLOC_FREE(subreq);
410 if (ret == -1) {
411 const char *reason;
412
413 reason = talloc_asprintf(conn, "ldapsrv_accept_tls_loop: "
414 "tstream_tls_accept_recv() - %d:%s",
415 sys_errno, strerror(sys_errno));
416 if (!reason) {
417 reason = "ldapsrv_accept_tls_loop: "
418 "tstream_tls_accept_recv() - failed";
419 }
420
421 ldapsrv_terminate_connection(conn, reason);
422 return;
423 }
424
425 conn->sockets.active = conn->sockets.tls;
426 ldapsrv_call_read_next(conn);
427}
428
429static void ldapsrv_call_read_done(struct tevent_req *subreq);
430
431static bool ldapsrv_call_read_next(struct ldapsrv_connection *conn)
432{
433 struct tevent_req *subreq;
434
435 if (conn->pending_calls != NULL) {
436 conn->limits.endtime = timeval_zero();
437
438 ldapsrv_notification_retry_setup(conn->service, false);
439 } else if (timeval_is_zero(&conn->limits.endtime)) {
440 conn->limits.endtime =
441 timeval_current_ofs(conn->limits.initial_timeout, 0);
442 } else {
443 conn->limits.endtime =
444 timeval_current_ofs(conn->limits.conn_idle_time, 0);
445 }
446
447 if (conn->sockets.read_req != NULL) {
448 return true;
449 }
450
451 /*
452 * The minimum size of a LDAP pdu is 7 bytes
453 *
454 * dumpasn1 -hh ldap-unbind-min.dat
455 *
456 * <30 05 02 01 09 42 00>
457 * 0 5: SEQUENCE {
458 * <02 01 09>
459 * 2 1: INTEGER 9
460 * <42 00>
461 * 5 0: [APPLICATION 2]
462 * : Error: Object has zero length.
463 * : }
464 *
465 * dumpasn1 -hh ldap-unbind-windows.dat
466 *
467 * <30 84 00 00 00 05 02 01 09 42 00>
468 * 0 5: SEQUENCE {
469 * <02 01 09>
470 * 6 1: INTEGER 9
471 * <42 00>
472 * 9 0: [APPLICATION 2]
473 * : Error: Object has zero length.
474 * : }
475 *
476 * This means using an initial read size
477 * of 7 is ok.
478 */
479 subreq = tstream_read_pdu_blob_send(conn,
480 conn->connection->event.ctx,
481 conn->sockets.active,
482 7, /* initial_read_size */
483 ldap_full_packet,
484 conn);
485 if (subreq == NULL) {
486 ldapsrv_terminate_connection(conn, "ldapsrv_call_read_next: "
487 "no memory for tstream_read_pdu_blob_send");
488 return false;
489 }
490 if (!timeval_is_zero(&conn->limits.endtime)) {
491 tevent_req_set_endtime(subreq,
492 conn->connection->event.ctx,
493 conn->limits.endtime);
494 }
495 tevent_req_set_callback(subreq, ldapsrv_call_read_done, conn);
496 conn->sockets.read_req = subreq;
497 return true;
498}
499
500static void ldapsrv_call_process_done(struct tevent_req *subreq);
501
502static void ldapsrv_call_read_done(struct tevent_req *subreq)
503{
504 struct ldapsrv_connection *conn =
505 tevent_req_callback_data(subreq,
506 struct ldapsrv_connection);
507 NTSTATUS status;
508 struct ldapsrv_call *call;
509 struct asn1_data *asn1;
510 DATA_BLOB blob;
511
512 conn->sockets.read_req = NULL;
513
514 call = talloc_zero(conn, struct ldapsrv_call);
515 if (!call) {
516 ldapsrv_terminate_connection(conn, "no memory");
517 return;
518 }
519 talloc_set_destructor(call, ldapsrv_call_destructor);
520
521 call->conn = conn;
522
523 status = tstream_read_pdu_blob_recv(subreq,
524 call,
525 &blob);
526 TALLOC_FREE(subreq);
527 if (!NT_STATUS_IS_OK(status)) {
528 const char *reason;
529
530 reason = talloc_asprintf(call, "ldapsrv_call_loop: "
531 "tstream_read_pdu_blob_recv() - %s",
532 nt_errstr(status));
533 if (!reason) {
534 reason = nt_errstr(status);
535 }
536
537 ldapsrv_terminate_connection(conn, reason);
538 return;
539 }
540
541 asn1 = asn1_init(call);
542 if (asn1 == NULL) {
543 ldapsrv_terminate_connection(conn, "no memory");
544 return;
545 }
546
547 call->request = talloc(call, struct ldap_message);
548 if (call->request == NULL) {
549 ldapsrv_terminate_connection(conn, "no memory");
550 return;
551 }
552
553 if (!asn1_load(asn1, blob)) {
554 ldapsrv_terminate_connection(conn, "asn1_load failed");
555 return;
556 }
557
558 status = ldap_decode(asn1, samba_ldap_control_handlers(),
559 call->request);
560 if (!NT_STATUS_IS_OK(status)) {
561 ldapsrv_terminate_connection(conn, nt_errstr(status));
562 return;
563 }
564
565 data_blob_free(&blob);
566
567
568 /* queue the call in the global queue */
569 subreq = ldapsrv_process_call_send(call,
570 conn->connection->event.ctx,
571 conn->service->call_queue,
572 call);
573 if (subreq == NULL) {
574 ldapsrv_terminate_connection(conn, "ldapsrv_process_call_send failed");
575 return;
576 }
577 tevent_req_set_callback(subreq, ldapsrv_call_process_done, call);
578 conn->active_call = subreq;
579}
580
581static void ldapsrv_call_wait_done(struct tevent_req *subreq);
582static void ldapsrv_call_writev_start(struct ldapsrv_call *call);
583static void ldapsrv_call_writev_done(struct tevent_req *subreq);
584
585static void ldapsrv_call_process_done(struct tevent_req *subreq)
586{
587 struct ldapsrv_call *call =
588 tevent_req_callback_data(subreq,
589 struct ldapsrv_call);
590 struct ldapsrv_connection *conn = call->conn;
591 NTSTATUS status;
592
593 conn->active_call = NULL;
594
595 status = ldapsrv_process_call_recv(subreq);
596 TALLOC_FREE(subreq);
597 if (!NT_STATUS_IS_OK(status)) {
598 ldapsrv_terminate_connection(conn, nt_errstr(status));
599 return;
600 }
601
602 if (call->wait_send != NULL) {
603 subreq = call->wait_send(call,
604 conn->connection->event.ctx,
605 call->wait_private);
606 if (subreq == NULL) {
607 ldapsrv_terminate_connection(conn,
608 "ldapsrv_call_process_done: "
609 "call->wait_send - no memory");
610 return;
611 }
612 tevent_req_set_callback(subreq,
613 ldapsrv_call_wait_done,
614 call);
615 conn->active_call = subreq;
616 return;
617 }
618
619 ldapsrv_call_writev_start(call);
620}
621
622static void ldapsrv_call_wait_done(struct tevent_req *subreq)
623{
624 struct ldapsrv_call *call =
625 tevent_req_callback_data(subreq,
626 struct ldapsrv_call);
627 struct ldapsrv_connection *conn = call->conn;
628 NTSTATUS status;
629
630 conn->active_call = NULL;
631
632 status = call->wait_recv(subreq);
633 TALLOC_FREE(subreq);
634 if (!NT_STATUS_IS_OK(status)) {
635 const char *reason;
636
637 reason = talloc_asprintf(call, "ldapsrv_call_wait_done: "
638 "call->wait_recv() - %s",
639 nt_errstr(status));
640 if (reason == NULL) {
641 reason = nt_errstr(status);
642 }
643
644 ldapsrv_terminate_connection(conn, reason);
645 return;
646 }
647
648 ldapsrv_call_writev_start(call);
649}
650
651static void ldapsrv_call_writev_start(struct ldapsrv_call *call)
652{
653 struct ldapsrv_connection *conn = call->conn;
654 DATA_BLOB blob = data_blob_null;
655 struct tevent_req *subreq = NULL;
656
657 /* build all the replies into a single blob */
658 while (call->replies) {
659 DATA_BLOB b;
660 bool ret;
661
662 if (!ldap_encode(call->replies->msg, samba_ldap_control_handlers(), &b, call)) {
663 DEBUG(0,("Failed to encode ldap reply of type %d\n",
664 call->replies->msg->type));
665 ldapsrv_terminate_connection(conn, "ldap_encode failed");
666 return;
667 }
668
669 ret = data_blob_append(call, &blob, b.data, b.length);
670 data_blob_free(&b);
671
672 talloc_set_name_const(blob.data, "Outgoing, encoded LDAP packet");
673
674 if (!ret) {
675 ldapsrv_terminate_connection(conn, "data_blob_append failed");
676 return;
677 }
678
679 DLIST_REMOVE(call->replies, call->replies);
680 }
681
682 if (blob.length == 0) {
683 if (!call->notification.busy) {
684 TALLOC_FREE(call);
685 }
686
687 ldapsrv_call_read_next(conn);
688 return;
689 }
690
691 call->out_iov.iov_base = blob.data;
692 call->out_iov.iov_len = blob.length;
693
694 subreq = tstream_writev_queue_send(call,
695 conn->connection->event.ctx,
696 conn->sockets.active,
697 conn->sockets.send_queue,
698 &call->out_iov, 1);
699 if (subreq == NULL) {
700 ldapsrv_terminate_connection(conn, "stream_writev_queue_send failed");
701 return;
702 }
703 tevent_req_set_callback(subreq, ldapsrv_call_writev_done, call);
704}
705
706static void ldapsrv_call_postprocess_done(struct tevent_req *subreq);
707
708static void ldapsrv_call_writev_done(struct tevent_req *subreq)
709{
710 struct ldapsrv_call *call =
711 tevent_req_callback_data(subreq,
712 struct ldapsrv_call);
713 struct ldapsrv_connection *conn = call->conn;
714 int sys_errno;
715 int rc;
716
717 rc = tstream_writev_queue_recv(subreq, &sys_errno);
718 TALLOC_FREE(subreq);
719 if (rc == -1) {
720 const char *reason;
721
722 reason = talloc_asprintf(call, "ldapsrv_call_writev_done: "
723 "tstream_writev_queue_recv() - %d:%s",
724 sys_errno, strerror(sys_errno));
725 if (reason == NULL) {
726 reason = "ldapsrv_call_writev_done: "
727 "tstream_writev_queue_recv() failed";
728 }
729
730 ldapsrv_terminate_connection(conn, reason);
731 return;
732 }
733
734 if (call->postprocess_send) {
735 subreq = call->postprocess_send(call,
736 conn->connection->event.ctx,
737 call->postprocess_private);
738 if (subreq == NULL) {
739 ldapsrv_terminate_connection(conn, "ldapsrv_call_writev_done: "
740 "call->postprocess_send - no memory");
741 return;
742 }
743 tevent_req_set_callback(subreq,
744 ldapsrv_call_postprocess_done,
745 call);
746 return;
747 }
748
749 if (!call->notification.busy) {
750 TALLOC_FREE(call);
751 }
752
753 ldapsrv_call_read_next(conn);
754}
755
756static void ldapsrv_call_postprocess_done(struct tevent_req *subreq)
757{
758 struct ldapsrv_call *call =
759 tevent_req_callback_data(subreq,
760 struct ldapsrv_call);
761 struct ldapsrv_connection *conn = call->conn;
762 NTSTATUS status;
763
764 status = call->postprocess_recv(subreq);
765 TALLOC_FREE(subreq);
766 if (!NT_STATUS_IS_OK(status)) {
767 const char *reason;
768
769 reason = talloc_asprintf(call, "ldapsrv_call_postprocess_done: "
770 "call->postprocess_recv() - %s",
771 nt_errstr(status));
772 if (reason == NULL) {
773 reason = nt_errstr(status);
774 }
775
776 ldapsrv_terminate_connection(conn, reason);
777 return;
778 }
779
780 TALLOC_FREE(call);
781
782 ldapsrv_call_read_next(conn);
783}
784
785static void ldapsrv_notification_retry_done(struct tevent_req *subreq);
786
787void ldapsrv_notification_retry_setup(struct ldapsrv_service *service, bool force)
788{
789 struct ldapsrv_connection *conn = NULL;
790 struct timeval retry;
791 size_t num_pending = 0;
792 size_t num_active = 0;
793
794 if (force) {
795 TALLOC_FREE(service->notification.retry);
796 service->notification.generation += 1;
797 }
798
799 if (service->notification.retry != NULL) {
800 return;
801 }
802
803 for (conn = service->connections; conn != NULL; conn = conn->next) {
804 if (conn->pending_calls == NULL) {
805 continue;
806 }
807
808 num_pending += 1;
809
810 if (conn->pending_calls->notification.generation !=
811 service->notification.generation)
812 {
813 num_active += 1;
814 }
815 }
816
817 if (num_pending == 0) {
818 return;
819 }
820
821 if (num_active != 0) {
822 retry = timeval_current_ofs(0, 100);
823 } else {
824 retry = timeval_current_ofs(5, 0);
825 }
826
827 service->notification.retry = tevent_wakeup_send(service,
828 service->task->event_ctx,
829 retry);
830 if (service->notification.retry == NULL) {
831 /* retry later */
832 return;
833 }
834
835 tevent_req_set_callback(service->notification.retry,
836 ldapsrv_notification_retry_done,
837 service);
838}
839
840static void ldapsrv_notification_retry_done(struct tevent_req *subreq)
841{
842 struct ldapsrv_service *service =
843 tevent_req_callback_data(subreq,
844 struct ldapsrv_service);
845 struct ldapsrv_connection *conn = NULL;
846 struct ldapsrv_connection *conn_next = NULL;
847 bool ok;
848
849 service->notification.retry = NULL;
850
851 ok = tevent_wakeup_recv(subreq);
852 TALLOC_FREE(subreq);
853 if (!ok) {
854 /* ignore */
855 }
856
857 for (conn = service->connections; conn != NULL; conn = conn_next) {
858 struct ldapsrv_call *call = conn->pending_calls;
859
860 conn_next = conn->next;
861
862 if (conn->pending_calls == NULL) {
863 continue;
864 }
865
866 if (conn->active_call != NULL) {
867 continue;
868 }
869
870 DLIST_DEMOTE(conn->pending_calls, call);
871 call->notification.generation =
872 service->notification.generation;
873
874 /* queue the call in the global queue */
875 subreq = ldapsrv_process_call_send(call,
876 conn->connection->event.ctx,
877 conn->service->call_queue,
878 call);
879 if (subreq == NULL) {
880 ldapsrv_terminate_connection(conn,
881 "ldapsrv_process_call_send failed");
882 continue;
883 }
884 tevent_req_set_callback(subreq, ldapsrv_call_process_done, call);
885 conn->active_call = subreq;
886 }
887
888 ldapsrv_notification_retry_setup(service, false);
889}
890
891struct ldapsrv_process_call_state {
892 struct ldapsrv_call *call;
893};
894
895static void ldapsrv_process_call_trigger(struct tevent_req *req,
896 void *private_data);
897
898static struct tevent_req *ldapsrv_process_call_send(TALLOC_CTX *mem_ctx,
899 struct tevent_context *ev,
900 struct tevent_queue *call_queue,
901 struct ldapsrv_call *call)
902{
903 struct tevent_req *req;
904 struct ldapsrv_process_call_state *state;
905 bool ok;
906
907 req = tevent_req_create(mem_ctx, &state,
908 struct ldapsrv_process_call_state);
909 if (req == NULL) {
910 return req;
911 }
912
913 state->call = call;
914
915 ok = tevent_queue_add(call_queue, ev, req,
916 ldapsrv_process_call_trigger, NULL);
917 if (!ok) {
918 tevent_req_oom(req);
919 return tevent_req_post(req, ev);
920 }
921
922 return req;
923}
924
925static void ldapsrv_process_call_trigger(struct tevent_req *req,
926 void *private_data)
927{
928 struct ldapsrv_process_call_state *state =
929 tevent_req_data(req,
930 struct ldapsrv_process_call_state);
931 NTSTATUS status;
932
933 /* make the call */
934 status = ldapsrv_do_call(state->call);
935 if (!NT_STATUS_IS_OK(status)) {
936 tevent_req_nterror(req, status);
937 return;
938 }
939
940 tevent_req_done(req);
941}
942
943static NTSTATUS ldapsrv_process_call_recv(struct tevent_req *req)
944{
945 NTSTATUS status;
946
947 if (tevent_req_is_nterror(req, &status)) {
948 tevent_req_received(req);
949 return status;
950 }
951
952 tevent_req_received(req);
953 return NT_STATUS_OK;
954}
955
956static void ldapsrv_accept_nonpriv(struct stream_connection *c)
957{
958 struct ldapsrv_service *ldapsrv_service = talloc_get_type_abort(
959 c->private_data, struct ldapsrv_service);
960 struct auth_session_info *session_info;
961 NTSTATUS status;
962
963 status = auth_anonymous_session_info(
964 c, ldapsrv_service->task->lp_ctx, &session_info);
965 if (!NT_STATUS_IS_OK(status)) {
966 stream_terminate_connection(c, "failed to setup anonymous "
967 "session info");
968 return;
969 }
970 ldapsrv_accept(c, session_info, false);
971}
972
973static const struct stream_server_ops ldap_stream_nonpriv_ops = {
974 .name = "ldap",
975 .accept_connection = ldapsrv_accept_nonpriv,
976 .recv_handler = ldapsrv_recv,
977 .send_handler = ldapsrv_send,
978};
979
980/* The feature removed behind an #ifdef until we can do it properly
981 * with an EXTERNAL bind. */
982
983#define WITH_LDAPI_PRIV_SOCKET
984
985#ifdef WITH_LDAPI_PRIV_SOCKET
986static void ldapsrv_accept_priv(struct stream_connection *c)
987{
988 struct ldapsrv_service *ldapsrv_service = talloc_get_type_abort(
989 c->private_data, struct ldapsrv_service);
990 struct auth_session_info *session_info;
991
992 session_info = system_session(ldapsrv_service->task->lp_ctx);
993 if (!session_info) {
994 stream_terminate_connection(c, "failed to setup system "
995 "session info");
996 return;
997 }
998 ldapsrv_accept(c, session_info, true);
999}
1000
1001static const struct stream_server_ops ldap_stream_priv_ops = {
1002 .name = "ldap",
1003 .accept_connection = ldapsrv_accept_priv,
1004 .recv_handler = ldapsrv_recv,
1005 .send_handler = ldapsrv_send,
1006};
1007
1008#endif
1009
1010
1011/*
1012 add a socket address to the list of events, one event per port
1013*/
1014static NTSTATUS add_socket(struct task_server *task,
1015 struct loadparm_context *lp_ctx,
1016 const struct model_ops *model_ops,
1017 const char *address, struct ldapsrv_service *ldap_service)
1018{
1019 uint16_t port = 389;
1020 NTSTATUS status;
1021 struct ldb_context *ldb;
1022
1023 status = stream_setup_socket(task, task->event_ctx, lp_ctx,
1024 model_ops, &ldap_stream_nonpriv_ops,
1025 "ip", address, &port,
1026 lpcfg_socket_options(lp_ctx),
1027 ldap_service);
1028 if (!NT_STATUS_IS_OK(status)) {
1029 DEBUG(0,("ldapsrv failed to bind to %s:%u - %s\n",
1030 address, port, nt_errstr(status)));
1031 return status;
1032 }
1033
1034 if (tstream_tls_params_enabled(ldap_service->tls_params)) {
1035 /* add ldaps server */
1036 port = 636;
1037 status = stream_setup_socket(task, task->event_ctx, lp_ctx,
1038 model_ops,
1039 &ldap_stream_nonpriv_ops,
1040 "ip", address, &port,
1041 lpcfg_socket_options(lp_ctx),
1042 ldap_service);
1043 if (!NT_STATUS_IS_OK(status)) {
1044 DEBUG(0,("ldapsrv failed to bind to %s:%u - %s\n",
1045 address, port, nt_errstr(status)));
1046 return status;
1047 }
1048 }
1049
1050 /* Load LDAP database, but only to read our settings */
1051 ldb = samdb_connect(ldap_service, ldap_service->task->event_ctx,
1052 lp_ctx, system_session(lp_ctx), 0);
1053 if (!ldb) {
1054 return NT_STATUS_INTERNAL_DB_CORRUPTION;
1055 }
1056
1057 if (samdb_is_gc(ldb)) {
1058 port = 3268;
1059 status = stream_setup_socket(task, task->event_ctx, lp_ctx,
1060 model_ops,
1061 &ldap_stream_nonpriv_ops,
1062 "ip", address, &port,
1063 lpcfg_socket_options(lp_ctx),
1064 ldap_service);
1065 if (!NT_STATUS_IS_OK(status)) {
1066 DEBUG(0,("ldapsrv failed to bind to %s:%u - %s\n",
1067 address, port, nt_errstr(status)));
1068 return status;
1069 }
1070 if (tstream_tls_params_enabled(ldap_service->tls_params)) {
1071 /* add ldaps server for the global catalog */
1072 port = 3269;
1073 status = stream_setup_socket(task, task->event_ctx, lp_ctx,
1074 model_ops,
1075 &ldap_stream_nonpriv_ops,
1076 "ip", address, &port,
1077 lpcfg_socket_options(lp_ctx),
1078 ldap_service);
1079 if (!NT_STATUS_IS_OK(status)) {
1080 DEBUG(0,("ldapsrv failed to bind to %s:%u - %s\n",
1081 address, port, nt_errstr(status)));
1082 return status;
1083 }
1084 }
1085 }
1086
1087 /* And once we are bound, free the temporary ldb, it will
1088 * connect again on each incoming LDAP connection */
1089 talloc_unlink(ldap_service, ldb);
1090
1091 return NT_STATUS_OK;
1092}
1093
1094/*
1095 open the ldap server sockets
1096*/
1097static void ldapsrv_task_init(struct task_server *task)
1098{
1099 char *ldapi_path;
1100#ifdef WITH_LDAPI_PRIV_SOCKET
1101 char *priv_dir;
1102#endif
1103 const char *dns_host_name;
1104 struct ldapsrv_service *ldap_service;
1105 NTSTATUS status;
1106 const struct model_ops *model_ops;
1107
1108 switch (lpcfg_server_role(task->lp_ctx)) {
1109 case ROLE_STANDALONE:
1110 task_server_terminate(task, "ldap_server: no LDAP server required in standalone configuration",
1111 false);
1112 return;
1113 case ROLE_DOMAIN_MEMBER:
1114 task_server_terminate(task, "ldap_server: no LDAP server required in member server configuration",
1115 false);
1116 return;
1117 case ROLE_ACTIVE_DIRECTORY_DC:
1118 /* Yes, we want an LDAP server */
1119 break;
1120 }
1121
1122 task_server_set_title(task, "task[ldapsrv]");
1123
1124 /*
1125 * Here we used to run the ldap server as a single process,
1126 * but we don't want transaction locks for one task in a write
1127 * blocking all other reads, so we go multi-process.
1128 */
1129 model_ops = task->model_ops;
1130
1131 ldap_service = talloc_zero(task, struct ldapsrv_service);
1132 if (ldap_service == NULL) goto failed;
1133
1134 ldap_service->task = task;
1135
1136 dns_host_name = talloc_asprintf(ldap_service, "%s.%s",
1137 lpcfg_netbios_name(task->lp_ctx),
1138 lpcfg_dnsdomain(task->lp_ctx));
1139 if (dns_host_name == NULL) goto failed;
1140
1141 status = tstream_tls_params_server(ldap_service,
1142 dns_host_name,
1143 lpcfg_tls_enabled(task->lp_ctx),
1144 lpcfg_tls_keyfile(ldap_service, task->lp_ctx),
1145 lpcfg_tls_certfile(ldap_service, task->lp_ctx),
1146 lpcfg_tls_cafile(ldap_service, task->lp_ctx),
1147 lpcfg_tls_crlfile(ldap_service, task->lp_ctx),
1148 lpcfg_tls_dhpfile(ldap_service, task->lp_ctx),
1149 lpcfg_tls_priority(task->lp_ctx),
1150 &ldap_service->tls_params);
1151 if (!NT_STATUS_IS_OK(status)) {
1152 DEBUG(0,("ldapsrv failed tstream_tls_params_server - %s\n",
1153 nt_errstr(status)));
1154 goto failed;
1155 }
1156
1157 ldap_service->call_queue = tevent_queue_create(ldap_service, "ldapsrv_call_queue");
1158 if (ldap_service->call_queue == NULL) goto failed;
1159
1160 if (lpcfg_interfaces(task->lp_ctx) && lpcfg_bind_interfaces_only(task->lp_ctx)) {
1161 struct interface *ifaces;
1162 int num_interfaces;
1163 int i;
1164
1165 load_interface_list(task, task->lp_ctx, &ifaces);
1166 num_interfaces = iface_list_count(ifaces);
1167
1168 /* We have been given an interfaces line, and been
1169 told to only bind to those interfaces. Create a
1170 socket per interface and bind to only these.
1171 */
1172 for(i = 0; i < num_interfaces; i++) {
1173 const char *address = iface_list_n_ip(ifaces, i);
1174 status = add_socket(task, task->lp_ctx, model_ops, address, ldap_service);
1175 if (!NT_STATUS_IS_OK(status)) goto failed;
1176 }
1177 } else {
1178 char **wcard;
1179 int i;
1180 int num_binds = 0;
1181 wcard = iface_list_wildcard(task);
1182 if (wcard == NULL) {
1183 DEBUG(0,("No wildcard addresses available\n"));
1184 goto failed;
1185 }
1186 for (i=0; wcard[i]; i++) {
1187 status = add_socket(task, task->lp_ctx, model_ops, wcard[i], ldap_service);
1188 if (NT_STATUS_IS_OK(status)) {
1189 num_binds++;
1190 }
1191 }
1192 talloc_free(wcard);
1193 if (num_binds == 0) {
1194 goto failed;
1195 }
1196 }
1197
1198 ldapi_path = lpcfg_private_path(ldap_service, task->lp_ctx, "ldapi");
1199 if (!ldapi_path) {
1200 goto failed;
1201 }
1202
1203 status = stream_setup_socket(task, task->event_ctx, task->lp_ctx,
1204 model_ops, &ldap_stream_nonpriv_ops,
1205 "unix", ldapi_path, NULL,
1206 lpcfg_socket_options(task->lp_ctx),
1207 ldap_service);
1208 talloc_free(ldapi_path);
1209 if (!NT_STATUS_IS_OK(status)) {
1210 DEBUG(0,("ldapsrv failed to bind to %s - %s\n",
1211 ldapi_path, nt_errstr(status)));
1212 }
1213
1214#ifdef WITH_LDAPI_PRIV_SOCKET
1215 priv_dir = lpcfg_private_path(ldap_service, task->lp_ctx, "ldap_priv");
1216 if (priv_dir == NULL) {
1217 goto failed;
1218 }
1219 /*
1220 * Make sure the directory for the privileged ldapi socket exists, and
1221 * is of the correct permissions
1222 */
1223 if (!directory_create_or_exist(priv_dir, 0750)) {
1224 task_server_terminate(task, "Cannot create ldap "
1225 "privileged ldapi directory", true);
1226 return;
1227 }
1228 ldapi_path = talloc_asprintf(ldap_service, "%s/ldapi", priv_dir);
1229 talloc_free(priv_dir);
1230 if (ldapi_path == NULL) {
1231 goto failed;
1232 }
1233
1234 status = stream_setup_socket(task, task->event_ctx, task->lp_ctx,
1235 model_ops, &ldap_stream_priv_ops,
1236 "unix", ldapi_path, NULL,
1237 lpcfg_socket_options(task->lp_ctx),
1238 ldap_service);
1239 talloc_free(ldapi_path);
1240 if (!NT_STATUS_IS_OK(status)) {
1241 DEBUG(0,("ldapsrv failed to bind to %s - %s\n",
1242 ldapi_path, nt_errstr(status)));
1243 }
1244
1245#endif
1246
1247 /* register the server */
1248 irpc_add_name(task->msg_ctx, "ldap_server");
1249 return;
1250
1251failed:
1252 task_server_terminate(task, "Failed to startup ldap server task", true);
1253}
1254
1255
1256NTSTATUS server_service_ldap_init(TALLOC_CTX *ctx)
1257{
1258 return register_server_service(ctx, "ldap", ldapsrv_task_init);
1259}
diff --git a/source4/ldap_server/ldap_server.h b/source4/ldap_server/ldap_server.h
0new file mode 1006441260new file mode 100644
index 0000000..d3e31fb
--- /dev/null
+++ b/source4/ldap_server/ldap_server.h
@@ -0,0 +1,105 @@
1/*
2 Unix SMB/CIFS implementation.
3 LDAP server
4 Copyright (C) Volker Lendecke 2004
5 Copyright (C) Stefan Metzmacher 2004
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#include "libcli/ldap/libcli_ldap.h"
22#include "lib/socket/socket.h"
23#include "lib/stream/packet.h"
24#include "system/network.h"
25#include "lib/param/loadparm.h"
26
27struct ldapsrv_connection {
28 struct ldapsrv_connection *next, *prev;
29 struct loadparm_context *lp_ctx;
30 struct stream_connection *connection;
31 struct gensec_security *gensec;
32 struct auth_session_info *session_info;
33 struct ldapsrv_service *service;
34 struct cli_credentials *server_credentials;
35 struct ldb_context *ldb;
36
37 struct {
38 struct tevent_queue *send_queue;
39 struct tevent_req *read_req;
40 struct tstream_context *raw;
41 struct tstream_context *tls;
42 struct tstream_context *sasl;
43 struct tstream_context *active;
44 } sockets;
45
46 bool global_catalog;
47 bool is_privileged;
48 enum ldap_server_require_strong_auth require_strong_auth;
49 bool authz_logged;
50
51 struct {
52 int initial_timeout;
53 int conn_idle_time;
54 int max_page_size;
55 int max_notifications;
56 int search_timeout;
57 struct timeval endtime;
58 const char *reason;
59 } limits;
60
61 struct tevent_req *active_call;
62
63 struct ldapsrv_call *pending_calls;
64};
65
66struct ldapsrv_call {
67 struct ldapsrv_call *prev, *next;
68 struct ldapsrv_connection *conn;
69 struct ldap_message *request;
70 struct ldapsrv_reply {
71 struct ldapsrv_reply *prev, *next;
72 struct ldap_message *msg;
73 } *replies;
74 struct iovec out_iov;
75
76 struct tevent_req *(*wait_send)(TALLOC_CTX *mem_ctx,
77 struct tevent_context *ev,
78 void *private_data);
79 NTSTATUS (*wait_recv)(struct tevent_req *req);
80 void *wait_private;
81
82 struct tevent_req *(*postprocess_send)(TALLOC_CTX *mem_ctx,
83 struct tevent_context *ev,
84 void *private_data);
85 NTSTATUS (*postprocess_recv)(struct tevent_req *req);
86 void *postprocess_private;
87
88 struct {
89 bool busy;
90 uint64_t generation;
91 } notification;
92};
93
94struct ldapsrv_service {
95 struct tstream_tls_params *tls_params;
96 struct task_server *task;
97 struct tevent_queue *call_queue;
98 struct ldapsrv_connection *connections;
99 struct {
100 uint64_t generation;
101 struct tevent_req *retry;
102 } notification;
103};
104
105#include "ldap_server/proto.h"
diff --git a/source4/ldap_server/wscript_build b/source4/ldap_server/wscript_build
0new file mode 100644106new file mode 100644
index 0000000..881cc89
--- /dev/null
+++ b/source4/ldap_server/wscript_build
@@ -0,0 +1,13 @@
1#!/usr/bin/env python
2
3
4bld.SAMBA_MODULE('service_ldap',
5 source='ldap_server.c ldap_backend.c ldap_bind.c ldap_extended.c',
6 autoproto='proto.h',
7 subsystem='service',
8 init_function='server_service_ldap_init',
9 deps='samba-credentials cli-ldap samdb process_model gensec samba-hostconfig samba_server_gensec common_auth',
10 internal_module=False,
11 enabled=bld.AD_DC_BUILD_IS_ENABLED()
12 )
13
diff --git a/source4/lib/cmdline/credentials.c b/source4/lib/cmdline/credentials.c
0new file mode 10064414new file mode 100644
index 0000000..fb517f3
--- /dev/null
+++ b/source4/lib/cmdline/credentials.c
@@ -0,0 +1,54 @@
1/*
2 Unix SMB/CIFS implementation.
3
4 Copyright (C) Jelmer Vernooij 2005
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#include "includes.h"
21#include "system/filesys.h"
22#include "auth/credentials/credentials.h"
23#include "lib/cmdline/credentials.h"
24
25static const char *cmdline_get_userpassword(struct cli_credentials *credentials)
26{
27 TALLOC_CTX *mem_ctx = talloc_new(NULL);
28 const char *prompt_name = cli_credentials_get_unparsed_name(credentials, mem_ctx);
29 const char *prompt;
30 static char pwd[256]; /* FIXME: Return a dup pwd and free it. */
31 int rc;
32
33 prompt = talloc_asprintf(mem_ctx, "Password for [%s]:",
34 prompt_name);
35
36 memset(pwd, '\0', sizeof(pwd));
37 rc = samba_getpass(prompt, pwd, sizeof(pwd), false, false);
38 talloc_free(mem_ctx);
39 if (rc < 0) {
40 return NULL;
41 }
42
43 return pwd;
44}
45
46bool cli_credentials_set_cmdline_callbacks(struct cli_credentials *cred)
47{
48 if (isatty(fileno(stdout))) {
49 cli_credentials_set_password_callback(cred, cmdline_get_userpassword);
50 return true;
51 }
52
53 return false;
54}
diff --git a/source4/lib/cmdline/popt_common.c b/source4/lib/cmdline/popt_common.c
0new file mode 10064455new file mode 100644
index 0000000..5fce312
--- /dev/null
+++ b/source4/lib/cmdline/popt_common.c
@@ -0,0 +1,235 @@
1/*
2 Unix SMB/CIFS implementation.
3 Common popt routines
4
5 Copyright (C) Tim Potter 2001,2002
6 Copyright (C) Jelmer Vernooij 2002,2003,2005
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22#include "includes.h"
23#include "version.h"
24#include "lib/cmdline/popt_common.h"
25#include "param/param.h"
26
27/* Handle command line options:
28 * -d,--debuglevel
29 * -s,--configfile
30 * -O,--socket-options
31 * -V,--version
32 * -l,--log-base
33 * -n,--netbios-name
34 * -W,--workgroup
35 * --realm
36 * -i,--scope
37 */
38
39enum {OPT_OPTION=1,OPT_LEAK_REPORT,OPT_LEAK_REPORT_FULL,OPT_DEBUG_STDERR};
40
41static struct cli_credentials *cmdline_credentials = NULL;
42
43void popt_set_cmdline_credentials(struct cli_credentials *creds)
44{
45 cmdline_credentials = creds;
46}
47
48struct cli_credentials *popt_get_cmdline_credentials(void)
49{
50 return cmdline_credentials;
51}
52
53void popt_free_cmdline_credentials(void)
54{
55 TALLOC_FREE(cmdline_credentials);
56}
57
58struct loadparm_context *cmdline_lp_ctx = NULL;
59
60static void popt_version_callback(poptContext con,
61 enum poptCallbackReason reason,
62 const struct poptOption *opt,
63 const char *arg, const void *data)
64{
65 switch(opt->val) {
66 case 'V':
67 printf("Version %s\n", SAMBA_VERSION_STRING );
68 exit(0);
69 }
70}
71
72static void popt_s4_talloc_log_fn(const char *message)
73{
74 DEBUG(0,("%s", message));
75}
76
77static void popt_samba_callback(poptContext con,
78 enum poptCallbackReason reason,
79 const struct poptOption *opt,
80 const char *arg, const void *data)
81{
82 const char *pname;
83
84 if (reason == POPT_CALLBACK_REASON_POST) {
85 if (lpcfg_configfile(cmdline_lp_ctx) == NULL) {
86 lpcfg_load_default(cmdline_lp_ctx);
87 }
88 /* Hook any 'every Samba program must do this, after
89 * the smb.conf is setup' functions here */
90 return;
91 }
92
93 /* Find out basename of current program */
94 pname = strrchr_m(poptGetInvocationName(con),'/');
95
96 if (!pname)
97 pname = poptGetInvocationName(con);
98 else
99 pname++;
100
101 if (reason == POPT_CALLBACK_REASON_PRE) {
102 /* Hook for 'almost the first thing to do in a samba program' here */
103 /* setup for panics */
104 fault_setup();
105
106 /* and logging */
107 setup_logging(pname, DEBUG_DEFAULT_STDOUT);
108 talloc_set_log_fn(popt_s4_talloc_log_fn);
109 talloc_set_abort_fn(smb_panic);
110
111 cmdline_lp_ctx = loadparm_init_global(false);
112 return;
113 }
114
115 switch(opt->val) {
116
117 case OPT_LEAK_REPORT:
118 talloc_enable_leak_report();
119 break;
120
121 case OPT_LEAK_REPORT_FULL:
122 talloc_enable_leak_report_full();
123 break;
124
125 case OPT_OPTION:
126 if (!lpcfg_set_option(cmdline_lp_ctx, arg)) {
127 fprintf(stderr, "Error setting option '%s'\n", arg);
128 exit(1);
129 }
130 break;
131
132 case 'd':
133 lpcfg_set_cmdline(cmdline_lp_ctx, "log level", arg);
134 break;
135
136 case OPT_DEBUG_STDERR:
137 setup_logging(pname, DEBUG_STDERR);
138 break;
139
140 case 's':
141 if (arg) {
142 lpcfg_load(cmdline_lp_ctx, arg);
143 }
144 break;
145
146 case 'l':
147 if (arg) {
148 char *new_logfile = talloc_asprintf(NULL, "%s/log.%s", arg, pname);
149 lpcfg_set_cmdline(cmdline_lp_ctx, "log file", new_logfile);
150 talloc_free(new_logfile);
151 }
152 break;
153
154
155 }
156
157}
158
159
160static void popt_common_callback(poptContext con,
161 enum poptCallbackReason reason,
162 const struct poptOption *opt,
163 const char *arg, const void *data)
164{
165 struct loadparm_context *lp_ctx = cmdline_lp_ctx;
166
167 switch(opt->val) {
168 case 'O':
169 if (arg) {
170 lpcfg_set_cmdline(lp_ctx, "socket options", arg);
171 }
172 break;
173
174 case 'W':
175 lpcfg_set_cmdline(lp_ctx, "workgroup", arg);
176 break;
177
178 case 'r':
179 lpcfg_set_cmdline(lp_ctx, "realm", arg);
180 break;
181
182 case 'n':
183 lpcfg_set_cmdline(lp_ctx, "netbios name", arg);
184 break;
185
186 case 'i':
187 lpcfg_set_cmdline(lp_ctx, "netbios scope", arg);
188 break;
189
190 case 'm':
191 lpcfg_set_cmdline(lp_ctx, "client max protocol", arg);
192 break;
193
194 case 'R':
195 lpcfg_set_cmdline(lp_ctx, "name resolve order", arg);
196 break;
197
198 case 'S':
199 lpcfg_set_cmdline(lp_ctx, "client signing", arg);
200 break;
201
202 }
203}
204
205struct poptOption popt_common_connection4[] = {
206 { NULL, 0, POPT_ARG_CALLBACK, (void *)popt_common_callback },
207 { "name-resolve", 'R', POPT_ARG_STRING, NULL, 'R', "Use these name resolution services only", "NAME-RESOLVE-ORDER" },
208 { "socket-options", 'O', POPT_ARG_STRING, NULL, 'O', "socket options to use", "SOCKETOPTIONS" },
209 { "netbiosname", 'n', POPT_ARG_STRING, NULL, 'n', "Primary netbios name", "NETBIOSNAME" },
210 { "signing", 'S', POPT_ARG_STRING, NULL, 'S', "Set the client signing state", "on|off|required" },
211 { "workgroup", 'W', POPT_ARG_STRING, NULL, 'W', "Set the workgroup name", "WORKGROUP" },
212 { "realm", 0, POPT_ARG_STRING, NULL, 'r', "Set the realm name", "REALM" },
213 { "scope", 'i', POPT_ARG_STRING, NULL, 'i', "Use this Netbios scope", "SCOPE" },
214 { "maxprotocol", 'm', POPT_ARG_STRING, NULL, 'm', "Set max protocol level", "MAXPROTOCOL" },
215 { NULL }
216};
217
218struct poptOption popt_common_samba4[] = {
219 { NULL, 0, POPT_ARG_CALLBACK|POPT_CBFLAG_PRE|POPT_CBFLAG_POST, (void *)popt_samba_callback },
220 { "debuglevel", 'd', POPT_ARG_STRING, NULL, 'd', "Set debug level", "DEBUGLEVEL" },
221 { "debug-stderr", 0, POPT_ARG_NONE, NULL, OPT_DEBUG_STDERR, "Send debug output to STDERR", NULL },
222 { "configfile", 's', POPT_ARG_STRING, NULL, 's', "Use alternative configuration file", "CONFIGFILE" },
223 { "option", 0, POPT_ARG_STRING, NULL, OPT_OPTION, "Set smb.conf option from command line", "name=value" },
224 { "log-basename", 'l', POPT_ARG_STRING, NULL, 'l', "Basename for log/debug files", "LOGFILEBASE" },
225 { "leak-report", 0, POPT_ARG_NONE, NULL, OPT_LEAK_REPORT, "enable talloc leak reporting on exit", NULL },
226 { "leak-report-full",0, POPT_ARG_NONE, NULL, OPT_LEAK_REPORT_FULL, "enable full talloc leak reporting on exit", NULL },
227 { NULL }
228};
229
230struct poptOption popt_common_version4[] = {
231 { NULL, 0, POPT_ARG_CALLBACK, (void *)popt_version_callback },
232 { "version", 'V', POPT_ARG_NONE, NULL, 'V', "Print version" },
233 { NULL }
234};
235
diff --git a/source4/lib/cmdline/popt_common.h b/source4/lib/cmdline/popt_common.h
0new file mode 100644236new file mode 100644
index 0000000..4271aa4
--- /dev/null
+++ b/source4/lib/cmdline/popt_common.h
@@ -0,0 +1,47 @@
1/*
2 Unix SMB/CIFS implementation.
3 Common popt arguments
4 Copyright (C) Jelmer Vernooij 2003
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef _POPT_COMMON_H
21#define _POPT_COMMON_H
22
23#include <popt.h>
24
25/* Common popt structures */
26extern struct poptOption popt_common_samba4[];
27extern struct poptOption popt_common_connection4[];
28extern struct poptOption popt_common_version4[];
29extern struct poptOption popt_common_credentials4[];
30
31#ifndef POPT_TABLEEND
32#define POPT_TABLEEND { NULL, '\0', 0, 0, 0, NULL, NULL }
33#endif
34
35#define POPT_COMMON_SAMBA { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_samba4, 0, "Common Samba options:", NULL },
36#define POPT_COMMON_CONNECTION { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_connection4, 0, "Connection options:", NULL },
37#define POPT_COMMON_VERSION { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_version4, 0, "Version options:", NULL },
38#define POPT_COMMON_CREDENTIALS { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_credentials4, 0, "Authentication options:", NULL },
39
40struct cli_credentials;
41
42void popt_set_cmdline_credentials(struct cli_credentials *creds);
43struct cli_credentials *popt_get_cmdline_credentials(void);
44void popt_free_cmdline_credentials(void);
45extern struct loadparm_context *cmdline_lp_ctx;
46
47#endif /* _POPT_COMMON_H */
diff --git a/source4/lib/cmdline/popt_credentials.c b/source4/lib/cmdline/popt_credentials.c
0new file mode 10064448new file mode 100644
index 0000000..c06b8c7
--- /dev/null
+++ b/source4/lib/cmdline/popt_credentials.c
@@ -0,0 +1,190 @@
1/*
2 Unix SMB/CIFS implementation.
3 Credentials popt routines
4
5 Copyright (C) Jelmer Vernooij 2002,2003,2005
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#include "includes.h"
22#include "lib/cmdline/popt_common.h"
23#include "lib/cmdline/credentials.h"
24#include "auth/credentials/credentials.h"
25#include "auth/gensec/gensec.h"
26#include "param/param.h"
27
28/* Handle command line options:
29 * -U,--user
30 * -A,--authentication-file
31 * -k,--use-kerberos
32 * -N,--no-pass
33 * -S,--signing
34 * -P,--machine-pass
35 * --simple-bind-dn
36 * --password
37 * --krb5-ccache
38 */
39
40static bool dont_ask;
41static bool machine_account_pending;
42
43enum opt { OPT_SIMPLE_BIND_DN, OPT_PASSWORD, OPT_KERBEROS, OPT_SIGN, OPT_ENCRYPT, OPT_KRB5_CCACHE };
44
45static void popt_common_credentials_callback(poptContext con,
46 enum poptCallbackReason reason,
47 const struct poptOption *opt,
48 const char *arg, const void *data)
49{
50 if (reason == POPT_CALLBACK_REASON_PRE) {
51 popt_set_cmdline_credentials(cli_credentials_init(NULL));
52 return;
53 }
54
55 if (reason == POPT_CALLBACK_REASON_POST) {
56 cli_credentials_guess(popt_get_cmdline_credentials(),
57 cmdline_lp_ctx);
58
59 if (!dont_ask) {
60 cli_credentials_set_cmdline_callbacks(
61 popt_get_cmdline_credentials());
62 }
63
64 if (machine_account_pending) {
65 cli_credentials_set_machine_account(
66 popt_get_cmdline_credentials(), cmdline_lp_ctx);
67 }
68
69 return;
70
71 }
72
73 switch(opt->val) {
74 case 'U':
75 {
76 char *lp;
77
78 cli_credentials_parse_string(
79 popt_get_cmdline_credentials(), arg, CRED_SPECIFIED);
80 /* This breaks the abstraction, including the const above */
81 if ((lp=strchr_m(arg,'%'))) {
82 lp[0]='\0';
83 lp++;
84 /* Try to prevent this showing up in ps */
85 memset(lp,0,strlen(lp));
86 }
87 }
88 break;
89
90 case OPT_PASSWORD:
91 cli_credentials_set_password(popt_get_cmdline_credentials(),
92 arg, CRED_SPECIFIED);
93 /* Try to prevent this showing up in ps */
94 memset(discard_const(arg),0,strlen(arg));
95 break;
96
97 case 'A':
98 cli_credentials_parse_file(popt_get_cmdline_credentials(),
99 arg, CRED_SPECIFIED);
100 break;
101
102 case 'P':
103 /* Later, after this is all over, get the machine account details from the secrets.ldb */
104 machine_account_pending = true;
105 break;
106
107 case OPT_KERBEROS:
108 {
109 bool use_kerberos = true;
110 /* Force us to only use kerberos */
111 if (arg) {
112 if (!set_boolean(arg, &use_kerberos)) {
113 fprintf(stderr, "Error parsing -k %s. Should be "
114 "-k [yes|no]\n", arg);
115 exit(1);
116 break;
117 }
118 }
119
120 cli_credentials_set_kerberos_state(
121 popt_get_cmdline_credentials(),
122 use_kerberos
123 ? CRED_MUST_USE_KERBEROS
124 : CRED_DONT_USE_KERBEROS);
125 break;
126 }
127
128 case OPT_SIMPLE_BIND_DN:
129 {
130 cli_credentials_set_bind_dn(popt_get_cmdline_credentials(),
131 arg);
132 break;
133 }
134 case OPT_KRB5_CCACHE:
135 {
136 const char *error_string;
137 if (cli_credentials_set_ccache(
138 popt_get_cmdline_credentials(), cmdline_lp_ctx,
139 arg, CRED_SPECIFIED,
140 &error_string) != 0) {
141 fprintf(stderr, "Error reading krb5 credentials cache: '%s' %s", arg, error_string);
142 exit(1);
143 }
144 break;
145 }
146 case OPT_SIGN:
147 {
148 uint32_t gensec_features;
149
150 gensec_features = cli_credentials_get_gensec_features(
151 popt_get_cmdline_credentials());
152
153 gensec_features |= GENSEC_FEATURE_SIGN;
154 cli_credentials_set_gensec_features(
155 popt_get_cmdline_credentials(),
156 gensec_features);
157 break;
158 }
159 case OPT_ENCRYPT:
160 {
161 uint32_t gensec_features;
162
163 gensec_features = cli_credentials_get_gensec_features(
164 popt_get_cmdline_credentials());
165
166 gensec_features |= GENSEC_FEATURE_SEAL;
167 cli_credentials_set_gensec_features(
168 popt_get_cmdline_credentials(),
169 gensec_features);
170 break;
171 }
172 }
173}
174
175
176
177struct poptOption popt_common_credentials4[] = {
178 { NULL, 0, POPT_ARG_CALLBACK|POPT_CBFLAG_PRE|POPT_CBFLAG_POST, (void *)popt_common_credentials_callback },
179 { "user", 'U', POPT_ARG_STRING, NULL, 'U', "Set the network username", "[DOMAIN/]USERNAME[%PASSWORD]" },
180 { "no-pass", 'N', POPT_ARG_NONE, &dont_ask, 'N', "Don't ask for a password" },
181 { "password", 0, POPT_ARG_STRING, NULL, OPT_PASSWORD, "Password" },
182 { "authentication-file", 'A', POPT_ARG_STRING, NULL, 'A', "Get the credentials from a file", "FILE" },
183 { "machine-pass", 'P', POPT_ARG_NONE, NULL, 'P', "Use stored machine account password" },
184 { "simple-bind-dn", 0, POPT_ARG_STRING, NULL, OPT_SIMPLE_BIND_DN, "DN to use for a simple bind" },
185 { "kerberos", 'k', POPT_ARG_STRING, NULL, OPT_KERBEROS, "Use Kerberos, -k [yes|no]" },
186 { "krb5-ccache", 0, POPT_ARG_STRING, NULL, OPT_KRB5_CCACHE, "Credentials cache location for Kerberos" },
187 { "sign", 'S', POPT_ARG_NONE, NULL, OPT_SIGN, "Sign connection to prevent modification in transit" },
188 { "encrypt", 'e', POPT_ARG_NONE, NULL, OPT_ENCRYPT, "Encrypt connection for privacy" },
189 { NULL }
190};
diff --git a/source4/lib/cmdline/wscript_build b/source4/lib/cmdline/wscript_build
0new file mode 100644191new file mode 100644
index 0000000..f8df22a
--- /dev/null
+++ b/source4/lib/cmdline/wscript_build
@@ -0,0 +1,23 @@
1#!/usr/bin/env python
2
3bld.SAMBA_LIBRARY('cmdline-credentials',
4 source='credentials.c',
5 autoproto='credentials.h',
6 public_deps='samba-credentials popt',
7 deps='samba-util',
8 private_library=True)
9
10bld.SAMBA_SUBSYSTEM('POPT_SAMBA',
11 source='popt_common.c',
12 public_deps='popt',
13 header_path='samba',
14 deps='talloc samba-hostconfig'
15 )
16
17bld.SAMBA_SUBSYSTEM('POPT_CREDENTIALS',
18 source='popt_credentials.c',
19 autoproto='popt_credentials.h',
20 public_deps='samba-credentials CREDENTIALS_SECRETS cmdline-credentials popt',
21 deps='samba-util'
22 )
23
diff --git a/source4/lib/com/README b/source4/lib/com/README
0new file mode 10064424new file mode 100644
index 0000000..361024e
--- /dev/null
+++ b/source4/lib/com/README
@@ -0,0 +1,9 @@
1This directory contains Samba's very simple COM implementation.
2It is by no means finished yet.
3
4The main aim of this implementation is for use by our DCOM implementation,
5which lives in the dcom subdirectory. The local version is used mostly for
6testing.
7
8More information on this effort can be found in the DCOM whitepaper in
9the lorikeet repository.
diff --git a/source4/lib/com/classes/simple.c b/source4/lib/com/classes/simple.c
0new file mode 10064410new file mode 100644
index 0000000..7d05733
--- /dev/null
+++ b/source4/lib/com/classes/simple.c
@@ -0,0 +1,124 @@
1/*
2 Unix SMB/CIFS implementation.
3 Simple class
4 Copyright (C) 2004-2005 Jelmer Vernooij <jelmer@samba.org>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#include "includes.h"
22#include "lib/com/com.h"
23#include "librpc/gen_ndr/com_dcom.h"
24
25NTSTATUS com_simple_init(TALLOC_CTX *);
26
27static struct IClassFactory_vtable simple_classobject_vtable;
28static struct IStream_vtable simple_IStream_vtable;
29
30static WERROR simple_IUnknown_QueryInterface (struct IUnknown *d, TALLOC_CTX *mem_ctx, struct GUID *iid, struct IUnknown **iun)
31{
32 *iun = d;
33 return WERR_OK;
34}
35
36static uint32_t simple_IUnknown_AddRef (struct IUnknown *d, TALLOC_CTX *mem_ctx)
37{
38 return 1;
39}
40
41static uint32_t simple_IUnknown_Release (struct IUnknown *d, TALLOC_CTX *mem_ctx)
42{
43 return 1;
44}
45
46static WERROR simple_IStream_Read (struct IStream *d, TALLOC_CTX *mem_ctx, uint8_t *pv, uint32_t num_requested, uint32_t *num_readx, uint32_t num_read)
47{
48 printf("%d bytes are being read\n", num_read);
49 return WERR_OK;
50}
51
52static WERROR simple_IStream_Write (struct IStream *d, TALLOC_CTX *mem_ctx, uint8_t *data, uint32_t num_requested, uint32_t num_written)
53{
54 printf("%d bytes are being written\n", num_requested);
55 return WERR_OK;
56}
57
58static WERROR simpleclass_IUnknown_QueryInterface (struct IUnknown *d, TALLOC_CTX *mem_ctx, struct GUID *iid, struct IUnknown **iun)
59{
60 /* FIXME: Return WERR_IFACE_NOT_SUPPORTED if IID != IID_IUNKNOWN and IID != IID_CLASSFACTORY */
61 *iun = d;
62 return WERR_OK;
63}
64
65static WERROR simpleclass_IClassFactory_CreateInstance (struct IClassFactory *d, TALLOC_CTX *mem_ctx, struct IUnknown *iunk, struct GUID *iid, struct IUnknown **ppv)
66{
67 struct IStream *ret;
68 /* FIXME: Check whether IID == ISTREAM_IID */
69 ret = talloc(mem_ctx, struct IStream);
70 ret->ctx = NULL;
71 ret->vtable = &simple_IStream_vtable;
72 ret->object_data = NULL;
73
74 *ppv = (struct IUnknown *)ret;
75
76 return WERR_OK;
77}
78
79static uint32_t simpleclass_IUnknown_AddRef (struct IUnknown *d, TALLOC_CTX *mem_ctx)
80{
81 return 1;
82}
83
84static uint32_t simpleclass_IUnknown_Release (struct IUnknown *d, TALLOC_CTX *mem_ctx)
85{
86 return 1;
87}
88
89/* Everything below this line should be autogenerated later on */
90static struct IClassFactory_vtable simple_classobject_vtable = {
91 { 0, 0, 0, { 0, 0 }, { 0, 0, 0, 0, 0, 0 } },
92 simpleclass_IUnknown_QueryInterface,
93 simpleclass_IUnknown_AddRef,
94 simpleclass_IUnknown_Release,
95 simpleclass_IClassFactory_CreateInstance,
96 NULL,
97 NULL,
98 NULL
99};
100
101static struct IStream_vtable simple_IStream_vtable = {
102 { 0, 0, 0, { 0, 0 }, { 0, 0, 0, 0, 0, 0 } },
103 simple_IUnknown_QueryInterface,
104 simple_IUnknown_AddRef,
105 simple_IUnknown_Release,
106 simple_IStream_Read,
107 simple_IStream_Write
108};
109
110NTSTATUS com_simple_init(TALLOC_CTX *ctx)
111{
112 struct GUID clsid;
113 struct IUnknown *class_object = talloc(ctx, struct IUnknown);
114
115 class_object->ctx = NULL;
116 class_object->object_data = NULL;
117 class_object->vtable = (struct IUnknown_vtable *)&simple_classobject_vtable;
118
119 GUID_from_string(CLSID_SIMPLE, &clsid);
120 GUID_from_string(COM_ICLASSFACTORY_UUID, &simple_classobject_vtable.iid);
121 GUID_from_string(COM_ISTREAM_UUID, &simple_IStream_vtable.iid);
122
123 return com_register_running_class(ctx, &clsid, PROGID_SIMPLE, class_object);
124}
diff --git a/source4/lib/com/com.h b/source4/lib/com/com.h
0new file mode 100644125new file mode 100644
index 0000000..56cd210
--- /dev/null
+++ b/source4/lib/com/com.h
@@ -0,0 +1,53 @@
1/*
2 Unix SMB/CIFS implementation.
3 Utility functions for Samba
4 Copyright (C) Jelmer Vernooij 2008
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#ifndef __SAMBA_COM_H__
21#define __SAMBA_COM_H__
22
23#include <talloc.h>
24#include "librpc/gen_ndr/misc.h"
25
26struct com_context;
27struct tevent_context;
28
29struct com_context
30{
31 struct dcom_client_context *dcom;
32 struct tevent_context *event_ctx;
33 struct com_extension {
34 uint32_t id;
35 void *data;
36 struct com_extension *prev, *next;
37 } *extensions;
38 struct loadparm_context *lp_ctx;
39};
40
41struct IUnknown *com_class_by_clsid(struct com_context *ctx, const struct GUID *clsid);
42NTSTATUS com_register_running_class(TALLOC_CTX *ctx, struct GUID *clsid, const char *progid, struct IUnknown *p);
43
44struct dcom_interface_p *dcom_get_local_iface_p(struct GUID *ipid);
45
46WERROR com_init_ctx(struct com_context **ctx, struct tevent_context *event_ctx);
47WERROR com_create_object(struct com_context *ctx, struct GUID *clsid, int num_ifaces, struct GUID *iid, struct IUnknown **ip, WERROR *results);
48WERROR com_get_class_object(struct com_context *ctx, struct GUID *clsid, struct GUID *iid, struct IUnknown **ip);
49NTSTATUS com_init(void);
50
51typedef struct IUnknown *(*get_class_object_function) (const struct GUID *clsid);
52
53#endif /* __SAMBA_COM_H__ */
diff --git a/source4/lib/com/dcom/dcom.h b/source4/lib/com/dcom/dcom.h
0new file mode 10064454new file mode 100644
index 0000000..cb549b1
--- /dev/null
+++ b/source4/lib/com/dcom/dcom.h
@@ -0,0 +1,85 @@
1/*
2 Unix SMB/CIFS implementation.
3 COM standard objects
4 Copyright (C) Jelmer Vernooij 2004-2005.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19*/
20
21#ifndef _DCOM_H /* _DCOM_H */
22#define _DCOM_H
23
24struct cli_credentials;
25struct dcerpc_pipe;
26
27#include "lib/com/com.h"
28#include "librpc/gen_ndr/orpc.h"
29
30struct dcom_client_context {
31 struct dcom_server_credentials {
32 const char *server;
33 struct cli_credentials *credentials;
34 struct dcom_server_credentials *prev, *next;
35 } *credentials;
36 struct dcom_object_exporter {
37 uint64_t oxid;
38 char *host;
39 struct IRemUnknown *rem_unknown;
40 struct DUALSTRINGARRAY *bindings;
41 struct dcerpc_pipe *pipe;
42 struct dcom_object_exporter *prev, *next;
43 } *object_exporters;
44};
45
46typedef enum ndr_err_code (*marshal_fn)(TALLOC_CTX *mem_ctx, struct IUnknown *pv, struct OBJREF *o);
47typedef enum ndr_err_code (*unmarshal_fn)(TALLOC_CTX *mem_ctx, struct OBJREF *o, struct IUnknown **pv);
48
49
50struct dcom_client_context *dcom_client_init(struct com_context *ctx, struct cli_credentials *credentials);
51struct dcom_object_exporter *object_exporter_by_oxid(struct com_context *ctx, uint64_t oxid);
52struct dcom_object_exporter *object_exporter_by_ip(struct com_context *ctx, struct IUnknown *ip);
53WERROR dcom_create_object(struct com_context *ctx, struct GUID *clsid, const char *server, int num_ifaces, struct GUID *iid, struct IUnknown ***ip, HRESULT *results);
54WERROR dcom_get_class_object(struct com_context *ctx, struct GUID *clsid, const char *server, struct GUID *iid, struct IUnknown **ip);
55NTSTATUS dcom_get_pipe(struct IUnknown *iface, struct dcerpc_pipe **pp);
56NTSTATUS dcom_OBJREF_from_IUnknown(struct OBJREF *o, struct IUnknown *p);
57NTSTATUS dcom_IUnknown_from_OBJREF(TALLOC_CTX *mem_ctx, struct com_context *ctx, struct IUnknown **_p, struct OBJREF *o);
58uint64_t dcom_get_current_oxid(void);
59void dcom_add_server_credentials(struct com_context *ctx, const char *server, struct cli_credentials *credentials);
60WERROR dcom_query_interface(struct IUnknown *d, uint32_t cRefs, uint16_t cIids, struct GUID *iids, struct IUnknown **ip, WERROR *results);
61
62#include "librpc/gen_ndr/com_dcom.h"
63
64NTSTATUS dcom_register_proxy(struct IUnknown_vtable *proxy_vtable);
65struct IUnknown_vtable *dcom_proxy_vtable_by_iid(struct GUID *iid);
66NTSTATUS dcom_register_marshal(struct GUID *clsid, marshal_fn marshal, unmarshal_fn unmarshal);
67
68#include "libcli/composite/composite.h"
69void dcom_release_continue(struct composite_context *cr);
70#define IUnknown_ipid(d) ((d)->obj.u_objref.u_standard.std.ipid)
71struct composite_context *dcom_release_send(struct IUnknown *d, TALLOC_CTX *mem_ctx);
72marshal_fn dcom_marshal_by_clsid(struct GUID *clsid);
73unmarshal_fn dcom_unmarshal_by_clsid(struct GUID *clsid);
74
75struct dcom_proxy_async_call_state {
76 struct IUnknown *d;
77 const struct ndr_interface_table *table;
78 uint32_t opnum;
79 void (*continuation)(struct rpc_request *);
80 TALLOC_CTX *mem_ctx;
81 void *r;
82};
83
84
85#endif /* _DCOM_H */
diff --git a/source4/lib/com/dcom/main.c b/source4/lib/com/dcom/main.c
0new file mode 10064486new file mode 100644
index 0000000..088d7fe
--- /dev/null
+++ b/source4/lib/com/dcom/main.c
@@ -0,0 +1,704 @@
1/*
2 Unix SMB/CIFS implementation.
3 Main DCOM functionality
4 Copyright (C) 2004 Jelmer Vernooij <jelmer@samba.org>
5 Copyright (C) 2006 Andrzej Hajda <andrzej.hajda@wp.pl>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22#include "includes.h"
23#include "system/filesys.h"
24#include "librpc/gen_ndr/epmapper.h"
25#include "librpc/gen_ndr/ndr_remact_c.h"
26#include "librpc/gen_ndr/com_dcom.h"
27#include "librpc/gen_ndr/dcom.h"
28#include "librpc/rpc/dcerpc.h"
29#include "lib/com/dcom/dcom.h"
30#include "librpc/ndr/ndr_table.h"
31#include "../lib/util/dlinklist.h"
32#include "auth/credentials/credentials.h"
33#include "libcli/composite/composite.h"
34
35#define DCOM_NEGOTIATED_PROTOCOLS { EPM_PROTOCOL_TCP, EPM_PROTOCOL_SMB, EPM_PROTOCOL_NCALRPC }
36
37static NTSTATUS dcerpc_binding_from_STRINGBINDING(TALLOC_CTX *mem_ctx, struct dcerpc_binding **b_out, struct STRINGBINDING *bd)
38{
39 char *tstr;
40 char *bstr;
41 enum dcerpc_transport_t transport;
42 struct dcerpc_binding *b;
43
44 transport = dcerpc_transport_by_endpoint_protocol(bd->wTowerId);
45 if (transport == NCA_UNKNOWN) {
46 DEBUG(1, ("Can't find transport match endpoint protocol %d\n", bd->wTowerId));
47 return NT_STATUS_NOT_SUPPORTED;
48 }
49
50 tstr = derpc_transport_string_by_transport(transport);
51 bstr = talloc_asprintf(mem_ctx, "%s:%s", tstr, bd->NetworkAddr);
52 if (bstr == NULL) {
53 return NT_STATUS_NO_MEMORY;
54 }
55
56 status = dcerpc_parse_binding(mem_ctx, bstr, &b);
57 TALLOC_FREE(bstr);
58 if (!NT_STATUS_IS_OK(status)) {
59 return status;
60 }
61
62 *b_out = b;
63 return NT_STATUS_OK;
64}
65
66struct cli_credentials *dcom_get_server_credentials(struct com_context *ctx, const char *server)
67{
68 struct dcom_server_credentials *c;
69 struct cli_credentials *d;
70
71 d = NULL;
72 for (c = ctx->dcom->credentials; c; c = c->next) {
73 if (c->server == NULL) {
74 d = c->credentials;
75 continue;
76 }
77 if (server && !strcmp(c->server, server)) return c->credentials;
78 }
79 return d;
80}
81
82/**
83 * Register credentials for a specific server.
84 *
85 * @param ctx COM context
86 * @param server Name of server, can be NULL
87 * @param credentials Credentials object
88 */
89void dcom_add_server_credentials(struct com_context *ctx, const char *server,
90 struct cli_credentials *credentials)
91{
92 struct dcom_server_credentials *c;
93
94 /* FIXME: Don't use talloc_find_parent_bytype */
95 for (c = ctx->dcom->credentials; c; c = c->next) {
96 if ((server == NULL && c->server == NULL) ||
97 (server != NULL && c->server != NULL &&
98 !strcmp(c->server, server))) {
99 if (c->credentials && c->credentials != credentials) {
100 talloc_unlink(c, c->credentials);
101 c->credentials = credentials;
102 if (talloc_find_parent_bytype(c->credentials, struct dcom_server_credentials))
103 (void)talloc_reference(c, c->credentials);
104 else
105 talloc_steal(c, c->credentials);
106 }
107
108 return;
109 }
110 }
111
112 c = talloc(ctx->event_ctx, struct dcom_server_credentials);
113 c->server = talloc_strdup(c, server);
114 c->credentials = credentials;
115 if (talloc_find_parent_bytype(c->credentials, struct dcom_server_credentials))
116 (void)talloc_reference(c, c->credentials);
117 else
118 talloc_steal(c, c->credentials);
119
120 DLIST_ADD(ctx->dcom->credentials, c);
121}
122
123void dcom_update_credentials_for_aliases(struct com_context *ctx,
124 const char *server,
125 struct DUALSTRINGARRAY *pds)
126{
127 struct cli_credentials *cc;
128 struct dcerpc_binding *b;
129 uint32_t i;
130 NTSTATUS status;
131
132 cc = dcom_get_server_credentials(ctx, server);
133 for (i = 0; pds->stringbindings[i]; ++i) {
134 if (pds->stringbindings[i]->wTowerId != EPM_PROTOCOL_TCP)
135 continue;
136 status = dcerpc_binding_from_STRINGBINDING(ctx, &b, pds->stringbindings[i]);
137 if (!NT_STATUS_IS_OK(status))
138 continue;
139 dcom_add_server_credentials(ctx, b->host, cc);
140 talloc_free(b);
141 }
142}
143
144struct dcom_client_context *dcom_client_init(struct com_context *ctx, struct cli_credentials *credentials)
145{
146 ctx->dcom = talloc_zero(ctx, struct dcom_client_context);
147 if (!credentials) {
148 credentials = cli_credentials_init(ctx);
149 cli_credentials_set_conf(credentials, ctx->lp_ctx);
150 cli_credentials_parse_string(credentials, "%", CRED_SPECIFIED);
151 }
152 dcom_add_server_credentials(ctx, NULL, credentials);
153 return ctx->dcom;
154}
155
156static NTSTATUS dcom_connect_host(struct com_context *ctx,
157 struct dcerpc_pipe **p, const char *server)
158{
159 struct dcerpc_binding *bd;
160 const char * available_transports[] = { "ncacn_ip_tcp", "ncacn_np" };
161 int i;
162 NTSTATUS status;
163 TALLOC_CTX *loc_ctx;
164
165 if (server == NULL) {
166 return dcerpc_pipe_connect(ctx->event_ctx, p, "ncalrpc",
167 &ndr_table_IRemoteActivation,
168 dcom_get_server_credentials(ctx, NULL), ctx->event_ctx, ctx->lp_ctx);
169 }
170 loc_ctx = talloc_new(ctx);
171
172 /* Allow server name to contain a binding string */
173 if (strchr(server, ':') &&
174 NT_STATUS_IS_OK(dcerpc_parse_binding(loc_ctx, server, &bd))) {
175 if (DEBUGLVL(11))
176 bd->flags |= DCERPC_DEBUG_PRINT_BOTH;
177 status = dcerpc_pipe_connect_b(ctx->event_ctx, p, bd,
178 &ndr_table_IRemoteActivation,
179 dcom_get_server_credentials(ctx, bd->host), ctx->event_ctx, ctx->lp_ctx);
180 goto end;
181 }
182
183 for (i = 0; i < ARRAY_SIZE(available_transports); i++)
184 {
185 char *binding = talloc_asprintf(loc_ctx, "%s:%s", available_transports[i], server);
186 if (!binding) {
187 status = NT_STATUS_NO_MEMORY;
188 goto end;
189 }
190 status = dcerpc_pipe_connect(ctx->event_ctx, p, binding,
191 &ndr_table_IRemoteActivation,
192 dcom_get_server_credentials(ctx, server),
193 ctx->event_ctx, ctx->lp_ctx);
194
195 if (NT_STATUS_IS_OK(status)) {
196 if (DEBUGLVL(11))
197 (*p)->conn->flags |= DCERPC_DEBUG_PRINT_BOTH;
198 goto end;
199 } else {
200 DEBUG(1,(__location__": dcom_connect_host : %s\n", get_friendly_nt_error_msg(status)));
201 }
202 }
203
204end:
205 talloc_free(loc_ctx);
206 return status;
207}
208
209struct dcom_object_exporter *object_exporter_by_oxid(struct com_context *ctx,
210 uint64_t oxid)
211{
212 struct dcom_object_exporter *ox;
213 for (ox = ctx->dcom->object_exporters; ox; ox = ox->next) {
214 if (ox->oxid == oxid) {
215 return ox;
216 }
217 }
218
219 return NULL;
220}
221
222struct dcom_object_exporter *object_exporter_update_oxid(struct com_context *ctx, uint64_t oxid, struct DUALSTRINGARRAY *bindings)
223{
224 struct dcom_object_exporter *ox;
225 ox = object_exporter_by_oxid(ctx, oxid);
226 if (!ox) {
227 ox = talloc_zero(ctx, struct dcom_object_exporter);
228 DLIST_ADD(ctx->dcom->object_exporters, ox);
229 ox->oxid = oxid;
230 } else {
231 talloc_free(ox->bindings);
232 }
233 ox->bindings = bindings;
234 talloc_steal(ox, bindings);
235 return ox;
236}
237
238struct dcom_object_exporter *object_exporter_by_ip(struct com_context *ctx, struct IUnknown *ip)
239{
240 return object_exporter_by_oxid(ctx, ip->obj.u_objref.u_standard.std.oxid);
241}
242
243WERROR dcom_create_object(struct com_context *ctx, struct GUID *clsid, const char *server, int num_ifaces, struct GUID *iid, struct IUnknown ***ip, HRESULT *results)
244{
245 uint16_t protseq[] = DCOM_NEGOTIATED_PROTOCOLS;
246 struct dcerpc_pipe *p;
247 struct dcom_object_exporter *m;
248 NTSTATUS status;
249 struct RemoteActivation r;
250 struct DUALSTRINGARRAY *pds;
251 int i;
252 HRESULT hr;
253 uint64_t oxid;
254 struct GUID ipidRemUnknown;
255 struct IUnknown *ru_template;
256 struct ORPCTHAT that;
257 uint32_t AuthnHint;
258 struct COMVERSION ServerVersion;
259 struct MInterfacePointer **ifaces;
260 TALLOC_CTX *loc_ctx;
261
262 status = dcom_connect_host(ctx, &p, server);
263 if (NT_STATUS_IS_ERR(status)) {
264 DEBUG(1, ("Unable to connect to %s - %s\n", server, get_friendly_nt_error_msg(status)));
265 return ntstatus_to_werror(status);
266 }
267 loc_ctx = talloc_new(ctx);
268
269 ifaces = talloc_array(loc_ctx, struct MInterfacePointer *, num_ifaces);
270
271 ZERO_STRUCT(r.in);
272 r.in.this.version.MajorVersion = COM_MAJOR_VERSION;
273 r.in.this.version.MinorVersion = COM_MINOR_VERSION;
274 r.in.this.cid = GUID_random();
275 r.in.Clsid = *clsid;
276 r.in.ClientImpLevel = RPC_C_IMP_LEVEL_IDENTIFY;
277 r.in.num_protseqs = ARRAY_SIZE(protseq);
278 r.in.protseq = protseq;
279 r.in.Interfaces = num_ifaces;
280 r.in.pIIDs = iid;
281 r.out.that = &that;
282 r.out.pOxid = &oxid;
283 r.out.pdsaOxidBindings = &pds;
284 r.out.ipidRemUnknown = &ipidRemUnknown;
285 r.out.AuthnHint = &AuthnHint;
286 r.out.ServerVersion = &ServerVersion;
287 r.out.hr = &hr;
288 r.out.ifaces = ifaces;
289 r.out.results = results;
290
291 status = dcerpc_RemoteActivation(p, loc_ctx, &r);
292 talloc_free(p);
293
294 if(NT_STATUS_IS_ERR(status)) {
295 DEBUG(1, ("Error while running RemoteActivation %s\n", nt_errstr(status)));
296 hr = ntstatus_to_werror(status);
297 goto end;
298 }
299
300 if(!W_ERROR_IS_OK(r.out.result)) {
301 hr = r.out.result;
302 goto end;
303 }
304
305 if(!HRES_IS_OK(hr)) {
306 goto end;
307 }
308
309 m = object_exporter_update_oxid(ctx, oxid, pds);
310
311 ru_template = NULL;
312 *ip = talloc_array(ctx, struct IUnknown *, num_ifaces);
313 for (i = 0; i < num_ifaces; i++) {
314 (*ip)[i] = NULL;
315 if (W_ERROR_IS_OK(results[i])) {
316 status = dcom_IUnknown_from_OBJREF(ctx, &(*ip)[i], &r.out.ifaces[i]->obj);
317 if (!NT_STATUS_IS_OK(status)) {
318 results[i] = ntstatus_to_werror(status);
319 } else if (!ru_template)
320 ru_template = (*ip)[i];
321 }
322 }
323
324 /* TODO:avg check when exactly oxid should be updated,its lifetime etc */
325 if (m->rem_unknown && memcmp(&m->rem_unknown->obj.u_objref.u_standard.std.ipid, &ipidRemUnknown, sizeof(ipidRemUnknown))) {
326 talloc_free(m->rem_unknown);
327 m->rem_unknown = NULL;
328 }
329 if (!m->rem_unknown) {
330 if (!ru_template) {
331 DEBUG(1,("dcom_create_object: Cannot Create IRemUnknown - template interface not available\n"));
332 hr = WERR_GEN_FAILURE;
333 }
334 m->rem_unknown = talloc_zero(m, struct IRemUnknown);
335 memcpy(m->rem_unknown, ru_template, sizeof(struct IUnknown));
336 GUID_from_string(COM_IREMUNKNOWN_UUID, &m->rem_unknown->obj.iid);
337 m->rem_unknown->obj.u_objref.u_standard.std.ipid = ipidRemUnknown;
338 m->rem_unknown->vtable = (struct IRemUnknown_vtable *)dcom_proxy_vtable_by_iid(&m->rem_unknown->obj.iid);
339 /* TODO:avg copy stringbindigs?? */
340 }
341
342 dcom_update_credentials_for_aliases(ctx, server, pds);
343 {
344 char *c;
345 c = strchr(server, '[');
346 if (m->host) talloc_free(m->host);
347 m->host = c ? talloc_strndup(m, server, c - server) : talloc_strdup(m, server);
348 }
349 hr = WERR_OK;
350end:
351 talloc_free(loc_ctx);
352 return hr;
353}
354
355int find_similar_binding(struct STRINGBINDING **sb, const char *host)
356{
357 int i, l;
358 l = strlen(host);
359 for (i = 0; sb[i]; ++i) {
360 if ((sb[i]->wTowerId == EPM_PROTOCOL_TCP) && !strncasecmp(host, sb[i]->NetworkAddr, l) && (sb[i]->NetworkAddr[l] == '['))
361 break;
362 }
363 return i;
364}
365
366WERROR dcom_query_interface(struct IUnknown *d, uint32_t cRefs, uint16_t cIids, struct GUID *iids, struct IUnknown **ip, WERROR *results)
367{
368 struct dcom_object_exporter *ox;
369 struct REMQIRESULT *rqir;
370 WERROR result;
371 NTSTATUS status;
372 int i;
373 TALLOC_CTX *loc_ctx;
374 struct IUnknown ru;
375
376 loc_ctx = talloc_new(d);
377 ox = object_exporter_by_ip(d->ctx, d);
378
379 result = IRemUnknown_RemQueryInterface(ox->rem_unknown, loc_ctx, &IUnknown_ipid(d), cRefs, cIids, iids, &rqir);
380 if (!W_ERROR_IS_OK(result)) {
381 DEBUG(1, ("dcom_query_interface failed: %08X\n", W_ERROR_V(result)));
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches