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

357 Commits

Author SHA1 Message Date
Jeremy Allison
3d9b163655 Fixed overrun write error when using debuglevel > 50.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
6d081a9017 Implemented AbortPrinter() from Gerald's Win32 test code. Just purge all
possible printjobs from that printer (I think this is correct).
Added error code returns for print_queue_XXX() functions.
Jeremy.
0001-01-01 00:00:00 +00:00
Andrew Tridgell
14e534a890 yipee!
The spoolss AddJob function has an [in,out] buffer not an [in] buffer
(despite the comment in the code to the contrary). Also, we must fail
this function - not just blindly reply "no problem" as AddJob should
always fail on non-local printers.

This fixes a bug where the "print test page" failed about half the
time. I suspect it will also fix a bunch of other intermittent spoolss
bugs where the client (incorrectly) tries to use the AddJob printing
interface.
0001-01-01 00:00:00 +00:00
Gerald Carter
b64ddbd1aa added comment for my own memory purposes
jerry
0001-01-01 00:00:00 +00:00
Gerald Carter
3b14487c7e 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
0001-01-01 00:00:00 +00:00
Gerald Carter
65ee5f9b6e - fixed memcpy bug in copy_unistr2()
- init_unistr2_from_unistr() does not NULL terminate
  the buffer



--jerry
0001-01-01 00:00:00 +00:00
Jeremy Allison
f94f37dcab Tidied up extra ()'s.
Jeremy
0001-01-01 00:00:00 +00:00
Gerald Carter
bd4c83eb40 fixed a few bugs in new_smb_io_relarraystr().
Marshalling code path now uses spoolss_smb_io_unistr()
also caught a NULL pointer case.

i'll update TNG later.
0001-01-01 00:00:00 +00:00
Gerald Carter
bc154e8522 fix for new_smb_io_relarraystr() and new_smb_io_relstr()
to use spool_smb_io_unistr() as this does not call prs_align()
befrore parsing the UNISTR.

Parsing a void* buffer from an RPC should not be aligned
on 4 byte boundaries.  Don't think this change affects
any marshalling code, only unmarshalling...




jerry
0001-01-01 00:00:00 +00:00
Gerald Carter
236f19659c removed the prs_align in spoolss_smb_io_unistr() (JF, please check)
as it was throwing things off when parsing buffers passed in SPOOLSS
RPCs

fixed the unmarshalling of UNISTR arrays to be double NULL terminated




jerry
0001-01-01 00:00:00 +00:00
Gerald Carter
3fcc59ba92 fixes to prs_unistr UNMARSHALLING only. Problem was due to talloc's
of 0 bytes.



jerry
0001-01-01 00:00:00 +00:00
Jeremy Allison
ceba9f3dcd Fixed the problem with UNISTR marshalling in a buffer5 struct.
The smb_io_unistr() code called a prs_align, this was not being
counted in the size or taken account of in the offset calculation.
Fixed size_ calculation to always return a size a multiple of 4
and also set the offset correctly. This fixes the problem I saw
and will hopefully fix the problem HP reported. JF please check
this change.
Jeremy.
0001-01-01 00:00:00 +00:00
Gerald Carter
1a145977f0 working on the unmarshalling of dependentfiles to a DRIVER_INFO_3
struct.  Not wuite there.





jerry
0001-01-01 00:00:00 +00:00
Gerald Carter
26a73a70e2 deal with allocation size of 0 in prs_unistr when UNMARSHALLING
jerry
0001-01-01 00:00:00 +00:00
Gerald Carter
8ecd5dd52a More work on AddPrinterDriver() and AddPrinterEx() client RPC's
Also fixed init_unistr() to deal with a NULL source character string.



-jerry
0001-01-01 00:00:00 +00:00
Gerald Carter
1e00ac19cd cleanup in init_unistr2_from_unistr()
--jerry
0001-01-01 00:00:00 +00:00
Gerald Carter
3bf9a29f34 All changes related to rpcclient...
- cleaned up some code
- Fixed a few memory leaks of my own making
- Add AddPrinterDriver(); I'm missing some of the semantics
  here as the call is done correctly, but I'm not getting all
  the information right in the DRIVER_INFO_3 struct I think.
  Will work on it tomorrow some more...



--jerry
0001-01-01 00:00:00 +00:00
Gerald Carter
7b69cbbde3 it is not my day it seems. :-(
Fixed missing )


j-
0001-01-01 00:00:00 +00:00
Gerald Carter
34d4fb54c3 removed the for() loop to copy the buffer in init_unistr2_from_unistr()
Replaced with a memcpy()



Forgot to commit this a few moments ago


j-
0001-01-01 00:00:00 +00:00
Gerald Carter
4ecd15cd58 Fixed bug in init_unistr2_from_unistr() found by Elrond.
Thanks :-)





j-
0001-01-01 00:00:00 +00:00
Gerald Carter
e15d9befd2 clunky support for calling AddPrinterEx(). The code currently reports
that the call failed, but the printer shows up on the remote NT client.
(note this is the client side call).  I've botched the return value
somewhere and will fix that today.




jerry
0001-01-01 00:00:00 +00:00
Gerald Carter
c8f9e54bea After talking with Jeremy and JF (and staring at packet traces between
NT <-> NT), I've come to realize that UNISTR2 strings should be NULL
terminated.




