1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-07 17:18:11 +03:00
Commit Graph

91 Commits

Author SHA1 Message Date
Jeremy Allison
b090cff4b5 Synced up srv_samr with HP changes. Added error checking to original code
- what a concept :-). All this code will be replaced with TNG stuff anyway,
so not a big deal....
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
f76c037255 the beginnings of a new scheme I've working on to allow an easier
head/tng merge.

It goes something like this:

- headers from tng get copied over one at a time

- the old headers get renamed to *_old.h

- server side code that used the old headers gets a
  #define OLD_NTDOMAIN 1
  #undef OLD_NTDOMAIN
  at the start and end of the code

- mkproto.awk recognises these special defines and does magic stuff so
  that each .c file sees the right headers

- we start moving the rpc client libraries from tng to head.

if this goes OK then, in theory, we should be able to move the client
side rpc code from tng to head without disturbing the existing head
server side code. Then when that works we can consider merging the
server side.

it remains to be seen if this scheme will work. So far I've moved
rpc_samr.h and don't seem to have broken anything.

Note this this is still a very delicate operation, as at every step of
the way I want to keep head fully functional. Please don't take part
unless you discuss it with me first.
0001-01-01 00:00:00 +00:00
Jeremy Allison
f02999dbf7 acconfig.h configure configure.in: Added check for UT_SYSLEN for utmp code.
include/byteorder.h: Added alignment macros.
include/nameserv.h: Added defines for msg_type field options - from rfc1002.
lib/time.c: Typo fix.
lib/util_unistr.c: Updates from UNICODE branch.
printing/nt_printing.c: bzero -> memset.
smbd/connection.c: Added check for UT_SYSLEN for utmp code.

Other fixes : Rollback of unapproved commit from Luke.
Please *ask* next time before doing large changes to HEAD.

