1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-31 17:18:04 +03:00
Commit Graph

113 Commits

Author SHA1 Message Date
Luke Leighton
b60eb8c9fc use of safe_cli_errstr() and cli_establish_connection(). 0001-01-01 00:00:00 +00:00
Luke Leighton
ab1a6aa42d improving authentication code (tidyup). 0001-01-01 00:00:00 +00:00
Luke Leighton
ac0060443d safe string error reporting functions (found a potential buffer overflow
of a pstrcpy into an fstring).
0001-01-01 00:00:00 +00:00
Matthew Chapman
c3c25e762f Some more BDC-related fixes, mainly to the NET_SAM_SYNC RPC with respect
to alignment, missing fields, etc. - it should now work correctly.
There is still the problem of decoding the private data field.
0001-01-01 00:00:00 +00:00
Jean-François Micouleau
66b4b896fb Added a new command to rpcclient: eventlog <log> where <log> is System,
Security or Application. That's a crude equivalent to the eventviewer.

	Jean Francois
0001-01-01 00:00:00 +00:00
Matthew Chapman
f456dcf08e Adding "time" rpcclient command which displays the remote time.
Also added special "now" time to the "at" command, e.g.:
  at now /i cmd   ; pops up a command prompt
0001-01-01 00:00:00 +00:00
Matthew Chapman
cf30a472f7 Adding scheduler control pipe (\atsvc), client-side routines, and rpcclient
command "at" (compatible with NT's "at" command - see rpcclient commit) -
useful for remote NT administration.
0001-01-01 00:00:00 +00:00
Matthew Chapman
7b830350eb Mainly BDC-related changes.
* Added SEC_CHAN_BDC
* Propagate sec_chan into the various functions which change trust account
  passwords, so they can be used for domain control and inter-domain
  trusts.
* Fix for endianness problem reported by Edan Idzerda <edan@mtu.edu>. A
  BUFFER2 is really a "unibuf" in my terminology and we should treat it as
  such.
* Added some more common NT structures (BIGINT, BUFHDR2, BUFFER4).
* Added NET_SAM_SYNC (-> NetDatabaseSync2) RPC for account replication.
  Still experimental and incomplete, with a few too many NULL security
  descriptors lying around (must go look at Jeremy's SD code). Haven't
  worked out password encryption yet either.
  However, the XXX_INFO structures I've added to rpc_netlogon.h are quite
  nice as they give some insight into how these objects are stored in the
  SAM.
0001-01-01 00:00:00 +00:00
Matthew Chapman
6d03f61d25 Fixed LSA Lookup Names. There were a few too many NULL pointers in a
negative response, which tended to crash lsass.exe.
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
90b6fce780 Fixed a typo where the RPC header mem_buffer was initialised as 0x8 bytes long
rather than 0x18. Rather nasty, I doubt the client ever worked for multiple
PDU's.
0001-01-01 00:00:00 +00:00
Luke Leighton
fefb4bf191 added a "createuser" command. 0001-01-01 00:00:00 +00:00
Luke Leighton
96e358a2f0 valid_pol in lsa_query_secret() needed to be initialised to False. 0001-01-01 00:00:00 +00:00
Matthew Chapman
5951e16a11 querysecret now shows the real, fairdinkum, decrypted secret :-) 0001-01-01 00:00:00 +00:00
Matthew Chapman
365fa3b5fb Adding LSA_OPENSECRET (-> LsarOpenSecret) and LSA_QUERYSECRET
(-> LsarQuerySecret) on client side, including rpcclient command
"querysecret" for others to play with.

The major obstacle is working out the encryption algorithm used
for the secret value. It definitely uses the NT hash as part of the
key, and it seems the block size is 64 bits - probably DES based -
but I can't work out what's done in between. Help required.
0001-01-01 00:00:00 +00:00
Luke Leighton
65b0abe8b7 new "domtrust" test command. r&d into inter-domain trust accounts. 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
ec1b7000fd added jeremy's new c++-like code for parsing of security descriptors. 0001-01-01 00:00:00 +00:00
Luke Leighton
59f081069a rpcclient shutdown command 0001-01-01 00:00:00 +00:00
Matthew Chapman
ce24191939 Always null-terminate strings.
Also some string length and sizeof(pointer) corrections.
0001-01-01 00:00:00 +00:00
Matthew Chapman
a1d39af1ce UNICODE cleanup (see lib/util_unistr.c).
No more ugly static library buffers and all functions take a destination
string length (especially unistrcpy was rather dangerous; we were only
saved by the fact that datagrams are limited in size).
0001-01-01 00:00:00 +00:00
Luke Leighton
ac72fe1ab3 removal of the use of unistrn2 function: replace it with unistr2_to_str
which is more appropriate.
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
a022710f1e rpcclient "Service Control Manager" svcenum [-i] command. 0001-01-01 00:00:00 +00:00
Luke Leighton
f4dd8f6b56 Service Control Manager - service enumeration. 0001-01-01 00:00:00 +00:00
Luke Leighton
0b2095e092 added sid_name_use array argument to lsa_lookup_names and lsa_lookup_sids. 0001-01-01 00:00:00 +00:00
Luke Leighton
dacf5b152b adding some enumerate services code, client and server. 0001-01-01 00:00:00 +00:00
Luke Leighton
e5ee965f8d adding "Service Control Manager" commands to rpcclient. 0001-01-01 00:00:00 +00:00
Luke Leighton
d06d636994 adding srvsvc pipe. 0001-01-01 00:00:00 +00:00
Luke Leighton
bee8f7fa6b removed nt_pipe_fnum from struct cli_state. need to be able to call
LsaLookupSids etc from within SamrQueryAliasMembers, for example.
fnum is now a parameter to client functions.  thanks to mike black
for starting the ball rolling.
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
aabb4b3bc5 fixing "addgroupmem" and "enumgroups -m" commands, samr_open_group()
needed a flags fields as you get 0x0000 0010 and 0x0000 001f unknown
values for different purposes, no-one's going to tell us what they
are and i don't CARE!
0001-01-01 00:00:00 +00:00
Luke Leighton
165b15a8ca - oops, i got "add alias member" and "delete alias member" swapped.
- samr_enum_dom_users, the first 4 bytes is some sort of garbage,
  nt5-beta2 clears them out to zeros whereas nt4 does not.
  fixed bug where we were assuming that the first 4 bytes of a
  response _had_ to be non-zero.

- cli_lsarpc.c: forgot to append the rid on the lsa_lookup_names()
  client call.

- added in "addaliasmem" and "addgroupmem" commands.  the addaliasmem
  command actually turned out to be a "delaliasmem" :-) :-)

