1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

239 Commits

Author SHA1 Message Date
Gerald Carter
9fede0dc0d Large commit which restructures the local password storage API.
Currently the only backend which works is smbpasswd (tdb, LDAP, and NIS+)
are broken, but they were somewhat broken before. :)

The following functions implement the storage manipulation interface

/*The following definitions come from  passdb/pdb_smbpasswd.c  */

BOOL pdb_setsampwent (BOOL update);
void pdb_endsampwent (void);
SAM_ACCOUNT* pdb_getsampwent (void);
SAM_ACCOUNT* pdb_getsampwnam (char *username);
SAM_ACCOUNT* pdb_getsampwuid (uid_t uid);
SAM_ACCOUNT* pdb_getsampwrid (uint32 rid);
BOOL pdb_add_sam_account (SAM_ACCOUNT *sampass);
BOOL pdb_update_sam_account (SAM_ACCOUNT *sampass, BOOL override);
BOOL pdb_delete_sam_account (char* username);

There is also a host of pdb_set..() and pdb_get..() functions for
manipulating SAM_ACCOUNT struct members.  Note that the struct
passdb_ops {} has gone away.  Also notice that struct smb_passwd
(formally in smb.h) has been moved to passdb/pdb_smbpasswd.c
and is not accessed outisde of static internal functions in this
file.  All local password searches should make use of the the SAM_ACCOUNT
struct and the previously mentioned functions.

I'll write some documentation for this later.  The next step is to fix
the TDB passdb backend, then work on spliting the backends out into
share libraries, and finally get the LDAP backend going.

What works and may not:

	o domain logons from Win9x 	works
	o domain logons from WinNT 4	works
	o user and group enumeration
		as implemented by Tim	works
	o file and print access		works
	o changing password from
		Win9x & NT		ummm...i'll fix this tonight :)

If I broke anything else, just yell and I'll fix it.  I think it
should be fairly quite.





-- jerry
(This used to be commit 0b92d0838e)
2000-11-13 23:03:34 +00:00
Tim Potter
7c4c781df2 Remove duplicate group initialisation function.
Don't initialise groups twice.
(This used to be commit 5375261152)
2000-10-11 04:54:01 +00:00
Jeremy Allison
56d514235e Fix for null passwords being allowed bug.
Jeremy.
(This used to be commit d4d5548839)
2000-10-05 22:51:57 +00:00
Jeremy Allison
7ec53a14b1 With John Reilly help tracking it down - fixed a *nasty* bug when
authorising logins. If a user connected to a share as guest, then
the snum was getting flagged as "force guest", meaning that all
subsequent connections to it, even under a different vuid, would
be bounced to guest.
This explains several very hard to reproduce access denied bugs,
and as the NT client also has bugs in that it will sometimes
erroneously use guest instead of the correct vuid on an IPC$
connection lead to a *very* hard problem to find.
This fix should be propagated into all branches (TNG/Applience
take note) and I'll also make a separate patch availalble on the
samba-technical list.
Jeremy.
(This used to be commit 0264fdafe9)
2000-09-12 19:51:38 +00:00
Tim Potter
45d30f72ff Hopefully this should fix the primary group permission problem.
(This used to be commit 2f33ec41ac)
2000-09-07 08:43:05 +00:00
Jeremy Allison
a1f66a820d Fix for the SID history problem when using a Win2k domain controller
with security=domain. Also fixed to dynamically allocate the SIDs and GIDs.
Jeremy.
(This used to be commit 2b1f66eb82)
2000-09-06 01:06:39 +00:00
Jeremy Allison
7d93eb3483 smbd/password.c: Fixed typo in Tim's new code that caused insure overrun error.
smbd/reply.c: Fixed lowercasing UNIX character set problem.
Jeremy.
(This used to be commit 2b6e3ed7a6)
2000-08-28 20:45:00 +00:00
Tim Potter
66cc9787ef Merge bug - still getting used to dirdiff.
(This used to be commit cb717b4a2b)
2000-08-28 07:25:18 +00:00
Tim Potter
d12f3fea75 Merge from appliance branch.
(This used to be commit 567b0095b1)
2000-08-28 06:46:53 +00:00
Jeremy Allison
04de6d0258 Found the sec_ctx_stack overflow - a become_root() should have been an
unbecome_root() - typo.
Jeremy.
(This used to be commit ebb160663e)
2000-08-08 23:49:26 +00:00
Jeremy Allison
06e4f11acd Fixed up the user/group contexts when using authenticated pipes.
Added a become_root()/unbecome_root() (push/pop security context)
around the initgroups() call to ensure it would succeed. Hmmm - I
wonder if this call being done as non-root might explain any "group access"
bugs we've had in the past....
Jeremy.
(This used to be commit 06a65972e8)
2000-08-04 00:59:09 +00:00
Jeremy Allison
f87399915b Added an NT_USER_TOKEN structure that is copied/passed around associated
with the current user. This will allow se_access_check() to quickly do
a SD check without having to translate uid/gid's to SIDs.
Still needs work on pipe calls.
Jeremy.
(This used to be commit e28d01b744)
2000-08-03 22:38:43 +00:00
Jeremy Allison
17dcd9a834 Started to canonicalize our handling of uid -> sid code in order to
get ready and fix se_access_check().
Added cannonical lookup_name(), lookup_sid(), uid_to_sid(), gid_to_sid()
functions that look via winbind first the fall back on local lookup.

