summaryrefslogtreecommitdiff
path: root/source3/registry
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-06-29 16:35:32 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:58:07 -0500
commit270b90e25f2ec5fcb1283588a9e605b7228e0e41 (patch)
treef84f6736eab9650035426c30acb781a11a7a2046 /source3/registry
parent2e7f22e833fbb549f698460f9ed4d81af68b86e9 (diff)
downloadsamba-270b90e25f2ec5fcb1283588a9e605b7228e0e41.tar.gz
samba-270b90e25f2ec5fcb1283588a9e605b7228e0e41.tar.bz2
samba-270b90e25f2ec5fcb1283588a9e605b7228e0e41.zip
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 0d6352da4800aabc04dfd7c65a6afe6af7cd2d4b)
Diffstat (limited to 'source3/registry')
-rw-r--r--source3/registry/reg_db.c14
-rw-r--r--source3/registry/reg_frontend.c3
-rw-r--r--source3/registry/reg_objects.c10
-rw-r--r--source3/registry/reg_printing.c55
4 files changed, 41 insertions, 41 deletions
diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c
index 884949375b..741bc4127b 100644
--- a/source3/registry/reg_db.c
+++ b/source3/registry/reg_db.c
@@ -399,7 +399,7 @@ static int regdb_unpack_values(REGVAL_CTR *values, char *buf, int buflen)
int len = 0;
uint32 type;
pstring valuename;
- int size;
+ uint32 size;
uint8 *data_p;
uint32 num_values = 0;
int i;
@@ -413,17 +413,21 @@ static int regdb_unpack_values(REGVAL_CTR *values, char *buf, int buflen)
for ( i=0; i<num_values; i++ ) {
/* unpack the next regval */
+ type = REG_NONE;
+ size = 0;
+ data_p = NULL;
len += tdb_unpack(buf+len, buflen-len, "fdB",
valuename,
&type,
&size,
&data_p);
- /* add the new value */
-
- regval_ctr_addvalue( values, valuename, type, (const char *)data_p, size );
+ /* add the new value. Paranoid protective code -- make sure data_p is valid */
- SAFE_FREE(data_p); /* 'B' option to tdbpack does a malloc() */
+ if ( size && data_p ) {
+ regval_ctr_addvalue( values, valuename, type, (const char *)data_p, size );
+ SAFE_FREE(data_p); /* 'B' option to tdb_unpack does a malloc() */
+ }
DEBUG(8,("specific: [%s], len: %d\n", valuename, size));
}
diff --git a/source3/registry/reg_frontend.c b/source3/registry/reg_frontend.c
index 440f108cc9..51ad23b498 100644
--- a/source3/registry/reg_frontend.c
+++ b/source3/registry/reg_frontend.c
@@ -31,13 +31,16 @@ extern REGISTRY_OPS shares_reg_ops;
extern REGISTRY_OPS regdb_ops; /* these are the default */
/* array of REGISTRY_HOOK's which are read into a tree for easy access */
+/* #define REG_TDB_ONLY 1 */
REGISTRY_HOOK reg_hooks[] = {
+#ifndef REG_TDB_ONLY
{ KEY_PRINTING, &printing_ops },
{ KEY_PRINTING_2K, &printing_ops },
{ KEY_PRINTING_PORTS, &printing_ops },
{ KEY_EVENTLOG, &eventlog_ops },
{ KEY_SHARES, &shares_reg_ops },
+#endif
{ NULL, NULL }
};
diff --git a/source3/registry/reg_objects.c b/source3/registry/reg_objects.c
index 7ee2cd8414..b3b47ae0e1 100644
--- a/source3/registry/reg_objects.c
+++ b/source3/registry/reg_objects.c
@@ -94,7 +94,7 @@ int regsubkey_ctr_delkey( REGSUBKEY_CTR *ctr, const char *keyname )
/* update if we have any keys left */
ctr->num_subkeys--;
- if ( ctr->num_subkeys )
+ if ( i < ctr->num_subkeys )
memmove( &ctr->subkeys[i], &ctr->subkeys[i+1], sizeof(char*) * (ctr->num_subkeys-i) );
return ctr->num_subkeys;
@@ -232,7 +232,7 @@ uint8* regval_data_p( REGISTRY_VALUE *val )
/**********************************************************************
*********************************************************************/
-int regval_size( REGISTRY_VALUE *val )
+uint32 regval_size( REGISTRY_VALUE *val )
{
return val->size;
}
@@ -392,10 +392,10 @@ int regval_ctr_delvalue( REGVAL_CTR *ctr, const char *name )
if ( i == ctr->num_values )
return ctr->num_values;
- /* just shift everything down one */
+ /* If 'i' was not the last element, just shift everything down one */
ctr->num_values--;
- if ( ctr->num_values )
- memmove( ctr->values[i], ctr->values[i+1], sizeof(REGISTRY_VALUE)*(ctr->num_values-i) );
+ if ( i < ctr->num_values )
+ memmove( ctr->values[i], ctr->values[i+1], sizeof(REGISTRY_VALUE*)*(ctr->num_values-i) );
return ctr->num_values;
}
diff --git a/source3/registry/reg_printing.c b/source3/registry/reg_printing.c
index 30f2d74660..6fedb524d6 100644
--- a/source3/registry/reg_printing.c
+++ b/source3/registry/reg_printing.c
@@ -38,7 +38,6 @@ static const char *top_level_keys[MAX_TOP_LEVEL_KEYS] = {
"Forms",
"Printers"
};
-
/**********************************************************************
It is safe to assume that every registry path passed into on of
@@ -832,6 +831,7 @@ static int handle_printing_subpath( char *key, REGSUBKEY_CTR *subkeys, REGVAL_CT
return result;
}
+
/**********************************************************************
Enumerate registry subkey names given a registry path.
Caller is responsible for freeing memory to **subkeys
@@ -840,7 +840,6 @@ static int handle_printing_subpath( char *key, REGSUBKEY_CTR *subkeys, REGVAL_CT
static int printing_subkey_info( const char *key, REGSUBKEY_CTR *subkey_ctr )
{
char *path;
- BOOL top_level = False;
int num_subkeys = 0;
DEBUG(10,("printing_subkey_info: key=>[%s]\n", key));
@@ -849,25 +848,22 @@ static int printing_subkey_info( const char *key, REGSUBKEY_CTR *subkey_ctr )
/* check to see if we are dealing with the top level key */
- if ( !path )
- top_level = True;
-
- if ( top_level ) {
- /* check between the two top level keys here */
-
- if ( strequal( KEY_PRINTING, key ) ) {
- regsubkey_ctr_addkey( subkey_ctr, "Environments" );
- regsubkey_ctr_addkey( subkey_ctr, "Forms" );
- }
- else if ( strequal( KEY_PRINTING_2K, key ) ) {
- regsubkey_ctr_addkey( subkey_ctr, "Printers" );
- }
- }
- else
+ if ( path ) {
num_subkeys = handle_printing_subpath( path, subkey_ctr, NULL );
+ SAFE_FREE( path );
+ return num_subkeys;
+ }
- SAFE_FREE( path );
-
+ /* handle top level keys here */
+
+ if ( strequal( KEY_PRINTING, key ) ) {
+ regsubkey_ctr_addkey( subkey_ctr, "Environments" );
+ regsubkey_ctr_addkey( subkey_ctr, "Forms" );
+ }
+ else if ( strequal( KEY_PRINTING_2K, key ) ) {
+ regsubkey_ctr_addkey( subkey_ctr, "Printers" );
+ }
+
return num_subkeys;
}
@@ -879,25 +875,22 @@ static int printing_subkey_info( const char *key, REGSUBKEY_CTR *subkey_ctr )
static int printing_value_info( const char *key, REGVAL_CTR *val )
{
char *path;
- BOOL top_level = False;
int num_values = 0;
DEBUG(10,("printing_value_info: key=>[%s]\n", key));
path = trim_reg_path( key );
+
+ if ( path ) {
+ num_values = handle_printing_subpath( path, NULL, val );
+ SAFE_FREE( path );
+ return num_values;
+ }
- /* check to see if we are dealing with the top level key */
-
- if ( !path )
- top_level = True;
+ /* top level key */
- /* fill in values from the getprinterdata_printer_server() */
- if ( top_level ) {
- if ( strequal( key, KEY_PRINTING_PORTS ) )
- num_values = fill_ports_values( val );
- } else
- num_values = handle_printing_subpath( path, NULL, val );
-
+ if ( strequal( key, KEY_PRINTING_PORTS ) )
+ num_values = fill_ports_values( val );
return num_values;
}