- parse_lsa.c: moved assert array check to after the size of useable
  array space is set...
0001-01-01 00:00:00 +00:00
Luke Leighton
eacc5e581a - renamed do_samr_xxx to samr_xxx
- renamed do_lsa_xxx to lsa_xxx

- added "enumgroups [-m]" command, enumerates groups, shows members.
- added cmd_sam_add_groupmem(), need to call these in rpcclient.c
- added cmd_sam_add_aliasmem(), need to call these in rpcclient.c

- modified "enumaliases [-m]" command

- improved "enumgroups" and "enumaliases" to display names not just RIDS/SIDs.

- renamed "samr_unknown_12" to "samr_lookup_rids".

- added the following client-side functions:

	get_samr_query_groupmem()
	get_samr_query_aliasmem()
	get_samr_query_groupinfo()
	samr_enum_dom_groups()
	samr_enum_dom_aliases()
	samr_add_aliasmem()
	samr_add_groupmem()

- improved display output (display.c)
0001-01-01 00:00:00 +00:00
Luke Leighton
4771d5451b added createalias command to rpcclient 0001-01-01 00:00:00 +00:00
Luke Leighton
1e5d81c154 create domain group command (creategroup) added to rpcclient.
renamed do_samr_xxxx to samr_xxxx.
0001-01-01 00:00:00 +00:00
Luke Leighton
74f826af36 jeremy's going to do me in, again.
jean-francois' going to get annoyed, again.
andrew's going to threaten to take cvs access away, again.

missed compilation of this file when updating sam_unknown_12 call.
0001-01-01 00:00:00 +00:00
Luke Leighton
779a7aa30d issues spotted by andrej: %s\\%s not %s\%s 0001-01-01 00:00:00 +00:00
Luke Leighton
e4930f5f48 - adding builtin[alias]db.
- lib/sids.c:

	generate_sam_sid() modified to take a domain name: it now
	generates "DOMAIN_NAME.SID".  reasons:

	1) if you run multiple samba servers on the same machine
	under different netbios names as members of a domain,
	they won't all use the same SID, which is a _big_ mistake
	but it would happen _by default_.

	2) we have (had) a problem with sid_to_string() and string_to_sid()
	which cause SIDs to be incorrectly read.  one of the major
	reasons for *NOT* making this change was so as not to disrupt
	existing users.  but as they will be anyway by this bug,
	we might as well go ahead.

- passdb/smbpass.c:

	wanted to change the meaning of the name in the smbpasswd
	file to an "nt" name not a "unix" name.  this is probably
	not a good idea: reverted this.

- output formatting / bug-fixing in rpcclient query_useraliases code.
0001-01-01 00:00:00 +00:00
Luke Leighton
5d5d7e4de7 weekend work. user / group database API.
- split sam_passwd and smb_passwd into separate higher-order function tables

- renamed struct smb_passwd's "smb_user" to "unix_user".  added "nt_user"
plus user_rid, and added a "wrap" function in both sam_passwd and smb_passwd
password databases to fill in the blank entries that are not obtained
from whatever password database API instance is being used.

NOTE: whenever a struct smb_passwd or struct sam_passwd is used, it MUST
be initialised with pwdb_sam_init() or pwd_smb_init(), see chgpasswd.c
for the only example outside of the password database APIs i could find.

- added query_useraliases code to rpcclient.