jerry
0001-01-01 00:00:00 +00:00
Jeremy Allison
d6db29be98 Much though I hate to admit it - JF was completely correct. I cannot
now reproduce the bug I had with adding a printer driver, and PrintMig.exe
crashes if I use my SD code but works with his.
I stand completely corrected :-). - So I'm reverting to his code as it works :-).
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
c55bcec817 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.
0001-01-01 00:00:00 +00:00
Jeremy Allison
902ada6379 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.
0001-01-01 00:00:00 +00:00
Gerald Carter
d321d0dddd More work on rpcclient...
* Fixed to work with Jeremy's recent changes re: dunamic
    memory allocation when unmarshalling unistr[2]
  * included EnumPorts level 1
  * more work on AddPrinterEx




--jerry
0001-01-01 00:00:00 +00:00
Tim Potter
4ab75143c4 Fixed read overrun in init_string2() 0001-01-01 00:00:00 +00:00
Jean-François Micouleau
9178d2a1aa remove warnings
J.F.
0001-01-01 00:00:00 +00:00
Jeremy Allison
0ff2ce543e 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.
0001-01-01 00:00:00 +00:00
Jean-François Micouleau
883f7402d4 Found out that we are crashing spoolss in enumprinterdata.
So fixed enumprinterdatas in rpcclient to debug the server code,
and found that the parsing code was missing 2 prs_align().

We are not crashing NT anymore. :-)

        J.F.
0001-01-01 00:00:00 +00:00
Jean-François Micouleau
ac0a145acc 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.
0001-01-01 00:00:00 +00:00
Jeremy Allison
a0ee774fe9 Fixed open handle code in printers - 3 functions were always being done
in order - moved them into open_printer_hnd().
Added saving of comment field.
Jeremy.
0001-01-01 00:00:00 +00:00
Gerald Carter
a2205c6646 Added functions for enumerating ports on remote print server.
Tim,  You should also look at new_smb_io_printer_info_2()
and see if the change from NULL to &i regarding the secdesc is ok.




jerry
0001-01-01 00:00:00 +00:00
Jeremy Allison
f038a24e9f 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.
0001-01-01 00:00:00 +00:00
Gerald Carter
f7bc6df3be fixed a bug (my own) in create_ntc_from_cli_state()
--jerry
0001-01-01 00:00:00 +00:00
Gerald Carter
3bc9af4c1d 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.
0001-01-01 00:00:00 +00:00
Jean-François Micouleau
08b41bab17 we are now sure the printer_info_2 timestamp is updated everytime
required.

	J.F.
0001-01-01 00:00:00 +00:00
Jean-François Micouleau
493f7d11ac - The printers are indexed by the sharename in both get_a_printer() and
add_a_printer() now.

- correctly unpack the private part of a devmode and remove a memleak

- correctly retrieve the pair(value,data) for getprinterdata

- handle null devicemode in printer_info_2

I still have some bugs but I'm not crashing anymore NT4SP6 d/c build :-)


        J.F.
0001-01-01 00:00:00 +00:00
Gerald Carter
fb0e1fb9e3 #ifndef RPCCLIENT_TEST
use old prs_unistr()
#else
	use new prs_unistr() which handles UNMARSHALL
#endif /* RPCCLIENT_TEST */



jerry
0001-01-01 00:00:00 +00:00
Gerald Carter
4f431ea1f5 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
0001-01-01 00:00:00 +00:00
Tim Potter
898a483cda Fixes for various compile warnings on Solaris 8. 0001-01-01 00:00:00 +00:00
Tim Potter
3ee111bff7 Fix for passing NULL pointer as an array parameter in
domain_client_validate()
0001-01-01 00:00:00 +00:00
Gerald Carter
61d2aad5dc 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
0001-01-01 00:00:00 +00:00
Jean-François Micouleau
1fae158529 the dummy field in driver_info_6 is before the driver version and not
after.

I don't know who broke all that code, but I'm  ******** (censured)

	J.F.
0001-01-01 00:00:00 +00:00
Jean-François Micouleau
a882dd225e driver_info_6 had a prs_align() that should not have been there.
J.F.
0001-01-01 00:00:00 +00:00
Jeremy Allison
d47329649d Removed unneccessary ()'s afer &'s that made it look like we
don't know how the C language works :-).
Jeremy
0001-01-01 00:00:00 +00:00
Jeremy Allison
f3fe384dc3 Tidy up current spool code - added some JRATEST ifdefs to allow
experimentation with what is making spoolss.exe crash - may be removed
later.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
aa49dc037f Removed extra uint32 field in auto-notify reply. This fixes some spoolss.exe
crashes but there are still more to work on.
Jeremy.
0001-01-01 00:00:00 +00:00
Jeremy Allison
8c9ed87436 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.
0001-01-01 00:00:00 +00:00
Jeremy Allison
151b131ee0 lib/util_sid.c: Uninitialized memory read.
rpc_parse/parse_spoolss.c: Added note about prs_align when marshalling a SEC_DESC...
rpc_server/srv_lsa.c: Tim - your changes broke the display of the 'everyone' group
						when doing file access with no winbindd running. This is a partial
						fix - more when I have analysed this more.
rpc_server/srv_spoolss_nt.c: Fix for the 'change driver' problem ! Hurrah !

Jeremy.
0001-01-01 00:00:00 +00:00