Jeremy.
0001-01-01 00:00:00 +00:00
Luke Leighton
cfaea90529 added the following message to all dce/rpc client/server code, except
the spoolss code (it's cut from TNG) and the smb-dce/rpc interface
code that jeremy has been working up to TNG-functionality.

i also want this message to go into SAMBA_2_0 and SAMBA_2_0_RELEASE,
because it is intolerable that potentially good modifications be made
to code that is going to be thrown away, and people waste their time
fixing bugs and adding enhancements that have already been carried
out already, up to two years ago in the TNG branch.

/*
 * THIS CODE IS OUT-OF-DATE BY TWO YEARS, IS LEGACY DESIGN AND VERY, VERY,
 * INCOMPLETE.  PLEASE DO NOT MAKE ANY FURTHER ENHANCEMENTS TO THIS CODE
 * UNLESS THEY ARE ALSO CARRIED OUT IN THE SAMBA_TNG BRANCH.
 *
 * PLEASE DO NOT TREAT THIS CODE AS AUTHORITATIVE IN *ANY* WAY.
 *
 * REPEAT, PLEASE DO NOT MAKE ANY MODIFICATIONS TO THIS CODE WITHOUT
 * FIRST CHECKING THE EQUIVALENT MODULE IN SAMBA_TNG, UPDATING THAT
 * FIRST, *THEN* CONSIDER MAKING THE SAME MODIFICATION IN THIS BRANCH
 *
 * YOU WILL, ALMOST GUARANTEED, FIND THAT THE BUG-FIX OR ENHANCEMENT THAT
 * YOU THINK IS NECESSARY, HAS ALREADY BEEN IMPLEMENTED IN SAMBA_TNG.
 * IF IT HAS NOT, YOUR BUG-FIX OR ENHANCEMENT *MUST* GO INTO SAMBA_TNG
 * AS THE SAMBA_TNG CODE WILL REPLACE THIS MODULE WITHOUT REFERENCE TO
 * ANYTHING IN IT, WITH THE POSSIBLE RISK THAT THE BUG-FIX OR ENHANCEMENT
 * MAY BE LOST.
 *
 * PLEASE OBSERVE AND RESPECT THIS SIMPLE REQUEST.
 *
 * THANK YOU.
 *
 * lkcl@samba.org
 */
0001-01-01 00:00:00 +00:00
Luke Leighton
55035b8984 SAMR_R_UNKNOWN_38 is 3 uint16 params (4-byte aligned) followed by status code. 0001-01-01 00:00:00 +00:00
Andrew Tridgell
453a822a76 first pass at updating head branch to be to be the same as the SAMBA_2_0 branch 0001-01-01 00:00:00 +00:00
Luke Leighton
aa3c659a8d delineation between smb and msrpc more marked. smbd now constructs
pdus, and then feeds them over either a "local" function call or a "remote"
function call to an msrpc service.  the "remote" msrpc daemon, on the
other side of a unix socket, then calls the same "local" function that
smbd would, if the msrpc service were being run from inside smbd.

this allows a transition from local msrpc services (inside the same smbd
process) to remote (over a unix socket).

removed reference to pipes_struct in msrpc services.  all msrpc processing
functions take rpcsrv_struct which is a structure containing state info
for the msrpc functions to decode and create pdus.

created become_vuser() which does everything not related to connection_struct
that become_user() does.

removed, as best i could, connection_struct dependencies from the nt spoolss
printing code.

todo: remove dcinfo from rpcsrv_struct because this stores NETLOGON-specific
info on a per-connection basis, and if the connection dies then so does
the info, and that's a fairly serious problem.

had to put pretty much everything that is in user_struct into parse_creds.c
to feed unix user info over to the msrpc daemons.  why?  because it's
expensive to do unix password/group database lookups, and it's definitely
expensive to do nt user profile lookups, not to mention pretty difficult
and if you did either of these it would introduce a complication /
unnecessary interdependency.  so, send uid/gid/num_groups/gid_t* +
SID+num_rids+domain_group_rids* + unix username + nt username + nt domain
+ user session key etc.  this is the MINIMUM info identified so far that's
actually implemented.  missing bits include the called and calling
netbios names etc.  (basically, anything that can be loaded into
standard_sub() and standard_sub_basic()...)
0001-01-01 00:00:00 +00:00
Luke Leighton
cef258f1c9 fixing joining to domain plus something weird going down with nt logins... 0001-01-01 00:00:00 +00:00
Luke Leighton
7846818432 improving createuser account command to be able to add workstations
and then set a default random password.
0001-01-01 00:00:00 +00:00
Luke Leighton
44dd3efa63 first attempt at getting \PIPE\NETLOGON working. it's pretty horrible. 0001-01-01 00:00:00 +00:00
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...
0001-01-01 00:00:00 +00:00
Luke Leighton
a51f62f4cf dynamic memory allocation i added a month ago: forgot to ZERO_STRUCT()
some of the server-side stuff.  Realloc() was being used, so it
Realloc()d some random area of memory.  oops.dynamic memory allocation i added a month ago: forgot to ZERO_STRUCT()
some of the server-side stuff.  Realloc() was being used, so it
Realloc()d some random area of memory.  oops.dynamic memory allocation i added a month ago: forgot to ZERO_STRUCT()
some of the server-side stuff.  Realloc() was being used, so it
Realloc()d some random area of memory.  oops.
0001-01-01 00:00:00 +00:00
Luke Leighton
3152bde7d8 - surprise! the number of UNICODE strings that didn't have alignment
after them is incredible.  how did we get away with this for so long?
0001-01-01 00:00:00 +00:00
Luke Leighton
c3913f8ae2 added samuserset2 rpcclient command to test ACB_XXX bit-setting on
samr opcode 0x25.  _yet_ another failed attempt to get nt5rc2 to join
a samba domain.  what _is_ it with this stuff, dammit?
0001-01-01 00:00:00 +00:00
Luke Leighton
70b2c1ecbb attempting to get nt5 wksta to join domain.
1) had to fix samr "create user" and "set user info" (level 23).

2) had to fix netlogon enum trust domains

3) registry key needed \\ in it not \.
0001-01-01 00:00:00 +00:00
Luke Leighton
60b0840106 added server-side samr enum domains. fixed some parsing issues, server-side. 0001-01-01 00:00:00 +00:00
Luke Leighton
3146aa6b60 added rpcclient "enumdomains" command. enumerates names of domains
for which a PDC is responsible.  typical answers are:
<Name of Domain> plus <Builtin>.

