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

50 Commits

Author SHA1 Message Date
Gerald Carter
a9b2a40682 hack for unmarshalling unistr's on machines with BIG_ENDIAN arch
I think we have a lot more of these bugs lurking (i'm fairly
confident of it).




jerry
(This used to be commit 3b14487c7e)
2000-08-16 03:44:04 +00:00
Gerald Carter
2ca88a0f2d fixes to prs_unistr UNMARSHALLING only. Problem was due to talloc's
of 0 bytes.



jerry
(This used to be commit 3fcc59ba92)
2000-08-12 14:31:29 +00:00
Gerald Carter
2f9a0f83fe deal with allocation size of 0 in prs_unistr when UNMARSHALLING
jerry
(This used to be commit 26a73a70e2)
2000-08-10 14:00:40 +00:00
Jeremy Allison
49fcb300de Added John Reilly's enumports/addprinter/delprinter scripting code plus the
fix for the Win9x printer drivers.
Changed command names to add "command" string on the end for some consistancy
with the other scripting commands.
Added '%P' option to tdbpack/unpack to store long comment string.
Made port name be "Samba Printer Port" if no enum port script given.
Fixed prs_uint32_pre code to cope with null args.
Jeremy.
(This used to be commit 902ada6379)
2000-07-31 20:41:51 +00:00
Jeremy Allison
5ec1642809 Ok - this is a *BIG* change - but it fixes the problems with static strings
in the RPC code. This change was prompted by trying to save a long (>256)
character comment in the printer properties page.

The new system associates a TALLOC_CTX with the pipe struct, and frees
the pool on return of a complete PDU.

A global TALLOC_CTX is used for the odd buffer allocated in the BUFFERxx
code, and is freed in the main loop.

This code works with insure, and seems to be free of memory leaks and
crashes (so far) but there are probably the occasional problem with
code that uses UNISTRxx structs on the stack and expects them to contain
storage without doing a init_unistrXX().

This means that rpcclient will probably be horribly broken.
A TALLOC_CTX also needed associating with the struct cli_state also,
to make the prs_xx code there work.

The main interface change is the addition of a TALLOC_CTX to the
prs_init calls - used for dynamic allocation in the prs_XXX calls.

Now this is in place it should make dynamic allocation of all RPC
memory on unmarshall *much* easier to fix.

Jeremy.
(This used to be commit 0ff2ce543e)
2000-07-27 00:47:19 +00:00
Jean-François Micouleau
5a5ef18379 A rather big change set ! (listed in no particular order)
- changed the default forms flag to 2
- all short architecture name are uppercased
- get_short_archi() is now case unsensitive
- the drivers TDB is indexed by archi/version/name
- implemented code to move drivers from the upload area to the download
area. Someone else need to look at that code.
- don't return anymore a default driver if it doesn't exist in the TDB.
Instead return an error.
- cleaned prs_unistr.
- #ifdef out jeremy's new SD parsing in printer_info_2
- removed the unused MANGLE_CODE

- #ifdef out the security checking in update_printer() as it doesn't work
for me.

Zap your ntdrivers.tdb, it won't work anymore.

	J.F.
(This used to be commit ac0a145acc)
2000-07-25 13:15:16 +00:00
Jeremy Allison
2637bfee06 rpc_parse/parse_prs.c: Removed extraneous ()'s.
rpc_parse/parse_spoolss.c: Fixed the security descriptor marshalling in a INFO_2 struct.
							for some reason SD's should be done inline after the info2, not
							as the last buffer marshall.
rpc_server/srv_spoolss_nt.c: Removed extraneous ()'s.
Jeremy.
(This used to be commit f038a24e9f)
2000-07-18 19:25:32 +00:00
Gerald Carter
2c46a26a8b removed prs_data(), prs_free_data(), and prs_realloc_data()
as these were unneeded and replaced by the real functions
already in HEAD.

Added a few more functions to parse_spoolss.c to help with the
rpcclient merge from TNG.
(This used to be commit 3bc9af4c1d)
2000-07-14 16:58:03 +00:00
Gerald Carter
9ab8dfa381 #ifndef RPCCLIENT_TEST
use old prs_unistr()
#else
	use new prs_unistr() which handles UNMARSHALL
#endif /* RPCCLIENT_TEST */



jerry
(This used to be commit fb0e1fb9e3)
2000-07-11 16:28:59 +00:00
Gerald Carter
64db2010fb included a a new prs_unistr(). Is currently #if'd out (denoted
by RPCCLIENT_TEST) in order to not break anything in the smbd
code (and to give time to review it).  Originally written by JF.
In effect, this checkin makes no changes to parse_prs.c at all.





jerry
(This used to be commit 4f431ea1f5)
2000-07-10 19:55:39 +00:00
Gerald Carter
d2b40a7de2 More rpcclient merge issues:
* fixes some readline bugs from the merge
        * first attempt at commands (spoolenum almost works)
        * no changes to existing functions in HEAD; only additions
          of new functions.  I'll weed out what I can as I go.




--jerry
(This used to be commit 61d2aad5dc)
2000-07-07 06:20:46 +00:00
Jeremy Allison
36fd3866ef Changing drivers using the properties page works - but only if getting/setting
security descriptors is disabled (as it is in this code).