All Samba should use these rather than trying to call winbindd code
directly.

Added NT_USER_TOKEN struct in user_struct, contains list of NT sids
associated with this user.

se_access_check() should use this (cached) value rather than attempting
to do the same thing itself when given a uid/gid pair.

More work needs to be done to preserve these things accross security
context changes (especially with the tricky pipe problem) but I'm
beginning to see how this will be done..... probably by registering
a new vuid for an authenticated RPC pipe and not treating the
pipe calls specially.

More thoughts needed - but we're almost there...

Jeremy.
(This used to be commit 5e5cc6efe2)
2000-08-02 02:11:55 +00:00
Jeremy Allison
7f36df301e Tidyup removing many of the 0xC0000000 | NT_STATUS_XXX stuff (only need NT_STATUS_XXX).
Removed IS_BITS_xxx macros as they were just reproducing "C" syntax in a more
obscure way.
Jeremy.
(This used to be commit c55bcec817)
2000-08-01 18:32:34 +00:00
Tim Potter
5af35320a9 Spelling fixes.
(This used to be commit c1d242f1dd)
2000-07-10 04:57:09 +00:00
Tim Potter
2a1dbb0acd Delete OriginalDir stuff.
(This used to be commit 3d0f1845c8)
2000-06-23 05:57:48 +00:00
Tim Potter
31e83abd3d ZERO_STRUCT() of info3 structure before using it.
(This used to be commit efe7f818c9)
2000-06-14 01:48:08 +00:00
Jeremy Allison
03e0164270 Luke, I am moving the code back into passdb/passdb.c, this the correct
place to do this, not in smbd/passwd.c

