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

43 Commits

Author SHA1 Message Date
Volker Lendecke
9e29e5d2b8 r19839: Fix the build, we are not there yet :-)
(This used to be commit ff4123c8f2)
2007-10-10 12:16:01 -05:00
Volker Lendecke
45111ff1cb r19838: We have to delete the value record as well, otherwise the old values pop up
again if the key is re-created.

Volker
(This used to be commit f722f3341f)
2007-10-10 12:16:01 -05:00
Volker Lendecke
aad7194999 r19837: Some reformatting (Jerry, I hope you do not mind
(This used to be commit 6639f8c119)
2007-10-10 12:16:01 -05:00
Volker Lendecke
02eea79624 r17333: Some C++ warnings
(This used to be commit be9aaffdac)
2007-10-10 11:38:26 -05:00
Volker Lendecke
4f33673b41 r17047: Fix a typo and a possible NULL dereference
(This used to be commit c0d9114706)
2007-10-10 11:19:22 -05:00
Volker Lendecke
db249de135 r14247: Fix Coverity bug # 136
(This used to be commit 1b247ff2ed)
2007-10-10 11:15:20 -05:00
Jeremy Allison
894358a8f3 r13915: Fixed a very interesting class of realloc() bugs found by Coverity.
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 1d710d06a2)
2007-10-10 11:10:59 -05:00
Gerald Carter
01a1e5cdb0 r10819: merging a couple of fixes from trunk
* only keep the registry,tdb file open when we have an open key handle
* tpot's setup.py fix
* removing files that no longer exist in trunk and copying some
  that were missing in 3.0
(This used to be commit 6c6bf6ca5f)
2007-10-10 11:04:54 -05:00
Gerald Carter
54abd2aa66 r10656: BIG merge from trunk. Features not copied over
* \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 939c3cb5d7)
2007-10-10 11:04:48 -05:00
Gerald Carter
926ebe50ff r9895: fix typo in registry path
(This used to be commit ef7e0d70c6)
2007-10-10 11:03:27 -05:00
Gerald Carter
790a29253c r9894: Add new registry key expected by Windows XP clients.
HKLM\\SYSTEM\\CurrentControlSet\\Control\\Termininal Server\\DefaultUserConfiguration

Apparently this started showing up after the winreg-write support
was added in 3.0.20rc1 or so.

Also modifed init_registry_data() to always run and add the
required keys.  Initial values however are only written if
they don't already exist.

This makes it easier to add new keys without having to rev the
tdb version number (which is really unnecessary in this case).

Portions of patch reviewed by Thomas Bork on the general samba ml.
(This used to be commit b12a05b237)
2007-10-10 11:03:27 -05:00
Gerald Carter
44707ad2e0 r9739: conver the reg_objects (REGSUBKEY_CTR & REGVAL_CTR) to use
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 ef721333ab)
2007-10-10 11:03:25 -05:00
Tim Potter
9a14b005a1 r9278: Remove unused variable. Bugzilla #2983.
(This used to be commit 5d592691e4)
2007-10-10 11:00:30 -05:00
Gerald Carter
30865196bf r9115: using #define for reg paths rather than typing the string
(This used to be commit e9427912a7)
2007-10-10 11:00:26 -05:00
Gerald Carter
6fe5451543 r8501: * disable printer handle object cache (was mostly used
for NT4 clients enumerating printer data on slow CPUs)
* fix pinter and secdesc record upgrade to normalize the key
  (rev'd printer tdb version)
* fixed problem that was normalizing the printername name field

in general, this should fix the issues upgrading print servers
from 3.0.14a to 3.0.20
(This used to be commit d07179de2f)
2007-10-10 11:00:06 -05:00
Gerald Carter
2427e00b1d r8152: * remove commented out structure
* use SAMBA_PRINTER_PORT_NAME in registry values for builtin printer
  port
(This used to be commit 63bc03536b)
2007-10-10 10:58:12 -05:00
Gerald Carter
0a01b2246a r8064: * add the REG_XXX error codes to the pretty error messages
* 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 89f17b41ce)
2007-10-10 10:58:10 -05:00
Gerald Carter
8e3445c804 r8061: * mostly cleanup and refactoring for better readability
* 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 6f654c5741)
2007-10-10 10:58:10 -05:00
Gerald Carter
8cea99d3ac r8026: * more fixes to the printing registry interface
(still not completely back to the read functionality
  we previously had but the cleanup is progressing)
(This used to be commit 04431372a6)
2007-10-10 10:58:09 -05:00
Gerald Carter
b319bdd32f r8007: * cleanup unused structure from reg_objects.h
* 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 28c7293ee9)
2007-10-10 10:58:08 -05:00
Gerald Carter
270b90e25f r7995: * privileges are local except when they're *not*
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 0d6352da48)
2007-10-10 10:58:07 -05:00
Gerald Carter
ab0033d40a r7938: * move the hardcoded registry value names from _reg_query_value()
to a thin layer in fetch_reg_values().  Not entirely efficient
  seeing as the the dynamic value paths are stored in an unsorted
  array but it is one strequal() per path.  If this was really big
  it should be worked into the reghook_cache().