If get/set sd's is enabled spooler.exe crashes on NT.

I'll investigate and fix that issue next.

Jeremy.
(This used to be commit 8c9ed87436)
2000-06-26 22:08:20 +00:00
Jeremy Allison
6d38ba721c Moved tdb functions that access parse structs into parse_prs.c
to prevent builkd breaking.
Jeremy.
(This used to be commit 6c7adeab0f)
2000-06-08 01:16:42 +00:00
Jeremy Allison
0164047afb Fixing get/set of security descriptors.
Removed ugly hack for NT printing.
Fixed up tdb parse stuff memory leaks.
Jeremy.
(This used to be commit 8ef41f31c5)
2000-06-07 01:49:23 +00:00
Jeremy Allison
6d8c131f50 Some tidyup fixes (memory leaks etc.). Still no progress with the
"no driver" issue. I'm banging my head against comparitive packet
dumps right now...
Jeremy.
(This used to be commit 03cd4aa144)
2000-06-05 20:55:57 +00:00
Jeremy Allison
0cc1389935 More memory leak and PANIC action fixes.
This is *horrible* code :-(.
Jeremy.
(This used to be commit ac383bb765)
2000-06-02 21:16:39 +00:00
Shirish Kalele
f3c44fba11 Fixed memory leak in RPC parsing code.
Problem in prs_set_buffer_size() was Realloc returns a NULL when newsize is zero (equivalent to a free()). We were returning a failure here without resetting the buffer_size or the data_p pointer in the prs_struct. And we weren't checking for a failure from prs_set_buffer_size(). So realloc's to zero size were not reflected in the prs_struct: memory leak.
(This used to be commit 590d9ece84)
2000-05-26 22:37:08 +00:00
Jeremy Allison
819c154498 Fixed bug I introduced last night (sorry). Now truncate incoming prs_struct
buffer size to exact size of incoming data to prevent read overruns into slop
space.
Jeremy.
(This used to be commit aa1a4f46da)
2000-05-17 19:17:16 +00:00
Jeremy Allison
c560164030 Fixed bug where mallocd size of prs_struct could be larger than
incoming packet. Ensure new alloced memory is zeroed before use.
Jeremy.
(This used to be commit 1c3193aa1c)
2000-05-17 03:12:56 +00:00
Andrew Tridgell
bb01686063 update grow_size in prs_grow
(This used to be commit a42da20536)
2000-05-15 09:58:58 +00:00
Andrew Tridgell
414caf80a2 make prs_dump() store up to 100 variants of each msg type
(This used to be commit 0e7819bb45)
2000-05-15 07:17:34 +00:00
Andrew Tridgell
0806cf75ff added spool_io_printer_driver_info_level_6()
thsi function and the associated header structure were autogenerated
using a little awk based code geerator I wroe ths evening. I'll commit
that next ...
(This used to be commit 974813f0d4)
2000-05-12 14:28:46 +00:00
Jean-François Micouleau
78d7ba5ca0 changed prs_unistr to parse empty and non-empty strings the same way.
fixed typo in SPOOLSS_SYNT
some cleanup of unused functions
wrote make_spoolss_enumprinter and make_spoolss_openprinterex for
rpcclient as I'm trying to keep in sync the parsing code between HEAD and
TNG.

Will commit changes to TNG after lunch.

	J.F.
(This used to be commit 025cdb345f)
2000-03-06 11:13:40 +00:00
Jean-François Micouleau
8688933c7f fix the reply of rpc_alter_context
OpenPrinterEx is now decoding correctly the query
most of the EnumXXX use the new_buffer struct.
check the (un)marshalling return code.

conclusion: still a long way to go. all the client code has to be
rewritten, and I still wonder how to implement correctly the notify stuff.
(This used to be commit 3d6d386375)
2000-02-15 18:07:45 +00:00
Jean-François Micouleau
195e3d44da spoolss definitions.
also added some prs_struct functions, 'cause I'm handling buffers as
prs_struct.

	J.F.
(This used to be commit 81e375bbbe)
2000-02-07 16:25:15 +00:00
Luke Leighton
fbd17c8daf simple mods to add msrpc pipe redirection. default behaviour: fall back
to using internal msrpc code in smbd.
(This used to be commit 8976e26d46)
2000-01-03 19:19:48 +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
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
4ab9d91428 ABOUT TIME!!!!!!!!
damn, this one is bad.

started, at least two days ago, to add an authentication mechanism to
the smbd<->msrpc redirector/relay, such that sufficient unix / nt
information could be transferred across the unix socket to do a
become_user() on the other side of the socket.

it is necessary that the msrpc daemon inherit the same unix and nt
credentials as the smbd process from which it was spawned, until
such time as the msrpc daemon receives an authentication request
of its own, whereupon the msrpc daemon is responsible for authenticating
the new credentials and doing yet another become_user() etc sequence.
(This used to be commit 30c7fdd6ef)
1999-12-08 21:43:03 +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
5612824426 - typecast malloc / Realloc issues.
- signed / unsigned issues.
(This used to be commit c8fd555179)
1999-10-25 19:03:27 +00:00
Luke Leighton
63fa96e216 added prs_struct "error" member, set and checked when prs_struct
data is handled.
(This used to be commit b4ba49c5c1)
1999-10-15 20:10:46 +00:00
Luke Leighton
003f7364fd adding error checking in parsing code
(This used to be commit 4c98d71ebd)
1999-10-15 20:00:30 +00:00
Luke Leighton
896ecb48ca 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.
(This used to be commit 3b583f7be5)
1999-10-15 18:46:22 +00:00
Luke Leighton
dcea4bfd0f stop over-runs in reading / writing data stream.
(This used to be commit 144fd01f37)
1999-10-14 19:21:23 +00:00
Luke Leighton
6a5a4e8186 BDC support.
(This used to be commit 2331aa32ab)
1999-07-21 00:32:09 +00:00
Jean-François Micouleau
be552ca350 rpc_parse/parse_misc.c : defined a new BUFFER5 struct
include/ntdomain.h     : added rpc_spoolss.h include statement
include/proto.h
include/rpc_dce.h      : added definition of RPC_ALTER_CONTEXT request &
                         reply
param/loadparm.c       : 2 new options for NT printing support and some
                         changes to initial values in the LPRNG case.
rpc_parse/parse_prs.c  : added prs_uint16s()
rpc_parse/parse_rpc.c  : added SYNT_SPOOLSS_V1 and code for the
                         alter-context support.
rpc_server/srv_pipe.c  : alter-context support
smbd/nttrans.c
smbd/server.c
include/rpc_misc.h
Makefile.in
include/smb.h

Jean Francois
(This used to be commit 4c515804b7)
1999-04-27 10:43:32 +00:00
Matthew Chapman
373ea639e0 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.
(This used to be commit 7b830350eb)
1999-04-08 05:36:15 +00:00
Luke Leighton
74576a48fd adding some enumerate services code, client and server.
(This used to be commit dacf5b152b)
1998-12-09 16:28:04 +00:00
Luke Leighton
597c5a6caa jean-f. sent me some S-1-3-0,1,2,3 SIDs and names. S-1-3 doesn't exist.
security descriptor testing.  hey wow, you can get a SD then send it back!
(This used to be commit 7466c3113e)
1998-11-12 19:21:20 +00:00
Luke Leighton
1ab463a795 security descriptors and registry.
(This used to be commit 9814ac8a65)
1998-11-12 16:03:35 +00:00
Luke Leighton
60a91a1dca clearing up security descriptor
(This used to be commit abdc9d790b)
1998-11-11 19:22:08 +00:00
Luke Leighton
1e1c2ec93c rpcclient registry commands.
(This used to be commit 36fcb4a6e6)
1998-11-10 19:05:00 +00:00
Luke Leighton
48b31ae44f dce/rpc
(This used to be commit 6677b888bd)
1998-10-07 21:42:24 +00:00
Luke Leighton
2fef8f2e87 dce/rpc
(This used to be commit 34afa638f6)
1998-10-07 15:22:49 +00:00
Luke Leighton
c07b2bdf90 dce/rpc
(This used to be commit eb279cabd0)
1998-10-06 22:03:04 +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
3dfc0c8472 changed to use slprintf() instead of sprintf() just about
everywhere. I've implemented slprintf() as a bounds checked sprintf()
using mprotect() and a non-writeable page.

This should prevent any sprintf based security holes.
(This used to be commit ee09e9dadb)
1998-05-11 06:38:36 +00:00
Jeremy Allison
e300c0346f includes.h: Moved HPUX undefine of SEMMSL to where it actually does something.
ipc.c: Added Luke's debug statement.
locking_slow.c: Added FTRUNCATE_NEEDS_ROOT code for broken systems that
need it (not sure what these are yet).

membuffer.c ntdomain.h proto.h
lib/rpc/include/rpc_dce.h lib/rpc/include/rpc_srvsvc.h
lib/rpc/parse/parse_prs.c lib/rpc/parse/parse_rpc.c
lib/rpc/server/srv_pipe_hnd.c lib/rpc/server/srv_util.c:
   Re-merge of Luke's NTDOM changes 'cos he's a lazy git with
   carpel tunnel syndrome :-).

Jeremy.
(This used to be commit 52e3966fbc)
1998-04-10 18:21:16 +00:00
Jeremy Allison
fdeea341ed "For I have laboured mightily on Luke's code, and hath broken
all I saw" - the book of Jeremy, chapter 1 :-).

So here is the mega-merge of the NTDOM branch server code.
It doesn't include the new client side pieces, we'll look
at that later.

This should give the same functionality, server wise, as
the NTDOM branch does, only merged into the main branch.

Any fixes to domain controler functionality should be
added to the main branch, not the NTDOM branch.

This code compiles without warnings on gcc2.8, but will
need further testing before we are sure all the working
functionality of the NTDOM server branch has been
correctly carried over.

I hereby declare the server side of the NTDOM branch
dead (and all who sail in her :-).

Jeremy.
(This used to be commit 118ba4d77a)
1998-03-11 21:11:04 +00:00