r23801: The FSF has moved around a lot. This fixes their Mass Ave address.
[kai/samba.git] / source3 / rpc_server / srv_winreg_nt.c
index 404210a41676cd778565f4799ebd1151ca0f69fd..fe3295e7e9e87b1cb54fbb1b04796ebb7261da4b 100644 (file)
@@ -6,7 +6,7 @@
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
+ *  the Free Software Foundation; either version 3 of the License, or
  *  (at your option) any later version.
  *  
  *  This program is distributed in the hope that it will be useful,
@@ -15,8 +15,7 @@
  *  GNU General Public License for more details.
  *  
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /* Implementation of registry functions. */
@@ -31,7 +30,7 @@ static struct generic_mapping reg_generic_map =
        { REG_KEY_READ, REG_KEY_WRITE, REG_KEY_EXECUTE, REG_KEY_ALL };
 
 /******************************************************************
- free() function for struct regkey_info
+ free() function for struct registry_key
  *****************************************************************/
  
 static void free_regkey(void *ptr)
@@ -73,8 +72,6 @@ static WERROR open_registry_key( pipes_struct *p, POLICY_HND *hnd,
        WERROR result = WERR_OK;
        struct registry_key *key;
 
-       /* now do the internal open */
-
        if (parent == NULL) {
                result = reg_openhive(NULL, subkeyname, access_desired,
                                      p->pipe_user.nt_user_token, &key);
@@ -92,7 +89,7 @@ static WERROR open_registry_key( pipes_struct *p, POLICY_HND *hnd,
                return WERR_BADFILE; 
        }
        
-       return WERR_OK;;
+       return WERR_OK;
 }
 
 /*******************************************************************
@@ -444,23 +441,23 @@ WERROR _winreg_EnumValue(pipes_struct *p, struct winreg_EnumValue *r)
                *r->out.type = val->type;
        }
 
-       if (r->out.data != NULL) {
-               if ((r->out.data_size == NULL) || (r->out.value_length == NULL)) {
+       if (r->out.value != NULL) {
+               if ((r->out.size == NULL) || (r->out.length == NULL)) {
                        return WERR_INVALID_PARAM;
                }
 
-               if (value_blob.length > *r->out.data_size) {
+               if (value_blob.length > *r->out.size) {
                        return WERR_MORE_DATA;
                }
 
-               memcpy( r->out.data, value_blob.data, value_blob.length );
+               memcpy( r->out.value, value_blob.data, value_blob.length );
        }
 
-       if (r->out.value_length != NULL) {
-               *r->out.value_length = value_blob.length;
+       if (r->out.length != NULL) {
+               *r->out.length = value_blob.length;
        }
-       if (r->out.data_size != NULL) {
-               *r->out.data_size = value_blob.length;
+       if (r->out.size != NULL) {
+               *r->out.size = value_blob.length;
        }
 
        return WERR_OK;
@@ -663,7 +660,12 @@ static WERROR reg_load_tree( REGF_FILE *regfile, const char *topkeypath,
                        topkeypath ));
                return WERR_BADFILE;
        }
-       pstrcpy( registry_key.name, topkeypath );
+
+       registry_key.name = talloc_strdup( regfile->mem_ctx, topkeypath );
+       if ( !registry_key.name ) {
+               DEBUG(0,("reg_load_tree: Talloc failed for reg_key.name!\n"));
+               return WERR_NOMEM;
+       }
        
        /* now start parsing the values and subkeys */