(This used to be commit 63b81ad3cb)
2007-10-10 10:58:03 -05:00
Gerald Carter
bd509a81cb r7908: * change REGISTRY_HOOK api to use const (fix compiler warning
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 3d837e58db)
2007-10-10 10:58:03 -05:00
Gerald Carter
b8e787bcac r7890: * add Reg[SG]etKeySec() server stubs
* merge a compile warning fix from trunk to SAMBA_3_0
(This used to be commit 71eb018a05)
2007-10-10 10:58:01 -05:00
Gerald Carter
c25b67b24d r7698: * clean upserver frontend for RegDeleteKey()
* implement RegDeleteKey() for reg_db backend
(This used to be commit 91b81a23b8)
2007-10-10 10:57:19 -05:00
Gerald Carter
fee4b03e02 r7692: start versioning the registry.tdb file since it can be modified now
(This used to be commit a091b37d59)
2007-10-10 10:57:19 -05:00
Gerald Carter
2129d3c711 r7691: * add .gdbinit to the svn:ignore files
* start adding write support to the Samba registry
  Flesh out the server implementations of
  RegCreateKey(), RegSetValue(), RegDeleteKey() and RegDeleteValue()

I can create a new key using regedit.exe now but the 'New Key #1'
key cannot be deleted yet.
(This used to be commit e188fdbef8)
2007-10-10 10:57:19 -05:00
Gerald Carter
17eb05228e r7648: adding REGISTRY_HOOK->reg_access_check() for authprization checks on RegOpenKey(); passing it off to the backend code for a given path
(This used to be commit 867fd3052b)
2007-10-10 10:57:18 -05:00
Gerald Carter
f0c650a382 r6942: * merging the registry changes back to the 3.0 tree
* removing the testprns tool
(This used to be commit 81ffb0dbbb)
2007-10-10 10:56:57 -05:00
Gerald Carter
cf4005a78d r6680: event log patches from Marcin
(This used to be commit a71e104af8)
2007-10-10 10:56:51 -05:00
Gerald Carter
466a825ce7 r6232: more cleanups; remove BUFFER3; rename BUFFER4 -> RPC_DATA_BLOB; rename REG_CREATE_VALE -> REG_SET_VALUE
(This used to be commit 28d433351c)
2007-10-10 10:56:30 -05:00
Jeremy Allison
acf9d61421 r4088: Get medieval on our ass about malloc.... :-). Take control of all our 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 620f2e608f)
2007-10-10 10:53:32 -05:00
Gerald Carter
c674e411c7 i guess i'm the only one this ever annyoed...
fix the confusion when we tdb_lock_bystring() but
we retrieve an entry using tdb_fetch_by_string.
It's now always tdb.*bystring()
(This used to be commit 66359531b8)
2003-07-10 20:37:01 +00:00
Tim Potter
d8d0a4e909 Merge of case fixes from APPLIANCE_HEAD.
(This used to be commit f8072d964f)
2002-08-11 18:19:03 +00:00
Andrew Bartlett
9542ef87c0 Back out idra's change (at his request) - the values in the tdb *should* be
upper cased already.

However, if you created your registry tdb in the very early versions of jerry's
patch, you could find that usrmgr doesn't function.  Simply delete the
registry.tdb, it will be recreated on startup.

Andrew Bartlett
(This used to be commit 17136a88c3)
2002-08-06 10:10:54 +00:00
Simo Sorce
918e681894 commented out strupper before key check against internal db, it's no good
to check for uppercased strings when we store them not uppercased.

jerry, this fix is needed to make usrmgr.exe work again.
meanwhile we found out that NT_STATUS code may not be appropriate there.
In particular it seem that an NT PDC will send back 02 as error
(ERRbadfile) not 0xc000000f (NT_STATUS_NO_SUCH_FILE NT)

I think further investigation is need to understand which are aprropriate
return codes here.
(This used to be commit 2ad0e81c8d)
2002-08-04 14:25:32 +00:00
Gerald Carter
a23e96316e 3 things:
* normalize all registry key strings before storing or looking
  up paths in the registry tdb
* return the current buffer size for REG_INFO even when not returning
  actual data
* fix a segfault report by metze on #samba-technical so that the
  user/group object picker works again (was the "ProductType" key
  lookup that was failing).
(This used to be commit 5640e6cdb2)
2002-07-26 22:40:06 +00:00
Gerald Carter
f1ed55d903 * fix return code so we don't let a client just open any key it wants
(even nonexistent ones).  This gets rid of the Scheduling Agent icon.

* fix NT_STATUS return code for bad registry path (NT_STATUS_NO_SUCH_FILE)
(This used to be commit 915ee5c0ec)
2002-07-24 19:53:49 +00:00
Gerald Carter
c808cc3643 several changes in this checkin
* 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 419d7208e8)
2002-07-24 06:42:09 +00:00
Gerald Carter
b516eb62db enumeration of printers keys ( no data yet ) via the registry
functions now works :-)
(This used to be commit c5768538f6)
2002-07-20 04:27:30 +00:00
Gerald Carter
3c0a9c46d8 fixed seg fault in registry frontend caused by trying to
use a destroyed TALLOC_CTX*
(This used to be commit 432b9f8d7c)
2002-07-19 22:16:03 +00:00
Gerald Carter
9fe3bd1259 * refactored registry operations some. subkey lists and
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 e7b55e8f01)
2002-07-19 18:49:44 +00:00
Gerald Carter
06ae9ac5d9 virtual registry framework with initial printing hooks.
(This used to be commit a43d9788fa)
2002-07-18 23:00:24 +00:00