r7995: * privileges are local except when they're *not*
[tprouty/samba.git] / source / rpc_server / srv_reg_nt.c
index 158888967b3c4dda582b2e94377479f8412fe4fd..7170c0a30110a80be3311b77e884b1a1bbc7e70e 100644 (file)
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_RPC_SRV
 
-#define REGSTR_PRODUCTTYPE             "ProductType"
-#define REG_PT_WINNT                   "WinNT"
-#define REG_PT_LANMANNT                        "LanmanNT"
-#define REG_PT_SERVERNT                        "ServerNT"
-
 #define OUR_HANDLE(hnd) (((hnd)==NULL)?"NULL":(IVAL((hnd)->data5,4)==(uint32)sys_getpid()?"OURS":"OTHER")), \
 ((unsigned int)IVAL((hnd)->data5,4)),((unsigned int)sys_getpid())
 
 
-/* no idea if this is correct, just use the file access bits for now */
-
 static struct generic_mapping reg_generic_map = { REG_KEY_READ, REG_KEY_WRITE, REG_KEY_EXECUTE, REG_KEY_ALL };
 
 /********************************************************************
@@ -266,9 +259,7 @@ static BOOL get_subkey_information( REGISTRY_KEY *key, uint32 *maxnum, uint32 *m
 }
 
 /********************************************************************
- retrieve information about the values.  We don't store values 
- here.  The registry tdb is intended to be a frontend to oether 
- Samba tdb's (such as ntdrivers.tdb).
+ retrieve information about the values.  
  *******************************************************************/
  
 static BOOL get_value_information( REGISTRY_KEY *key, uint32 *maxnum, 
@@ -294,7 +285,7 @@ static BOOL get_value_information( REGISTRY_KEY *key, uint32 *maxnum,
        
        for ( i=0; i<num_values && val; i++ ) 
        {
-               lenmax  = MAX(lenmax,  strlen(val->valuename)+1 );
+               lenmax  = MAX(lenmax,  val->valuename ? strlen(val->valuename)+1 : 0 );
                sizemax = MAX(sizemax, val->size );
                
                val = regval_ctr_specific_value( &values, i );
@@ -1106,7 +1097,7 @@ WERROR _reg_save_key(pipes_struct *p, REG_Q_SAVE_KEY  *q_u, REG_R_SAVE_KEY *r_u)
 /*******************************************************************
  ********************************************************************/
 
-WERROR _reg_create_key(pipes_struct *p, REG_Q_CREATE_KEY  *q_u, REG_R_CREATE_KEY *r_u)
+WERROR _reg_create_key_ex(pipes_struct *p, REG_Q_CREATE_KEY_EX *q_u, REG_R_CREATE_KEY_EX *r_u)
 {
        REGISTRY_KEY *parent = find_regkey_index_by_hnd(p, &q_u->handle);
        REGISTRY_KEY *newparent;
@@ -1223,6 +1214,12 @@ WERROR _reg_set_value(pipes_struct *p, REG_Q_SET_VALUE  *q_u, REG_R_SET_VALUE *r
                
        rpcstr_pull( valuename, q_u->name.string->buffer, sizeof(valuename), q_u->name.string->uni_str_len*2, 0 );
 
+       /* verify the name */
+
+       if ( !*valuename )
+               return WERR_INVALID_PARAM;
+
+       DEBUG(8,("_reg_set_value: Setting value for [%s:%s]\n", key->name, valuename));
                
        regval_ctr_init( &values );
        
@@ -1357,6 +1354,11 @@ WERROR _reg_delete_value(pipes_struct *p, REG_Q_DELETE_VALUE  *q_u, REG_R_DELETE
 
        rpcstr_pull( valuename, q_u->name.string->buffer, sizeof(valuename), q_u->name.string->uni_str_len*2, 0 );
 
+       if ( !*valuename )
+               return WERR_INVALID_PARAM;
+
+       DEBUG(8,("_reg_delete_value: Setting value for [%s:%s]\n", key->name, valuename));
+
        regval_ctr_init( &values );
        
        /* lookup the current values and add the new one */