net: Make "net rpc registry" use functable3
[kai/samba.git] / source3 / utils / net_rpc_registry.c
index 55585ec62b731ec067d241ab6ea078fda574d036..0d7d46fb981e200f42869463e3b8de226c81b715 100644 (file)
@@ -47,7 +47,7 @@ static bool reg_hive_key(TALLOC_CTX *ctx, const char *fullname,
        {
                (*reg_type) = HKEY_LOCAL_MACHINE;
        } else if (strequal(hivename, "HKCR") ||
-                  strequal(hivename, "HKEY_CLASSES_ROOT")) 
+                  strequal(hivename, "HKEY_CLASSES_ROOT"))
        {
                (*reg_type) = HKEY_CLASSES_ROOT;
        } else if (strequal(hivename, "HKU") ||
@@ -172,7 +172,7 @@ static NTSTATUS registry_enumkeys(TALLOC_CTX *ctx,
                status = rpccli_winreg_EnumKey(pipe_hnd, mem_ctx, key_hnd,
                                               i, &name_buf, &class_buf,
                                               &modtime, &werr);
-               
+
                if (W_ERROR_EQUAL(werr,
                                  WERR_NO_MORE_ITEMS) ) {
                        status = NT_STATUS_OK;
@@ -369,11 +369,12 @@ static NTSTATUS registry_setvalue(TALLOC_CTX *mem_ctx,
        return result;
 }
 
-static NTSTATUS rpc_registry_setvalue_internal(const DOM_SID *domain_sid,
-                                              const char *domain_name, 
+static NTSTATUS rpc_registry_setvalue_internal(struct net_context *c,
+                                              const DOM_SID *domain_sid,
+                                              const char *domain_name,
                                               struct cli_state *cli,
                                               struct rpc_pipe_client *pipe_hnd,
-                                              TALLOC_CTX *mem_ctx, 
+                                              TALLOC_CTX *mem_ctx,
                                               int argc,
                                               const char **argv )
 {
@@ -381,7 +382,7 @@ static NTSTATUS rpc_registry_setvalue_internal(const DOM_SID *domain_sid,
        NTSTATUS status;
        struct registry_value value;
 
-       status = registry_openkey(mem_ctx, pipe_hnd, argv[0], 
+       status = registry_openkey(mem_ctx, pipe_hnd, argv[0],
                                  SEC_RIGHTS_MAXIMUM_ALLOWED,
                                  &hive_hnd, &key_hnd);
        if (!NT_STATUS_IS_OK(status)) {
@@ -425,23 +426,25 @@ static NTSTATUS rpc_registry_setvalue_internal(const DOM_SID *domain_sid,
        return NT_STATUS_OK;
 }
 
-static int rpc_registry_setvalue( int argc, const char **argv )
+static int rpc_registry_setvalue(struct net_context *c, int argc,
+                                const char **argv )
 {
-       if (argc < 4) {
+       if (argc < 4 || c->display_usage) {
                d_fprintf(stderr, "usage: net rpc registry setvalue <key> "
                          "<valuename> <type> [<val>]+\n");
                return -1;
        }
 
-       return run_rpc_command( NULL, PI_WINREG, 0, 
+       return run_rpc_command(c, NULL, PI_WINREG, 0,
                rpc_registry_setvalue_internal, argc, argv );
 }
 
-static NTSTATUS rpc_registry_deletevalue_internal(const DOM_SID *domain_sid,
-                                                 const char *domain_name, 
+static NTSTATUS rpc_registry_deletevalue_internal(struct net_context *c,
+                                                 const DOM_SID *domain_sid,
+                                                 const char *domain_name,
                                                  struct cli_state *cli,
                                                  struct rpc_pipe_client *pipe_hnd,
-                                                 TALLOC_CTX *mem_ctx, 
+                                                 TALLOC_CTX *mem_ctx,
                                                  int argc,
                                                  const char **argv )
 {
@@ -473,26 +476,170 @@ static NTSTATUS rpc_registry_deletevalue_internal(const DOM_SID *domain_sid,
        rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &key_hnd, NULL);
        rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &hive_hnd, NULL);
 
-       return NT_STATUS_OK;
+       return status;
 }
 
-static int rpc_registry_deletevalue( int argc, const char **argv )
+static int rpc_registry_deletevalue(struct net_context *c, int argc,
+                                   const char **argv )
 {
-       if (argc != 2) {
+       if (argc != 2 || c->display_usage) {
                d_fprintf(stderr, "usage: net rpc registry deletevalue <key> "
                          "<valuename>\n");
                return -1;
        }
 
-       return run_rpc_command( NULL, PI_WINREG, 0, 
+       return run_rpc_command(c, NULL, PI_WINREG, 0,
                rpc_registry_deletevalue_internal, argc, argv );
 }
 
-static NTSTATUS rpc_registry_createkey_internal(const DOM_SID *domain_sid,
-                                               const char *domain_name, 
+static NTSTATUS rpc_registry_getvalue_internal(struct net_context *c,
+                                              const DOM_SID *domain_sid,
+                                              const char *domain_name,
+                                              struct cli_state *cli,
+                                              struct rpc_pipe_client *pipe_hnd,
+                                              TALLOC_CTX *mem_ctx,
+                                              bool raw,
+                                              int argc,
+                                              const char **argv)
+{
+       struct policy_handle hive_hnd, key_hnd;
+       NTSTATUS status;
+       WERROR werr;
+       struct winreg_String valuename;
+       struct registry_value *value = NULL;
+       enum winreg_Type type = REG_NONE;
+       uint8_t *data = NULL;
+       uint32_t data_size = 0;
+       uint32_t value_length = 0;
+       TALLOC_CTX *tmp_ctx = talloc_stackframe();
+
+       ZERO_STRUCT(valuename);
+
+       status = registry_openkey(tmp_ctx, pipe_hnd, argv[0],
+                                 SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                 &hive_hnd, &key_hnd);
+       if (!NT_STATUS_IS_OK(status)) {
+               d_fprintf(stderr, "registry_openkey failed: %s\n",
+                         nt_errstr(status));
+               return status;
+       }
+
+       valuename.name = argv[1];
+
+       /*
+        * call QueryValue once with data == NULL to get the
+        * needed memory size to be allocated, then allocate
+        * data buffer and call again.
+        */
+       status = rpccli_winreg_QueryValue(pipe_hnd, tmp_ctx, &key_hnd,
+                                         &valuename,
+                                         &type,
+                                         data,
+                                         &data_size,
+                                         &value_length,
+                                         NULL);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               d_fprintf(stderr, "registry_queryvalue failed: %s\n",
+                         nt_errstr(status));
+               goto done;
+       }
+
+       data = (uint8 *)TALLOC(tmp_ctx, data_size);
+       value_length = 0;
+
+       status = rpccli_winreg_QueryValue(pipe_hnd, tmp_ctx, &key_hnd,
+                                         &valuename,
+                                         &type,
+                                         data,
+                                         &data_size,
+                                         &value_length,
+                                         NULL);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               d_fprintf(stderr, "registry_queryvalue failed: %s\n",
+                         nt_errstr(status));
+               goto done;
+       }
+
+       werr = registry_pull_value(tmp_ctx, &value, type, data,
+                                  data_size, value_length);
+       if (!W_ERROR_IS_OK(werr)) {
+               status = werror_to_ntstatus(werr);
+               goto done;
+       }
+
+       print_registry_value(value, raw);
+
+done:
+       rpccli_winreg_CloseKey(pipe_hnd, tmp_ctx, &key_hnd, NULL);
+       rpccli_winreg_CloseKey(pipe_hnd, tmp_ctx, &hive_hnd, NULL);
+
+       TALLOC_FREE(tmp_ctx);
+
+       return status;
+}
+
+static NTSTATUS rpc_registry_getvalue_full(struct net_context *c,
+                                          const DOM_SID *domain_sid,
+                                          const char *domain_name,
+                                          struct cli_state *cli,
+                                          struct rpc_pipe_client *pipe_hnd,
+                                          TALLOC_CTX *mem_ctx,
+                                          int argc,
+                                          const char **argv)
+{
+       return rpc_registry_getvalue_internal(c, domain_sid, domain_name,
+                                             cli, pipe_hnd, mem_ctx, false,
+                                             argc, argv);
+}
+
+static int rpc_registry_getvalue(struct net_context *c, int argc,
+                                const char **argv)
+{
+       if (argc != 2 || c->display_usage) {
+               d_fprintf(stderr, "usage: net rpc registry getvalue <key> "
+                         "<valuename>\n");
+               return -1;
+       }
+
+       return run_rpc_command(c, NULL, PI_WINREG, 0,
+               rpc_registry_getvalue_full, argc, argv);
+}
+
+static NTSTATUS rpc_registry_getvalue_raw(struct net_context *c,
+                                         const DOM_SID *domain_sid,
+                                         const char *domain_name,
+                                         struct cli_state *cli,
+                                         struct rpc_pipe_client *pipe_hnd,
+                                         TALLOC_CTX *mem_ctx,
+                                         int argc,
+                                         const char **argv)
+{
+       return rpc_registry_getvalue_internal(c, domain_sid, domain_name,
+                                             cli, pipe_hnd, mem_ctx, true,
+                                             argc, argv);
+}
+
+static int rpc_registry_getvalueraw(struct net_context *c, int argc,
+                                   const char **argv)
+{
+       if (argc != 2 || c->display_usage) {
+               d_fprintf(stderr, "usage: net rpc registry getvalue <key> "
+                         "<valuename>\n");
+               return -1;
+       }
+
+       return run_rpc_command(c, NULL, PI_WINREG, 0,
+               rpc_registry_getvalue_raw, argc, argv);
+}
+
+static NTSTATUS rpc_registry_createkey_internal(struct net_context *c,
+                                               const DOM_SID *domain_sid,
+                                               const char *domain_name,
                                                struct cli_state *cli,
                                                struct rpc_pipe_client *pipe_hnd,
-                                               TALLOC_CTX *mem_ctx, 
+                                               TALLOC_CTX *mem_ctx,
                                                int argc,
                                                const char **argv )
 {
@@ -547,22 +694,24 @@ static NTSTATUS rpc_registry_createkey_internal(const DOM_SID *domain_sid,
        return status;
 }
 
-static int rpc_registry_createkey( int argc, const char **argv )
+static int rpc_registry_createkey(struct net_context *c, int argc,
+                                 const char **argv )
 {
-       if (argc != 1) {
+       if (argc != 1 || c->display_usage) {
                d_fprintf(stderr, "usage: net rpc registry createkey <key>\n");
                return -1;
        }
 
-       return run_rpc_command( NULL, PI_WINREG, 0, 
+       return run_rpc_command(c, NULL, PI_WINREG, 0,
                rpc_registry_createkey_internal, argc, argv );
 }
 
-static NTSTATUS rpc_registry_deletekey_internal(const DOM_SID *domain_sid,
-                                               const char *domain_name, 
+static NTSTATUS rpc_registry_deletekey_internal(struct net_context *c,
+                                               const DOM_SID *domain_sid,
+                                               const char *domain_name,
                                                struct cli_state *cli,
                                                struct rpc_pipe_client *pipe_hnd,
-                                               TALLOC_CTX *mem_ctx, 
+                                               TALLOC_CTX *mem_ctx,
                                                int argc,
                                                const char **argv )
 {
@@ -595,29 +744,30 @@ static NTSTATUS rpc_registry_deletekey_internal(const DOM_SID *domain_sid,
        return status;
 }
 
-static int rpc_registry_deletekey( int argc, const char **argv )
+static int rpc_registry_deletekey(struct net_context *c, int argc, const char **argv )
 {
-       if (argc != 1) {
+       if (argc != 1 || c->display_usage) {
                d_fprintf(stderr, "usage: net rpc registry deletekey <key>\n");
                return -1;
        }
 
-       return run_rpc_command( NULL, PI_WINREG, 0, 
+       return run_rpc_command(c, NULL, PI_WINREG, 0,
                rpc_registry_deletekey_internal, argc, argv );
 }
 
 /********************************************************************
 ********************************************************************/
 
-static NTSTATUS rpc_registry_enumerate_internal(const DOM_SID *domain_sid,
-                                               const char *domain_name, 
+static NTSTATUS rpc_registry_enumerate_internal(struct net_context *c,
+                                               const DOM_SID *domain_sid,
+                                               const char *domain_name,
                                                struct cli_state *cli,
                                                struct rpc_pipe_client *pipe_hnd,
-                                               TALLOC_CTX *mem_ctx, 
+                                               TALLOC_CTX *mem_ctx,
                                                int argc,
                                                const char **argv )
 {
-       POLICY_HND pol_hive, pol_key; 
+       POLICY_HND pol_hive, pol_key;
        NTSTATUS status;
        uint32 num_subkeys = 0;
        uint32 num_values = 0;
@@ -625,9 +775,9 @@ static NTSTATUS rpc_registry_enumerate_internal(const DOM_SID *domain_sid,
        NTTIME **modtimes = NULL;
        uint32 i;
        struct registry_value **values = NULL;
-       
-       if (argc != 1 ) {
-               d_printf("Usage:    net rpc registry enumerate <path> [recurse]\n");
+
+       if (argc != 1 || c->display_usage) {
+               d_printf("Usage:    net rpc registry enumerate <path>\n");
                d_printf("Example:  net rpc registry enumerate 'HKLM\\Software\\Samba'\n");
                return NT_STATUS_INVALID_PARAMETER;
        }
@@ -661,7 +811,7 @@ static NTSTATUS rpc_registry_enumerate_internal(const DOM_SID *domain_sid,
        }
 
        for (i=0; i<num_values; i++) {
-               print_registry_value(names[i], values[i]);
+               print_registry_value_with_name(names[i], values[i]);
        }
 
        rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &pol_key, NULL);
@@ -673,33 +823,35 @@ static NTSTATUS rpc_registry_enumerate_internal(const DOM_SID *domain_sid,
 /********************************************************************
 ********************************************************************/
 
-static int rpc_registry_enumerate( int argc, const char **argv )
+static int rpc_registry_enumerate(struct net_context *c, int argc,
+                                 const char **argv )
 {
-       return run_rpc_command( NULL, PI_WINREG, 0, 
+       return run_rpc_command(c, NULL, PI_WINREG, 0,
                rpc_registry_enumerate_internal, argc, argv );
 }
 
 /********************************************************************
 ********************************************************************/
 
-static NTSTATUS rpc_registry_save_internal(const DOM_SID *domain_sid,
-                                       const char *domain_name, 
+static NTSTATUS rpc_registry_save_internal(struct net_context *c,
+                                       const DOM_SID *domain_sid,
+                                       const char *domain_name,
                                        struct cli_state *cli,
                                        struct rpc_pipe_client *pipe_hnd,
-                                       TALLOC_CTX *mem_ctx, 
+                                       TALLOC_CTX *mem_ctx,
                                        int argc,
                                        const char **argv )
 {
        WERROR result = WERR_GENERAL_FAILURE;
-       POLICY_HND pol_hive, pol_key; 
+       POLICY_HND pol_hive, pol_key;
        NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
        struct winreg_String filename;
-       
-       if (argc != 2 ) {
+
+       if (argc != 2 || c->display_usage) {
                d_printf("Usage:    net rpc registry backup <path> <file> \n");
                return NT_STATUS_INVALID_PARAMETER;
        }
-       
+
        status = registry_openkey(mem_ctx, pipe_hnd, argv[0], REG_KEY_ALL,
                                  &pol_hive, &pol_key);
        if (!NT_STATUS_IS_OK(status)) {
@@ -713,9 +865,9 @@ static NTSTATUS rpc_registry_save_internal(const DOM_SID *domain_sid,
        if ( !W_ERROR_IS_OK(result) ) {
                d_fprintf(stderr, "Unable to save [%s] to %s:%s\n", argv[0], cli->desthost, argv[1]);
        }
-       
+
        /* cleanup */
-       
+
        rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &pol_key, NULL);
        rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &pol_hive, NULL);
 
@@ -725,9 +877,9 @@ static NTSTATUS rpc_registry_save_internal(const DOM_SID *domain_sid,
 /********************************************************************
 ********************************************************************/
 
-static int rpc_registry_save( int argc, const char **argv )
+static int rpc_registry_save(struct net_context *c, int argc, const char **argv )
 {
-       return run_rpc_command( NULL, PI_WINREG, 0, 
+       return run_rpc_command(c, NULL, PI_WINREG, 0,
                rpc_registry_save_internal, argc, argv );
 }
 
@@ -807,13 +959,13 @@ static bool dump_registry_tree( REGF_FILE *file, REGF_NK_REC *nk, const char *pa
                SAFE_FREE(regpath);
        }
 
-       return True;
+       return true;
 }
 
 /********************************************************************
 ********************************************************************/
 
-static bool write_registry_tree( REGF_FILE *infile, REGF_NK_REC *nk, 
+static bool write_registry_tree( REGF_FILE *infile, REGF_NK_REC *nk,
                                  REGF_NK_REC *parent, REGF_FILE *outfile,
                                 const char *parentpath )
 {
@@ -825,13 +977,13 @@ static bool write_registry_tree( REGF_FILE *infile, REGF_NK_REC *nk,
 
        if ( !( subkeys = TALLOC_ZERO_P( infile->mem_ctx, REGSUBKEY_CTR )) ) {
                DEBUG(0,("write_registry_tree: talloc() failed!\n"));
-               return False;
+               return false;
        }
 
        if ( !(values = TALLOC_ZERO_P( subkeys, REGVAL_CTR )) ) {
                DEBUG(0,("write_registry_tree: talloc() failed!\n"));
                TALLOC_FREE(subkeys);
-               return False;
+               return false;
        }
 
        /* copy values into the REGVAL_CTR */
@@ -869,31 +1021,31 @@ static bool write_registry_tree( REGF_FILE *infile, REGF_NK_REC *nk,
        d_printf("[%s]\n", path );
        TALLOC_FREE(subkeys);
 
-       return True;
+       return true;
 }
 
 /********************************************************************
 ********************************************************************/
 
-static int rpc_registry_dump( int argc, const char **argv )
+static int rpc_registry_dump(struct net_context *c, int argc, const char **argv)
 {
        REGF_FILE   *registry;
        REGF_NK_REC *nk;
-       
-       if (argc != 1 ) {
+
+       if (argc != 1 || c->display_usage) {
                d_printf("Usage:    net rpc registry dump <file> \n");
                return -1;
        }
-       
+
        d_printf("Opening %s....", argv[0]);
        if ( !(registry = regfio_open( argv[0], O_RDONLY, 0)) ) {
                d_fprintf(stderr, "Failed to open %s for reading\n", argv[0]);
                return 1;
        }
        d_printf("ok\n");
-       
+
        /* get the root of the registry file */
-       
+
        if ((nk = regfio_rootkey( registry )) == NULL) {
                d_fprintf(stderr, "Could not get rootkey\n");
                regfio_close( registry );
@@ -907,7 +1059,7 @@ static int rpc_registry_dump( int argc, const char **argv )
 
 #if 0
        talloc_report_full( registry->mem_ctx, stderr );
-#endif 
+#endif
        d_printf("Closing registry...");
        regfio_close( registry );
        d_printf("ok\n");
@@ -918,17 +1070,17 @@ static int rpc_registry_dump( int argc, const char **argv )
 /********************************************************************
 ********************************************************************/
 
-static int rpc_registry_copy( int argc, const char **argv )
+static int rpc_registry_copy(struct net_context *c, int argc, const char **argv )
 {
        REGF_FILE   *infile = NULL, *outfile = NULL;
        REGF_NK_REC *nk;
        int result = 1;
-       
-       if (argc != 2 ) {
+
+       if (argc != 2 || c->display_usage) {
                d_printf("Usage:    net rpc registry copy <srcfile> <newfile>\n");
                return -1;
        }
-       
+
        d_printf("Opening %s....", argv[0]);
        if ( !(infile = regfio_open( argv[0], O_RDONLY, 0 )) ) {
                d_fprintf(stderr, "Failed to open %s for reading\n", argv[0]);
@@ -942,9 +1094,9 @@ static int rpc_registry_copy( int argc, const char **argv )
                goto out;
        }
        d_printf("ok\n");
-       
+
        /* get the root of the registry file */
-       
+
        if ((nk = regfio_rootkey( infile )) == NULL) {
                d_fprintf(stderr, "Could not get rootkey\n");
                goto out;
@@ -975,7 +1127,8 @@ out:
 /********************************************************************
 ********************************************************************/
 
-static NTSTATUS rpc_registry_getsd_internal(const DOM_SID *domain_sid,
+static NTSTATUS rpc_registry_getsd_internal(struct net_context *c,
+                                           const DOM_SID *domain_sid,
                                            const char *domain_name,
                                            struct cli_state *cli,
                                            struct rpc_pipe_client *pipe_hnd,
@@ -994,7 +1147,7 @@ static NTSTATUS rpc_registry_getsd_internal(const DOM_SID *domain_sid,
                               SEC_RIGHT_MAXIMUM_ALLOWED |
                               SEC_RIGHT_SYSTEM_SECURITY;
 
-       if (argc <1 || argc > 2) {
+       if (argc <1 || argc > 2 || c->display_usage) {
                d_printf("Usage:    net rpc registry getsd <path> <secinfo>\n");
                d_printf("Example:  net rpc registry getsd 'HKLM\\Software\\Samba'\n");
                return NT_STATUS_INVALID_PARAMETER;
@@ -1051,38 +1204,108 @@ static NTSTATUS rpc_registry_getsd_internal(const DOM_SID *domain_sid,
 }
 
 
-static int rpc_registry_getsd(int argc, const char **argv)
+static int rpc_registry_getsd(struct net_context *c, int argc, const char **argv)
 {
-       return run_rpc_command(NULL, PI_WINREG, 0,
+       return run_rpc_command(c, NULL, PI_WINREG, 0,
                rpc_registry_getsd_internal, argc, argv);
 }
 
 /********************************************************************
 ********************************************************************/
 
-int net_rpc_registry(int argc, const char **argv) 
+int net_rpc_registry(struct net_context *c, int argc, const char **argv)
 {
-       struct functable2 func[] = {
-               { "enumerate", rpc_registry_enumerate,
-                 "Enumerate registry keys and values" },
-               { "createkey",  rpc_registry_createkey,
-                 "Create a new registry key" },
-               { "deletekey",  rpc_registry_deletekey,
-                 "Delete a registry key" },
-               { "setvalue",  rpc_registry_setvalue,
-                 "Set a new registry value" },
-               { "deletevalue",  rpc_registry_deletevalue,
-                 "Delete a registry value" },
-               { "save", rpc_registry_save,
-                 "Save a registry file" },
-               { "dump", rpc_registry_dump,
-                 "Dump a registry file" },
-               { "copy", rpc_registry_copy,
-                 "Copy a registry file" },
-               { "getsd", rpc_registry_getsd,
-                 "Get security descriptor" },
-               {NULL, NULL, NULL}
+       struct functable3 func[] = {
+               {
+                       "enumerate",
+                       rpc_registry_enumerate,
+                       NET_TRANSPORT_RPC,
+                       "Enumerate registry keys and values",
+                       "net rpc registry enumerate\n"
+                       "    Enumerate registry keys and values"
+               },
+               {
+                       "createkey",
+                       rpc_registry_createkey,
+                       NET_TRANSPORT_RPC,
+                       "Create a new registry key",
+                       "net rpc registry createkey\n"
+                       "    Create a new registry key"
+               },
+               {
+                       "deletekey",
+                       rpc_registry_deletekey,
+                       NET_TRANSPORT_RPC,
+                       "Delete a registry key",
+                       "net rpc registry deletekey\n"
+                       "    Delete a registry key"
+               },
+               {
+                       "getvalue",
+                       rpc_registry_getvalue,
+                       NET_TRANSPORT_RPC,
+                       "Print a registry value",
+                       "net rpc registry getvalue\n"
+                       "    Print a registry value"
+               },
+               {
+                       "getvalueraw",
+                       rpc_registry_getvalueraw,
+                       NET_TRANSPORT_RPC,
+                       "Print a registry value",
+                       "net rpc registry getvalueraw\n"
+                       "    Print a registry value (raw version)"
+               },
+               {
+                       "setvalue",
+                       rpc_registry_setvalue,
+                       NET_TRANSPORT_RPC,
+                       "Set a new registry value",
+                       "net rpc registry setvalue\n"
+                       "    Set a new registry value"
+               },
+               {
+                       "deletevalue",
+                       rpc_registry_deletevalue,
+                       NET_TRANSPORT_RPC,
+                       "Delete a registry value",
+                       "net rpc registry deletevalue\n"
+                       "    Delete a registry value"
+               },
+               {
+                       "save",
+                       rpc_registry_save,
+                       NET_TRANSPORT_RPC,
+                       "Save a registry file",
+                       "net rpc registry save\n"
+                       "    Save a registry file"
+               },
+               {
+                       "dump",
+                       rpc_registry_dump,
+                       NET_TRANSPORT_RPC,
+                       "Dump a registry file",
+                       "net rpc registry dump\n"
+                       "    Dump a registry file"
+               },
+               {
+                       "copy",
+                       rpc_registry_copy,
+                       NET_TRANSPORT_RPC,
+                       "Copy a registry file",
+                       "net rpc registry copy\n"
+                       "    Copy a registry file"
+               },
+               {
+                       "getsd",
+                       rpc_registry_getsd,
+                       NET_TRANSPORT_RPC,
+                       "Get security descriptor",
+                       "net rpc registry getsd\n"
+                       "    Get security descriptior"
+               },
+               {NULL, NULL, 0, NULL, NULL}
        };
-       
-       return net_run_function2(argc, argv, "net rpc registry", func);
+
+       return net_run_function3(c, argc, argv, "net rpc registry", func);
 }