1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-18 17:57:55 +03:00

319 Commits

Author SHA1 Message Date
Luke Leighton
5e5a1dceee first version of msrpc agent redirector code. client-side only. -
Luke Leighton
d923bc8da2 jeremy is going to hate me for this.
created an "nmb-agent" utility that, yes: it connects to the 137 socket
and accepts unix socket connections which it redirects onto port 137.

it uses the name_trn_id field to filter requests to the correct
location.

name_query() and name_status() are the first victims to use this
feature (by specifying a file descriptor of -1).
-
Luke Leighton
e9e5a34de8 argh! smb-agent redirection client reusage is a nightmare!
moved smb-agent over to a single-process model instead of fork()
in order to reuse client connections.  except, of course, you
can't do a select() on the same socket connections!  argh!
-
Luke Leighton
d54a64ae3a starting "connection reuse" system in smb-agent. added version number
which isn't actually used right now :-)
-
Luke Leighton
294b653f2e cool! a unix socket smb redirector. code based on smbfilter and
ideas from ssh-agent.

the intent is to be able to share smb sessions using cli_net_use_add()
across multiple processes, where one process knows the target server
name, user name and domain, but not the smb password.
-
Luke Leighton
dd3ccdd7d9 new get_any_dc_name() function allows lookups of trusted domains from
lp_trusted_domains() parameter, so trusted domain logins should work,
right, if you put user = TRUSTED_DOMAIN\NTuser in "domain name map", right?

right - as _long_ as you're not using NTLMv2, because the damn NT username
gets mapped to the damn unix name too early, and NTLMv2 challenge-responses
are based on the client's user name, client's domain name, client's host name
etc damn etc.

so it becomes necessary to stop using char* username because this allows
for massive amounts of confusion as to which username is being referred to.
the underlying unix username on the local unix system that is associated with
the smbd process that represents the NT username?  or the NT username itself?
-
Luke Leighton
3a2b920ea2 cleaning up: removing those horrible references to server list
functions (cli_net_use_addlist()).  needed originally because
there was no get_dc_any_name() function.
-
Luke Leighton
f0946d1cca default SID map now reads in "trusted domains" from smb.conf. -
Luke Leighton
50dc709fa9 improved enumdomains added -i option. -
Luke Leighton
338d08f69b clearing up connection-related stuff. password credentials were messing
up.

added a complicated prompt which i don't like, but it tells you
domain\user@hostname$
-
Luke Leighton
fcc39b3f4f more cli_session_setup() calls. what the heck are these doing???
they should all be replaced with cli_establish_connection().

created cli_use_wait_keyboard() which waits on multiple cli_states
and swallows session keepalives.
-
Luke Leighton
c98c666906 damn, that took a while. nt login password was being stored incorrectly
in private .mac file (oops).  ntlogin test now works.
-
Luke Leighton
cef258f1c9 fixing joining to domain plus something weird going down with nt logins... -
Luke Leighton
7846818432 improving createuser account command to be able to add workstations
and then set a default random password.
-
Luke Leighton
301a6efaf6 1) when no domain used in ntlogin test command, should use default one
from previous lsaquery command.  over-ridden from DOMAIN\username

2) initialisation of cli_state is a little more specific: sets use_ntlmv2
   to Auto.  this can always be over-ridden.

3) fixed reusage of ntlmssp_cli_flgs which was being a pain

4) added pwd_compare() function then fixed bug in cli_use where NULL
   domain name was making connections multiply unfruitfully

5) type-casting of mallocs and Reallocs that cause ansi-c compilers to bitch
-
Luke Leighton
e4d92ff9df sys_select added one more argument (read, write selectors). -
Luke Leighton
3c4a6256dd added failed connections to the net use array, even though they'd been
freed / cleaned up.  oops, dat bad, cos they get freed again when u quit.
-
Luke Leighton
0fcd8ce096 ok. this is where it gets interesting. client states are now maintained
by cli_net_use_add() and cli_net_use_del().  MSRPC connections are
established with cli_connection_init(), and automatically unlinked with
cli_connection_unlink.  client states are _reused_ by cli_connection_init.
-
Luke Leighton
1abdf9a45f bug-fix -
Luke Leighton
86f4b1d3cc this is going to sound _really_ weird, ok, but i had to implement
equivalents of NetUseAdd and NetUseDel!
-
Luke Leighton
2ae9ee1485 sam sync - one of the files that use multiple connection server list
to \PIPE\NETLOGON.
-
Luke Leighton
d1986ade30 attempting to resolve the issue that multiple servers often specified in
parameters to connect to \PIPE\NETLOGON.
-
Luke Leighton
85cc680736 ok. got ntlogin command working. argh, it maintains a connection to
the remote machine, because i don't know what to _do_ with it!!!!