Please don't change this without asking first, I have run this past
Andrew so talk to him (I'm on vacation next week).

I also removed the g_newXXX macros. There are essentially a private C extension,
not used anywhere else in the code, and add no functionality over malloc(XX)
and make the code harder to understand (everyone knows what malloc does).

Jeremy.
(This used to be commit e1b1b6fb67)
2000-06-09 18:45:31 +00:00
Luke Leighton
979f509e74 free NET_USER_INFO_3 gids when vuser invalidated.
(This used to be commit 2f056c2aad)
2000-06-09 03:30:54 +00:00
Luke Leighton
ad98207f54 dynamic allocation of NET_USER_INFO_3 gids.
jeremy, the intent is to call se_access_check() with usr-sid, grp-sid,
array-of-group-rids (but array-of-group-sids would do).

please do look at smbd/lanman.c's api_NetWkstaGetInfo, it will show you
that we really do need to store the entire NET_USER_INFO_3 structure.

then again, api_NetWkstaGetInfo is only used by win9x so who cares :)
(This used to be commit bd34f65239)
2000-06-09 03:00:34 +00:00
Luke Leighton
c3487b00dd reverted jeremy's changes that removed NET_USER_INFO_3. will you please
not just undercut work in progress, thank you.
(This used to be commit 86d440a88c)
2000-06-09 01:26:42 +00:00
Jeremy Allison
28555ec92e include/smb.h: Removed NET_USER_3 struct from user struct. It doesn't belong there (yet)
as there is no infrastructure for it. Replaced it with a dynamic array
				of group SIDs plus a user.
passdb/passdb.c: Added setup_user_sids() function. This is where the lookup should be done,
				eventually calling winbind.
smbd/password.c: Changed to call setup_user_sids(). Removed spurious DEBUG(0) statements.
smbd/reply.c: Removed extra parameter to register_vuid().

Jeremy.
(This used to be commit 425f4ad9a5)
2000-06-08 17:50:19 +00:00
Luke Leighton
84d40095e1 added a NET_USER_INFO_3 struct to user_struct.
register_vuid fills it with constructed info.
(This used to be commit b1889e4334)
2000-06-08 13:56:07 +00:00
Andrew Tridgell
da44845a09 moved secrets fns into secrets.c
(This used to be commit f890bcf067)
2000-06-03 06:22:19 +00:00
Andrew Tridgell
7f2b42abec got rid of lp_revalidate()
(This used to be commit 8dea95e62c)
2000-05-24 06:36:10 +00:00
Andrew Tridgell
479c73559e use "winbind separator" option for domain/user separator character
(This used to be commit 6cbb826b15)
2000-05-12 06:30:45 +00:00
Andrew Tridgell
ebd73f37a2 use our primary domain trust account for trusted domain authentication
(This used to be commit db90a4b960)
2000-05-12 05:07:26 +00:00
Andrew Tridgell
43a3faab08 - changed smb_getpwnam() to use winbind style usernames
- finished ntdom -> winbind rename in head
(This used to be commit ada483cb56)
2000-05-10 14:48:33 +00:00
Andrew Tridgell
a71d9b291c treat a blank "password server =" line as a "*" if in domain security
(This used to be commit 5a617c013c)
2000-05-10 13:21:32 +00:00
Andrew Tridgell
49a0e6d598 more merging voodoo
this adds "#define OLD_NTDOMAIN 1" in lots of places. Don't panic -
this isn't permanent, it should go after another few merge steps have
been done
(This used to be commit 92109d7b3c)
2000-05-10 10:41:59 +00:00
Andrew Tridgell
4c061ca15c - use smb_gwtpwnam() in another couple of places
- don't call add/del user if the scripts are empty
(This used to be commit 43860215d4)
2000-05-09 15:09:52 +00:00
Andrew Tridgell
2958dfcdf8 added secrets.tdb and changed storage of trust account password to use
it
(This used to be commit 88ad00b82a)
2000-05-08 10:42:21 +00:00
Andrew Tridgell
f6844e0b7e a minimal change to get appliance mode to work with winbindd
we needed to accept usernames of the form DOMAIN/user, which means we
needed to pass the domain to a getpwnam() like routine in certain
critical spots.

What I'd rather do is get rid of "char *user" everywhere and use the
new userdom_struct, but that will have to wait a few days.
(This used to be commit 8b7a10febe)
2000-05-04 16:01:47 +00:00
Andrew Tridgell
f3a861e04e - use full_name instead of real_name
- got rid of guest map code in lpq parser
(This used to be commit 8e53f781d3)
2000-05-04 07:59:34 +00:00
Jeremy Allison
99352a0986 Insure uninitialized memory read fixes.
Jeremy.
(This used to be commit 577ddbfbec)
2000-05-03 02:24:01 +00:00
Andrew Tridgell
32d5416b6a split the username in the vuser structure into a separate
userdom_struct. As the name implies this also contains a domain
(unused at the moment).