- dealt with some nasty interdependencies involving non-smbd programs
and the password database API.  this is still not satisfactorily
resolved completelely, but it's the best i can do for now.

- #ifdef'd out some password database options so that people don't
mistakenly set them unless they recompile to _use_ those options.

lots of debugging done, it's still not finished.  the unix/NT uid/gid
and user-rid/group-rid issues are better, but not perfect.  the "BUILTIN"
domain is still missing: users cannot be added to "BUILTIN" groups yet,
as we only have an "alias" db API and a "group" db API but not "builtin-alias"
db API...
0001-01-01 00:00:00 +00:00
Luke Leighton
68342a29a8 LsaLookupNames client call (first used as lookupnames command in rpcclient). 0001-01-01 00:00:00 +00:00
Jeremy Allison
34d8f4b1c4 acconfig.h configure configure.in include/config.h.in: Added -lsec and -lsecurity checks
in a more sane way.
rpc_client/cli_netlogon.c: Removed correct bits check to see if this works with an NT3.51 PDC.
rpc_parse/parse_samr.c: Fixed compile warnings.
Jeremy.
0001-01-01 00:00:00 +00:00
Luke Leighton
0d21e1e609 - group database API. oops and oh dear, the threat has been carried out:
the pre-alpha "domain group" etc parameters have disappeared.

- interactive debug detection

- re-added mem_man (andrew's memory management, detects memory corruption)

- american spellings of "initialise" replaced with english spelling of
  "initialise".

- started on "lookup_name()" and "lookup_sid()" functions.  proper ones.

- moved lots of functions around.  created some modules of commonly used
  code.  e.g the password file locking code, which is used in groupfile.c
  and aliasfile.c and smbpass.c

- moved RID_TYPE_MASK up another bit.  this is really unfortunate, but
  there is no other "fast" way to identify users from groups from aliases.
  i do not believe that this code saves us anything (the multipliers)
  and puts us at a disadvantage (reduces the useable rid space).
  the designers of NT aren't silly: if they can get away with a user-
  interface-speed LsaLookupNames / LsaLookupSids, then so can we.  i
  spoke with isaac at the cifs conference, the only time for example that
  they do a security context check is on file create.  certainly not on
  individual file reads / writes, which would drastically hit their
  performance and ours, too.

- renamed myworkgroup to global_sam_name, amongst other things, when used
  in the rpc code.  there is also a global_member_name, as we are always
  responsible for a SAM database, the scope of which is limited by the role
  of the machine (e.g if a member of a workgroup, your SAM is for _local_
  logins only, and its name is the name of your server.  you even still
  have a SID.  see LsaQueryInfoPolicy, levels 3 and 5).

- updated functionality of groupname.c to be able to cope with names
  like DOMAIN\group and SERVER\alias.  used this code to be able to
  do aliases as well as groups.  this code may actually be better
  off being used in username mapping, too.

- created a connect to serverlist function in clientgen.c and used it
  in password.c

- initialisation in server.c depends on the role of the server.  well,
  it does now.

- rpctorture.  smbtorture.  EXERCISE EXTREME CAUTION.
0001-01-01 00:00:00 +00:00
Jeremy Allison
4c2b5a0098 Makefile.in configure configure.in include/config.h.in: Changes for DGUX and UNIXWARE.
groupdb/aliasdb.c groupdb/aliasfile.c groupdb/groupfile.c: Don't use snprinf, use slprintf.
include/includes.h: Fix YP problem.
include/smb.h: Fix ZERO_STRUCTP.
lib/util_sock.c: Added strerror() in debugs.
passdb/ldap.c: Don't use snprinf, use slprintf.
rpc_client/cli_lsarpc.c rpc_client/cli_pipe.c rpc_parse/parse_sec.c rpc_server/srv_pipe.c: Don't use snprinf, use slprintf.
script/installman.sh: DGUX changes.
smbd/open.c smbd/oplock.c: Fixed gcc warnings.
web/swat.c: Changes USER to SWAT_USER.
0001-01-01 00:00:00 +00:00
Luke Leighton
9412edfd4c security descriptors 0001-01-01 00:00:00 +00:00
Luke Leighton
06abdfd68e security descriptors.
kanji const char* warnings.
0001-01-01 00:00:00 +00:00
Luke Leighton
cbac0f165d cleaning up conflicts between group code not yet committed and
changes from yesterday by me, jeremy and andrew.

jeremy, your ACB_PWNOTREQ mod would have caused a crash if the user
didn't exist (first check should be for smb_pass != NULL)
0001-01-01 00:00:00 +00:00
Jeremy Allison
45131501f2 Moved some code (NTLMSSPcalc) out of smbdes and inline for paranioa
resons and my own piece of mind...
Jeremy.
0001-01-01 00:00:00 +00:00
Luke Leighton
abdc9d790b clearing up security descriptor 0001-01-01 00:00:00 +00:00
Luke Leighton
13a0ee851f changed syntax of registry commands so keys can start with HKLM or HKU.
sorted lookupsids command
0001-01-01 00:00:00 +00:00