against a hierarchical, down-level-compatible NT5 PDC, there's likely to
be more than these two entries!!!!!
0001-01-01 00:00:00 +00:00
Luke Leighton
e0eb390ab3 const feeding frenzy 0001-01-01 00:00:00 +00:00
Luke Leighton
f52504c553 samuserset <username> -p password. YESSSSS :)
you have to use "ntlmv1" at the moment (i.e set client ntlmv2 = no).
0001-01-01 00:00:00 +00:00
Luke Leighton
b3f16e6b5a adding experimental set user password command to rpcclient, it returns
error wrong password against nt.  ????
0001-01-01 00:00:00 +00:00
Luke Leighton
baa789fabc dynamic mem allocation in enum dom groups and enum dom aliases 0001-01-01 00:00:00 +00:00
Luke Leighton
497d423172 more reshuffling of enum groups code. more higher order functions. 0001-01-01 00:00:00 +00:00
Luke Leighton
6e22bf912c signed / unsigned and typecast issues 0001-01-01 00:00:00 +00:00
Luke Leighton
19490d8b4f one of those wonderful moments when running against a different MSRPC
implementation (NT5) when you discover that your code is trash.
samr_enum_dom_users(), samr_enum_dom_aliases() and samr_enum_dom_groups()
all take a HANDLE for multiple-call enumeration purposes.
0001-01-01 00:00:00 +00:00
Luke Leighton
134b20e2a7 the dynamic memory alloc blood-fest goes on... 0001-01-01 00:00:00 +00:00
Luke Leighton
4b06f30323 turning some of the rpcclient functions dynamic. this is likely to
break a few things...
0001-01-01 00:00:00 +00:00
Luke Leighton
8976eca2db various. debug levels changed. nmbd doesn't need libsmb/clienttrust.c.
samr_lookup_rids() moved to a dynamic memory structure not a
static one limited to 32 RIDs.  cli_pipe.c reading wasn't checking
ERRmoredata when DOS error codes negotiated (this terminates
MSRPC code with prejudice).
0001-01-01 00:00:00 +00:00
Luke Leighton
6f933fb359 initialising enum dom users mem and account name ptrs to NULL. 0001-01-01 00:00:00 +00:00
Luke Leighton
3b583f7be5 return results on prs_xxxxx() and all xxx_io_xxx() routines.
the whole task is not complete, yet.  xxx_io_xxx() routines that
_call_ xxx_io_xxx() routines not done.

prs_xxxx() covered by macros.  considering doing xxx_io_xxxx in the same way.
0001-01-01 00:00:00 +00:00
Luke Leighton
39c367b8e9 splitting dom info into sam_query_dominfo function 0001-01-01 00:00:00 +00:00
Luke Leighton
cc19d5cc5c testing for attempts to get more info levels into samr_query_userinfo 0001-01-01 00:00:00 +00:00
Luke Leighton
e66b6afc69 alignment needed after unicode string names in password change. 0001-01-01 00:00:00 +00:00
Luke Leighton
ac070dfd39 added SamrQueryDomainInfo call info level 0x3 for kix32.exe support 0001-01-01 00:00:00 +00:00
Luke Leighton
4aed18b5e1 added SAMR_USER_INFO_24 info level to samr_set_userinfo. this is used
by "Welcome to SAMBA Domain".
0001-01-01 00:00:00 +00:00
Luke Leighton
2e58ed7424 SAM database "set user info".
----------------------------

- removed DOM_RID4

- removed SAMR_UNKNOWN_32

- added SAMR_SET_USERINFO (opcode 0x32)

- added level 0x1 to SAMR_QUERY_DOM_INFO (needed for create user)

- fixed pwdb_gethexpwd() it was failing on XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

- added mod_sam21pwd_entry()

- preparing to call mod_sam21pwd_entry()