This will be important shortly, as operation in appliance mode needs
the domain to be always carried with the username.
(This used to be commit ee8546342d)
2000-05-02 13:55:42 +00:00
Jeremy Allison
693ffb8466 Added sys_fork() and sys_getpid() functions to stop the overhead
of doing a system call every time we want to just get our pid.
Jeremy.
(This used to be commit 148628b616)
2000-05-02 02:23:41 +00:00
Andrew Tridgell
8d7e498db1 converted a couple more functions to use a fd instead of a FILE*
added a new utility fn file_lines_slashcont() which is used to handle
files that treat a \ followed by a newline as a blank
(This used to be commit 384ecd9d66)
2000-04-16 11:17:19 +00:00
Andrew Tridgell
2fa922611b finally got sick of the "extern int Client" code and the stupid
assumption that we have one socket everywhere

while doing so I discovered a few bugs!

1) the clientgen session retarget code if used from smbd or nmbd would
cause a crash as it called close_sockets() which closed our main
socket! fixed by removing close_sockets() completely - it is unnecessary

2) the caching in client_addr() and client_name() was bogus - it could
easily get fooled and give the wrong result. fixed.

3) the retarget could could recurse, allowing an easy denial of
service attack on nmbd. fixed.
(This used to be commit 5937ab14d2)
2000-04-11 13:55:53 +00:00
Luke Leighton
83ee9372fc you know, when you do a cvs commit, you _really_ expect it to actually work.
this explains why j-f wasn't happy.
(This used to be commit c51e38214a)
2000-03-10 18:10:10 +00:00
Jeremy Allison
3cf31a194f Added replacement functions sys_popen and sys_pclose. These are based
on the glibc source code and are safer than the traditional popen as
they don't use a shell to exec the requested command. Now we have
these functions they can be tightened up (environment etc.) as required
to make a safe popen. It should now be safe to add the environement
variable loading code to loadparm.c
Jeremy.
(This used to be commit b52e92b09d)
2000-02-15 19:36:47 +00:00
Andrew Tridgell
171da4d787 this looks like a big commit, but it isn't really :)
This fixes our netbios scope handling. We now have a 'netbios scope' option
in smb.conf and the scope option is removed from make_nmb_name()

this was prompted by a bug in our PDC finding code where it didn't append
the scope to the query of the '*' name.
(This used to be commit b563be824b)
2000-01-07 06:55:36 +00:00
Jeremy Allison
7434c1aabd Fixed getgrent() recurse problem.
Jeremy.
(This used to be commit b5420f6152)
2000-01-04 01:01:27 +00:00
Andrew Tridgell
632b4f806e added suppport for unexpected udp/138 packets
I also fixed up the lookup_pdc_name() code so that it now works, even
with a NT server that insists on replying to udp/138.

The method I used to match packets was to use the mailslot string as a
datagram ID. The true dgm_id doesn't work as NT doesn't set it
correctly. uggh.

PS: Jeremy, I had to change your code quite a bit, are you sure this
worked with a Samba PDC?? The code looked broken, it got the offsets
wrong in the SMB portion of the packet and filled in the IP
incorrectly.
(This used to be commit 32f66f4ea6)
2000-01-03 06:30:50 +00:00
Andrew Tridgell
3db52feb1f first pass at updating head branch to be to be the same as the SAMBA_2_0 branch
(This used to be commit 453a822a76)
1999-12-13 13:27:58 +00:00
Luke Leighton
f6276724ba changed function name of get_home_dir() to get_unixhome_dir(), to stop
clash with gnu readline library.

