summaryrefslogtreecommitdiff
path: root/source3/registry/reg_printing.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-10r17333: Some C++ warningsVolker Lendecke1-2/+2
(This used to be commit be9aaffdaccae06c8c035eaf31862e34b7cfbe38)
2007-10-10r16945: Sync trunk -> 3.0 for 3.0.24 code. Still needJeremy Allison1-3/+1
to do the upper layer directories but this is what everyone is waiting for.... Jeremy. (This used to be commit 9dafb7f48ca3e7af956b0a7d1720c2546fc4cfb8)
2007-10-10r16603: Klockwork #2028. Fix null deref on error path.Jeremy Allison1-12/+38
Jeremy. (This used to be commit 067feef34388e93ded8db7fd3b4a6a4b752a3059)
2007-10-10r16424: Fix possible null deref and a memory leak found byJeremy Allison1-1/+5
examining Klockwork #1519. get_printer_subkeys() could return zero without initializing it's return pointer arg. Fixed this. Added free of subkey pointer return in registry/reg_printing.c (interesting that neithe Coverity or Klocwork found this one). Jeremy. (This used to be commit 4fbeae1a3ac3499e5d9f566655cbafccd9d691cb)
2007-10-10r13915: Fixed a very interesting class of realloc() bugs found by Coverity.Jeremy Allison1-8/+5
realloc can return NULL in one of two cases - (1) the realloc failed, (2) realloc succeeded but the new size requested was zero, in which case this is identical to a free() call. The error paths dealing with these two cases should be different, but mostly weren't. Secondly the standard idiom for dealing with realloc when you know the new size is non-zero is the following : tmp = realloc(p, size); if (!tmp) { SAFE_FREE(p); return error; } else { p = tmp; } However, there were *many* *many* places in Samba where we were using the old (broken) idiom of : p = realloc(p, size) if (!p) { return error; } which will leak the memory pointed to by p on realloc fail. This commit (hopefully) fixes all these cases by moving to a standard idiom of : p = SMB_REALLOC(p, size) if (!p) { return error; } Where if the realloc returns null due to the realloc failing or size == 0 we *guarentee* that the storage pointed to by p has been freed. This allows me to remove a lot of code that was dealing with the standard (more verbose) method that required a tmp pointer. This is almost always what you want. When a realloc fails you never usually want the old memory, you want to free it and get into your error processing asap. For the 11 remaining cases where we really do need to keep the old pointer I have invented the new macro SMB_REALLOC_KEEP_OLD_ON_ERROR, which can be used as follows : tmp = SMB_REALLOC_KEEP_OLD_ON_ERROR(p, size); if (!tmp) { SAFE_FREE(p); return error; } else { p = tmp; } SMB_REALLOC_KEEP_OLD_ON_ERROR guarentees never to free the pointer p, even on size == 0 or realloc fail. All this is done by a hidden extra argument to Realloc(), BOOL free_old_on_error which is set appropriately by the SMB_REALLOC and SMB_REALLOC_KEEP_OLD_ON_ERROR macros (and their array counterparts). It remains to be seen what this will do to our Coverity bug count :-). Jeremy. (This used to be commit 1d710d06a214f3f1740e80e0bffd6aab44aac2b0)
2007-10-10r11860: BUG 3156: don't use find_service() when explicitly looking for a ↵Gerald Carter1-1/+10
printer as the username map might get in the way (This used to be commit 46bf28c81c27dfdc412318a83bf565211a58a47d)
2007-10-10r10656: BIG merge from trunk. Features not copied overGerald Carter1-34/+6
* \PIPE\unixinfo * winbindd's {group,alias}membership new functions * winbindd's lookupsids() functionality * swat (trunk changes to be reverted as per discussion with Deryck) (This used to be commit 939c3cb5d78e3a2236209b296aa8aba8bdce32d3)
2007-10-10r9739: conver the reg_objects (REGSUBKEY_CTR & REGVAL_CTR) to useGerald Carter1-10/+10
the new talloc() features: Note that the REGSUB_CTR and REGVAL_CTR objects *must* be talloc()'d since the methods use the object pointer as the talloc context for internal private data. There is no longer a regXXX_ctr_intit() and regXXX_ctr_destroy() pair of functions. Simply TALLOC_ZERO_P() and TALLOC_FREE() the object. Also had to convert the printer_info_2->NT_PRINTER_DATA field to be talloc()'d as well. This is just a stop on the road to cleaning up the printer memory management. (This used to be commit ef721333ab9639cb5346067497e99fbd0d4425dd)
2007-10-10r8327: * don't use unitialized variablesGerald Carter1-3/+2
(This used to be commit bd878197954cf4d259dfd01f2d4cb4a663b34121)
2007-10-10r8325: * punt....don't normalize the printer name in the RegCreateKey().Gerald Carter1-3/+1
Print Migrator now works as long as the addprinter command can handle the name (This used to be commit 61f14cdcbd3b183caf6172d5b60b0888fc4363f7)
2007-10-10r8324: * initial cut at creating printers via the registry APIGerald Carter1-5/+40
Need to add delete_key support (This used to be commit 9a27f7181adca10f60c47d342a51dec34321e12b)
2007-10-10r8323: * convert RegSetValue() calls immediately beneath the printerGerald Carter1-9/+23
key to PRINTER_INFO_2 fields. (This used to be commit fadda2f240eb3c8eb08198c702a93e23b14f0fcc)
2007-10-10r8322: * get RegSetValue() working for printer subkey valuesGerald Carter1-3/+169
(not immediate values below the <printer name> key yet. (This used to be commit a872ea5f0e29f7b585574a56b52a5eb44cb92278)
2007-10-10r8089: successfully delete printer subkeys via the registry....now for valuesGerald Carter1-1/+19
(This used to be commit d3427960b0676c506c639b582a2544dc58990c9e)
2007-10-10r8066: * had to modify the printer data storage slightly in ntprinters.tdbGerald Carter1-19/+60
when packing values. It is a compatible change though and will not require a tdb version upgrade * Can successfully create new printer subkeys via winreg that are immediately available via spoolss calls. Still cannot delete keys yet though. That comes next. (This used to be commit 00bce2b3bb78a44842a258b1737076281297d247)
2007-10-10r8064: * add the REG_XXX error codes to the pretty error messagesGerald Carter1-39/+65
* more work on the store_values() functions for the Printers key * add Control\Print\Monitors key to list for reg_db (This used to be commit 89f17b41cee633838b8cbd0d1bf8119a4b8d707e)
2007-10-10r8061: * mostly cleanup and refactoring for better readabilityGerald Carter1-312/+302
* move to registry.tdb for port listing (at least via the winreg ops) If no one opposes on the samba list, we'll move to a registry lookup for enumerating ports rather than the 'enumports command'. This means that there is a bit of a disconnect between EnumPorts() and RegEnumKey('hklm\software\microsoft\windows nt\currentversion\ports'). (This used to be commit 6f654c5741e98abf00c010c5dd38038092c0f7a3)
2007-10-10r8027: driver information is now back via winregGerald Carter1-2/+7
(This used to be commit f0a1c6b9cec28d5b4aa8a1a2f9b34d1f13113a6c)
2007-10-10r8026: * more fixes to the printing registry interfaceGerald Carter1-308/+195
(still not completely back to the read functionality we previously had but the cleanup is progressing) (This used to be commit 04431372a698433b4936392047228908a64ff382)
2007-10-10r8022: * implement default actions rather than having to define functionsGerald Carter1-398/+338
for every fetch/store callback (some keys should never have a value) (This used to be commit 7466351dd059b75c29bc0d2977c6c9d318a14dc6)
2007-10-10r8008: * start adding logic for restricting subkey pathsGerald Carter1-69/+56
e.g. 'hklm\software\microsoft\windows nt\currentversion\ports' should have no subkeys. Return an error if a client tries to open a path below here (This used to be commit 7a2ecb1aec2b84e6bc326be4a1191fb54526c430)
2007-10-10r8007: * cleanup unused structure from reg_objects.hGerald Carter1-130/+331
* make regdb_store_XXX() and regdb_fetch_XXX() functions non-static * use case sensitive string lookups in reg_dynamic.c since the keys have already been normalized * move to new design for making printing related data available via the winreg pipe (with the intent of allowing writes) (This used to be commit 28c7293ee9e68b913faf8d74d63f73e09087169b)
2007-10-10r7995: * privileges are local except when they're *not*Gerald Carter1-31/+24
printmig.exe assumes that the LUID of the SeBackupPrivlege on the target server matches the LUID of the privilege on the local client. Even though an LUID is never guaranteed to be the same across reboots. How *awful*! My cat could write better code! (more on my cat later....) * Set the privelege LUID in the global PRIVS[] array * Rename RegCreateKey() to RegCreateKeyEx() to better match MSDN * Rename the unknown field in RegCreateKeyEx() to disposition (guess according to MSDN) * Add the capability to define REG_TDB_ONLY for using the reg_db.c functions and stress the RegXXX() rpc functions. (This used to be commit 0d6352da4800aabc04dfd7c65a6afe6af7cd2d4b)
2007-10-10r7908: * change REGISTRY_HOOK api to use const (fix compiler warningGerald Carter1-6/+6
in init_registry_data() * Add means of storing registry values in registry.tdb * add builtin_registry_values[] array for REG_DWORD and REG_SZ values needed during startup * Finish up RegDeleteValue() and RegSetValue() * Finish up regdb_store_reg_values() and regdb_fetch_reg_values() I can now create and retrieve values using regedit.exe on Win2k. bin/net -S rain -U% rpc registry enumerate 'hklm\software\samba' Valuename = Version Type = REG_SZ Data = 3.0.20 Next is to do the virtual writes in reg_printing.c and I'll be done with Print Migrator (yeah! finally) (This used to be commit 3d837e58db9ded64d6b85f047012c7d487be4627)
2007-10-10r7838: lie about the printer status when doing the queryvalue() registry ↵Gerald Carter1-1/+5
call. Note that if you migrate a printer to a Windows server, the win spooler will remove any printers that have an invalid status value in the registry (This used to be commit 0a22ea9eb7fd5aa8c57d2bf1ea2a171b377cab5a)
2007-10-10r7648: adding REGISTRY_HOOK->reg_access_check() for authprization checks on ↵Gerald Carter1-1/+2
RegOpenKey(); passing it off to the backend code for a given path (This used to be commit 867fd3052bbfdd45856886999619e2ebc6552675)
2007-10-10r7415: * big change -- volker's new async winbindd from trunkGerald Carter1-2/+2
(This used to be commit a0ac9a8ffd4af31a0ebc423b4acbb2f043d865b8)
2007-10-10r6953: Many compilers in the build farm don't like static variables ↵Volker Lendecke1-3/+3
initialized with strlen(..). Jerry, I think this needs another fix. I just want to make the build farm happy. Not merging to trunk, this needs further looking at. Volker (This used to be commit 4f36e4f4343e56842affa8de495c2258f5d971ad)
2007-10-10r6942: * merging the registry changes back to the 3.0 treeGerald Carter1-138/+244
* removing the testprns tool (This used to be commit 81ffb0dbbbd244623507880c323a3c37e2b8dc4d)
2007-10-10r4088: Get medieval on our ass about malloc.... :-). Take control of all our ↵Jeremy Allison1-7/+7
allocation functions so we can funnel through some well known functions. Should help greatly with malloc checking. HEAD patch to follow. Jeremy. (This used to be commit 620f2e608f70ba92f032720c031283d295c5c06a)
2007-10-10r2821: Adding "Windows x64" as architecture string and driverdir "x64" for theGünther Deschner1-0/+2
64bit AMD platform. (This used to be "Windows AMD64" and "AMD64" in one of the release candidates of SP2 for Windows XP. AMD64 is obviously still supported but not documented.) Guenther (This used to be commit cc5892f0411b8eb5daebe746164a2cf21d3d4c68)
2003-09-25Fix for #480. Change the interface for init_unistr2 to not take a lengthJeremy Allison1-22/+19
but a flags field. We were assuming that 2*strlen(mb_string) == length of ucs2-le string. This is not the case. Count it after conversion. Jeremy. (This used to be commit f82c273a42f930c7152cfab84394781744815e0e)
2003-03-05More const fixes.Jeremy Allison1-1/+1
Jeremy. (This used to be commit fa93763248f2043395e4cfc70b8afd81e28b2b75)
2003-02-25Progress on CR 601Gerald Carter1-4/+3
cache the printer_info_2 with the open printer handle. cache is invalidated on a mod_a_printer() call **on that smbd**. Yes, this means that the window for admins to step on each other from different clients just got larger, but since handles a generally short lived this is probably ok. (This used to be commit 31272d3b6bb9ec62fd666301c7adfa0c1720a99b)
2003-01-03Merge from HEAD - make Samba compile with -Wwrite-strings without additionalAndrew Bartlett1-1/+1
warnings. (Adds a lot of const). Andrew Bartlett (This used to be commit 3a7458f9472432ef12c43008414925fd1ce8ea0c)
2002-09-25sync'ing up for 3.0alpha20 releaseGerald Carter1-62/+78
(This used to be commit 65e7b5273bb58802bf0c389b77f7fcae0a1f6139)
2002-08-16Fairly large change to printing code.Gerald Carter1-2/+4
* removed support for PHANTOM_DEVMODE printer data * s/NT_PRINTER_PARAM/REGISTRY_VALUE/g - This was a good bit of work. Everything seems stable, but is not complete. * support for printer data keys other than PrinterDriverData in the store and fetch routines. Still needs to be plugged into the XxxPrinterDataEx() calls. Tested against NT4.0 & 2k. Like I said, it's not done, but doesn't crash so it shouldn't upset anyone (unless you're trying to build a Samba printer server off of HEAD). More work to come. Should settle by Monday. jerry (This used to be commit 7ba7c04c0e961618c82c2112b9627af114c6cc42)
2002-07-29hardcode printprocessor name since it is everywhere elseGerald Carter1-1/+1
(This used to be commit efbfb8ca5415424827f4b01c9e79439ab8cc9b1c)
2002-07-24done! printer_info_2, devicemode, sec_desc, & printer data all enumerateGerald Carter1-3/+175
and display correctly in regedit.exe. Not sure about REG_SZ values in PrinterDriverData. If we store these in UNICODE, I'll have to fix up a few things. REG_BINARY & REG_DWORD are fine. (This used to be commit 2a30c243ec28734bbc721dfc01b743faa6f73788)
2002-07-24several changes in this checkinGerald Carter1-2/+256
* added REG_OPEN_HKCR for supporting regedit.exe * All data n a REGISTRY_VALUE is stored to a pointer now * fixed REG_INFO to correctly display data when double clicking on and entry in the registry editor * Will now enumerate installed driver_info_3 data * fixed numerous bugs related to pointer offsets, memory issues, etc.. in the registry routines * added a simple caching mechanism to fetch_reg_[keys|values]_specific() All that is left now is to enumerate PrinterData and I will have finished what I started out to do.... (This used to be commit 419d7208e8384e4ad2c4dd328ad5e630971bc76c)
2002-07-23* fix to display correct form information in REG_BINARY informationGerald Carter1-17/+19
This should be 8 x uint32 (not 7. I'm guessing the 2nd to the last uint32 is the index number for the form? Not that big a deal I don't think. (This used to be commit 88f0e68bc631f1a0032056bc6c7b9213e8a15be8)
2002-07-20another intermediate checkin on the way to enumerating formsGerald Carter1-22/+64
via the registry. There is a seg fault here which shouldn't bother anyone until I can get it fixed. I just need a check point in case I need to roll back to this version later on. (This used to be commit e62ae94823461e142978a786b2860ea97906cfb3)
2002-07-20enumeration of printers keys ( no data yet ) via the registryGerald Carter1-20/+42
functions now works :-) (This used to be commit c5768538f6cf6ee824bc6e105a3391bbc2ea8e46)
2002-07-19* refactored registry operations some. subkey lists andGerald Carter1-61/+138
registry values are now passed around in containers (REGSUBKEY_CTR & REGVAL_CTR) which each possess a TALLOC_CTX. * removed subkey_specific_fn() from REGISTRY_OPS. Is implemented in the form of a wrapper * temporarily broke the printing registry ops. * implemented inheritence for the data_p of nodes in a SORTED_TREE * All REGISTRY_KEY instances now store a valid REGISTRY_HOOK since the default REGOSTRY_OPS structure is stored in the root of the cache_tree. * Probably some other change I forgot.... T (This used to be commit e7b55e8f017e638342d9c8c1a9259000745a0298)
2002-07-19Formatting fixup. Fix shadow warning.Jeremy Allison1-6/+6
Jeremy. (This used to be commit beb298898d5700dcd775ee3b1f1965e67214e9e5)
2002-07-18virtual registry framework with initial printing hooks.Gerald Carter1-0/+243
(This used to be commit a43d9788fa8823d678ee72470421b980165ec2b0)