- added "user session key" to user_struct.dc.  this is md4(nt#) and is
  needed to decode user's clear-text passwords in SAMR_SET_USERINFO.

- split code out in chgpasswd.c to decode 516 byte password buffers.
0001-01-01 00:00:00 +00:00
Luke Leighton
f84dede27e removed 2 unnecessary args from make_uni_hdr. 0001-01-01 00:00:00 +00:00
Luke Leighton
103557e26b dynamic memory allocation in samr enum dom users. works with 849 entries now. 0001-01-01 00:00:00 +00:00
Matthew Chapman
402ed18188 If a buffer pointer is NULL then its length_is() attribute should not be
transmitted.

Such a problem was crashing Server Manager.
0001-01-01 00:00:00 +00:00
Matthew Chapman
1e17c2529c Ensuring return status is aligned in SAMR_QUERY_DISPINFO response. 0001-01-01 00:00:00 +00:00
Luke Leighton
fefb4bf191 added a "createuser" command. 0001-01-01 00:00:00 +00:00
Matthew Chapman
900238a661 Changed hard-coded number of users/groups in SAMR_QUERY_DOMAIN_INFO
to MAX_SAM_ENTRIES to prevent truncation of user lists.
A proper implementation is not important right now.
0001-01-01 00:00:00 +00:00
Luke Leighton
1c330d5682 - todd sabin spotted bugs in samr enum dom users / groups / aliases code:
last count (probably an ENUM / resume handle) should always be returned
  even if there are no items being returned.

- got fed up of seven intendation levels in cmd_samr.c, maximum recommended
  in *any* code is three!  made some sub-fns instead.
0001-01-01 00:00:00 +00:00
Matthew Chapman
7d03e6e219 Win9x user level security.
* Added SAMR_LOOKUP_DOMAIN (-> SamrLookupDomainInSamServer)

* Added real SAMR_ENUM_DOM_GROUPS (corresponding to
SamrEnumerateGroupsInDomain). The existing one is just an alias for
SamrQueryDisplayInformation (see below).

* Added three extra info levels to SAMR_QUERY_DISPINFO. Info level 3 is
what was previously SAMR_ENUM_DOM_GROUPS; info levels 4 and 5 are
simple user/group list requests used by Win9x and I suspect (haven't
checked) the "low speed connection" User Manager.

* Added another two aliases for SAMR_QUERY_DISPINFO, opcodes 0x30 and
0x33. Usually the first is with info level 3 and the second 4 but there is
some overlap so indeed these should be implemented as just aliases.

* Return ERRDOS/ERRmoredata on extra data instead of
STATUS_BUFFER_OVERFLOW for Win95's benefit. On a named pipe this results
in an SMBreadX as usual.

Still need to fix SAMR_QUERY_DOMAIN_INFO which has a hard-coded number of
users and groups - which Win95 proceeds to truncate at.
0001-01-01 00:00:00 +00:00
Luke Leighton
e164b5080c samr_lookup_names "none found" error needed corrections with empty lists. 0001-01-01 00:00:00 +00:00
Luke Leighton
f7dfa55a2e cache unix groups so that two-level getgrent calls don't occur. 0001-01-01 00:00:00 +00:00
Luke Leighton
ad58cdfac6 fix for enumerate domain users (bug spotted by sean matthews).
also needed to use start index properly and generate next index.

both client and server code need to recognise error code 0x105
when there's not enough room to store all the users in one call.

sort this out another time.
0001-01-01 00:00:00 +00:00
Luke Leighton
d06d636994 adding srvsvc pipe. 0001-01-01 00:00:00 +00:00
Luke Leighton
8a85d7abed bugs in rpcclient. add_aliasmem uses a DOM_SID2 not a DOM_SID. 0001-01-01 00:00:00 +00:00
Luke Leighton
b8175702ef - lib/unix_sec_ctxt.c
attempt at taking lib/uid.c and getting a unix security context
	change module that is independent of "cnums" and "snums".
	a security context is needed for pipes, not just IPC$ or other
	services.

- group database API

	added add_group/alias_member, del_group/alias_member,
	del_group/alias_entry functions.  del_builtin_entry() is
	deliberately set to NULL to cause an exception, you cannot
	delete builtin aliases.

- parse_lsa.c srv_lsa.c

	fixed lookup_names code, it was a load of trash and didn't do
	anything.

- cmd_samr.c rpcclient.c srv_samr.c

	added "deletegroup", "deletealias", "delaliasmem", "delgroupmem",
	"addgroupmem", "addaliasmem", "createalias", "creategroup", to
	both client and server code.

	server code calls into unix stubs right now, which don't actually
	do anything.  the only instance where they are expected to do
	anything is in appliance mode NOT even in the ldap code or anything.

	client code modified to call samr_lookup_names() for group code
	(because we can) and lsa_lookup_names() for alias code (because
	we have to).

- srv_lookup.c

	oops, lookup on unsplit name, we got lookup on DOMAIN, DOMAIN\name
	instead of DOMAIN, name.
0001-01-01 00:00:00 +00:00
Luke Leighton
bf15343def added delete domain group and local group and delete domain group member. 0001-01-01 00:00:00 +00:00