fixed issue with [homes] service not being there - call lp_add_home()
just before starting the msrpc processing.
(This used to be commit 054195df9b)
1999-12-12 21:00:35 +00:00
Luke Leighton
4f8a24522c final part of "first" phase converting over to msrpc daemon architecture.
done a minimal amout of clean-up in the Makefile, removing unnecessary
modules from the link stage.  this is not complete, yet, and will
involve some changes, for example to smbd, to remove dependencies on
the password database API that shouldn't be there.  for example,
smbd should not ever call getsmbpwXXX() it should call the Samr or Lsa
API.

this first implementation has minor problems with not reinstantiating
the same services as the caller.  the "homes" service is a good example.
(This used to be commit caa5052522)
1999-12-12 20:03:42 +00:00
Luke Leighton
0ce128e355 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()...)
(This used to be commit aa3c659a8d)
1999-12-12 01:25:49 +00:00
Luke Leighton
a0ba234cf9 the first independent msrpc daemon - lsarpcd.
one horrible cut / paste job from smbd, plus a code split of shared
components between the two.

the job is not _yet_ complete, as i need to be able to do a become_user()
call for security reasons.  i picked lsarpcd first because you don't
_need_ security on it (microsoft botched so badly on this one, it's not
real.  at least they fixed this in nt5 with restrictanonymous=0x2).
fixing this involves sending the current smb and unix credentials down
the unix pipe so that the daemon it eventually goes to can pick them
up at the other end.

i can't believe this all worked!!!
(This used to be commit 2245b0c6d1)
1999-12-06 00:44:32 +00:00
Luke Leighton
b96e4e4f7d domain_client_validate() no longer takes serverlist, it calls
get_any_dc_name().
(This used to be commit e21367c0eb)
1999-12-02 19:07:13 +00:00
Luke Leighton
c15b95cd1e cli_session_setup() now takes an extra argument (host name). hey, what
the heck is a cli_session_setup() call doing in here???  this should use
cli_establish_connection()server!
(This used to be commit fa054c96c6)
1999-12-01 21:47:30 +00:00
Luke Leighton
0d44ff9a76 attempting to resolve the issue that multiple servers often specified in
parameters to connect to \PIPE\NETLOGON.
(This used to be commit d1986ade30)
1999-11-29 21:47:14 +00:00
Luke Leighton
32b9508d06 implement server-side generation of NTLMv2 session key. YESSS :-)
(This used to be commit 1092b4f6fb)
1999-11-21 19:59:56 +00:00
Luke Leighton
680dcc9341 hmmm... have to add client-side support in domain_client_validate() to
_use_ user session key.
(This used to be commit be6a6b1393)
1999-11-21 17:27:20 +00:00
Luke Leighton
4081147c31 adding user session key into network netlogon response.
(This used to be commit c73f6b0d02)
1999-11-21 17:11:00 +00:00
Luke Leighton
387cc182e6 oops, #ifdef'd cli_shutdown out, as the fun has _already_ started:
NT refuses to play nice, and establish a trust relationship.
(This used to be commit 98c42764fb)
1999-11-20 22:05:31 +00:00
Luke Leighton
27b8df4d9b attempting to establish inter-domain trust relationships. modified
smbpasswd so it can be used to set up inter-domain trust account.
(This used to be commit 99ec0620c3)
1999-11-20 21:59:16 +00:00
Luke Leighton
24a069eac3 modified domain_client_validate to take trust account name / type. this
is to pass DOMAIN_NAME$ and SEC_CHAN_DOMAIN instead of WKSTA_NAME$ and
SEC_CHAN_WKSTA.