argh!!!
-
Luke Leighton
44dd3efa63 first attempt at getting \PIPE\NETLOGON working. it's pretty horrible. -
Luke Leighton
4e92090016 cool! spooljobs works! this surprised me very much :-) helped to
specify \PIPE\spoolss instead of \PIPE\lsarpc...
-
Luke Leighton
7a69633058 well, i stuffed up the spooler commands. -
Luke Leighton
0aaf0c9c80 moved at command over to new abstract connection system. matthew, you
initialised dest_wks _after_ using it in at_soon() :-) so i fixed this :)
-
Luke Leighton
601d217f44 moved browser command brsinfo over to new abstracted connection -
Luke Leighton
4c3556fae7 this one's a handle-based one (missed in the first round). -
Luke Leighton
e4e5743a40 removed do_ prefix from srvsvc API -
Luke Leighton
3204829225 updated \PIPE\wkssvc commands to use new abstracted connection system.
modified resolve_srv_name() to return dest host of *SMBSERVER if
server name is \\ip.add.ress.format
-
Luke Leighton
6b67d6164d using "abstracted" cli_connection, got \PIPE\srvsvc commands up and running
again.
-
Luke Leighton
a1ff7e8fc3 further abstraction involving client states. main client-side code
is pretty much independent of SMB client states, which will make it
easier to add other transports.
-
Luke Leighton
4e029d50fc enhanced samuser command to do same thing as enumusers command (-g -u -a)
except with only one user.  done by sharing same code.
-
Luke Leighton
29c480085e whoa. _major_ restructure of rpcclient. fixed some buuugs, created a few.
found out that getopt() _must_ have optind set to 0 before reuse.

still haven't decided what to do with the net* api yet...
-
Luke Leighton
cda2577881 this file manages client states associated with handles. -
Luke Leighton
c1ea396de2 previous commit added an abstraction function that didn't even have
struct cli_state, uint16 fnum into the code: rpc_hnd_api_req().
modified cli_lsarpc.c to use this.  the rest is const issues.
-
Luke Leighton
8ce93b80d3 cool! completed a samr* API that _would_ look like an msdn samr* api...
if microsoft bothered to publish it.  actually, there are good reasons
for not publishing it: people might write programs for it, and then
those programs wouldn't work on nt5, for example...
-
Luke Leighton
45e92258e7 registry API moved over to new format. reg_connect() is the top-level
function, which takes \\server_name.

tested a _few_ functions.  found that regcreatekey receives a Fault PDU.
-
Luke Leighton
7cacf8bd02 service control manager API completed. svcenum -i works, but does not
do so twice.  possible memory corruption, revolving around getopt().
-
Luke Leighton
57bff6fe82 ok. *whew*. this is the first completed part of the restructure.
verified that lsaquery, lsalookupsids work, and found some bugs in the
parameters of these commands :-)

soo... we now have an lsa_* api that has the same arguments as the nt
Lsa* api!  cool!

the only significant coding difference is the introduction of a
user_credentials structure, containing user, domain, pass and ntlmssp
flags.
-
Luke Leighton
c01b18e632 first stages of removing struct cli_state* and uint16 fnum from all
msrpc client code.  the intent is to hide / abstract / associate
connection info behind policy handles.

this makes the msrpc functions look more and more like their nt equivalents.

who-hou!
-
Luke Leighton
eaac0923e0 rewrote policy handle code to be generic (it's needed for client-side too)
attempted to fix regsetsec command
-
Luke Leighton
9193f0eff5 attempted a svcset command. password is encrypted / messed up, therefore
command fails.
-
Luke Leighton
cbbfef6d2a oops!!!! wrong command!!! -
Luke Leighton
e88e7d529b shuffling msrpc code around so that it can be used independently of rpcclient -
Luke Leighton
ab174759cd you know what? this sort of thing makes me laugh. hmm, what functions
have we got.  and what data do we have.  hmm.. i wonder what the NTLMv2
user session key can be... hmmm... weell.... there's some hidden data
here, generated from the user password that doesn't go over-the-wire,
so that's _got_ to be involved.  and... that bit of data took a lot of
computation to produce, so it's probably _also_ involved... and md4 no, md5?
no, how about hmac_md5 yes let's try that one (the other's didn't work)
oh goodie, it worked!

i love it when this sort of thing happens.  took all of fifteen minutes to
guess it.  tried concatenating client and server challenges.  tried
concatenating _random_ bits of client and server challenges.  tried
md5 of the above.  tried hmac_md5 of the above.  eventually, it boils down
to this:

kr = MD4(NT#,username,domainname)
hmacntchal=hmac_md5(kr, nt server challenge)
sess_key = hmac_md5(kr, hmacntchal);
-
Luke Leighton
be6a6b1393 hmmm... have to add client-side support in domain_client_validate() to
_use_ user session key.
-
Luke Leighton
e885027eb7 moving create user function into msrpc_samr.c -
Luke Leighton
3ec269b402 doing a code reshuffle. want to add code to establish trust relationships. -