modified check_domain_security to determine if domain name is own domain,
and to use wksta trust account if so, otherwise check "trusting domains"
parameter and use inter-domain trust account if so, otherwise return
False.
(This used to be commit 97ec74e1fa)
1999-11-20 20:54:29 +00:00
Luke Leighton
902b53dcc0 cli_nt_setup_creds() returns uint32 NT status code not a BOOL.
removed all comparisons to if (fn() == False), replaced with if (!fn()).
(This used to be commit fdef97eb7c)
1999-10-29 15:53:18 +00:00
Luke Leighton
6f9105c853 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).
(This used to be commit 8976eca2db)
1999-10-21 16:53:50 +00:00
Luke Leighton
33ed8059a2 NTLMv2 check being actioned when NT password response was only 24 chars.
added check to ensure response is more than 24 chars before bothering
to do an NTLMv2 check.
(This used to be commit 7a58895ff2)
1999-07-16 22:23:45 +00:00
Luke Leighton
0262b2a6b4 copy of password struct needed to be made prior to calling copy_passwd_struct
found by Bertl <bs@vpnet.at>.
(This used to be commit 93298bca1c)
1999-07-16 22:03:15 +00:00
Luke Leighton
92b8937bae added %d %d to error message, try to track down the uid / smb_uid mismatch
(This used to be commit ec918ba144)
1999-07-15 17:50:27 +00:00
Luke Leighton
527820d306 oops, refused lm when ntlmv2 was true not false/auto. oops!
(This used to be commit 6b4b24d220)
1999-07-07 16:44:38 +00:00
Luke Leighton
ec711742c0 smb_password_ok() checking incorrectly whether lm password exists.
when lmcompatibilitylevel=0x2 on nt sp4+ clients, lm# is not sent.
(This used to be commit e655e68474)
1999-07-06 21:25:42 +00:00
Luke Leighton
73891ca8e4 improving authentication code (tidyup).
(This used to be commit ab1a6aa42d)
1999-06-29 18:47:06 +00:00
Tim Potter
731c7f2ecf Moved code that changes the pw_passwd entry (i.e shadow password and
weird unixware stuff) into _Get_Pwnam() to fix a memory allocation bug.

Note that the Get_Pwnam() function now returns a const struct passwd *
as a hint to other developers not to change entries in the struct
passwd.
(This used to be commit 36d7cb4ccc)
1999-06-13 04:14:24 +00:00
Luke Leighton
150645f955 Jani Jaakkola's "getpwuid() / getpwnam()" hash-cache-hack
(This used to be commit 899fc053c5)
1999-05-06 18:05:45 +00:00
Luke Leighton
43a460075a 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.
(This used to be commit 2e58ed7424)
1999-03-25 13:54:31 +00:00
Luke Leighton
bd76e02ec4 going to start adding inter-domain trust logons soon.
(This used to be commit f9f594c03e)
1999-03-19 15:49:22 +00:00
Luke Leighton
c4241b5662 cli_setup_creds new arguments added.
(This used to be commit 5fa3a3f710)
1999-03-12 19:37:40 +00:00
Luke Leighton
e67a8d9d98 server_cryptkey() now calling cli_connectserverlist(). stupid microsoft
idiotic *SMBSERVER connectionism added to cli_connect_serverlist().
also added check for protocol < LANMAN2.
(This used to be commit c2bcb3a286)
1998-12-14 21:22:59 +00:00
Luke Leighton
9c848ec329 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.
(This used to be commit bee8f7fa6b)
1998-12-07 20:23:41 +00:00
Luke Leighton
f3787515d6 moved get_unixgroups it will be needed by the unix instance of the group
DB API
(This used to be commit ef58e48bc9)
1998-12-03 17:41:14 +00:00
Luke Leighton
30038de462 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...
(This used to be commit 5d5d7e4de7)
1998-11-29 20:03:33 +00:00
Andrew Tridgell
091a92e996 try to use *SMBSERVER to connect to password server if the first
session_request fails.
(This used to be commit ab2370e7ac)
1998-11-21 01:28:15 +00:00
Jeremy Allison
a97baa50fd smbd/password.c: Added *SMBSERVER fix is name is too long.
web/swat.c: Changed '?' to help.
Jeremy.
(This used to be commit 631913ea85)
1998-11-21 00:16:28 +00:00
Jeremy Allison
768761820e Added the same open()/fopen()/creat()/mmap() -> sys_XXX calls.
Tidied up some of the mess (no other word for it). Still doesn't
compile cleanly. There are calls with incorrect parameters that
don't seem to be doing the right thing.

This code still needs surgery :-(.

Jeremy.
(This used to be commit 18ff93a9ab)
1998-11-17 20:50:07 +00:00
Luke Leighton
74d539f557 - 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.
(This used to be commit 0d21e1e609)
1998-11-17 16:19:04 +00:00
Andrew Tridgell
8c62b28e0e converted smbclient to use clientgen.c rather than clientutil.c
I did this when I saw yet another bug report complaining about
smbclient intermittently missing files. Rather than applying more
patches to smbclient it was better to move to the more robust
clientgen.c code.

The conversion wasn't perfect, I probably lost some features of
smbclient while doing it, but at least smbclient should be consistent
now. It if fails it should _always_ fail rather than giving people the
false impression of a reliable utility.

the tar stuff seems to work, but hasn't had much testing as I never
use it myself. I'm sure someone will find bugs in my conversion of
smbtar.c. It was quite tricky as it did a lot of its own SMB calls. It
now uses clientgen.c exclusively.

smbclient is still quite messy, but at least it doesn't build its own
SMB packets.

I haven't touched smbmount as I never use it. Mike, do you want to
convert smbmount to use clientgen.c?
(This used to be commit e14ca7765a)
1998-11-09 03:45:49 +00:00
Jeremy Allison
548b417d40 codepages/codepage_def.936: Updated comment.
param/loadparm.c: Removed "networkstation user login", "domain controller", and "domain sid" parameters.
passdb/passdb.c: Removed "networkstation user login" code and changed bug test code
                 to only check once for a bad password server. This will stop the
                 complaints of many "bad login" audit records in NT PDC logs.
utils/smbpasswd.c: Removed check for "domain controller".
Jeremy.
(This used to be commit d6e6e936b5)
1998-11-07 05:32:37 +00:00
Jeremy Allison
6e3af45afe Fixed mainly signed/unsigned issues found by SGI cc in -fullwarn mode.
smbd/chgpasswd.c: Fixed (my) stupid bug where I was returning stack based variables. Doh !
smbd/trans2.c: Allows SETFILEINFO as well as QFILEINFO on directory handles.
Jeremy.
(This used to be commit 0b44d27d0b)
1998-10-21 16:58:34 +00:00
Luke Leighton
01de603084 - dce/rpc code
- removed debug info in struni2 and unistr2 (security risk)

- rpc_pipe function was getting pointer to data then calling realloc *dur*

- password check function, the start of "credential checking",
  user, wks, domain, pass as the credentials (not just user,pass which
  is incorrect in a domain context)

- cli_write needs to return ssize_t not size_t, because total can be -1
  if the write fails.

- fixed signed / unsigned warnings (how come i don't get those any more
  when i compile with gcc???)

- nt password change added in smbd.  yes, jeremy, i verified that the
  SMBtrans2 version still works.
(This used to be commit fcfb40d2b0)
1998-10-19 17:32:10 +00:00
Luke Leighton
b6993a89af !pass -> pass != NULL is wrong: !pass -> pass == NULL is correct. oops.
(This used to be commit 866e101818)
1998-10-16 21:41:42 +00:00
Luke Leighton
97f0c9d550 made pass_check_smb() available for dce/rpc use.
(This used to be commit 95e8a910c5)
1998-10-16 21:36:19 +00:00
Luke Leighton
3637ad5f2b cli_nt_session_open() encrypt arg removed
(This used to be commit 63def71799)
1998-10-16 20:18:46 +00:00
Luke Leighton
5cb99177af setup_groups() - code clarification. no functional change.
(This used to be commit dae7c5ea9a)
1998-10-16 20:13:26 +00:00
Luke Leighton
c404bb7754 rpcclient interactive login (with trust account changing if you are root)
cli_session_setup handles null sessions correctly
(This used to be commit 60c0f22a4e)
1998-10-15 23:51:07 +00:00
Jeremy Allison
fc7d3e4caa config: Fix crypt prototype on RedHat Linux.
include/includes.h: Fix crypt prototype on RedHat Linux.
smbd/fileio.c: Fix mmap bug found by WinCE client.
smbd/ipc.c: Fix WinCE wierdness with pipes being opened as \server\pipe\lanman
smbd/password.c: Fix encrypted null passwords.
Jeremy.
(This used to be commit 475992730c)
1998-10-15 00:55:17 +00:00
Luke Leighton
935dc98f66 dce/rpc
(This used to be commit 69f5f9f889)
1998-10-14 06:29:20 +00:00
Andrew Tridgell
99208208fa use level 0 for DEBUG() of malformed password entry in smbpasswd
(This used to be commit bff457b4a4)
1998-10-13 14:14:09 +00:00
Luke Leighton
f8a3e2df11 using wrong cli_state in "security = domain" call.
(This used to be commit 1c08cc2466)
1998-10-06 16:25:24 +00:00
Andrew Tridgell
40984f6b55 - modified resolve_name() to take a name_type
- cleaned up resolve_name() (split into separate functions for each resolver)
- if can't find local master then use #1B name
- support listing of foreign workgroups in /smb/
(This used to be commit a4e607c17d)
1998-10-04 12:00:40 +00:00
Jeremy Allison
9066025a8a Got very strict about the differences and uses of
uid_t, gid_t and vuid. Added sys_getgroups() to get
around the int * return problem. Set correct datatypes
for all uid, gid and vuid variables.
Jeremy.
(This used to be commit e570db46fc)
1998-09-29 20:24:17 +00:00
Jeremy Allison
cf3a9741dc Changes to test in configure if capabilities are enabled on a system.
Changes to get Samba to compile cleanly with the IRIX compiler
with the options : -fullwarn -woff 1209,1174 (the -woff options
are to turn off warnings about unused function parameters and
controlling loop expressions being constants).
Split prototype generation as we hit a limit in IRIX nawk.
Removed "." code in smbd/filename.c (yet again :-).
Jeremy.
(This used to be commit e0567433bd)
1998-09-28 21:43:48 +00:00
Luke Leighton
66d5d73a5d added rpcclient program
(This used to be commit aa38f39d67)
1998-09-25 21:01:52 +00:00
Andrew Tridgell
f6044c87c0 some cleanups to use ZERO_STRUCT() and friends
(This used to be commit 7b154dc431)
1998-09-05 13:24:20 +00:00
Andrew Tridgell
e9ea36e4d2 tridge the destroyer returns!
prompted by the interpret_security() dead code that Jean-Francois
pointed out I added a make target "finddead" that finds potentially
dead (ie. unused) code. It spat out 304 function names ...

I went through these are deleted many of them, making others static
(finddead also reports functions that are used only in the local
file).

in doing this I have almost certainly deleted some useful code. I may
have even prevented compilation with some compile options. I
apologise. I decided it was better to get rid of this code now and add
back the one or two functions that are needed than to keep all this
baggage.

So, if I have done a bit too much "destroying" then let me know. Keep
the swearing to a minimum :)

One bit I didn't do is the ubibt code. Chris, can you look at that?
Heaps of unused functions there. Can they be made static?
(This used to be commit 2204475c87)
1998-09-05 05:07:05 +00:00
Andrew Tridgell
61b5fd6f32 bounds check next_token() to prevent possible buffer overflows
(This used to be commit 3eade55dc7)
1998-08-31 03:11:42 +00:00
Jeremy Allison
5e5e320d36 This is the stat cache code - seems to work fine (needs heavy
NetBench testing though.... :-). Attempts to efficiently reduce
the number of stat() calls Samba does.
Jeremy.
(This used to be commit d0e48a2d80)
1998-08-27 20:38:53 +00:00